/*************************************************************************
* 2007 - Acreat Web Technologies
* Tous droits réservés
*************************************************************************/
var domTT_oneOnly = true;
var domTT_activateDelay = 000;
var domTT_lifetime = 0;

function ParcExpoMap()
{
	this.id = "ParcExpoMap";
	this.w = 655;
	this.h = 407;
	this.img_path = "img/parc_expo_map/";
	// ---
	this.coords = [
		["hall11", null, "243,166,243,150,220,118,200,122,199,137,223,171"],
		["hall10b", null, "221,213,244,249,245,264,215,271,191,235,191,218"],
		["hall10a", null, "293,277,293,259,259,209,225,216,225,224,240,248,241,259,258,285"],
		["hall9",	null, 	"287,217,286,233,320,283,357,276,357,261,324,211"],
		["hall8",	null, 	"456,237,426,194,426,179,455,172,486,215,486,230"],
		["hall7",	null, 	"451,160,451,146,443,136,426,140,411,119,389,124,389,139,412,171,414,171,414,169"],
		["hall5",	null, 	"352,249,352,232,434,214,452,238,452,253,370,272"],
		["hall4",	null, 	"425,213,425,197,414,182,333,201,332,217,343,231"],
		["hall3",	null, 	"361,181,351,167,352,153,389,143,399,157,399,173"],
		["hall2",	null, 	"351,161,352,152,386,144,387,138,376,124,339,132,338,148,350,163"],
		["hall1",	null, 	"249,165,301,153,300,141,339,133,367,126,368,111,359,99,307,110,304,106,230,121,229,131,244,152,243,156"],
		["air1",	null, 	"494,286,461,250,383,268,408,310"],
		["air2",	null, 	"413,182,402,170,361,181,344,159,250,182,266,216"],
		["accueil",	"Accueil", 	"359,305,348,290,349,278,384,270,395,284,394,296"],
		["entree",	"Entrée", 	"462,174,462,166,456,159,414,168,414,177,420,184,427,183,427,178,454,172,458,175"],
		["salle600",	"Salle 600", 	"142,136,141,127,154,124,162,136,162,144,150,148"],
		["bureauparc",	"Bureau Parc Expo", 	"149,168,149,157,163,154,172,167,172,177,159,181"],
		["batiment1",	"Bâtiment 1", 	"331,157,331,152,326,144,317,145,317,152,323,160"],
		["batiment2",	"Bâtiment 2", 	"319,186,319,179,314,172,306,174,306,181,311,189"],
		["batiment3",	"Bâtiment 3", 	"339,197,339,191,334,183,316,188,315,194,320,201"],

	];
	// ---
	this.init();
};

/* --------------
* init
* --------- */
ParcExpoMap.prototype.init = function()
{
	// Création du container temporaire
	var CONTAINER = document.createElement("DIV");
	
	// Création du fond de carte
	var CARTE = document.createElement("DIV");
	CARTE.style.width = this.w + "px";
	CARTE.style.height = this.h + "px";
	CARTE.style.background = "url(" + this.img_path + "fond-carte.png) no-repeat";
	CARTE.id = this.id;
	CONTAINER.appendChild(CARTE);
	
	// Création du MAP
	MAP = document.createElement("MAP");
	MAP.id = MAP.name = "map_" + this.id;
	CONTAINER.appendChild(MAP);
	
	// Création de l'image supérieure
	IMG = document.createElement("IMG");
	IMG.src = this.img_path + "pixel.gif";
	IMG.style.position = "absolute";
	IMG.style.zIndex = 1;
	IMG.width = this.w;
	IMG.height = this.h;
	IMG.border = 0;
	IMG.useMap = "#" + MAP.name;
	CARTE.appendChild(IMG);
	
	// Insertion dans le document
	document.write(CONTAINER.innerHTML);
}

/* --------------
* add
* --------- */
ParcExpoMap.prototype.add = function(ref, html, link)
{
	if(!link) link = "#";
	var CARTE = document.getElementById(this.id);
	if(!CARTE) return false;
	var MAP = document.getElementById("map_" + this.id);
	if(!MAP) return false;
	
	var coords = false;
	for(var i=0; i<this.coords.length; i++) {
		if(this.coords[i][0] == ref) {
			coords = this.coords[i];
			break;
		}
	}
	
	if(!coords) 
		return false;
		
	/* --- */
	var ZONE_DIV = document.createElement("DIV");
	ZONE_DIV.style.position = "absolute";
	ZONE_DIV.style.zIndex = 0;
	ZONE_DIV.style.width = this.w + "px";
	ZONE_DIV.style.height = this.h + "px";
	ZONE_DIV.style.background = "url(" + this.img_path + coords[0] + ".gif) no-repeat";
	ZONE_DIV.style.display = "none";
	CARTE.appendChild(ZONE_DIV);
	/* --- */
	var ZONE_AREA = document.createElement("AREA");
	ZONE_AREA.zone_div = ZONE_DIV;
	ZONE_AREA.shape = "poly";
	ZONE_AREA.coords = coords[2];
	ZONE_AREA.href = link;
	ZONE_AREA.onmouseover = function(event) 	{ 
		this.zone_div.style.display = ''; 
		domTT_activate(this, event, 'caption', coords[1] , 'content', html/*, 'type', 'sticky'*/); 
		this.onmouseout = function(event) {  this.zone_div.style.display = 'none'; domTT_mouseout(this, event); }
	};
	MAP.appendChild(ZONE_AREA);
}

