
var defaultfocuscp=" ";
var defaultfocusinput = "                  ";
var opennodes = new Array();


function getParentWithClass(el,pTagName) {
	if (el == null) return null;
	else if (el.nodeType == 1 && el.className == pTagName)
		return el;
	else
		return getParentWithClass(el.parentNode, pTagName);
}

/*if(typeof HTMLElement!="undefined"){
		HTMLElement.prototype.__defineGetter__("innerText", function () {
		   var r = this.ownerDocument.createRange();
		   r.selectNodeContents(this);
		   return r.toString();
		});
		
}*/

function BuildSummary(obj) {
	var txt = '';
	var o = document.getElementById(obj);
	var swp_pxmin = document.getElementById("pxmin");
	var swp_pxmax = document.getElementById("pxmax");
	var otypebien2Choix = document.getElementById("typebien2");
	if (o) {
		
		var allInput = o.getElementsByTagName("input");
		for (var i=0; i<allInput.length;i++) {
			if (allInput[i].checked) {
				if (allInput[i].name=="typetransac") {
						var otypebienchoix = document.getElementById("typebien");
						var otypecommercechoix=document.getElementById("typecommerce");
					if (otypebienchoix && otypecommercechoix) {
					if (allInput[i].value==10) {
						swapvisible(otypebienchoix,"no");
						swapvisible(otypecommercechoix,"yes");		
					}
					else {
						if(otypebien2Choix.style.display != 'inline'){
					swapvisible(otypebienchoix,"yes");}
						swapvisible(otypecommercechoix,"no");
					}
				 }
				}
				/* txt = txt.concat(getParent(allInput[i],"LABEL").innerText+', '); */
				txt = txt.concat(allInput[i].title+', ');
			}
		}
	}
	
	o = o.getAttribute("id")
	if (o) {
	o=document.getElementById(o+"Text");
	//if (txt.length>0) {
	
		if (o!=null) {
			txt=String(txt).substring(0,txt.length-2);
			o.value = txt;
		}
		
	}
	//}
}

function BuildSummary2(obj) {
	var txt = '';
	var t,t2;
	var o = document.getElementById(obj);
	var swp_pxmin = document.getElementById("pxmin");
	var swp_pxmax = document.getElementById("pxmax");
	var otypebien2Choix = document.getElementById("typebien2");
	if (o) {
		
		var allInput = o.getElementsByTagName("input");
		for (var i=0; i<allInput.length;i++) {
			if (allInput[i].checked) {
 				if (allInput[i].name=="typetransac") {
						var otypebienchoix = document.getElementById("typebien");
						var otypecommercechoix=document.getElementById("typecommerce");
					if (otypebienchoix && otypecommercechoix) {
					if (allInput[i].value==10) {
						swapvisible(otypebienchoix,"no");
						swapvisible(otypecommercechoix,"yes");		
					}
					else {
						if(otypebien2Choix.style.display != 'inline'){
						swapvisible(otypebienchoix,"yes");}
						swapvisible(otypecommercechoix,"no");
					}
				 }
				} 
				alert("value :"+allInput[i].title + "_" + getParent(allInput[i],"LABEL").innerText);
				txt = txt.concat(allInput[i].title+', ');
			}
		}
	}
	
	t = o.getAttribute("id")
	if (t) {

	t2=document.getElementById(t+"Text");
	//if (txt.length>0) {
	
		if (t2!=null) {
	
			txt=String(txt).substring(0,txt.length-2);
		
			t2.value = txt;
		}
		
	}
	//}
}

function ClearOpenNodes() {
	
	for (var i=0; i<opennodes.length;i++) {
		var o =opennodes[i];
		if(o)
			o.className=o.className.replace(" over", "");
	}
	opennodes=new Array();
}

 function initDropdown() {
		var navRoot = document.getElementById("miniSearch");
		var allInput = navRoot.getElementsByTagName("input");
		var node, o, temp;
			for (var i=0; i<allInput.length;i++) {
				node = allInput[i];
				if (((node.getAttribute("type")=="checkbox") || (node.getAttribute("type")=="radio")) && node.name!="idsituation") {
					node.onchange=function() {
						setTimeout('BuildSummary("'+getParentWithClass(this,"searchchoix").id+'")',30);
					}
					node.onclick=function() {
						setTimeout('BuildSummary("'+getParentWithClass(this,"searchchoix").id+'")',30);
					}

				}
			}
			var subnodes = navRoot.getElementsByTagName("DIV");
			//for (var i=0; i<navRoot.childNodes.length; i++) {
			for (var i=0; i<subnodes.length; i++) {
				//node = navRoot.childNodes[i];
				node = subnodes[i];
				if (node.nodeName=="DIV" && node.className=="searchchoix") {
						setTimeout('BuildSummary("'+node.id+'")',10);
						node.onmouseover=function() {
								o = document.getElementById(this.getAttribute("id")+"Liste");
								if (o) o.className+=" over";
								ClearOpenNodes();
								opennodes.push(o);
				  	}
	  				node.onmouseout=function() {
	  					o = document.getElementById(this.getAttribute("id")+"Liste");
						  setTimeout('ClearOpenNodes()',50000);
						  //if (o) o.className=o.className.replace(" over", "");
	   				}
   			}
   			else if (node.nodeName=="DIV" && node.className=="dropdown") {
   				node.onmouseout=function() {ClearOpenNodes();}
   			}
  }
}



function miniSearchIntl() {
	//var oidtt = document.getElementById("ididtt").value;
	var oidtt = '';
	var url='';
	switch (oidtt) {
		case '1':
			url='location';
			break;
		case '4':
			url='vacances';
			break;
		default:
			url='achat';
			break;
	}
	id3_go('/intl/'+url+'-etranger-nofr.htm');
	return false;
}
function miniSearchSubmit(x) {
	var o;
  var annform = document.forms['miniSearchForm'];
	var oidtt = document.getElementById('ididtt');
	if (oidtt.value=="4")
		activeForm("typebien");
	else
		activeForm("typebien2");
	/*var otypetransac = document.getElementById('typetransac');
	annform = document.forms['miniSearchForm'];
	allInput = annform.getElementsByTagName("input");
	for (var i=0; i<allInput.length;i++)
			if (
			( allInput[i].name=="nb_pieces_2" || allInput[i].name=="typetransac")
			
			&& allInput[i].checked) allInput[i].checked=false;
  */
	
	if (x) {
		if(oidtt.value == "com"){
			//annform.pagenext.value = 'commercesannonces.htm';
			annform.action = 'commercesannonces.htm';
			oidtt.value = returnChecked();
			if (oidtt.value=='' || oidtt.value==undefined) oidtt.value=1;
		}	else{
			annform.action='annonces.htm';
			//annform.pagenext.value = annform.urlonerror.value;
		}
	}
	else {
		if(oidtt.value == "com"){
			annform.pagenext.value = 'commerces,recherche.htm';
			annform.urlonerror.value = 'commercesannonces.htm';
			oidtt.value = returnChecked();
			}	else
			{
			annform.pagenext.value='';
			annform.urlonerror.value = '';
		}
	}
	/* activeForm("typetransacChoix"); */
	activeForm("nb_piecesListe");
	activeForm("nb_chambresListe");

	o = document.getElementById("cpsaisie");
  if (o.value==defaultfocuscp) o.value="";
	o=document.getElementById("pxmin");
  if (o.value==defaultfocusinput) o.value="";
  o=document.getElementById("pxmax");
  if (o.value==defaultfocusinput) o.value="";
  o=document.getElementById("surfacemin");
  if (o.value==defaultfocusinput) {o.value=""};
  o=document.getElementById("surfacemax");
  if (o.value==defaultfocusinput) o.value="";
	annform.nb_chambres.value=annform.nb_chambres.value.replace('5 et +','+4');
	annform.nb_pieces.value=annform.nb_pieces.value.replace('5 et +','+4');
	annform.submit();
}


function swapvisible(obj,swp) {
	if (obj) {
	if ( swp == 'no' ) {
		obj.style.visibility='hidden';
		obj.style.display = 'none';
	}else {
		obj.style.visibility='visible';
		obj.style.display = 'inline';
	}
}
}

function returnChecked(){
		var otypetransac = document.getElementById('typetransacListe');
		var yes = 0;
		var allInput = otypetransac.getElementsByTagName("input");
		for (var i=0; i<allInput.length;i++) {
			if (allInput[i].checked) {
				if (allInput[i].name=="typetransac") {
						yes = 1;
				}
			}
		}		
		
		if(yes == 1) {
			return allInput[i].value;
		}else {
			return null;}
}			

function activeForm(xname){

		var o = document.getElementById(xname);
		if (o) {
		var allInput = o.getElementsByTagName("input");
		for (var i=0; i<allInput.length;i++) {
						allInput[i].checked = false;				
			}
		 //BuildSummary(xname.replace('Liste','Choix'));
		}
		//else {
			//alert(xname);
		//}		
	}	



function engine (id) {
	var o = document.getElementById(id);
	var oidtt = document.getElementById('ididtt');
	var cornerd = document.getElementById("cornerd_"+id);
	var cornerg = document.getElementById("cornerg_"+id);
	var tab = Array ("ogl_achat","ogl_location","ogl_bureaucomm","ogl_locvac");
	/* var swp_typetransac = document.getElementById("typetransac"); */
	var swp_nb_pieces = document.getElementById("nb_pieces");
	var swp_nb_chambres = document.getElementById("nb_chambres");
	var lineone = document.getElementById("lineone");
	var linetrd = document.getElementById("linetrd");
	var linetwo = document.getElementById("linetwo");
	var swp_idsituationgrp = document.getElementById("lineonehalf");
	var swp_typebien2Choix = document.getElementById("typebien2");
	var swp_typebienChoix = document.getElementById("typebien");
	var swp_typecommerceChoix = document.getElementById("typecommerce");
	var swp_bascritere = document.getElementById("bascritere");
	var swp_surface = document.getElementById("surface");
	var swp_prix = document.getElementById("prix");
	var swp_nbpersonne = document.getElementById("nbpersonne");
	var swp_infogeo = document.getElementById("infogeo");
	var swp_minimap = document.getElementById("minimap");
	var swp_esplocvac = document.getElementById("espacelocvac");

	
	var swp_pxmin = document.getElementById("pxmin");
	var swp_pxmax = document.getElementById("pxmax");
	if(o.className != "activelink" ) {
	for(var i=0;i<tab.length;i++){
			document.getElementById(tab[i]).className = "inactivelink";
			document.getElementById("cornerg_"+tab[i]).className = "oglinactivg";
			document.getElementById("cornerd_"+tab[i]).className = "oglinactivd";
		}
		o.className = "activelink";
		cornerg.className = "oglactivg";
		cornerd.className = "oglactivd";	
		if(id == "ogl_achat") {
			oidtt.value = "2"; 
			/* swapvisible(swp_typetransac,'no'); */
			swapvisible(swp_nb_pieces,'yes');
			swapvisible(swp_surface,'yes');
			swapvisible(swp_prix,'yes');
			swapvisible(swp_infogeo,'yes');
			swapvisible(swp_nbpersonne,'no');
			swapvisible(swp_nb_chambres,'yes');
			swapvisible(swp_idsituationgrp,'no');
			swapvisible(swp_typebien2Choix,'no');
			swapvisible(swp_typebienChoix,'yes');
			swapvisible(swp_typecommerceChoix,'no');		
			swapvisible(swp_bascritere,'yes');
			swapvisible(swp_esplocvac,'no');		
			swapvisible(swp_minimap,'no');	
			lineone.className = "wdthline";	
			linetrd.className = "wdthline";	
			linetwo.className = "wdthline";	
			swp_idsituationgrp.className = "wdthline";	
			swp_pxmax.name = "pxmax";	
			swp_pxmin.name = "pxmin";		
		}else{
			if(id == "ogl_location") {
				oidtt.value = "1"; 
				/* swapvisible(swp_typetransac,'no'); */
				swapvisible(swp_nb_pieces,'yes');
				swapvisible(swp_nb_chambres,'yes');
				swapvisible(swp_idsituationgrp,'no');
				swapvisible(swp_typebien2Choix,'no');
				swapvisible(swp_typebienChoix,'yes');
				swapvisible(swp_nbpersonne,'no');
				swapvisible(swp_infogeo,'yes');
				swapvisible(swp_typecommerceChoix,'no');
				swapvisible(swp_surface,'yes');
				swapvisible(swp_prix,'yes');
				swapvisible(swp_minimap,'no');
				lineone.className = "wdthline";	
				linetrd.className = "wdthline";	
				linetwo.className = "wdthline";	
				swp_idsituationgrp.className = "wdthline";	
				swp_pxmax.name = "px_loyermax";	
				swp_pxmin.name = "px_loyermin";		
			swapvisible(swp_bascritere,'yes');
						swapvisible(swp_esplocvac,'no');			

			}else{
				if(id == "ogl_locvac") {
					oidtt.value = "4"; 
					swapvisible(swp_typebien2Choix,'yes');
					swapvisible(swp_typebienChoix,'no');
					swapvisible(swp_typecommerceChoix,'no');	
					swapvisible(swp_nb_pieces,'no');
					swapvisible(swp_nb_chambres,'no');
					swapvisible(swp_surface,'no');
					swapvisible(swp_prix,'no');
					swapvisible(swp_infogeo,'no');
					swapvisible(swp_nbpersonne,'yes');
					/* swapvisible(swp_typetransac,'no'); */
					swapvisible(swp_idsituationgrp,'yes');
					swapvisible(swp_bascritere,'no');
								swapvisible(swp_esplocvac,'yes');	
					swapvisible(swp_minimap,'yes');
					lineone.className = "wdthline_locvac";	
					linetrd.className = "wdthline_locvac";	
					linetwo.className = "wdthline_locvac";	
					swp_idsituationgrp.className = "wdthline_locvac";	
					swp_pxmax.name = "px_bs_semainemax";	
					swp_pxmin.name = "px_bs_semainemin";	
				}else{
					oidtt.value = "com"; 
					activeForm('typebienListe');
					activeForm('typebien2Liste');
					swapvisible(swp_typetransac,'yes');
					swapvisible(swp_surface,'yes');
					swapvisible(swp_prix,'yes');
					swapvisible(swp_nb_pieces,'no');
					swapvisible(swp_nb_chambres,'no');
					swapvisible(swp_idsituationgrp,'no');
					swapvisible(swp_typebien2Choix,'no');
					swapvisible(swp_infogeo,'yes');
					swapvisible(swp_bascritere,'yes');		
					swapvisible(swp_nbpersonne,'no');
								swapvisible(swp_esplocvac,'no');	
					swapvisible(swp_minimap,'no');
					lineone.className = "wdthline";	
					linetrd.className = "wdthline";	
					linetwo.className = "wdthline";	
					swp_idsituationgrp.className = "wdthline";	
					if(returnChecked()!= 10){
						swapvisible(swp_typebienChoix,'yes');	
						swapvisible(swp_typecommerceChoix,'no');
					}else {
						swapvisible(swp_typebienChoix,'no');	
						swapvisible(swp_typecommerceChoix,'yes');
					}	
					swp_pxmax.name = "pxmax";	
					swp_pxmin.name = "pxmin";		 
							
				}
			}
		}
	}
}


function focuscp (o) {
	if (o.value==defaultfocuscp) {
		o.value="";
		o.style.color="black";
	}
}

function blurcp (o) {
	if (o.value=="" || o.value==defaultfocuscp) {
		o.style.color="gray";
		if (o.value=="") o.value=defaultfocuscp;
	}
	else
		o.style.color="black";
}


function focusinput (o) {
	if (o.value==defaultfocusinput) {
		o.value="";
		o.style.color="black";
	}
}

function blurinput (o) {
	if (o.value=="" || o.value==defaultfocusinput) {
		o.style.color="gray";
		if (o.value=="") o.value=defaultfocusinput;
	}
	else
		o.style.color="black";
}


function addLoadEvent(){}

addLoadEvent(initengine);
addLoadEvent(initDropdown);

function initengine() {
	//var oidtt = document.getElementById("ididtt").value;
	/*var oidtt = '';
	var opagenext = document.getElementById("pagenext");
	var theid = "";
	switch (oidtt) {
		case '2':
			theid="ogl_achat";
			break;
		case '1':
			theid="ogl_location";
			break;
		case '4':
			theid="ogl_locvac";
			break;
	}
	
	if (opagenext.value == 'commerces,recherche.htm')
		theid="ogl_bureaucomm";
	setTimeout('engine("'+theid+'");',10);
  oidtt=document.getElementById("cpsaisie");
  oidtt=blurcp(oidtt);*/
}

function setregion (rg) {
	
	var cpsaisie = document.getElementById("cpsaisie");
	
	cpsaisie.value = rg;
	
}


function infobMove(e) {
	if (!e) e=event;
	if (e.pageX) {
		l = e.pageX+document.body.scrollLeft;
		t = e.pageY+document.body.scrollTop;
	}
	else
	{
		l=e.clientX+document.body.scrollLeft;
		t=e.clientY+document.body.scrollTop;
	}
	
		
	if(infobCur!=null) {
//		infobCur.innerHTML=l+" top"+t;
		infobCur.style.top=t+10;
		infobCur.style.left=l;
		infobCur.style.display='inline';
		infobCur.style.visibility='visible';

	}
}


function infobDisp(oo) {
	var o = 	document.getElementById(oo);
	if(o) {
		infobCur=o;
		//o.style.display='inline';
		//o.style.visibility='visible';
		document.onmousemove=infobMove;
	}
}

function infobHide(oo) {
	var o = document.getElementById(oo);
	if(o) {
		document.onmousemove='';
		infobCur=null;
		o.style.display='none';
		o.style.visibility='hidden';
	}
}


var topMenu={
	el:null,
	cur:null,
	tim:null
};

function topMenuStart(nbr) {
	topMenu.el=[];
	for(i=1;i<=nbr;i++) {
		var el =$('topMe'+i);
		el.className='topMenuElementHid';
		el.onmouseover=topMenuClearTimeout;
		topMenu.el.push(el);
	}
	topMenuNext(Math.floor(Math.random()*topMenu.el.length,0));
}
function topMenuNext(i) {
	if (!i)
		i=topMenu.cur+1;
	if (i>=topMenu.el.length)
		i=0;
	topMenuShow(i);	
	topMenu.tim=setTimeout('topMenuNext()',5000);
}

function topMenuClearTimeout() {
	 window.clearTimeout(topMenu.tim);
}

function topMenuShow(nbr,force) {
	if (force && topMenu.tim!=null) {
		topMenuClearTimeout();
	}
	if (topMenu.cur!=null) topMenu.el[topMenu.cur].className='topMenuElementHid';
	if (nbr>=topMenu.el.length) return;
	topMenu.cur=nbr;
	topMenu.el[topMenu.cur].className='topMenuElement';
	topMenuIndexShow(topMenu.cur);
}

function topMenuIndexShow(cur) {
	var ht='';
	for (i=0;i<topMenu.el.length;i++)
	{
		ht+=((i==0)?'':'|')
		+((cur==i)?'<b>':'')
		+'<a href="#" onmouseover="topMenuShow('+(i)+',1)">'
		+(i+1)+'</a>'
		+((cur==i)?'</b>':'');
	}
	var xx=$('topMenuIndex');
	xx.innerHTML=ht;
}
	<!-- ID3x v4.60 - X13 - static - 15/06/2009 10:19:29 - js\smallengine_2.js -->