$(document).ready(function(){ 
	
/*Remove inputValue onfocus and recall default inputValue onblur*/
	$('input, textarea', '#subscription').focus(function() {
		value=$(this).val();
		if($(this).val()!=="Entrez votre email...") {
			$(this).val(value);
		}else if($(this).val()=="Entrez votre email..."){
			$(this).val("");
		}
		
	});
	$('input, textarea', '#subscription').blur(function() {
		value=$(this).val();
		if($(this).val()!=="") {
			$(this).val(value);
		}else if($(this).val()==""){
			$(this).val("Entrez votre email...");
		}
	});
	
/*centering height carousel*/
	$("#carouseldesmarques ul li img").each( function(){
		var higher = $(this).height();
		var diff = (44 - higher)/2;
		$(this).css( 'margin-top', (diff) );		
	});
	
/*Homepage Carousel*/
	$('#carousel').jcarousel({
		scroll: 2
	});
	$('#carouseldesmarques').jcarousel({
		scroll: 2
	});
	$('#carouselRight').jcarousel({
		scroll: 1
	});
	
/*cycle HP*/
	$('#affiche-promo ul').cycle({
		fx:             'fade',
	    timeout:        6000,
	    speed:			2000
	});
	
/*Lightbox*/
	$('a.lightbox').lightBox();
	
/*tabs admin magasin*/
	$( '#navMagasin' ).idTabs();
	
/*datepicker*/
	$( ".datepicker" ).datepicker( { dateFormat: 'dd/mm/yy' } );

});

function write_text(login,domain,ext,subject,classe) {
	emailE=(login+'@'+domain+'.'+ext)
	if (classe) document.write('<a href="mailto:' + emailE + '?subject='+subject+'" class="'+classe+'">' + emailE + '</a>')
	else document.write('<a href="mailto:' + emailE + '?subject='+subject+'">' + emailE + '</a>')
}

function addNewBrand( hiddenID, submitID )
{
	document.getElementById( hiddenID ).value = "newBrand";
	document.getElementById( submitID ).click();
}
