function isEmail(formName,champ){
with(eval('document.' + formName)){str=eval(champ+'.value');}
if (str.length < 3){return -1;}
if (str.indexOf ('@',0)==-1 || str.indexOf ('.',0)==-1){return -2;}
var oneChar=' ';
for (var i=0; i<str.length; i++){oneChar= str.substring(i,i+1);if (oneChar==' '){return -2;}}
return true;}

function Callme(a,b,c) {
		var largeur=300;
		var hauteur=350;
		var options="location=no,menubar=no,scrollbars=no,statusbar=no,resizable=1";
		var top=(screen.height-hauteur)/2;
		var left=(screen.width-largeur)/2;
		var urlOpen = "http://3620.arcane-networks.com/3620statsV2/dispo_callback.php?";
		var tmpurlFrom = window.location.href;
		var a = Callme.arguments[0];
		var b = Callme.arguments[1];
		var c = Callme.arguments[2];
		if(typeof(Callme.arguments[3]) == 'undefined') {
			var largeur=300;
			var hauteur=350; }
		else {
			var largeur=Callme.arguments[3];
			var hauteur = Callme.arguments[4];
		}
return true;
		window.open(urlOpen+"id_client="+a+"&id_bouton="+b+"&id_position="+c+"&urlFrom="+tmpurlFrom,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
		//window.open(urlOpen+tmpurlFrom+"&id_client="+a+"&id_bouton="+b+"&id_position="+c,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
		//alert(urlOpen+urlFrom+"&id_client="+a+"&id_bouton="+b);
}

function _cb() {
	var Taille = window.document.cb3620.telephone.value;
	if (isNaN(Taille)) { alert("Le Numéro doit être entièrement numérique."); return false; }
	Taille = Taille.length; if (Taille<10) { alert("Merci d’indiquer un numéro de téléphone à 10 chiffres"); return; }
	else {
		var urlOpen = "http://3620.arcane-networks.com/3620statsV2/adsense_callback.php";
		var a = window.document.cb3620.id_client.value;
		var b = window.document.cb3620.id_bouton.value;
		var c = window.document.cb3620.id_position.value;
		var d = window.document.cb3620.telephone.value ;
		var e = window.document.cb3620.info_form.value;
		var f = window.document.cb3620.urlFrom.value;
		
		var tagCW = new Image();
		tagCW.src='/dyn/Callback.asp?tel='+escape(d)+'&autres='+escape(document.cb3620.nom.value)+'|'+escape(document.cb3620.societe.value)+'|'+escape(document.cb3620.email.value)+'|'+escape(document.cb3620.ct_pays.value)+'|'+escape(document.cb3620.ct_cp.value)+'|'+escape(document.cb3620.rev_id.value);
		
		//alert(tagCW.src);
		var cmd		= "window.location.href='"+ urlOpen +"?id_client="+ a +"&id_bouton="+ b +"&id_position="+ c +"&id_numero="+ d +"&urlFrom="+ f +"'";
		setTimeout(cmd,1000);
						
//		setTimeout(window.location.href = urlOpen+"?id_client="+a+"&id_bouton="+b+"&id_position="+c+"&id_numero="+d+"&urlFrom="+f
//		window.location.href = urlOpen+"?id_client="+a+"&id_bouton="+b+"&id_position="+c+"&id_numero="+d+"&urlFrom="+f+"&info_form="+e ;
	}
}	

function sf() {
	document.cb3620.telephone.focus();
}

function collecte_form() {
	// convert all characters to lowercase to simplify testing
	var agt=navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var test = is_ie ? document.getElementById("Info_Form").value : document.getTargetElement("Info_Form").value ;
	alert(test);
}

function _cbrecette() {
	var Taille = window.document.cb3620.telephone.value;
	if (isNaN(Taille)) {
		alert("Le Numéro doit être entièrement numérique.");
	return false;
	}
	Taille = Taille.length;
	if (Taille < 10) {
		alert("Merci d’indiquer un numéro de téléphone à 10 chiffres");
		return ;
	} else {
		var urlOpen = "http://3620.arcane-networks.com/3620statsV2/adsense_callback_re.php";
		var a = window.document.cb3620.id_client.value;
		var b = window.document.cb3620.id_bouton.value;
		var c = window.document.cb3620.id_position.value;
		var d = window.document.cb3620.telephone.value ;
		var e = window.document.cb3620.info_form.value;
		var f = window.document.cb3620.urlFrom.value;
		alert(urlOpen+"?id_client="+a+"&id_bouton="+b+"&id_position="+c+"&id_numero="+d+"&urlFrom="+f+"&info_form="+e);
		window.location.href = urlOpen+"?id_client="+a+"&id_bouton="+b+"&id_position="+c+"&id_numero="+d+"&urlFrom="+f ;
	}
}	

function check() {
	var x=0;
	if (document.cb3620.nom.value.length==0) {alert("Vous devez saisir votre nom");document.cb3620.nom.focus();return false;}
	
	if (isNaN(document.cb3620.telephone.value) || document.cb3620.telephone.value.length < 10 ){alert("Numéro de téléphone erroné");document.cb3620.telephone.focus();return false;}
	if (document.cb3620.societe.value.length==0) {alert("Vous devez saisir votre societe");document.cb3620.societe.focus();return false;}
	if (document.cb3620.email.value.length==0) {alert("Vous devez saisir votre email");document.cb3620.email.focus();return false;}
	x = isEmail('cb3620','email');
	if(x<0){alert("Email erroné");document.cb3620.email.focus();return false;}
	
	TmpMom = document.getElementById('nom').value ;
	TmpSte = document.getElementById('societe').value ;
	TmpSte = TmpSte.toUpperCase();
	TmpEmail = document.getElementById('email').value ;
	document.getElementById('info_form').value = TmpMom+"|"+TmpSte+"|"+TmpEmail ;
	_cb();
}

function check_recette() {
var taille = document.cb3620.nom.value.length;
if (taille === 0) {
	alert("Vous devez saisir votre nom");
	return false;
	}
	if (isNaN(document.cb3620.telephone.value))
	{	alert("Numéro de téléphone erroné");
	return false;
	}else if (document.cb3620.telephone.value.length < 10)
	{	alert("Numéro de téléphone erroné");
	return false;
	}
	TmpMom = document.getElementById('nom').value ;
	TmpSte = document.getElementById('societe').value ;
	TmpSte = TmpSte.toUpperCase();
	TmpEmail = document.getElementById('email').value ;
	document.getElementById('info_form').value = TmpMom+"|"+TmpSte+"|"+TmpEmail ;
	alert(TmpMom+"|"+TmpSte+"|"+TmpEmail);
	_cbrecette();
}
