function makeActiveLink(){
	var listLink = $("#leftbar a");
	var CurrentUrl = document.location.href;
	listLink.each(function (index, domEle) {
		if(CurrentUrl == domEle){
			$(this).attr("class","active");
		}
	});
}

function openZoom() {
	$("#product .zoom_picture").click(function() {
		var dest = this.href;
		var index = dest.lastIndexOf('-');
		var linkZoom = dest.substring('0',index)+"getpagecontent-zoom.html";
		var imagePrincipale = $('#main #vig img').attr("src");
		$.get(linkZoom, function(data){
			$('#zoompicture').html(data);
			$('#main #zoompicture #zoomzoom img').attr({
					src: imagePrincipale
					});
					$('#zoompicture').css({
										top: '5%'
					 });
					$(".jqmClose + .jqmClose").css("display", "none") 
		});
		$('#zoompicture').jqm().jqmShow();
		return false;
	});
}
function openZoom2() {
	$("#visuels_additionnels .zoom_additionnals img").click(function() {
		var dest = $("#product .zoom_picture").attr("href");
		var imageAdditionnelle = $(this).attr("src");
		var index = dest.lastIndexOf('-');
		var linkZoom = dest.substring('0',index)+"getpagecontent-zoom.html";
		$.get(linkZoom, function(data){
			$('#zoompicture').html(data);
			$('#main #zoompicture #zoomzoom img').attr({
					src: imageAdditionnelle
					});
					$('#zoompicture').css({
										top: '5%'
					 });
					$(".jqmClose + .jqmClose").css("display", "none") 
		});
		$('#zoompicture').jqm().jqmShow();
		return false;
	});
}
function average_note(){
	var average = $('#star_note img').attr("alt");
	if(average.indexOf(',')!=-1){
		var index = average.lastIndexOf(',');
		var note='';
 		var decimal = average.substring(index+1,average.length);
		if( decimal >= 5){
			note = parseInt(average.substring('0',index))+1;
		}else{
			note = average.substring('0',index);
		}
		$('#star_note img').attr({
			src: '/images/note/note_'+note+'.jpg',
			alt:note
		});
		
	}
}

jQuery.fn.vjustify=function() {
	var maxHeight=0;
	this.each(function(){
		if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
	});
	this.each(function(){
		$(this).height(maxHeight + "px");
		if (this.offsetHeight>maxHeight) {
		//$(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
							$(this).css({
										height: ((maxHeight-(this.offsetHeight-maxHeight))+"px")
					 });
		}
	});
};

function TakePut(sourceURL, sourceZone, destinationZone) {
  var ListElem = $(sourceURL);
	ListElem.each(function (index, domEle) {	
					var source = $(domEle).attr("href")+"getpagecontent";
					var dest = $(domEle).parent().children(destinationZone);
					var cequejeveux = source +" #product #produits_commentaires #toggle_left #star_note";
					$(dest).load(cequejeveux);
	});
	
	
}