
jQuery(document).ready(function($){
	$('.flexslider').flexslider({
	animation: "fade",              //String: Select your animation type, "fade" or "slide"
	slideshow: true,                //Boolean: Animate slider automatically
	slideshowSpeed: 3000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
	animationDuration: 600,         //Integer: Set the speed of animations, in milliseconds
	directionNav: false,             //Boolean: Create navigation for previous/next navigation? (true/false)
	controlNav: false,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
	keyboardNav: false,              //Boolean: Allow slider navigating via keyboard left/right keys
	pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
	pauseOnHover: true          //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
	});
});



Event.observe(window,'load',init);

function init(){
	
	if($('ajax_ttc')){	Event.observe($('ajax_ht'),'keyup',auto_ht); }
	if($('ajax_tva')){	Event.observe($('ajax_ht'),'keyup',auto_ht); }
	
	if($('egal')){	Event.observe($('egal'),'click',egaliser); }
	
	
}

function egaliser(e){
		
	if($('egal').checked==true){
	
		$('livraison_nom').value=$F('facturation_nom');
		$('livraison_prenom').value=$F('facturation_prenom');
		$('livraison_societe').value=$F('facturation_societe');
		$('livraison_adresse').value=$F('facturation_adresse');
		$('livraison_complement').value=$F('facturation_complement');
		$('livraison_cp').value=$F('facturation_cp');
		$('livraison_ville').value=$F('facturation_ville');
		$('livraison_pays').value=$F('facturation_pays');
	}
}


function auto_ht(e){
	
	var mdl=$F('mdl');
	var ttc=$F('prix_ttc');
	var tva=$F('tva');
	
	var search=$F('speed_list_search');
	new Ajax.Updater($('ajax_ht'),'index.php',
		{ method:'post',
		parameters: {mdl:mdl,act:'auto_ht',ttc:ttc,tva:tva}});	
	Event.stop(e); // inhibe l'action de lien, permet de rester au meme endroit dans une page
}

function ajaxtestconnec(e){
	
	var mdl='accueil';
	var login=$F('login_connection');	
	var pass=$F('pass_connection');	
	new Ajax.Updater($('ajax_ht'),'index.php',
		{ method:'post',
		parameters: {mdl:mdl,act:'ajaxtestconnec',login:login,pass:pass}});	
	Event.stop(e); // inhibe l'action de lien, permet de rester au meme endroit dans une page
}


