		//no conflict jquery
		jQuery.noConflict();
		//jquery stuff
		(function($) {
		$(document).ready
		(
			function() 
			{

				$('.postImages').each(function(){
					var votesArr = $(this).attr('votes').split(',');
					var totalVotes = parseInt(votesArr[4]);
					if (totalVotes<2) return;
					var storyVote = parseInt(parseInt(votesArr[0]) * 100 / totalVotes);
					var compVote = parseInt(parseInt(votesArr[1]) * 100 / totalVotes);
					var techVote = parseInt(parseInt(votesArr[2]) * 100 / totalVotes);
					var likeVote = parseInt(parseInt(votesArr[3]) * 100 / totalVotes);
			
					$photoExt = $('<div class="photoExt" style=""></div>');
					$photoExt_overlay = $('<div class="photoExt_overlay" style="display: none; border: solid 1px white; padding: 0; cursor: pointer; height: 0px; width: 0px">');
					$photoExt_votes = $('<div class="photoExt_votes" style="width: 210px; background-color: white; padding-top: 5px; color:black">');
                    $photoExt_votes_story = $('<div style="width: 210px;  overflow: hidden;"><div style="float: left; margin-left: 4px; margin-right: 7px;">'+storyVote+'%</div><div style="float: right; width: 55px; margin-right: 4px; text-align: right;">סיפור</div><div style="float: right; margin-top: 5px; margin-left: '+(101-storyVote)+'px; background-color: #ABB9C9; width: '+(storyVote+1)+'px; height: 7px;"></div></div>');
                    $photoExt_votes_composite = $('<div style="clear: both; width: 210px;  overflow: hidden;"><div style="float: left; margin-left: 4px; margin-right: 7px;">'+compVote+'%</div><div style="float: right; width: 55px; margin-right: 4px; text-align: right;">קומפוזיציה</div><div style="float: right; margin-top: 5px; margin-left: '+(101-compVote)+'px;background-color: #475878;  width: '+(compVote+1)+'px; height: 7px;"></div></div>')                     
                    $photoExt_votes_tech = $('<div style="clear: both; width: 210px;  overflow: hidden;"><div style="float: left; margin-left: 4px; margin-right: 7px;">'+techVote+'%</div><div style="float: right; width: 55px; margin-right: 4px; text-align: right;">ביצוע טכני</div><div style="float: right; margin-top: 5px; margin-left: '+(101-techVote)+'px;background-color: #CF4813;  width: '+(techVote+1)+'px; height: 7px;"></div></div>')                     
                    $photoExt_votes_like = $('<div style="clear: both; width: 210px; overflow: hidden;"><div style="float: left; margin-left: 4px; margin-right: 7px;">'+likeVote+'%</div><div style="float: right; width: 55px; margin-right: 4px; text-align: right;">אהבתי</div><div style="float: right; margin-top: 5px; margin-left: '+(101-likeVote)+'px; background-color: #970000;   width: '+(likeVote+1)+'px; height: 7px;"></div></div>')                     
					$(this).parent().append($photoExt);
					$photoExt.append($(this));													
					$photoExt.append($photoExt_overlay);
					$photoExt_overlay.append($photoExt_votes);										
                    $photoExt_votes.append($photoExt_votes_story);
                    $photoExt_votes.append($photoExt_votes_composite);
                    $photoExt_votes.append($photoExt_votes_tech);
                    $photoExt_votes.append($photoExt_votes_like);

				});
				$('.photoExt').mouseenter(function() { 
					var overlayDiv = $('.photoExt_overlay', $(this));
					if (overlayDiv.data('opened')=='1') return;					
					overlayDiv.css('position','absolute').css('z-index','1000').css('display','block').height(70);
					overlayDiv.css('background-color', '#ececec').css('border-bottom', 'solid 1px #cccccc').css('border-right', 'solid 1px #cccccc');
					$('.photoExt_votes', $(this)).css('background-color', '#ececec');				
					var newOffset = $(this).offset();
					newOffset.top = newOffset.top + 10;
					newOffset.left = newOffset.left + 10;
					overlayDiv.offset(newOffset);
					overlayDiv.data('opened', '1');
					overlayDiv.clearQueue().stop();					
					overlayDiv.animate({
						opacity: 0.98,
						width: 210
					  	}, 400, function() {
							$('.photoExt_votes', $(this)).css('display','block');
					  });
				});
				$('.photoExt').mouseleave(function() { 
					var overlayDiv = $('.photoExt_overlay', $(this));
					if (overlayDiv.data('opened')!='1') return;			
					overlayDiv.data('opened', '0');		
					overlayDiv.clearQueue().stop();			
					overlayDiv.animate({
						opacity: 0,
						width: 0
					  	}, 400, function() {
							$('.photoExt_votes', $(this)).css('display','block');
					  });
				});				
			}
		);
		})(jQuery);	

