function FindID(id) {
	return FindIDFrom(id,document)
}

function FindIDParent(id) {
	return FindIDFrom(id,window.opener.document)
}

function FindIDFrom(id,collection) {
	var lo_ctrl;
			
	if(collection.layers) {
		lo_ctrl=collection.layers[id];
	} else if (collection.all && !collection.getElementsByName) {
		lo_ctrl=collection.all[id];
	} else if (collection.all && collection.getElementsByName) {
		lo_ctrl=collection.getElementsByName(id);
	} else if (!collection.all && collection.getElementsByName) {
		lo_ctrl=collection.getElementsByName(id);
	}	
	
	if (lo_ctrl.length==0) {
		lo_ctrl=undefined;
	} else if (lo_ctrl.length==1) {
		lo_ctrl=lo_ctrl[0];
	}		

	if (!lo_ctrl) {
		if(collection.layers) {
			lo_ctrl=collection.layers[id];
		} else if (collection.all && !collection.getElementById) {
			lo_ctrl=collection.all[id];
		} else if (collection.all && collection.getElementById) {
			lo_ctrl=collection.getElementById(id);
		} else if (!collection.all && collection.getElementById) {
			lo_ctrl=collection.getElementById(id);
		}
	}
	
	
	return lo_ctrl

	/*if(document.layers) return document.layers[id];
	if(document.all && !document.getElementById) return document.all[id];
	if(document.all && document.getElementById) return document.getElementById(id);
	if(!document.all && document.getElementById) return document.getElementById(id);*/
}



function OpenG(as_no) {
	var img_name
	
	if (arguments.length == 0) { as_no = ""} ;
	
	img_name = FindID("ImgM" + as_no).src
	
	img_name = img_name.substr(0,img_name.lastIndexOf(".") - 2) + "_g" + img_name.substr(img_name.lastIndexOf("."),img_name.length)

	window.open(img_name,null,"menubar=no,status=no,scrollbars=no,menubar=no,width=" + GetWidth(as_no) + ", height=" + GetHeight(as_no));

}

function SelectImg(noImg, Titre, imgWidth, imgHeight, as_no) {
	if (arguments.length == 4) { as_no = ""} ;

	FindID("ImgHeight" + as_no).value = imgHeight ;
	FindID("ImgWidth" + as_no).value = imgWidth ;
	
	FindID("Legende" + as_no).innerHTML = Titre

	var img_name
	
	img_name = FindID("ImgS" + as_no + noImg).src

	img_name = img_name.substr(0,img_name.lastIndexOf(".") - 2) + "_m" + img_name.substr(img_name.lastIndexOf("."),img_name.length)

	var newImg
	newImg = new Image;
	newImg.src = img_name;

	FindID("ImgM" + as_no).src = newImg.src	//.src = img_name
	FindID("ImgM" + as_no).alt = Titre
	
	if (imgWidth > imgHeight) {
		FindID("ImgM" + as_no).height = 199 ;
		FindID("ImgM" + as_no).width = 300 ;
	} else {
		FindID("ImgM" + as_no).height = 300 ;
		FindID("ImgM" + as_no).width = 199 ;
	}
}


function GetHeight(as_no) {
	if (arguments.length == 0) { as_no = ""} ;

	var ret = FindID("ImgHeight" + as_no).value
	
	if (ret == "") {
		ret = 550
	}
	
	return ret
}

function GetWidth(as_no) {
	if (arguments.length == 0) { as_no = ""} ;

	var ret = FindID("ImgWidth" + as_no).value
	
	if (ret == "") {
		ret = 820
	}
	
	return ret
}

function SetMenuSelected(idmenu) {
	FindID("menu01").className = "menu_gauche"
	FindID("menu02").className = "menu_gauche"
	FindID("menu03").className = "menu_gauche"
	FindID("menu04").className = "menu_gauche"
	FindID("menu05").className = "menu_gauche"
	
	FindID(idmenu).className = "menu_gauche_selected"

}

function PreloadImgs() {
	if (document.images) {
		preload_images_objects = new Array();

		// set image url
		image_url = new Array();

		image_url[0]  = "../images/photos/carte_g.jpg" ;
		image_url[1]  = "../images/photos/carte_m.jpg" ;
		image_url[2]  = "../images/photos/carte_s.jpg" ;
		image_url[3]  = "../images/photos/chbl1_g.jpg" ;
		image_url[4]  = "../images/photos/chbl1_m.jpg" ;
		image_url[5]  = "../images/photos/chbl1_s.jpg" ;
		image_url[6]  = "../images/photos/chbl2_g.jpg" ;
		image_url[7]  = "../images/photos/chbl2_m.jpg" ;
		image_url[8]  = "../images/photos/chbl2_s.jpg" ;
		image_url[9]  = "../images/photos/chja1_g.jpg" ;
		image_url[10]  = "../images/photos/chja1_m.jpg" ;
		image_url[11]  = "../images/photos/chja1_s.jpg" ;
		image_url[12]  = "../images/photos/chja2_g.jpg" ;
		image_url[13]  = "../images/photos/chja2_m.jpg" ;
		image_url[14]  = "../images/photos/chja2_s.jpg" ;
		image_url[15]  = "../images/photos/chja3_g.jpg" ;
		image_url[16]  = "../images/photos/chja3_m.jpg" ;
		image_url[17]  = "../images/photos/chja3_s.jpg" ;
		image_url[18]  = "../images/photos/chro1_g.jpg" ;
		image_url[19]  = "../images/photos/chro1_m.jpg" ;
		image_url[20]  = "../images/photos/chro1_s.jpg" ;
		image_url[21]  = "../images/photos/chro2_g.jpg" ;
		image_url[22]  = "../images/photos/chro2_m.jpg" ;
		image_url[23]  = "../images/photos/chro2_s.jpg" ;
		image_url[24]  = "../images/photos/chve1_g.jpg" ;
		image_url[25]  = "../images/photos/chve1_m.jpg" ;
		image_url[26]  = "../images/photos/chve1_s.jpg" ;
		image_url[27]  = "../images/photos/chve2_g.jpg" ;
		image_url[28]  = "../images/photos/chve2_m.jpg" ;
		image_url[29]  = "../images/photos/chve2_s.jpg" ;
		image_url[30]  = "../images/photos/cours1_g.jpg" ;
		image_url[31]  = "../images/photos/cours1_m.jpg" ;
		image_url[32]  = "../images/photos/cours1_s.jpg" ;
		image_url[33]  = "../images/photos/cuis_g.jpg" ;
		image_url[34]  = "../images/photos/cuis_m.jpg" ;
		image_url[35]  = "../images/photos/cuis_s.jpg" ;
		image_url[36]  = "../images/photos/escal_g.jpg" ;
		image_url[37]  = "../images/photos/escal_m.jpg" ;
		image_url[38]  = "../images/photos/escal_s.jpg" ;
		image_url[39]  = "../images/photos/IMG_0482_g.jpg" ;
		image_url[40]  = "../images/photos/IMG_0482_m.jpg" ;
		image_url[41]  = "../images/photos/IMG_0482_s.jpg" ;
		image_url[42]  = "../images/photos/patio_g.jpg" ;
		image_url[43]  = "../images/photos/patio_m.jpg" ;
		image_url[44]  = "../images/photos/patio_s.jpg" ;
		image_url[45]  = "../images/photos/rdc1_g.jpg" ;
		image_url[46]  = "../images/photos/rdc1_m.jpg" ;
		image_url[47]  = "../images/photos/rdc1_s.jpg" ;
		image_url[48]  = "../images/photos/rdcc_g.jpg" ;
		image_url[49]  = "../images/photos/rdcc_m.jpg" ;
		image_url[50]  = "../images/photos/rdcc_s.jpg" ;
		image_url[51]  = "../images/photos/sejo1_g.jpg" ;
		image_url[52]  = "../images/photos/sejo1_m.jpg" ;
		image_url[53]  = "../images/photos/sejo1_s.jpg" ;
		image_url[54]  = "../images/photos/sejo2_g.jpg" ;
		image_url[55]  = "../images/photos/sejo2_m.jpg" ;
		image_url[56]  = "../images/photos/sejo2_s.jpg" ;
		image_url[57]  = "../images/photos/sejo3_g.jpg" ;
		image_url[58]  = "../images/photos/sejo3_m.jpg" ;
		image_url[59]  = "../images/photos/sejo3_s.jpg" ;
		image_url[60]  = "../images/photos/souk_g.jpg" ;
		image_url[61]  = "../images/photos/souk_m.jpg" ;
		image_url[62]  = "../images/photos/souk_s.jpg" ;
		image_url[63]  = "../images/photos/terr1_g.jpg" ;
		image_url[64]  = "../images/photos/terr1_m.jpg" ;
		image_url[65]  = "../images/photos/terr1_s.jpg" ;
		image_url[66]  = "../images/photos/terr2_g.jpg" ;
		image_url[67]  = "../images/photos/terr2_m.jpg" ;
		image_url[68]  = "../images/photos/terr2_s.jpg" ;
		image_url[69]  = "../images/photos/terr3_g.jpg" ;
		image_url[70]  = "../images/photos/terr3_m.jpg" ;
		image_url[71]  = "../images/photos/terr3_s.jpg" ;

		var i = 0;
		for(i=0; i<=71; i++) {
			//preload_image_object = new Image();
			//preload_image_object.src = image_url[i];
			preload_images_objects[i] = new Image();
			preload_images_objects[i].src = image_url[i];
		}
	}
}

function DeactivateGA() {
	var ldiv = FindID("ga_shade")
	
	try {
		if (ldiv) {
			alert(1);
			ldiv.style.zIndex = 1;
			alert(2);
			ldiv.style.filter = "alpha(opacity=0)";
			alert(3);
			ldiv.style.height = "100px";
			alert(4);
		}
	} catch(err) {}
}

