/*	function Checkboxes(){
	var Check = $("input[name='theme_1'],input[name='theme_2'],input[name='theme_3']");
	Check.each(function (index, domEle) {
	$(this).before('<div style="background:#f00;">');
	$(this).after('</div>');
});*/
/*
	$(".row").each(function(i){
		if (i == 3) {
			$(this).before('<div style="float:left;clear:left;width:300px">div1');			
		}
		
		if(i == 6) {
			$(this).after('fin1</div>');
		}
		
		if (i == 7) {
			$(this).before('<div style="float:right;clear:right;width:300px">div2');			
		}
		
		if(i == 9) {
			$(this).after('fin2</div>');
		}
	})*/
	

 /*var monHTML = $(".inscription_form .formulaire #form").html();
 alert(monHTML);
 
 tableau = monHTML.split('<div class="row">');
 tableau[3] = tableau[3] + '<div id="test">';
 tableau[7] = tableau[7] + "</div>";
 
 monHTML = tableau.join('<div class="row">');
 $(".inscription_form .formulaire fieldset").html(monHTML);
*/
//	$("input[id='theme_1']:parent").css("border","1px solid #000000");
//};
/*

function fade(){
	$(".second_level").css({opacity: 0.5});
	$(".second_level").hover(makeTall,makeShort);
		
	function makeTall(){   $(this).fadeTo("slow", 0.9);}
	function makeShort(){  $(this).fadeTo("slow", 0.5);}
};


*/

function comparePrices(){
	
	if ($('.first_price span').html() == $('.second_price span').html() ) {
		$('.first_price span').css('display','none');
	}

};



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




function url_rewriting(){
    
   $(".promotion_box .short_product a").each(function(i){
   			
		  	var myUrl = $(this).attr("href");

	  		myTab = myUrl.split("/");
		  	
		  	if (myUrl.indexOf("promotion") == -1) {
		  		myTab[myTab.length - 2] = "promotion";
			} 

	  		myTab[myTab.length - 1] = "";
		  		
	  		myUrl = myTab.join("/");
		  	
		  	$(this).attr("href", myUrl);
    });
    
       $(".produits_right .short_product a").each(function(i){
   			
		  	var myUrl = $(this).attr("href");

	  		myTab = myUrl.split("/");

	  		myTab[myTab.length - 1] = "";
		  		
	  		myUrl = myTab.join("/");
		  	
		  	$(this).attr("href", myUrl);
    });
    
           $(".nouveaute_box .short_product a").each(function(i){
   			
		  	var myUrl = $(this).attr("href");

	  		myTab = myUrl.split("/");

	  		myTab[myTab.length - 1] = "";
		  		
	  		myUrl = myTab.join("/");
		  	
		  	$(this).attr("href", myUrl);
    });
    
};




function text_replacement(){
	$('.voir').text('En savoir plus');

	$("select:contains('Libellé')").html("dgdgd");

$("a:contains('Lire l'article')").text("En savoir plus");
	$("a:contains('Voir la fiche')").text("En savoir plus");
	$("a:contains('Voir la famille')").text("En savoir +");
  $('.nouveaute .top_short_product').css('display','none');
  $('.nouveaute .panier').css('display','none');  
	$("a:contains('Animaux')").html("Etre inform&eacute; <br/>des arrivages d'animaux ");
}

function empty(){
  $(".fiches:empty").css('display','none');
  //$("div").html("<p>&#160;</p>").css('display','none');
  //$(".fiches > p:empty").css('display','none');
}

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


function imageVisusAdd(){
	
	var imgZoom = new Array();
	$('#productPicture img, #visuels_additionnels  img').each(function(i){
			imagePrincipale = $(this).attr("src");
			imgZoom[i] = imagePrincipale;
			chaine = imagePrincipale.split("/");
			newChaine = "/" + chaine[1] + "/thumbnails/" + chaine[3];
			$(this).attr({src:newChaine});
	});
	$('#productPicture  a, #visuels_additionnels  a').each(function(i){
			var imgBig = imgZoom[i].replace("thumbnails/", "");
			$(this).attr({
	   		href: imgBig
  	 		});
 	});
}



/*
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 zoom(){
  var imagePrincipale = $('#visuels_additionnels img').attr("src");
	var chaine = imagePrincipale.lastIndexOf("/");
 	var imgZoom = imagePrincipale.substring(chaine+1,imagePrincipale.length);
  $('#visuels_additionnels a').attr({
			href: '/media/'+imgZoom
  });
}
*/

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 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);
	});	
};
