var map_display = false;
var text_display = false;

function iniCreateWindow() {
	// Sélection du body
	/*var obj_body = document.getElementsByTagName("body").item(0);
	
	//Création conteneur global
	var obj_map_container = document.createElement("div");
	obj_map_container.setAttribute('id', 'map_container');
	obj_body.appendChild(obj_map_container);	
	
	// Création du titre
	var obj_title_container = document.createElement("h3");
	obj_title_container.setAttribute('id', 'map_h3_container');
	var texte = document.createTextNode("Périmètre du SAGE Est Lyonnais");
	obj_title_container.appendChild(texte);	
	obj_map_container.appendChild(obj_title_container);

	//Création du lien
	var obj_link_container = document.createElement("div");
	obj_link_container.setAttribute('id', 'map_link_container');
	//obj_link_container.setAttribute('href', '#');	
	obj_map_container.appendChild(obj_link_container);
	
	// Création du bouton de fermeture
	var obj_hide_link_container = document.createElement("a");
	obj_hide_link_container.setAttribute('id', 'hide_link_container');
	obj_hide_link_container.setAttribute('href', '#mymaplink');	
	obj_map_container.appendChild(obj_hide_link_container);	*/
	
	$("#hide_link_container").click(function() { 
		if (map_display) {
			map_display = false;
			$("#map_container").fadeOut(1000);
		}
		return false;
	 });

	//Image
	//var obj_img = document.createElement("img");
	//obj_img.setAttribute('src', $("#mymaplink").attr('href'));	
	//obj_link_container.appendChild(obj_img);
	
	//$('#map_container').Draggable({handle:	'h3'})	
	
	$("#mymaplink").click(function() { 
		if (!map_display) {
			map_display = true;
			$("#map_container").fadeIn(1000);
		}
		return false;		
	 });
}

function iniCreateTextInfo() {
	$("#mytextlink").click(function() { 
		if (!text_display) {
			text_display = true;
			$("#text_container").fadeIn(1000);
		}
		return false;
	});
	
	$("#reversemytextlink").click(function() { 
		if (text_display) {
			text_display = false;
			$("#text_container").fadeOut(1000);
		}		
		return false;		
	});	

	$("#btn-txt-close").click(function() { 
		if (text_display) {
			text_display = false;
			$("#text_container").fadeOut(1000);
		}		
		return false;		
	});	
}


// JavaScript Document
$(document).ready(function() {
	iniMenu();
	iniCreateWindow();
	iniCreateTextInfo();	
});
