// Preload #1 :
/*
var hoverImg = new Array() ;
var hoverImgPath = new Array() ;
var hoverImgSrc = new Array(
	"master/img/header/i.png",
	"master/img/header/club.png",
	"master/img/header/nl.png",
	"plugin/bloc/img/clic.png",
	"plugin/bloc/img/clic-pro.png",
	"plugin/template/img/home/module.png",
	"plugin/template/img/home/clic1.gif",
	"plugin/template/img/home/clic2.gif",
	"plugin/template/img/home/visio.png",
	"plugin/template/img/home/slide-1-back.png",
	"plugin/template/img/home/slide-1-foward.png",
	"mod/bilan/img/download.png",
	"mod/bilan/img/order.png",
	"mod/contact/img/button.png",
	"mod/immobilier/img/ancien-ul1-1.png",
	"mod/immobilier/img/ancien-ul1-2.png",
	"mod/immobilier/img/ancien-ul1-3.png",
	"mod/immobilier/img/ancien-ul1-4.png",
	"mod/immobilier/img/article.png",
	"mod/immobilier/img/download.png",
	"mod/immobilier/img/plus.png",
	"mod/immobilier/img/om-ul-1.png",
	"mod/immobilier/img/om-ul-2.png",
	"mod/immobilier/img/button.png",
	"plugin/template/img/en-savoir-plus.png",
	"plugin/template/img/en-savoir-plus-pro.png",
	"plugin/template/img/documentation.gif"
	) ;

for (var i = 0 ; i < hoverImgSrc.length ; i++) {
	hoverImgPath[i] = "" ;
	var s = hoverImgSrc[i].split("/") ;
	for (var j = 0 ; j < document.styleSheets.length ; j++) {
		var rules = new Array() ;
		if (document.styleSheets[j].cssRules) rules = document.styleSheets[j].cssRules ;
		else if (document.styleSheets[j].rules) rules = document.styleSheets[j].rules ;
		for (var k = 0 ; k < rules.length ; k++) {
			var background = rules[k].style.backgroundImage ;
			if (background && background != "" && background.indexOf(s[s.length-1]) != -1) {
				hoverImgPath[i] = rules[k].selectorText ; 
				break ;
			}
		}
	}
}
*/
// ------------------------------
function club_expert_invest_ () {
// -------------------------
	var href = "https://webclient.cgpland.fr/?EXPERT INVEST" ;
	var name = "_blank" ;
	var options = "toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=1, copyhistory=0, menuBar=0, width=400px, height=600px" ;
	window.open(href,name,options) ;
}

// ---------------------------
function search_focus_ (elm) {
// -------------------
	elm.value = "" ;
}

// ---------------------------
$(document).ready(function() {
// ---------------------------
	if (document.readyState != "complete") {
		setTimeout(arguments.callee,100) ;
		return ;
	}
	
	// Preload #2 :
	/*
	for (var i = 0 ; i < hoverImgPath.length ; i++) {
		if(hoverImgPath[i] != "") {
			var hoverImgPath_ = hoverImgPath[i].split(",") ;
			for (var j = 0 ; j < hoverImgPath_.length ; j++) {
				if ($(hoverImgPath_[j]).length > 0) {
					var nb = hoverImg.length ;
					hoverImg[nb] = new Image() ;
					hoverImg[nb].src = hoverImgSrc[i].replace(".png","_.png").replace(".gif","_.gif").replace(".jpg","_.jpg") ;
				}
			}
		}
	}
	*/

	if (document.getElementById("map_canvas")) {
		var map_title = $("h2.fiche span").text() ;
		var map_canvas_dim1 = document.getElementById("map_canvas_dim1").innerHTML ;
		var map_canvas_dim2 = document.getElementById("map_canvas_dim2").innerHTML ;
		var latlng = new google.maps.LatLng(map_canvas_dim1,map_canvas_dim2) ;
		var myOptions = {
			zoom: 15,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
			} ;
		var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions) ;
		var marker = new google.maps.Marker({position:latlng,title:map_title}) ;
		marker.setMap(map) ;
	}
	
	if ($("div.immo ul.visuel")) {
		$("div.immo ul.visuel li img").click(function() {
			var src1 = $(this).attr("src") ;
			var src2 = src1.replace("/small/","/large/") ;
			$("#zoom img").attr("src",src2) ;
			document.getElementById("darth").style.top = document.documentElement.scrollTop + "px" ;
			document.getElementById("zoom").style.top = document.documentElement.scrollTop + "px" ;
			$("#darth").fadeIn(500) ;
			$("#zoom").fadeIn(500) ;
				
		}) ;
		$("#zoom a.close").click(function() {
			$("#darth").fadeOut(500) ;
			$("#zoom").fadeOut(500) ;
		}) ;
	}
	
	if ($("#blocs a.video")) {
		$("#blocs a.video").click(function() {
			document.getElementById("iframe").src = "http://www.youtube.com/embed/zvt9WsmdBYQ" ;
			document.getElementById("iframe").style.display = "block" ;
			document.getElementById("darth").style.top = document.documentElement.scrollTop + "px" ;
			document.getElementById("video").style.top = document.documentElement.scrollTop + "px" ;
			$("#darth").fadeIn(500) ;
			$("#video").fadeIn(500) ;
		}) ;
		$("#video a.close").click(function() {
			document.getElementById("iframe").src = "" ;
			$("#darth").fadeOut(500) ;
			$("#video").fadeOut(500) ;
		}) ;
	}
});

