// fonction immo-chr

function valide_alerte()
{
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (document.alerte.email.value.search( maReg ) == -1)
	{
		alert ( "L'Email n'est pas valide " ) ;
		return false;
	}
	document.alerte.submit();
}

function verif_franchise()
{	
	document.infos.nom.style.backgroundColor = "#FFFFFF";
	document.infos.nom.style.color = "#000000";
	document.infos.email.style.backgroundColor = "#FFFFFF";
	document.infos.email.style.color = "#000000";
	document.infos.tel.style.backgroundColor = "#FFFFFF";
	document.infos.tel.style.color = "#000000";
	document.infos.projet.style.backgroundColor = "#FFFFFF";
	document.infos.projet.style.color = "#000000";
	document.infos.apport.style.backgroundColor = "#FFFFFF";
	document.infos.apport.style.color = "#000000";
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (document.infos.nom.value=="")
	{
		document.infos.nom.style.backgroundColor = "#FF0000";
		document.infos.nom.style.color = "#ffffff";
		alert ( "Le champ Nom est obligatoire" ) ;
		return false;
	}
	if (document.infos.email.value=="")
	{
		document.infos.email.style.backgroundColor = "#FF0000";
		document.infos.email.style.color = "#ffffff";
		alert ( "L'email est obligatoire" ) ;
		return false;
	}
	if (document.infos.email.value.search( maReg ) == -1)
	{
		document.infos.email.style.backgroundColor = "#FF0000";
		document.infos.email.style.color = "#ffffff";
		alert ( "L'email n'est pas valide" ) ;
		return false;
	}
	if (document.infos.tel.value=="")
	{
		document.infos.tel.style.backgroundColor = "#FF0000";
		document.infos.tel.style.color = "#ffffff";
		alert ( "Le téléphone est obligatoire" ) ;
		return false;
	}
	if (document.infos.projet.value=="")
	{
		document.infos.projet.style.backgroundColor = "#FF0000";
		document.infos.projet.style.color = "#ffffff";
		alert ( "Projet, objectifs, motivations sont obligatoire" ) ;
		return false;
	}
	if (document.infos.apport.value=="")
	{
		document.infos.apport.style.backgroundColor = "#FF0000";
		document.infos.apport.style.color = "#ffffff";
		alert ( "L'apport est obligatoire" ) ;
		return false;
	}
	document.infos.submit();
}


function search_annonce() 
{ 
		var poste=document.rech_annonce.poste.value; 
		var dep=document.rech_annonce.dep.value; 
		window.location.replace("recherche-annonce-"+poste+"-"+dep+"-1.html"); 
} 


//BETA
/*function search_annonce_beta2() 
{ 
		var src =new Array(" ","â","à","é", "è", "ê","ë","î","ï","ô","/","\\*");
	    var dst = new Array("-","a","a","e", "e", "e","e","i","i","o","","");
		var poste=document.rech_annonce.poste.value; 
		var dep=document.rech_annonce.dep.value; 
		var depText=document.rech_annonce.dep[document.rech_annonce.dep.selectedIndex].text;
		var posteText=document.rech_annonce.poste[document.rech_annonce.poste.selectedIndex].text;
		if(poste==0) posteText="commerces";
		if(dep==0) depText="france";
		var linkIn = "vente-"+posteText+"-"+depText+"-"+poste+"-"+dep+"-0-1.html";
		var linkOut ="http://www.immo-chr.com/"+ escape(str_replace(src,dst,linkIn.toLowerCase() ));
		window.location.replace(linkOut); 
}*/

function search_annonce_beta() 
{ 
		var src =new Array(" ","â","à","é", "è", "ê","ë","î","ï","ô","/","\\*");
	    var dst = new Array("-","a","a","e", "e", "e","e","i","i","o","","");
		var poste=document.rech_annonce.poste.value; 
		var dep=document.rech_annonce.dep.value; 
		var surface=document.rech_annonce.surface.value; 
		var nature=document.rech_annonce.nature.value; 
		var prix=document.rech_annonce.prix.value; 
		var depText=document.rech_annonce.dep[document.rech_annonce.dep.selectedIndex].text;
		var posteText=document.rech_annonce.poste[document.rech_annonce.poste.selectedIndex].text;
		if(poste==0) posteText="commerces";
		if(dep==0) depText="france";
		//if(surface==0) surface="";
		//if(nature==0) nature="";
		//if(prix==0) prix="";
		var linkIn = "vente-"+posteText+"-"+depText+"-"+poste+"-"+dep+"-0-1.html";
		var linkOut ="http://www.immo-chr.com/"+ escape(str_replace(src,dst,linkIn.toLowerCase() ));
		linkOut=linkOut+"?surface="+surface+"&nature="+nature+"&prix="+prix;
		window.location.replace(linkOut); 
}

function search_annonce_beta_bis() 
{ 
		var src =new Array(" ","â","à","é", "è", "ê","ë","î","ï","ô","/","\\*");
	    var dst = new Array("-","a","a","e", "e", "e","e","i","i","o","","");
		var poste=document.rech_annonce_gauche.poste.value; 
		var dep=document.rech_annonce_gauche.dep.value; 
		var depText=document.rech_annonce_gauche.dep[document.rech_annonce_gauche.dep.selectedIndex].text;
		var posteText=document.rech_annonce_gauche.poste[document.rech_annonce_gauche.poste.selectedIndex].text;
		if(poste==0) posteText="commerces";
		if(dep==0) depText="france";
		var linkIn = "vente-"+posteText+"-"+depText+"-"+poste+"-"+dep+"-0-1.html";
		var linkOut ="http://www.immo-chr.com/"+ escape(str_replace(src,dst,linkIn.toLowerCase() ));
		window.location.replace(linkOut); 
}

function str_replace(search, replace, subject) {
    var s = subject;
	for(var i=0;i<search.length;i++)
	{
		var reg=new RegExp(search[i], "g");
		s=s.replace(reg,replace[i]);
	}
	return s;
}

function search_dem() 
{ 
		var poste=document.rech_dem.poste.value; 
		var dep=document.rech_dem.dep.value; 
		window.location.replace("recherche-acquereur-"+poste+"-"+dep+"-1.html"); 
} 

function search_dem_bis() 
{ 
		var poste=document.rech_dem2.poste.value; 
		var dep=document.rech_dem2.dep.value; 
		window.location.replace("recherche-acquereur-"+poste+"-"+dep+"-1.html"); 
} 

function efface(form,name,second,texte,texte_second)
{
eval ( that = window.document [form] [name]);
if (that.value == texte )
{
that.value = '';
	eval( that = window.document [form] [second]);
		if (that.value == texte_second ) {
			that.value='';
		}
}}

function alterner()
{
	var num = Math.floor(Math.random()*3);
	var nom_banniere;
	num=4;
	switch(num)
	{
		case 0 : 
			document.nom_banniere = "images/pub-immo468-68.swf"; 
			document.nom_banniere=
				'<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 height="60" width="467" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>'+
				"<param name=movie value="+document.nom_banniere+">"+
              	'<param name=quality value=high>'+
              	'<embed src="'+document.nom_banniere+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="60" width="467"></embed>'+
				'</OBJECT>';
				break;
		case 1 : document.nom_banniere = "images/pub-jobhrt168-68.swf"; 
				document.nom_banniere= '<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 height="60" width="467" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>\r\n'+
				"<param name=movie value="+document.nom_banniere+">\r\n"+
              	'<param name=quality value=high>\r\n'+
              	'<embed src="'+document.nom_banniere+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="60" width="467"></embed>\r\n'+
				'</OBJECT>';
				break;
		case 2:
				document.nom_banniere='<A href="http://perso.wanadoo.fr/RH-hotellerie/franchise/les_moulins_bleus_accueil.html" target=_blank><IMG height=58 src="http://www.job-hrt.com/portail/images/banners/franchise1.gif" width=468 border=0></A>';
				break;
		case 4:
			var uri = 'http://impfr.tradedoubler.com/imp/pool/iframe/125142/1212594?' + new String (Math.random()).substring (2, 11);
			document.nom_banniere='<iframe src="'+uri +'" width="468" height="60" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
	}
	
}

function alterner2()
{
	var num = Math.floor(Math.random()*2);
	var nom_bann;

	switch(num)
	{
		case 0:
				document.nom_bann='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="120" height="240">\r\n'+
                    '<param name="movie" value="http://pix.netimpact.fr/ban.swf" />\r\n'+
                    '<param name="quality" value="high" />\r\n'+
                    '<embed src="http://pix.netimpact.fr/ban.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="120" height="240"></embed>\r\n'+
                 '</object>';
				break;
		case 1:
				document.nom_bann='<A href="http://www.immo-chr.com/Recherche-franchises/Pasta-select/franchise-restauration-rapide-pates-pasta-select-bis.html" target=_blank><IMG  src="http://pix.netimpact.fr/banniere-pasta-select.JPG" width=124 border=0></A>';
				break;
	}
	
}

function gen120x240()
{
   var m3_u = (location.protocol=='https:'?'https://ks367716.kimsufi.com/~ad/www/delivery/ajs.php':'http://ks367716.kimsufi.com/~ad/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=4");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}

function gen120x600()
{
   var m3_u = (location.protocol=='https:'?'https://ks367716.kimsufi.com/~ad/www/delivery/ajs.php':'http://ks367716.kimsufi.com/~ad/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=5");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}

function gen468x60_header()
{
   var m3_u = (location.protocol=='https:'?'https://ks367716.kimsufi.com/~ad/www/delivery/ajs.php':'http://ks367716.kimsufi.com/~ad/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=6");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function verif_form_agence(form_agence)
{	
	form_agence=document.getElementById(form_agence)
	form_agence.f_nom.style.backgroundColor = "#FFFFFF";
	form_agence.f_nom.style.color = "#000000";
	form_agence.f_tel.style.backgroundColor = "#FFFFFF";
	form_agence.f_tel.style.color = "#000000";
	form_agence.f_email.style.backgroundColor = "#FFFFFF";
	form_agence.f_email.style.color = "#000000";
	form_agence.f_objet.style.backgroundColor = "#FFFFFF";
	form_agence.f_objet.style.color = "#000000";
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (form_agence.f_nom.value=="")
	{
		form_agence.f_nom.style.backgroundColor = "#FF0000";
		form_agence.f_nom.style.color = "#ffffff";
		alert ( "Le Nom est obligatoire" ) ;
		return false;
	}
	if (form_agence.f_tel.value=="")
	{
		form_agence.f_tel.style.backgroundColor = "#FF0000";
		form_agence.f_tel.style.color = "#ffffff";
		alert ( "Le numéro de téléphone est obligatoire" ) ;
		return false;
	}
	if (form_agence.f_email.value=="")
	{
		form_agence.f_email.style.backgroundColor = "#FF0000";
		form_agence.f_email.style.color = "#ffffff";
		alert ( "L'Email est obligatoire" ) ;
		return false;
	}
	if (form_agence.f_email.value.search( maReg ) == -1)
	{
		form_agence.f_email.style.backgroundColor = "#FF0000";
		form_agence.f_email.style.color = "#ffffff";
		alert ( "L'Email n'est pas valide " ) ;
		return false;
	}
	if (form_agence.f_objet.value=="")
	{
		form_agence.f_objet.style.backgroundColor = "#FF0000";
		form_agence.f_objet.style.color = "#ffffff";
		alert ( "Vous devez renseigner un minimum l'objet de la demande" ) ;
		return false;
	}
	form_agence.submit();
}

function verif_form_demande(form_demande)
{	
	form_demande=document.getElementById(form_demande)
	form_demande.f_nom.style.backgroundColor = "#FFFFFF";
	form_demande.f_nom.style.color = "#000000";
	form_demande.f_tel.style.backgroundColor = "#FFFFFF";
	form_demande.f_tel.style.color = "#000000";
	form_demande.f_email.style.backgroundColor = "#FFFFFF";
	form_demande.f_email.style.color = "#000000";
	form_demande.f_objet.style.backgroundColor = "#FFFFFF";
	form_demande.f_objet.style.color = "#000000";
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (form_demande.f_nom.value=="")
	{
		form_demande.f_nom.style.backgroundColor = "#FF0000";
		form_demande.f_nom.style.color = "#ffffff";
		alert ( "Le Nom est obligatoire" ) ;
		return false;
	}
	if (form_demande.f_tel.value=="")
	{
		form_demande.f_tel.style.backgroundColor = "#FF0000";
		form_demande.f_tel.style.color = "#ffffff";
		alert ( "Le numéro de téléphone est obligatoire" ) ;
		return false;
	}
	if (form_demande.f_email.value=="")
	{
		form_demande.f_email.style.backgroundColor = "#FF0000";
		form_demande.f_email.style.color = "#ffffff";
		alert ( "L'Email est obligatoire" ) ;
		return false;
	}
	if (form_demande.f_email.value.search( maReg ) == -1)
	{
		form_demande.f_email.style.backgroundColor = "#FF0000";
		form_demande.f_email.style.color = "#ffffff";
		alert ( "L'Email n'est pas valide " ) ;
		return false;
	}
	if (form_demande.f_objet.value=="")
	{
		form_demande.f_objet.style.backgroundColor = "#FF0000";
		form_demande.f_objet.style.color = "#ffffff";
		alert ( "Vous devez renseigner un minimum l'objet de la demande" ) ;
		return false;
	}
	form_demande.submit();
}

function verif_form_contact()
{	
	document.form_contact.entreprise.style.backgroundColor = "#FFFFFF";
	document.form_contact.entreprise.style.color = "#000000";
	document.form_contact.email.style.backgroundColor = "#FFFFFF";
	document.form_contact.email.style.color = "#000000";
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (document.form_contact.entreprise.value=="")
	{
		document.form_contact.entreprise.style.backgroundColor = "#FF0000";
		document.form_contact.entreprise.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "L'entreprise est obligatoire" ) ;
		return false;
	}
	if (document.form_contact.email.value=="")
	{
		document.form_contact.email.style.backgroundColor = "#FF0000";
		document.form_contact.email.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "L'Email est obligatoire" ) ;
		return false;
	}
	if (document.form_contact.email.value.search( maReg ) == -1)
	{
		document.form_contact.email.style.backgroundColor = "#FF0000";
		document.form_contact.email.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "L'Email n'est pas valide " ) ;
		return false;
	}
	document.form_contact.submit();
}

function verif_form_fra()
{	
	document.infos_fra.nom.style.backgroundColor = "#FFFFFF";
	document.infos_fra.nom.style.color = "#000000";
	document.infos_fra.email.style.backgroundColor = "#FFFFFF";
	document.infos_fra.email.style.color = "#000000";
	document.infos_fra.tel.style.backgroundColor = "#FFFFFF";
	document.infos_fra.tel.style.color = "#000000";
	document.infos_fra.societe.style.backgroundColor = "#FFFFFF";
	document.infos_fra.societe.style.color = "#000000";
	var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" );
	if (document.infos_fra.nom.value=="")
	{
		document.infos_fra.nom.style.backgroundColor = "#FF0000";
		document.infos_fra.nom.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "Le Nom est obligatoire" ) ;
		return false;
	}
	if (document.infos_fra.tel.value=="")
	{
		document.infos_fra.tel.style.backgroundColor = "#FF0000";
		document.infos_fra.tel.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "Le numéro de téléphone est obligatoire" ) ;
		return false;
	}
	if (document.infos_fra.email.value=="")
	{
		document.infos_fra.email.style.backgroundColor = "#FF0000";
		document.infos_fra.email.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "L'Email est obligatoire" ) ;
		return false;
	}
	if (document.infos_fra.email.value.search( maReg ) == -1)
	{
		document.infos_fra.email.style.backgroundColor = "#FF0000";
		document.infos_fra.email.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "L'Email n'est pas valide " ) ;
		return false;
	}
	if (document.infos_fra.societe.value=="")
	{
		document.infos_fra.societe.style.backgroundColor = "#FF0000";
		document.infos_fra.societe.style.color = "#ffffff";
		window.scrollTo(0,0);
		alert ( "Le Nom de votre enseigne est obligatoire" ) ;
		return false;
	}
	document.infos_fra.submit();
}