
// 0 : accueil / 1 : rechercher / 2 : proposer / 3 : concept / 4 : reseau / 5 : partenaire / 6 : contact


// Gestion coche ANCIEN sur recherche :
//**************************************************

	function alertCoche_uk(){
		if (document.recherche.ancien.checked){
			if(document.recherche.Categorie.value != "")
				window.open('alert_uk.htm','alert','width=568,height=406');
				
			document.getElementById("type_uk").style.display="none";
			document.getElementById("no_type_uk").style.display="block";
			document.recherche.Categorie.value = "";
		}
		else{
			document.getElementById("type_uk").style.display="block";
			document.getElementById("no_type_uk").style.display="none";		
		}
	}

	function alertCoche_fr(){
		if (document.recherche1.ancien.checked){
			if(document.recherche1.Categorie.value != "")				
				window.open('alert_fr.htm','alert','width=568,height=406');
									
			document.getElementById("type_fr").style.display="none";
			document.getElementById("no_type_fr").style.display="block";
			document.recherche1.Categorie.value = "";
		}
		else{
			document.getElementById("type_fr").style.display="block";
			document.getElementById("no_type_fr").style.display="none";		
		}
	}



// fonction gestion image ou flash :
//**************************************************

// tableau img / page
var tabImgP0 = new Array();
var tabImgP1 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");
var tabImgP2 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");
var tabImgP3 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");
var tabImgP4 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");
var tabImgP5 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");
var tabImgP6 = new Array("imgAmbiance1.jpg","imgAmbiance2.jpg","imgAmbiance3.jpg","imgAmbiance4.jpg","imgAmbiance5.jpg");

function affichImgPrincipale(){
	document.write('<table width="500" height="252" border="0" cellspacing="0" cellpadding="0"><tr><td>');

	if(accesRub == 0 && accesPage == "accueil")
		gestionFlash("Animation1_uk")
	else if(accesRub == 0 && accesPage == "deco")
		document.write('<img src="graph/imgPrincipale/imgAmbiance9.jpg" width="500" height="252">');
	else
		gestionImgPrincipale();

	document.write('</td></tr></table>');
}
// function alea
function gestionImgPrincipale(){
			aleaImg = (Math.random()*10/(10/eval('tabImgP'+accesRub).length));
			aleaImg = Math.floor(aleaImg);			
	document.write('<img src="graph/imgPrincipale/'+eval('tabImgP'+accesRub)[aleaImg]+'" width="500" height="252">');
}
// affich FLASH
function gestionFlash(nomAnim){
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=500 HEIGHT=252>'
			+'<PARAM NAME=movie VALUE="graph/imgPrincipale/'+nomAnim+'.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>'
			+'<EMBED src="graph/imgPrincipale/'+nomAnim+'.swf" quality=high bgcolor=#FFFFFF  WIDTH=500 HEIGHT=252 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'
			+'</OBJECT>');	
}


//fct spécifiques
//**************************************************

// POP UP DETAILS pour PUB NEW
function popupcentree(page,largeur,hauteur,options, name){
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,name,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}  

	
// design Bout Menu
//-------------------
var tabDesignBout = new Array("","boutRechercher","boutProposer","boutPHA","boutReseau","boutContact");

function boutDesign(){
	if(accesRub != 0)
		document.getElementById("boutMenu"+accesRub).src= 'graph/commun_uk/images/'+tabDesignBout[accesRub]+'2.gif';
}

// survol bouton menu
//-------------------------
function boutON(num){
	document.getElementById("boutMenu"+num).src= 'graph/commun_uk/images/'+tabDesignBout[num]+'2.gif';
}

function boutOUT(){
	for(i=1;i<tabDesignBout.length;i++){
		if(i != accesRub)
			document.getElementById("boutMenu"+i).src= 'graph/commun_uk/images/'+tabDesignBout[i]+'1.gif';
	}	
}


//********************************************************
//GESTION NOUVEAUTES
//********************************************************

function affichNouveautes(){

	//alea
		aleaPub = (Math.random()*10/(10/4));
		aleaPub = Math.floor(aleaPub)+1;


	//affich
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" background="graph/blocPub/images/pubFond.gif"><tr>'
		+'<td height="124" background="graph/commun_uk/images/pubNouveaute.gif"> '
		
		+'<table width="100%" border="0" cellspacing="0" cellpadding="4"><tr>' 
		+'<td width="100%">&nbsp;</td>'
		+'<td bgcolor="#FFFFFF"><img src="'+eval("nouv"+aleaPub).photo+'" width="144" height="108"></td>'
		+'<td><img src="graph/blocPub/images/espaceur.gif" width="5" height="1"></td>'
		+'</tr></table>'

		+'</td></tr><tr><td>'

		+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>' 
		+'<td><img src="graph/blocPub/images/espaceur.gif" width="10" height="1"></td>'
		+'<td width="100%" class="bleuF_10" height="40"><b> Ref. : '+eval("nouv"+aleaPub).ref+'<br>'
		+'Town : '+eval("nouv"+aleaPub).ville+' ('+eval("nouv"+aleaPub).departement+')<br>'
		+'As from : '+eval("nouv"+aleaPub).prix+' </b></td>'
		+'<td><img src="graph/blocPub/images/espaceur.gif" width="10" height="1"></td>'
		+'</tr><tr>' 
		+'<td><img src="graph/blocPub/images/espaceur.gif" width="10" height="1"></td>'
		+'<td class="bleuF_10" height="45">'+eval("nouv"+aleaPub).texte.substring(0,70)+' (...)</td>'
		+'</tr></table>'
		
		+'</td></tr>'
		+'<tr><td><img src="graph/blocPub/images/pubTrait.gif" width="193" height="5"></td></tr>'
		+'<tr><td><a href="#" onClick="javascript:popupcentree(\'http://www.appartement-maison-neuf-patrick-harlow.com'+eval("nouv"+aleaPub).lien+'\', 570, 500, \'menubar=no,scrollbars=yes,statusbar=no\', \'detail\');"><img src="graph/commun_uk/images/pubInfo.gif" width="193" height="15" border="0"></a></td></tr>'
		+'<tr><td background="graph/blocPub/images/pubBas.gif"><img src="graph/blocPub/images/espaceur.gif" width="193" height="15"></td></tr>'
		+'</table>');

}		



// fct Envoi Recherche
//------------------------





// fct Envoi proposition
//------------------------


							function lanceProposition(){
								
									var adresse = document.FormProposition.Email.value;
									var place = adresse.indexOf("@",1);
									var point = adresse.indexOf(".",place+1);
								
								if(FormProposition.Nom.value=="" || FormProposition.Tel.value=="" || FormProposition.Email.value==""){
									alert("Thank you to fill all the obligatory fields before validating your proposal : \nName - Telephone - E.mail");
								}
								else {
									if((place > -1)&&(adresse.length >2)&&(point > 1)&&(adresse.length > point+2)){
										// envoi form
										//alert("ok");
										FormProposition.submit();
									}
									else{
										alert('Thank you to state a valid  E-mail address');
										document.FormProposition.Email.focus();
									}						
								}								
							}



















