

function affnewimm(id, val)
{ 

	document.getElementById('img'+id).src=val;

}
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function displayblock(objname, objname2)
{
  obj1 = findObj(objname);
  obj1.style.display = 'block';
  obj2 = findObj(objname2);
  if (obj2!=null)
  obj2.style.backgroundColor = '#F3FDFF';
  
}
function displaynone(objname, objname2)
{
  obj1 = findObj(objname);
  if (obj1!=null)
  obj1.style.display = 'none';
  obj2 = findObj(objname2);
  if (obj2!=null)
  obj2.style.backgroundColor = '#E6E4D2';
}

<!--
function 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=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function autoLayers() 
{ 
	var g,b,k,f,args=autoLayers.arguments;
	var a = parseInt(args[0]);
	if(isNaN(a))a=0;
	//toutes les info du default (0) couleur et calque.
	//le probleme c'est qu'il les autre
	for(k=1; k<5; k++) 
	{
		if ((g=findObj('link'+k))!=null)
		{
			g.style.backgroundColor="#DDE";
		}
		if ((g=findObj('calque'+k))!=null)
		{
			g.style.display="none";
		}
	}
	
	//le numero que je passe il doit recuperer la couleur link
	// et le calque block
		if ((g=findObj('link'+a))!=null)
		{
			g.style.backgroundColor="#AAE";
		}
		if ((g=findObj('calque'+a))!=null)
		{
			g.style.display="block";
		}

/*
if(!document.p7setc) 
	{
		p7c=new Array();document.p7setc=true;
		for (var u=0;u<10;u++) {p7c[u] = new Array();}
	}
	for(k=0; k<p7c[a].length; k++) 
	{
		if((g=findObj(p7c[a][k]))!=null) 
		{
			b=(document.layers)?g:g.style;b.display="none";
		}
	}
	for(k=1; k<args.length; k++) 
	{
		if((g=findObj(args[k])) != null) 
		{
			b=(document.layers)?g:g.style;b.display="block";f=false;
			for(j=0;j<p7c[a].length;j++) 
			{
				if(args[k]==p7c[a][j]) {f=true;}
			}
			if(!f) {p7c[a][p7c[a].length++]=args[k];}
		}
	}
	*/
}
//-->


/*function storeCaret(text)
{ // voided
}
*/
function AddText(startTag,defaultText,endTag,nameForm) 
{
   with(document.poster)
   {
	 if (eval(nameForm).createTextRange) 
	  {
		 var text;
		  
		 eval(nameForm).focus(eval(nameForm).caretPos);
		 eval(nameForm).caretPos = document.selection.createRange().duplicate();
		 if(eval(nameForm).caretPos.text.length>0)
		 {
			//g�re les espace de fin de s�lection. Un double-click s�lectionne le mot
			//+ un espace qu'on ne souhaite pas forc�ment...
			var sel = eval(nameForm).caretPos.text;
			var fin = '';
			while(sel.substring(sel.length-1, sel.length)==' ')
			{
			   sel = sel.substring(0, sel.length-1)
			   fin += ' ';
			}
			eval(nameForm).caretPos.text = startTag + sel + endTag + fin;
		 }
		 else
			eval(nameForm).caretPos.text = startTag+defaultText+endTag;
	  }
	  else eval(nameForm).value += startTag+defaultText+endTag;
   }
}

function openflashpage(valmod_id)
{
	for (i=1;i<4;i++)
	{
		if ((g=findObj('c'+i))!=null)
		{
			tex='c'+i;
			if (document.getElementById(tex).value!='')
			{
				valeuselect=document.getElementById('c'+i).value;
			}
		}
	}
	if (valeuselect!=0)
	{
		//alert('mod-sit-coord.php?flash='+valeuselect+'');
		window.open('mod-sit-coord.php?flash='+valeuselect+'&mod_id='+valmod_id+'',"name","width=700,height=500,toolbar=no");
	}
	else
	{
	}
}

/*PARTIE CLIENT JS DE VERIFICATION*/
function verif_avantpost(value_form)
{
	
	//if (confirm('Etes vous sur de vouloir enregistrer ce qui entrainera la mise "hors ligne du site" jusqu\'� v�rification de notre part')==true)
		document.getElementById(value_form).submit();
	return false;
		
}

function avertissement()
{
	//if (confirm('Etes vous sur de vouloir enregistrer ce qui entrainera la mise "hors ligne du site" jusqu\'� v�rification de notre part')==true)
		return true;
	return false;
}


//les _mon sont au format yyyy-mm
//les _day sont au format dd
function fct_verif_date_form()
{
	if (document.getElementById("arrdate").value=="")
	{
		alert("Une date est obligatoire");
		return false;
	}
	
}
function fct_verif_date_form2()
{
	if (document.getElementById("arrdate2").value=="")
	{
		alert("Une date est obligatoire");
		return false;
	}
	
}
//On suppose que la date entr�e a �t� valid�e auparavant
//au format yyyy-mm-dd
function getDate(strDate)
{
	//decoupage de la chaine
	year 	= 	strDate.substring(0,4);
	month 	= 	strDate.substring(5,7);
	day 	=	strDate.substring(8,10);
	//mise en forme pour un type date
	d = new Date();
	d.setDate(day);
	d.setMonth(month-1);
	d.setFullYear(year); 
	//retourne la variable
	return d;
}
	  
//Return:
//   0 si date_1=date_2
//   1 si date_1>date_2
//  -1 si date_1<date_2	  
function comparedate(date_1, date_2)
{
	//calcul la difference des date
	diff = date_1.getTime()-date_2.getTime();
	//retourne la valeur
	return (diff==0?diff:diff/Math.abs(diff));
}

function testsearch_speed(lang_id)
{
	if (lang_id==1)
	{
		if (document.getElementById('search_speed').value=="Recherche Rapide...")
		{
			alert("Vous devez remplir un autre texte!");
			return false;
		}
	}
	else if (lang_id==2)// || lang_id==3 || lang_id==4 || lang_id==5)
	{
		if (document.getElementById('search_speed').value=="Quick search...")
		{
			alert("You must enter another text!");
			return false;
		}
	}
	else if (lang_id==5)
	{
		if (document.getElementById('search_speed').value=="Schnelle Suche...")
		{
			alert("You must enter another text!");
			return false;
		}
	}
	else if (lang_id==4)
	{
		if (document.getElementById('search_speed').value=="B�squeda r�pida...")
		{
			alert("You must enter another text!");
			return false;
		}
	}
	return true;
}
function JS_fct_testform_riad()
{
	if (document.getElementById('arrdate').value=="")
	{
		alert("Inserez une date");
		return false;
	}
	return true;
}
function JS_fct_testform_appartement()
{
	if (document.getElementById('arrdate').value=="")
	{
		alert("Inserez une date");
		return false;
	}
	return true;
}
function JS_fct_testform_villa()
{
	if (document.getElementById('arrdate').value=="")
	{
		alert("Inserez une date");
		return false;
	}
	return true;
}
function JS_show_hide(cadre)
{
	if (document.getElementById(cadre).style.display=="block")
		document.getElementById(cadre).style.display="none";
	else
		document.getElementById(cadre).style.display="block";
}
















