function image(){
  var imagePrincipale = $('#productPicture img').attr("src");
	var chaine = imagePrincipale.lastIndexOf("/");
  var imgZoom = imagePrincipale.substring(chaine+1,imagePrincipale.length);
  $('#productPicture a').attr({
   		href: '/media/'+imgZoom
   });
};


function desactive(){
  $('.boxcatalogshortcut ul .off').each(function() {
		$(this).attr({href:"#4444"});
		$(this).css({cursor:'default'});
	});
};



function fade(){
		$(".shortcuts ul li ul li a").css({opacity: 0.7});
		$(".shortcuts ul li ul li a").hover(makeTall,makeShort);
};

		function makeTall(){   $(this).fadeTo("fast", 1.0);}
		function makeShort(){  $(this).fadeTo("fast", 0.7);}




function fade_panier(){
		$(".short_product .panier , #selections_cart .submit input").css({opacity: 0.75});
		$(".short_product .panier , #selections_cart .submit input").hover(Fadein,Fadeout);
		
};
		

		function Fadein(){$(this).fadeTo("fast", 1);}
		function Fadeout(){$(this).fadeTo("fast", 0.75);}
		
		
function leftbarpanier(){
		$("#leftbar .panier").css({display: "none"});		
};


function TallDescription(){
		$("#TallDescription").hover(makeTallDescription,makeShortDescription);
};
		

		function makeTallDescription(){   $("#dimensions").animate({height:"50px"});}
		function makeShortDescription(){  $("#dimensions").animate({height:"5px"}, 200 );}

function TallAdditionnels(){
		$("#TallAdditionnels").hover(makeTallAdditionnels,makeShortAdditionnels);
};
		

		function makeTallAdditionnels(){   $("#visuels_additionnels").animate({height:"100px"});}
		function makeShortAdditionnels(){  $("#visuels_additionnels").animate({height:"5px"}, 200 );}

function ProduitsAssocies(){
		$("#produits_associes .short_product").hover(makeOn,makeOff);
				$("#produits_associes .short_product").css({opacity: 0.5});
};
	   
function makeOn(){	$(this).animate({marginTop:"-5px"}, 50 );
		$(this).fadeTo("fast", 1);}
function makeOff(){	$(this).animate({marginTop:"5px"}, 200 );
		$(this).fadeTo("fast", 0.5);}

function text_replacement(){
	$('.voir').html('En savoir plus');
	$("a:contains('Voir la fiche')").text("En savoir plus");
	$("a:contains('Voir la famille')").text("En savoir +"); 
	$("td:contains('franco')").text("Offert"); 
	$("td:contains('Franco de port')").text("Offert");
	};


function makeActiveLink(){
	var listLink = $(".shortcuts a");
	var CurrentUrl = document.location.href;
	listLink.each(function (index, domEle) {
		if(CurrentUrl == domEle){
			$(this).css("color","#ff6600");
		}
	});
};


function combo(){
$('#arboselect').combobox(
				{
					comboboxContainerClass: "comboboxContainer",
					comboboxValueContainerClass: "comboboxValueContainer",
					comboboxValueContentClass: "comboboxValueContent",
					comboboxDropDownClass: "comboboxDropDownContainer",
					comboboxDropDownButtonClass: "comboboxDropDownButton",
					comboboxDropDownItemClass: "comboboxItem",
					comboboxDropDownItemHoverClass: "comboboxItemHover",
					comboboxDropDownGroupItemHeaderClass: "comboboxGroupItemHeader",
					comboboxDropDownGroupItemContainerClass: "comboboxGroupItemContainer",
					animationType: "slide",
					width: "150px"
					});
};



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).css({
      		height: ((maxHeight-(this.offsetHeight-maxHeight))+"px")
		});
		}
	});
};




function JSReplace(inStr, inReplace){
	while(inStr.indexOf(inReplace) > 0){
		inStr = inStr.replace(inReplace);
	};
};

function resume() {
	$(".descriptif_court_pdt").each(function(){
		var monHTML = $(this).html();
		
		monHTML = monHTML.replace('<p>','');
		monHTML = monHTML.replace('</p>','');
		
		if (monHTML.length > 60)
			monHTML = monHTML.substring(0, 57)+'...';
			
		$(this).html(monHTML);
	});
}