function mq_left(promoblock) {
	//alert(promoblock);
	var current=document.getElementById('cont_tb_'+promoblock).style.marginLeft;
	var current_length=current.length;
	//alert(current);
	x=current.substring(0, current_length-2);
	x=parseInt(x);
	x=x+3;
	if (x>0) { x=0;}
	var xpx=x+'px';
	document.getElementById('cont_tb_'+promoblock).style.marginLeft=xpx;
	timer_down=setTimeout('mq_left('+promoblock+')',5);
	return (x);
}

function mq_right(minx,promoblock) {
	//alert(minx+'-'+promoblock);
	var current=document.getElementById('cont_tb_'+promoblock).style.marginLeft;
	var current_length=current.length;
	x=current.substring(0, current_length-2);
	x=parseInt(x);
	x=x-3;
	if (x<minx) { x=minx;}
	//alert(minx);
	var xpx=x+'px';
	document.getElementById('cont_tb_'+promoblock).style.marginLeft=xpx;
	//alert(minx);
	timer_up=setTimeout('mq_right('+minx+','+promoblock+')',5);
	return (x);
}


function set_plata(tip_plata) {
	document.getElementById('cart_modalitate_plata').value=tip_plata;
	if (tip_plata=="1") {
		document.getElementById('check_modalitate_plata1').src="/images_2010/check_fancy_on.gif";
		document.getElementById('check_modalitate_plata2').src="/images_2010/check_fancy_off.gif";
		document.getElementById('check_modalitate_plata3').src="/images_2010/check_fancy_off.gif";
	}
	if (tip_plata=="2") {
		document.getElementById('check_modalitate_plata1').src="/images_2010/check_fancy_off.gif";
		document.getElementById('check_modalitate_plata2').src="/images_2010/check_fancy_on.gif";
		document.getElementById('check_modalitate_plata3').src="/images_2010/check_fancy_off.gif";
	}
	if (tip_plata=="3") {
		document.getElementById('check_modalitate_plata1').src="/images_2010/check_fancy_off.gif";
		document.getElementById('check_modalitate_plata2').src="/images_2010/check_fancy_off.gif";
		document.getElementById('check_modalitate_plata3').src="/images_2010/check_fancy_on.gif";
	}
}

function in_array(string, array) {
	for (i = 0; i < array.length; i++) {
		if(array[i] == string) {
			return true;
		}
	}
	return false;
}

function check_iban(iban) {
	//alert(iban);
	var iban_ok=1;
	iban=iban.replace(/ /gi, "");
	iban=iban.toLowerCase();
		if (iban.length!=24) {
		iban_ok=0;
	} else {
		iban2=iban.substr(4,20)+iban.substr(0,4);
		//alert(iban.replace(" ", ""));
		iban2=iban2.replace(/a/gi, "10");
		iban2=iban2.replace(/b/gi, "11");
		iban2=iban2.replace(/c/gi, "12");
		iban2=iban2.replace(/d/gi, "13");
		iban2=iban2.replace(/e/gi, "14");
		iban2=iban2.replace(/f/gi, "15");
		iban2=iban2.replace(/g/gi, "16");
		iban2=iban2.replace(/h/gi, "17");
		iban2=iban2.replace(/i/gi, "18");
		iban2=iban2.replace(/j/gi, "19");
		iban2=iban2.replace(/k/gi, "20");
		iban2=iban2.replace(/l/gi, "21");
		iban2=iban2.replace(/m/gi, "22");
		iban2=iban2.replace(/n/gi, "23");
		iban2=iban2.replace(/o/gi, "24");
		iban2=iban2.replace(/p/gi, "25");
		iban2=iban2.replace(/q/gi, "26");
		iban2=iban2.replace(/r/gi, "27");
		iban2=iban2.replace(/s/gi, "28");
		iban2=iban2.replace(/t/gi, "29");
		iban2=iban2.replace(/u/gi, "30");
		iban2=iban2.replace(/v/gi, "31");
		iban2=iban2.replace(/w/gi, "32");
		iban2=iban2.replace(/x/gi, "33");
		iban2=iban2.replace(/y/gi, "34");
		iban2=iban2.replace(/z/gi, "35");
			
		while (iban2.substr(0,1)=="0") {
			iban2=iban2.substr(1);
		}
	
		var iban_d=new Array();
		var iban_a=new Array();	
		var iban_prod=0;
		var iban_sum=0;
		iban_d[0]="0";
		iban_a[0]="0";
		iban_d[1]=parseInt(iban2.substr(iban2.length-1,1));
		iban_a[1]=1
		
		for (i=2; i<=iban2.length; i++) {
			iban_d[i]=parseInt(iban2.substr(iban2.length-i,1)); // $nr[strlen($nr)-$i];
			iban_a[i]=(iban_a[i-1]*10)%97;
			//alert(i+' - '+iban_d[i]+' - '+iban_a[i]);
		}
		
		for (i=1; i<=iban2.length; i++) {
			iban_prod=iban_d[i]*iban_a[i];
			iban_sum=iban_sum+iban_prod;
			//echo $i.'-'.$d[$i].'-'.$a[$i].' | '.$prod.'<br>';
			//alert(i+' - '+iban_d[i]+' - '+iban_a[i]+' | '+iban_prod);
		}	
		
		iban_sum=iban_sum%97;
		
		//alert('IBANSUM='+iban_sum);
	
		if (iban_sum!=1) {
		 	iban_ok=0;
		}
	}
	//alert('IBANok');
	return (iban_ok);
}

function check_cos3() {
	var el_tip=document.getElementById('cart_tip');
	if (el_tip.value!=1 && el_tip.value!=2) {
		alert('Alegeti modalitatea de facturare - pe persoana fizica sau juridica!');
		return false;
	} else if (el_tip.value==1) {
		//persoana fizica	
		var el_fiz=document.getElementById('cart_nume');
		if (el_fiz.value=='') {
			alert('Introduceti numele dumneavoastra!');
				document.getElementById("datepf").style.display="block"; 
				document.getElementById("datepf_af").style.display="none";
			el_fiz.focus();
			return false;
		}

		var el_fiz=document.getElementById('cart_prenume');
		if (el_fiz.value=='') {
			alert('Introduceti prenumele dumneavoastra!');
				document.getElementById("datepf").style.display="block"; 
				document.getElementById("datepf_af").style.display="none";
			el_fiz.focus();
			return false;
		}

		var el_fiz=document.getElementById('cart_telefon');
		if (el_fiz.value=='') {
			alert('Introduceti numarul dumneavoastra de telefon!');
				document.getElementById("datepf").style.display="block"; 
				document.getElementById("datepf_af").style.display="none";
			el_fiz.focus();
			return false;
		}

		var el_fiz=document.getElementById('cart_cnp');
		if (el_fiz.value=='') {
			alert('Introduceti CNP-ul dumneavoastra!');
				document.getElementById("datepf").style.display="block"; 
				document.getElementById("datepf_af").style.display="none";
			el_fiz.focus();
			return false;
		} else {
			var cnperr=0;
			cnparrs = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
			cnparrcifre = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
			cnparrll = new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");

			if (el_fiz.value.length!=13) {
				cnperr=1;
			} else {
				var cnpi=0;
				for (cnpi=0; cnpi<13; cnpi++) {
					if (!in_array(el_fiz.value[cnpi], cnparrcifre)) {
						cnperr=1;
					}
				}
			}
			
			if(!in_array(el_fiz.value[0], cnparrs)) {
				cnperr=1;
			}
			
			if(!in_array(el_fiz.value[1], cnparrcifre) || !in_array(el_fiz.value[2], cnparrcifre)) {
				cnperr=1;
			}

			//alert(el_fiz.value.substring(3,5));
			var cnpll=el_fiz.value.substring(3,5);
			if(!in_array(el_fiz.value.substring(3,5), cnparrll)) {
				cnperr=1;
			}
			
			//alert(el_fiz.value.substring(5,7));
			//alert(parseInt(el_fiz.value.substring(5,7)));
			if(el_fiz.value[5]=="0") {
				if (!in_array(el_fiz.value[6], cnparrs)) {
					cnperr=1;						   
				}
			} else {
				var cnpzz=parseInt(el_fiz.value.substring(5,7));
				if (cnpzz<1) {
					cnperr=1;	
				} else {
					if 	(cnpzz>31) {
						cnperr=1;	
					}
				}
			}

			cnparrjj = new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "51", "52");
			var cnpjj=el_fiz.value.substring(7,9);
			//alert('judet='+cnpjj);
			if(!in_array(el_fiz.value.substring(7,9), cnparrjj)) {
				cnperr=1;
			}
			
			if (el_fiz.value[9]=="0" && el_fiz.value[10]=="0" && !in_array(el_fiz.value[11], cnparrs)) {
				cnperr=1;																			
			} else {
				if(!in_array(el_fiz.value[9], cnparrcifre) || !in_array(el_fiz.value[10], cnparrcifre) || !in_array(el_fiz.value[11], cnparrcifre)) {
					cnperr=1;
				}
			}

			var cnpcc="0";
			cnpcc=parseInt(el_fiz.value[0])*2 + parseInt(el_fiz.value[1])*7 + parseInt(el_fiz.value[2])*9 + parseInt(el_fiz.value[3])*1 + parseInt(el_fiz.value[4])*4 + parseInt(el_fiz.value[5])*6 + parseInt(el_fiz.value[6])*3 + parseInt(el_fiz.value[7])*5 + parseInt(el_fiz.value[8])*8 + parseInt(el_fiz.value[9])*2 + parseInt(el_fiz.value[10])*7 + parseInt(el_fiz.value[11])*9;
			var cnprest=cnpcc-Math.floor(cnpcc/11)*11;
			if (cnprest=="10") {
				cnprest=1;
			}
			if (cnprest!=el_fiz.value[12]) {
				cnperr=1;
			}
			// 0 1 2 3 4 5 6 7 8 9 a b
			// 2 7 9 1 4 6 3 5 8 2 7 9 
			
			if (cnperr>0) {
				alert("CNP invalid!");
				document.getElementById("datepf").style.display="block"; 
				document.getElementById("datepf_af").style.display="none";
				el_fiz.focus();
				return false;
			}
		}
		
	} else {
		// persoana juridica
		
		var el_fiz=document.getElementById('cart_nume');
		if (el_fiz.value=='') {
			alert('Introduceti numele persoanei de contact!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}

		var el_fiz=document.getElementById('cart_prenume');
		if (el_fiz.value=='') {
			alert('Introduceti prenumele persoanei de contact!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}

		var el_fiz=document.getElementById('cart_telefon');
		if (el_fiz.value=='') {
			alert('Introduceti numarul de telefon al persoanei de contact!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_nume_firma_1');
		if (el_fiz.value=='') {
			alert('Introduceti denumirea persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}
		
		// cart_pl_tva_1_da
		if (document.getElementById('cart_pl_tva_1_da').checked==false && document.getElementById('cart_pl_tva_1_nu').checked==false) {
			alert('Bifati daca persoana juridica este sau nu este platitoare de TVA!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			return false;
		}
		
		var el_fiz=document.getElementById('cart_cui_firma_1');
		if (el_fiz.value=='') {
			alert('Introduceti codul unic de inregistrare al persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		} else { 
			var cart_cui=el_fiz.value;
			var cui_cheie="753217532";
			var cui_cheie_i="235712357";
			var cart_cui_i="";
			var cuierr=0;
			arrcifre = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
			var cuii=0;
			var cuiver=0;

			if (parseInt(el_fiz.value.length)>10) {
				//alert('x');
				cuierr=1;
			} else {
				//alert('..');
				for (cuii=0; cuii<el_fiz.value.length; cuii++) {
					//alert(cuii);
					if (!in_array(el_fiz.value[cuii], arrcifre)) {
						cuierr=1;
						//echo 'y';
					}
				}
			}
			
			for (cuii=parseInt(el_fiz.value.length)-1; cuii>=0; cuii--) {
					cart_cui_i=cart_cui_i+cart_cui[cuii];
			}
			
			for (cuii=1; cuii<cart_cui_i.length; cuii++) {
				cuiver=cuiver+cart_cui_i[cuii]*cui_cheie_i[cuii-1];
				//echo $cuii.' - '.$cart_cui_i[$cuii]*$cui_cheie_i[$cuii-1].' | '.$cart_cui_i[$cuii].' - '.$cui_cheie_i[$cuii-1].'<br>';
			}
			cuiver=cuiver*10;
			//alert(cuiver);
			var cuivermod=cuiver-Math.floor(cuiver/11)*11;
			
			if (cuivermod==10) {
				cuivermod=0;
			}

			//echo $cuivermod.' / '.$cuiver.' / '.$cart_cui_i.' / '.$cui_cheie_i.'<hr>';
			if (cuivermod!=cart_cui[cart_cui.length-1]) {
				cuierr=1;
			}
			
			
			if (cuierr>0) {
				alert('Codul unic de inregistrare (fiscal) al persoanei juridice este invalid!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
				el_fiz.focus();
				return false;
			}
		}
		
		var el_fiz=document.getElementById('cart_localitate_firma_1');
		if (el_fiz.value=='') {
			alert('Introduceti localitatea persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_judet_firma_1');
		if (el_fiz.value=='0') {
			alert('Introduceti judetul persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_adresa_firma_1');
		if (el_fiz.value=='') {
			alert('Introduceti adresa persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_cont_firma_1');
		if (el_fiz.value=='') {
			alert('Introduceti contul bancar (IBAN) al persoanei juridice!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
			el_fiz.focus();
			return false;
		} else {
			if (check_iban(el_fiz.value)==0) {
				alert('Contul bancar (IBAN) nu este valid!');
				document.getElementById("datepj").style.display="block"; 
				document.getElementById("datepj_af").style.display="none";
				el_fiz.focus();
				return false;
			} 
		}
		
		//check_iban
	}
	// livrare prin curier 
	if (document.getElementById('cart_cos_transport').value=="2") {
		var el_fiz=document.getElementById('cart_localitate_livrare');
		if (el_fiz.value=='') {
			alert('Introduceti localitatea de livrare!');
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_judet_livrare');
		if (el_fiz.value=='0') {
			alert('Introduceti judetul de livrare!');
			el_fiz.focus();
			return false;
		}
		
		var el_fiz=document.getElementById('cart_adresa_livrare');
		if (el_fiz.value=='') {
			alert('Introduceti adresa de livrare!');
			el_fiz.focus();
			return false;
		}
	}
	
	if (document.getElementById('cart_modalitate_plata').value=="") {
		alert('Va rugam alegeti modalitatea de plata!');
		return false;
	}
	
	//alert('verificare OK'); 
	//return false;
}

function preia_date_firma() {
	if (document.getElementById('cart_localitate_firma_1')) {
		document.getElementById('cart_localitate_livrare').value=document.getElementById('cart_localitate_firma_1').value;
	}
	if (document.getElementById('cart_judet_firma_1')) {
		document.getElementById('cart_judet_livrare').value=document.getElementById('cart_judet_firma_1').value;
	}
	if (document.getElementById('cart_adresa_firma_1')) {
		document.getElementById('cart_adresa_livrare').value=document.getElementById('cart_adresa_firma_1').value;
	}
}

function popup(URL) {
	    day = new Date();
	    id = day.getTime();
	    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=680,height=300');");
	} 

	function popup_rec(URL) {
	    day = new Date();
	    id = day.getTime();
	    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=240');");
	} 
	
	function compare(_id) {
	  var day = new Date();
	  var id = day.getTime();
	  var url = '/compare.php?ids=' + _id;
	  eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600');"); 
	}

	function addToFavorites(pageName) { 
		if (window.external) { 
			window.external.AddFavorite(window.location, pageName);
		}
	}

function domError() {
	alert("eroare");
}

function join_email_check(email) {
	//alert(document.getElementById('join_email').value);
	if (document.getElementById('join_email').value!="") {
		var url = '/includes_2010/_ajax/join_email_check.php';
		//var je=document.getElementById('cart_u_email').value;
		var params = 'join_email='+email;
		new Ajax.Request(url,
		  {
			method:'get', 
			parameters: params, 
			onSuccess: function(transport){
			  var response = transport.responseText || "";
			  var responses=response.split('|');
			  document.getElementById('join_email_ok').value=responses[1];
			  document.getElementById('email_check_answer').innerHTML=responses[0];
			},
			onFailure: domError
		  });
	}
}

function join_submit_check() {
    var email=document.getElementById('join_email');
	if(email.value==""){
       	email.focus();
        alert ("Introdu adresa ta de email!");
    return false;}

    if(email.value!=""){
        if(email.value.length < 6){
            email.focus();
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(email.value.length > 49){
            email.focus();
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email.value))){
            email.focus();
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(document.getElementById('join_email_ok').value!="1"){
            email.focus();
            alert ("Emailul introdus este deja in uz!");
        return false;}
    }

	var pass=document.getElementById('join_pass');
	if (pass.value=='') {
		alert('Introdu parola dorita');
		pass.focus();
		return false;
	}
	
	var pass2=document.getElementById('join_pass2');
	if (pass2.value=='') {
		alert('Introdu confirmarea parolei');
		pass2.focus();
		return false;
	} else {
		if (pass.value!=pass2.value) {
			alert('Parola nu este corect confirmata');
			pass2.focus();
			return false;
		}
	}
}


function livrare_pf() {
	document.getElementById('check_tip_pf').src="/images_2010/check_fancy_on.gif";
	document.getElementById('check_tip_pj').src="/images_2010/check_fancy_off.gif";
	document.getElementById('cart_tip').value=1;
	document.getElementById('led1').style.display='none';
	var url = '/includes_2010/_ajax/livrare_pf.php';
	var params='';
	//alert(url);
	var ajax = new Ajax.Updater(
	{success: 'date_fact'},
	url,
	{method: 'get', parameters: params, onFailure: domError});
}

function livrare_pj() {
	document.getElementById('check_tip_pf').src="/images_2010/check_fancy_off.gif";
	document.getElementById('check_tip_pj').src="/images_2010/check_fancy_on.gif";
	document.getElementById('row_preia_date_firma').style.display='';
	document.getElementById('cart_tip').value=2;
	document.getElementById('led1').style.display='none';
	var url = '/includes_2010/_ajax/livrare_pj.php';
	var params='';
	//alert(url);
	var ajax = new Ajax.Updater(
	{success: 'date_fact'},
	url,
	{method: 'get', parameters: params, onFailure: domError});
}
/*
	function menu1_click() {
		document.getElementById('m1').className='selected'; 
		document.getElementById('m2').className=''; 
		document.getElementById('m3').className=''; 
		document.getElementById('detalii').style.display = 'block'; 
		document.getElementById('opinii').style.display = 'none';  
		document.getElementById('accesorii').style.display = 'none';
		//window.location = '#detalii';
	}

	function menu2_click() {
		document.getElementById('m2').className='selected'; 
		document.getElementById('m1').className=''; 
		document.getElementById('m3').className=''; 
		document.getElementById('detalii').style.display = 'none'; 
		document.getElementById('opinii').style.display = 'none';  
		document.getElementById('accesorii').style.display = 'block';
		//window.location = '#accesorii';
	}

	function menu3_click() {
		document.getElementById('m3').className='selected'; 
		document.getElementById('m1').className=''; 
		document.getElementById('m2').className=''; 
		document.getElementById('detalii').style.display = 'none'; 
		document.getElementById('opinii').style.display = 'block';  
		document.getElementById('accesorii').style.display = 'none';
		//window.location = '#opinii';
	}
	*/

function cleanAjaxParam(str) {
	var s = str;
	s = escape(s);
	return s;
}

function emd_search_price(ses, ref) {
	// products
	if ( document.getElementById('ppmin') && document.getElementById('ppmax') ) {
		var ppmin = document.getElementById('ppmin').value;
		var ppmax = document.getElementById('ppmax').value;
		document.location = ses+'?k=ppmin|ppmax&v='+cleanAjaxParam(ppmin)+'|'+cleanAjaxParam(ppmax)+'&ref='+ref;
	}
	
	// search
	if ( document.getElementById('pmin') && document.getElementById('pmax') ) {
		var pmin = document.getElementById('pmin').value;
		var pmax = document.getElementById('pmax').value;
		document.location = ses+'?k=pmin|pmax&v='+cleanAjaxParam(pmin)+'|'+cleanAjaxParam(pmax)+'&ref='+ref;
	}
}

/*
btn = 0 -> "filtreaza rezultatele"
btn = 1 -> "reseteaza filtrele"
*/
function emd_filters_ajx(btn) {
	id_c = 'suplimentar';
	if (document.getElementById(id_c)) {
		// category
		var el = $$('.flt_cat');
		var cat = '';
		for (var i=0; i<el.length; i++) {
			if ( el[i].checked ) {
				if ( cat!='' ) {
					cat += '|';
				}
				cat += el[i].value;
			}
		}
		// brand
		var el = $$('.flt_brnd');
		var brnd = '';
		for (var i=0; i<el.length; i++) {
			if ( el[i].checked ) {
				if ( brnd!='' ) {
					brnd += '|';
				}
				brnd += el[i].value;
			}
		}
		
		document.getElementById(id_c).innerHTML = '<img src="/images_2010/loader-circle.gif" alt="loader" border="0" />';
		
		var url = '/js_2010/2011-ajax-search-filt.php';
		var params = '?cat='+cleanAjaxParam(cat)+'&brnd='+cleanAjaxParam(brnd)+'&btn='+cleanAjaxParam(btn);
		new Ajax.Request(url, {
			method:'get',
			parameters: params,
			onSuccess: function(transport) {
				var response = transport.responseText || "";
				//alert(response);
				document.getElementById(id_c).innerHTML = response;
				emd_stylePage();
			},
			onFailure: domError
		});
	}
}

function emd_filters_disp(URL) {
	// category
	var el = $$('.flt_cat');
	var cat = '';
	for (var i=0; i<el.length; i++) {
		if ( el[i].checked ) {
			if ( cat!='' ) {
				cat += '|';
			}
			cat += el[i].value;
		}
	}
	// brand
	var el = $$('.flt_brnd');
	var brnd = '';
	for (var i=0; i<el.length; i++) {
		if ( el[i].checked ) {
			if ( brnd!='' ) {
				brnd += '|';
			}
			brnd += el[i].value;
		}
	}
	
	var url_c = URL;
	if ( cat!='' ) {
		url_c += '&cat='+cat;
	}
	if ( brnd!='' ) {
		url_c += '&brnd='+brnd;
	}
	document.location = url_c;
}

function emd_get_filters_url(URL) {
	// brands
	var el = $$('.flt_prod');
	var param = '';
	for (var i=0; i<el.length; i++) {
		if ( el[i].checked ) {
			if ( param!='' ) {
				param += '_';
			}
			param += el[i].value;
		}
	}
	
	// specifications
	el = $$('.flt_spec');
	for (var i=0; i<el.length; i++) {
		if ( el[i].checked ) {
			if ( param!='' ) {
				param += '_';
			}
			param += el[i].value;
		}
	}
	
	if ( param!='' ) {
		param = '/filtre/'+param+'.html';
	}
	document.location = URL+param;
}

