ret=function(){if(ajaxOk()){eval(objAjax.responseText);killAjax();}}
function addToCart(id){
	callAjax("/ajax/boutique.php?action=addtoCart&id="+id,ret,null);
}

function addToCartEn(id){
	callAjax("/ajax/boutique.php?action=addtoCartEn&id="+id,ret,null);
}

function addToCartEs(id){
	callAjax("/ajax/boutique.php?action=addtoCartEs&id="+id,ret,null);
}

function clearBasket(){
	if(confirm('Voulez-vous vraiment vider votre panier?')){
		callAjax("/ajax/boutique.php?action=emptyCart",ret,null);
	}
}

function clearBasketEn(){
	if(confirm('Do you really want to clear your cart?')){
		callAjax("/ajax/boutique.php?action=emptyCartEn",ret,null);
	}
}

function clearBasketEs(){
	if(confirm('żEst&aacute; seguro de querer vaciar su carrito?')){
		callAjax("/ajax/boutique.php?action=emptyCartEs",ret,null);
	}
}

function sendForm(hndl){
	funct = function(){if(ajaxOk()){alert(objAjax.responseText);killAjax();}}
	if(validForm(hndl)){
		callAjax('../box/contact.form.php',funct,$('formulaire'), hndl );
	}
}

function delItem(id, txt){
	if(confirm(txt)){
		callAjax("/ajax/boutique.php?action=remove&id="+id,ret,null);
	}
}


function updatecart(){
	t=document.getElementsByClassName('qteprod');
	q='action=update';
	for(i=0;i<t.length;i++){
		q+='&'+t[i].getAttribute('id')+'='+t[i].value;
	}
	callAjax("https://www.eddyscraper.com/ajax/boutique.php?"+q,ret,null);
}

function updatecartEn(){
	t=document.getElementsByClassName('qteprod');
	q='action=updateEn';
	for(i=0;i<t.length;i++){
		q+='&'+t[i].getAttribute('id')+'='+t[i].value;
	}
	callAjax("https://www.eddyscraper.com/ajax/boutique.php?"+q,ret,null);
}

function updatecartEs(){
	t=document.getElementsByClassName('qteprod');
	q='action=updateEs';
	for(i=0;i<t.length;i++){
		q+='&'+t[i].getAttribute('id')+'='+t[i].value;
	}
	callAjax("https://www.eddyscraper.com/ajax/boutique.php?"+q,ret,null);
}

function changeCurrency(){
	callAjax("/ajax/boutique.php?action=changeCur",ret,null);
}

function loadprovince(elm){
	callAjax("/ajax/boutique.php?action=loadprovince&p="+elm.options[elm.selectedIndex].value,ret,null);
}

function login(lang){
	callAjax("/ajax/boutique.php?action=login" + lang + "&u="+$('uname').value+"&p="+$('pass').value,ret,null);
}

function register(){
	if($('password').value!=$('password2').value){alert('La contrase&ntilde;a y la confirmaci&oacute;n de la contrase&ntilde;a no son id&eacute;nticas.');return(false);}
	if(validForm($('register'))){
		callAjax("/ajax/boutique.php?action=register",ret,null,$('register'));
	}
}

function registerEn(){
	if($('password').value!=$('password2').value){alert('The password and the password confirmation are not identical.');return(false);}
	if(validForm($('register'))){
		callAjax("/ajax/boutique.php?action=register",ret,null,$('register'));
	}
}

function registerEs(){
	if($('password').value!=$('password2').value){alert('Su correo electr&oacute;nico y/o contrase&ntilde;a no son valides.');return(false);}
	if(validForm($('register'))){
		callAjax("/ajax/boutique.php?action=register",ret,null,$('register'));
	}
}

//pour les modals
function addModal() {
	//clearTimers();
	
	try {  $('modal').parentNode.removeChild($('modal'));	}
	catch(e) { }
	var wheight;
	if (document.documentElement && document.documentElement.scrollHeight) wheight = document.documentElement.scrollHeight;
	else if (document.body && document.body.scrollHeight) wheight = document.body.scrollHeight;
	
	var div = document.createElement('div');
	div.id = 'modal';
	div.style.position = 'absolute';
	div.style.top = '0';
	div.style.left = '0';
	div.style.zIndex = 999997;
	div.style.width = '100%';
	div.style.height = wheight+'px';
	div2=document.createElement('div');
	div2.style.position = 'absolute';
	div2.style.top = '0';
	div2.style.left = '0';
	div2.style.zIndex = 999998;
	div2.style.width = '100%';
	div2.style.backgroundColor = '#000';
	div2.style.height = wheight+'px';
	if (document.all) div2.style.filter='alpha(opacity=75)';
	else Element.setOpacity(div2,.75);
	div.appendChild(div2);
	document.getElementsByTagName('body')[0].appendChild(div);	
	if (navigator.userAgent.match(/msie 6/i)) hideselects();	

}


function removeModal() {
	try {  $('modal').parentNode.removeChild($('modal'));	}
	catch(e) { }
	if (navigator.userAgent.match(/msie 6/i)) showselects();	
	window.onscroll = function () { 
		return;
	}; 
	document.body.style.overflow="visible";
	//enableTimers();
}

function hideselects() {
	var selects = document.getElementsByTagName('select');
	for(var x=0;x<selects.length;x++) {
		//selects[x].setAttribute('oldvisibility',selects[x].currentStyle.visibility);
		selects[x].style.visibility = 'hidden';
	}
}

function showselects() {
	var selects = document.getElementsByTagName('select');
	for(var x=0;x<selects.length;x++) {
		selects[x].style.visibility = 'visible';
	}	
}

function uneAlerte(html) {
	//alert(html);
	addModal();
	
	var box = '<div class="teaser" id="warningbox" style="position:absolute; filter:alpha(opacity=0); -moz-opacity:0;z-index:999999; background-color:#FFFFFF; border:1px solid #000000; width:502px;"><div><div  style="padding: 10px;" id="videoplace"><div class="dvBtn2" style="float:right;top:0;"><a href="javascript:;" id="omaxAlertBtn" onclick="removeModal();" class="btn" ><img src="/images/quit.gif"></a></div>'+html+'<div style="clear:both"></div></div></div></div>';
	$('modal').innerHTML += box;
	
	var mov = '<embed src=\"/swf/player.swf\" width=\"482\" height=\"340\" allowscriptaccess=\"always\" allowfullscreen=\"true\" flashvars=\"file=/video/eddylow.flv\"/>';
	
	$('videoplace').innerHTML += mov;
	
	Effect.Center('warningbox'); 
	window.onscroll = function () { 
		Effect.Center('warningbox'); 
	}; 
	
	$('warningbox').style.display='none';
	if (document.all) $('warningbox').style.filter='';
	else Element.setOpacity($('warningbox'),100);
		
	document.body.style.overflow="hidden";
	new Effect.Appear('warningbox',{ duration : 1 });
	
	

	//$('omaxAlertBtn').focus();
	
}

function videoKroko(html) {
	//alert(html);
	addModal();
	
	var box = '<div class="teaser" id="warningbox" style="position:absolute; filter:alpha(opacity=0); -moz-opacity:0;z-index:999999; background-color:#FFFFFF; border:1px solid #000000; width:450px;"><div><div  style="padding: 10px;" id="videoplace"><div class="dvBtn2" style="float:right;top:0;"><a href="javascript:;" id="omaxAlertBtn" onclick="removeModal();" class="btn" ><img src="/images/quit.gif"></a></div>'+html+'<div style="clear:both"></div></div></div></div>';
	$('modal').innerHTML += box;
	
	var mov = '<embed src=\"/swf/player.swf\" width=\"430\" height=\"340\" allowscriptaccess=\"always\" allowfullscreen=\"true\" flashvars=\"file=/video/kroko_en.FLV\"/>';
	
	$('videoplace').innerHTML += mov;
	
	Effect.Center('warningbox'); 
	window.onscroll = function () { 
		Effect.Center('warningbox'); 
	}; 
	
	$('warningbox').style.display='none';
	if (document.all) $('warningbox').style.filter='';
	else Element.setOpacity($('warningbox'),100);
		
	document.body.style.overflow="hidden";
	new Effect.Appear('warningbox',{ duration : 1 });
	
	

	//$('omaxAlertBtn').focus();
	
}

function videoKrokoFr(html) {
	//alert(html);
	addModal();
	
	var box = '<div class="teaser" id="warningbox" style="position:absolute; filter:alpha(opacity=0); -moz-opacity:0;z-index:999999; background-color:#FFFFFF; border:1px solid #000000; width:450px;"><div><div  style="padding: 10px;" id="videoplace"><div class="dvBtn2" style="float:right;top:0;"><a href="javascript:;" id="omaxAlertBtn" onclick="removeModal();" class="btn" ><img src="/images/quit.gif"></a></div>'+html+'<div style="clear:both"></div></div></div></div>';
	$('modal').innerHTML += box;
	
	var mov = '<embed src=\"/swf/player.swf\" width=\"430\" height=\"340\" allowscriptaccess=\"always\" allowfullscreen=\"true\" flashvars=\"file=/video/kroko_fr.FLV\"/>';
	
	$('videoplace').innerHTML += mov;
	
	Effect.Center('warningbox'); 
	window.onscroll = function () { 
		Effect.Center('warningbox'); 
	}; 
	
	$('warningbox').style.display='none';
	if (document.all) $('warningbox').style.filter='';
	else Element.setOpacity($('warningbox'),100);
		
	document.body.style.overflow="hidden";
	new Effect.Appear('warningbox',{ duration : 1 });
	
	

	//$('omaxAlertBtn').focus();
	
}

function test(){
	var FU = {movie:"/adnbase/flash/mediaplayer.swf",width:"488",height:"344",majorversion:"7",build:"0",bgcolor:"#FFFFFF",flashvars:"type=flv&amp;file=http://eddy.hebergementadn.ca/video/eddylow.flv&amp;shownavigation=true" };
	UFO.create(     FU, "ga");
}



