// JavaScript Document
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var ns = (browserName == "Netscape");
var nsMore4 = (ns && browserVer >= 5);
var nsLess4 = (ns && browserVer < 5);
var ie4 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 4')>0;
var ie5 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 5')>0;
var ie6 = (browserName == "Microsoft Internet Explorer") && navigator.appVersion.indexOf('MSIE 6')>0;
var ie = (browserName == "Microsoft Internet Explorer");
var mac = (navigator.userAgent.indexOf("Mac") != -1);

var services=new Array;
services[1] = new Array("ESTIMATION", "Si vous pensez vendre ou louer l’un de vos biens immobiliers, nos négociateurs seront là pour vous aider. Sans aucun engagement, vous recevrez un courrier d’estimation, basé sur les dernières réalisations de notre agence et sur les prix actuels du marché.<br><br>Elle sera donc en adéquation avec le prix que vous obtiendrez de la vente ou de la location de votre bien.<br><br>"); 
services[2] = new Array("MANDATS", "Si vous décidez de vendre ou louer votre bien, nos mandats vous apporteront la garantie de notre engagement total.<br><br>Avec notre mandat <span class='FicheTxtG'>TRADITION</span> (mandat sans exclusivité) :<br>&nbsp;&nbsp;&nbsp;- vous bénéficiez de l’expérience d’un acteur de référence<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sur le marché immobilier de prestige.<br>&nbsp;&nbsp;&nbsp;- vous tirez parti de notre réseau de clients fidèles, parfois depuis<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;la création de notre agence.<br>&nbsp;&nbsp;&nbsp;- vous exploitez le meilleur des nouvelles technologies pour exposer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vos biens dans des conditions optimales.<br><br>Vous choisissez de nous apporter votre confiance en exclusivité, alors avec notre mandat <span class='FicheTxtG'>ELITE</span>, nous nous engageons en plus à présenter votre bien, si vous l’acceptez, dans l’un des supports publicitaires dont nous sommes partenaires : Le Figaro, Propriété de France, Explorimmo.com...<br><br>"); 
services[3] = new Array("COMMERCIALISATION", "Vous mettez en place une opération immobilière (promotion, vente à la découpe, etc…), nos agences représentent un vecteur de communication idéal. Vous pourrez compter sur notre connaissance du marché pour vous accompagner au long de votre projet.<br><br>Vous profiterez des excellents emplacements commerciaux de nos agences et des relations privilégiées que nous avons tissées avec un grand nombre d’investisseurs et de clients potentiels.<br><br>");
services[4] = new Array("PROMOTIONS", "Après avoir été promoteur pendant plus de 25 ans, l’agence <span class='FicheTxtG'>JB BOITARD</span> s’est aujourd’hui concentrée sur la commercialisation de biens neufs ou anciens.<br>En revanche, vous pouvez toujours compter sur notre expertise pour la mise en place de nouvelles promotions.<br><br>Nous pourrons collaborer pour la commercialisation, en développant la stratégie de vente (publicités, sites internets, etc…).<br><br>");
services[5] = new Array("My JB BOITARD", "Ce nouveau service apporté par notre agence, permet de donner à nos meilleurs clients un accès privilégié à un panel de services exclusifs sur notre site internet.<br><br>Vous pourrez consulter la liste de tous les biens que nous commercialisons, utiliser un moteur de recherche mis à votre disposition, créer une sélection des produits les intéressants le plus et retrouver toutes les informations sur nos agences.<br><br>");

function Changetxt(id) {
  document.getElementById('titre').innerHTML = services[id][0];
  document.getElementById('texte').innerHTML = services[id][1];
}


var servicesGB=new Array;
servicesGB[1] = new Array("ASSESSMENT", "If you are thinking about selling or renting a piece of your real estate, our negotiators are here to help you. Without any commitment on your part, you will receive an assessment letter based on our agency’s latest transactions and on current market prices.<br><br>It will therefore exactly correspond with the price you would be getting for the sale or rental of your piece of real estate.<br><br>"); 
servicesGB[2] = new Array("MANDATES", "If you decide to sell or rent your piece of real estate, our mandates guarantee our total commitment.<br><br>With our <span class='FicheTxtG'>TRADITION</span> mandate (mandate without an exclusive contract) :<br>&nbsp;&nbsp;&nbsp;- you benefit from the experience of a reference actor<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on the prestige real estate market.<br>&nbsp;&nbsp;&nbsp;- you profit from our network of loyal customers, some of them<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with us from the creation of our agency.<br>&nbsp;&nbsp;&nbsp;- you have at your disposal the best of the new technologies<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to present your real estate in optimum conditions.<br><br>If you choose to give us your exclusive confidence, then with our <span class='FicheTxtG'>ELITE</span> mandate we commit ourselves to presenting your real estate in one of our partner publicity outlets, upon your acceptance: Le Figaro, Propriété de France, Explorimmo.com...<br><br>"); 
servicesGB[3] = new Array("MARKETING", "If you are setting up a real estate transaction (promotion, sale in lots, etc.), our agencies represent an ideal communication medium. You can count on our knowledge of the market to help you all during your project.<br><br>You will benefit from our agencies’ excellent business sites and privileged relationships that we have created with numerous investors and potential customers.<br><br>");
servicesGB[4] = new Array("PROMOTIONS", "After creating and managing real estate projects for more than 25 years, the JB BOITARD Agency is now concentrating on the marketing of real estate, new and old.<br>However, you may still count on our expertise for setting up new promotions.<br><br>We can collaborate for marketing by developing sales strategies (advertisements, Internet sites, etc.).<br><br>");
servicesGB[5] = new Array("My JB BOITARD", "This new service offered by our agency lets us give our best customers privileged access to a range of exclusive services on our Internet site.<br><br>You may consult the list of all of the real estate that we market, use a search engine at your disposal, create a selection of the most interesting products, and find all the information about our agencies.<br><br>");

function ChangetxtGB(id) {
  document.getElementById('titre').innerHTML = servicesGB[id][0];
  document.getElementById('texte').innerHTML = servicesGB[id][1];
}






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_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 roIn(name,imgro) {
window.document[name].src = "imgs/"+imgro;
}


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 YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('ATTENTION :\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}





// --------------AFFICHAGES DES LAYERS --------- //
function showlayer (lelayer){
if (ie)
{
document.all[lelayer].style.visibility = "visible"
}
else if (nsMore4)
{
document.getElementById(lelayer).style.visibility= "visible"
}
else if (nsLess4)
{
document.layers[lelayer].visibility= "visible"
}
}


function hiddelayer (lelayer){
if (ie){
document.all[lelayer].style.visibility = "hidden"
}
else if (nsMore4)
{
document.getElementById(lelayer).style.visibility= "hidden"
}
else if (nsLess4){
document.layers[lelayer].visibility = "hidden"
}
}


function ClickLayer (lelayer){
		   switch(lelayer)  {
     
				 case 'menuport' :
						showlayer (lelayer);
						hiddelayer ('menuoffre');
						hiddelayer ('menuserv');
						hiddelayer ('menutechno');
						hiddelayer ('menuespacec');
						hiddelayer ('menucontacts');
						hiddelayer ('menuferme');			  			  
				 break;


			
			
			}

}

//---- menu HOME ------ //
function ClickLayer_H (lelayer){
		   switch(lelayer)  {
     
				 case 'menuport' :
						showlayer (lelayer);
						hiddelayer ('menuoffre');
						hiddelayer ('menuserv');
						hiddelayer ('menutechno');
	 			  
				 break;

			
			
			}

}



// --------------AFFICHAGES DES LAYERS --------- //
/*
function verif(ligne,champ) { 

	if (champ=="titre" && ligne=="Autre"){;  
		document.formInscription.titre_autre.disabled=0;
	}
	else if (champ=="sectactivite" && ligne=="Autre") {
		document.formInscription.sectactivite_autre.disabled=0;
	}
	else{
		document.formInscription.titre_autre.disabled=1;
		document.formInscription.sectactivite_autre.disabled=1
	}
//alert (ligne)
alert ("Remplissez le champ 'Autre' suivant")
}

*/

function verif(ligne,champ) { 

	if (champ=="id_gamme" && ligne=="1"){;  
		document.famille.id_ssgamme.disabled=0;
		alert ("Vous devez choisir une Sous-gamme");
	}
	else{
		document.famille.id_ssgamme.disabled=1;
	}
//alert (ligne)
//alert ("Vous devez choissir un Sous-gamme");
}



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 submitForm(nameForm){
//document.forms["formulaire"].elements["action"].value=1;
//document.formulaire.action.value=1;
//document.insertagenda.submit();
document.forms[nameForm].submit();
}


function delLien(monLien,TXT){
  if (confirm(TXT)){
     window.location=monLien;
  //	  document.Monform.submit();
  }

}


function newWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function sumitDel(f,fournis){
  affiche = " Supprimer le fournisseur "+fournis + " ?";
  if (confirm(affiche)){
    f.submit();
	//  document.nomForm.submit();
	 
	 //window.location=monLien;
  //	  document.Monform.submit();
  }

}

function LC_jumpMenu(winName,features,selObj,restore) { //v1.0
  lien= selObj.options[selObj.selectedIndex].value;
  window.open(lien,winName,features);
  if (restore) selObj.selectedIndex=0;
}


function LC_choix (id_contact,civ,nom,prenom) {
	txt = civ +" " + nom + " " + prenom ;
	window.opener.ajoutVisit.visiteur.value = txt ;
	window.opener.ajoutVisit.id_contact_A.value = id_contact ;
	self.close();
	
}

function LC_choix2 (lien) {
	window.opener.location=lien; 
	self.close();

}


var win1=null;
function ST_openliste(){
LeftPosition=(screen.width)?(screen.width-765)/2:100;TopPosition=(screen.height)?(screen.height-450)/2:100;
settings='width=765,height=450,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=no';
win1=window.open('pop.php?page=listing_acq','Liste',settings);
win1.focus('Liste');
}

var win1=null;
function ST_openconvert(){
LeftPosition=(screen.width)?(screen.width-220)/2:100;TopPosition=(screen.height)?(screen.height-220)/2:100;
settings='width=220,height=270,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win1=window.open('calcu.htm','Convertisseur',settings);
win1.focus('Convertisseur');
}

var win1=null;
function ST_openfenetre(mypage,myname,w,h,scroll,resizable,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+resizable+'';
win1=window.open(mypage,myname,settings);
win1.focus(myname);
}



/*
function nbrchecked() {//détermine le nombre de checkbox (delImg1,delImg2,delImg3,etc.) cochées 
        var totalchecked = 0
        totalbox= <?php echo $c-1?>;
        for (i=1;i<=totalbox;i++) {
                var controle = eval("document.getElementById(\"delimg" + i +"\")");
                //alert (controle);
                if (controle.checked) {
                 totalchecked = totalchecked +1;
                }
        }
alert ("total = "+totalchecked);
}

*/


/* UPDATE DYNAMIQUE DU NB DE BIEN DISPONIBLES */
/* Update champ "parmis XXX biens" 			  */
function	check_nb_produits()
{
	var offres = document.getElementById('typesOffre').value;
	var lieu = document.getElementById('IDagence').value;
	var categorie = document.getElementById('IDtypeBien').value;
	var prix = document.getElementById('rateRanges').value;
	
	update_parmis_biens(offres, lieu, categorie, prix);
}

function	update_parmis_biens(offres, lieu, categorie, prix)
{
	var url = '/calcul_parmis_biens.php?reload=1&IDtypeOffre='+offres+'&IDtypeBien='+categorie+'&IDagence='+lieu+'&prix='+prix;
    var myAjax = new Ajax.Request(url, 
        {
          method: 'post',
          onLoading: function (xhr)
            { // pendant chargement
				
			},
          onSuccess: function (xhr)
            { // quand chargé
                $('parmis_nb_biens').innerHTML = xhr.responseText;
            },
          onComplete: function()
            { // Toujours appelé en fin de requête
            }
	});

}