function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		
		index_over = newImage("../images/layout/fr/main_nav/index-over.gif");
		vente_over = newImage("../images/layout/fr/main_nav/vente-over.gif");
		immoneuf_over = newImage("../images/layout/fr/main_nav/immoneuf-over.gif");
		gestion_over = newImage("../images/layout/fr/main_nav/gestion-over.gif");
		syndic_over = newImage("../images/layout/fr/main_nav/syndic-over.gif");
		immoentreprise_over = newImage("../images/layout/fr/main_nav/immoentreprise-over.gif");
		groupe_over = newImage("../images/layout/fr/main_nav/groupe-over.gif");
		partner_over = newImage("../images/layout/fr/main_nav/partner-over.gif");
		my_trevi_over = newImage("../images/layout/fr/main_nav/my_trevi-over.gif");
				
		business_vente_location_over = newImage("../images/layout/business/vente_location_over.gif");
		business_immobilier_neuf_over = newImage("../images/layout/business/immobilier_neuf_over.gif");
		business_gestion_privative_over = newImage("../images/layout/business/gestion_privative_over.gif");
		business_syndic_immeuble_over = newImage("../images/layout/business/syndic_immeuble_over.gif");
		business_immobilier_entreprise_over = newImage("../images/layout/business/immobilier_entreprise_over.gif");
		
		search_a_louer_over = newImage("../images/layout/search/a_louer_over.gif");
		search_a_vendre_over = newImage("../images/layout/search/a_vendre_over.gif");
		search_inscrivez_vous_over = newImage("../images/layout/search/inscrivez_vous_over.gif");
		
		lng_fr_over = newImage("../images/layout/ln_fr_over.gif");
		lng_en_over = newImage("../images/layout/ln_en_over.gif");
		lng_nl_over = newImage("../images/layout/ln_nl_over.gif");
		preloadFlag = true;
	}
}

function email(name,domain){
		var name = name;
		var domain = domain;
		document.write('<a href=\"mailto:' + name + '@' + domain + '\" class=\"mail\">');
		document.write(name + "@" + domain + '</a>');
	}
//------------------------------------------------------------------------------------------------------
	
function swapToLng(f_LngToSwap)
  {
  //génère le string de la nouvelle adresse	
//  newUrl=currentUrl.replace("_"+currentLng.toLowerCase(),"_"+f_LngToSwap)
  newUrl=currentUrl.replace("_"+currentLng.toLowerCase()+".","_"+f_LngToSwap+".")

//	alert(readCookie("cookie précédent --> lng :"+readCookie("lng")));
	//alert("cookie précédent --> lng :"+readCookie("lng"));

	writeCookie("lng", f_LngToSwap);

  //Envoie à la nouvelle adresse
  document.location=newUrl
  }

  var currentLng //language courant

currentUrl=(document.location+"").toLowerCase() //adresse courante de la page

//recherche _nl _fr _en dans l'adresse
startPosIndexNl=currentUrl.toLowerCase().indexOf("_nl")
startPosIndexFr=currentUrl.toLowerCase().indexOf("_fr")
startPosIndexEn=currentUrl.toLowerCase().indexOf("_en")
  
//trouve la langue courante	
if (startPosIndexNl>0) { currentLng="nl" }
if (startPosIndexEn>0) { currentLng="en" }
if (startPosIndexFr>0) { currentLng="fr" }

//------------------------------------------------------------------------------------------------------

function openCenterWin(url,theWidth,theHeight){
var theTop=(screen.height/2)-(theHeight/2);
var theLeft=(screen.width/2)-(theWidth/2);
var features=
'height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+",scrollbars=no";
theWin=window.open(url,'',features);
}

//------------------------------------------------------------------------------------------------------

function email(name,domain){
		var name = name;
		var domain = domain;
		document.write('<a href=\"mailto:' + name + '@' + domain + '\" class=\"legal\">');
		document.write(name + "@" + domain + '</a>');
	}

//------------------------------------------------------------------------------------------------------

function email2(name,domain){
		var name = name;
		var domain = domain;
		document.write('<a href=\"mailto:' + name + '@' + domain + '\" class=\"links\">');
		document.write(name + "@" + domain + '</a>');
	}
	
//------------------------------------------------------------------------------------------------------
	
// PickList II script (aka Menu Swapper)- By Phil Webb (http://www.philwebb.com)
// Visit JavaScript Kit (http://www.javascriptkit.com) for this JavaScript and 100s more
// Please keep this notice intact

function move(fbox, tbox) {
     var arrFbox = new Array();
     var arrTbox = new Array();
     var arrLookup = new Array();
     var i;
	 var check;
     for(i=0; i<tbox.options.length; i++) {
          arrLookup[tbox.options[i].text] = tbox.options[i].value;
          arrTbox[i] = tbox.options[i].text;
     }
     var fLength = 0;
     var tLength = arrTbox.length
     for(i=0; i<fbox.options.length; i++) {
          arrLookup[fbox.options[i].text] = fbox.options[i].value;
          if(fbox.options[i].selected && fbox.options[i].value != "") {
		  		//modified - fred pauwels www.zero-gravity.be - check if already selected
		  		check = true;
			  	for(j=0; j<tbox.options.length; j++) {
					if(fbox.options[i].value == tbox.options[j].value) {
						check = false;
					}
				}
				if(check == true){
		              arrTbox[tLength] = fbox.options[i].text;
		              tLength++;				
				}
          } else {
               arrFbox[fLength] = fbox.options[i].text;
               fLength++;
          }
     }
     arrFbox.sort();
     arrTbox.sort();
     fbox.length = 0;
     tbox.length = 0;
     var c;
     for(c=0; c<arrFbox.length; c++) {
         var no = new Option();
         no.value = arrLookup[arrFbox[c]];
         no.text = arrFbox[c];
         fbox[c] = no;
     }
     for(c=0; c<arrTbox.length; c++) {
     	var no = new Option();
     	no.value = arrLookup[arrTbox[c]];
     	no.text = arrTbox[c];
     	tbox[c] = no;
     }
}

function selectAll(box) {
     for(var i=0; i<box.length; i++) {
     box[i].selected = true;
     }
}
