function load_index(sn)
{
	
	// centrage de la fenetre
	browserSize();
	document.getElementById('zone1Id').style.left = curWidth/2 - parseInt(document.getElementById('zone1Id').style.width)/2
	
	oldTab = '';
	navigationBar = new menuConst()
	// debug
	if(sn)
		startMap(0,sn);
	else
		document.getElementById('mainId').style.backgroundImage = 'url(../img/fond_home.jpg)';
	//loadXMLDoc('mainId','concept.php');
}

function popup(nom,tx,ty)
{
	window.open(nom,'popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+tx+',height='+ty);
}

function menuConst()
{
	this.idArray = new Array('btn_cartesId','btn_conceptId','btn_mode_emploiId','btn_iconesId','btn_glossaireId','btn_partenairesId','btn_espcitoyenId','btn_contactId','btn_infos_legId');
}

menuConst.prototype.setTab = function (selTab)
{
	//alert(oldTab + " " + selTab);
	
	// GESTION DE L IMAGE DE FOND
	
	// Cas du passage a la carto
	if(selTab == 0)
	{
		document.getElementById('subnavId').style.backgroundImage = 'none';
		document.getElementById('mainId').style.backgroundImage = 'none';
		document.getElementById('mainId').innerHTML = '';
		document.getElementById('mapselectorId').selectedIndex = 0;
	}
	else if(!selTab)
	{
		document.getElementById('titre_villeId').style.backgroundImage = '';
		document.getElementById('fleche_rougeId').style.backgroundImage = '';
		document.getElementById('subnav2Id').innerHTML = '';
		document.getElementById('subnavId').style.backgroundImage = 'url(../img/fond_home0.jpg)';
		document.getElementById('mainId').style.backgroundImage = 'url(../img/fond_home.jpg)';
		document.getElementById('mainId').innerHTML = '';
		document.getElementById('mapselectorId').selectedIndex = 0;
	}
	else
	{
		document.getElementById('titre_villeId').style.backgroundImage = '';
		document.getElementById('fleche_rougeId').style.backgroundImage = '';
		document.getElementById('subnavId').style.backgroundImage = 'none';
		document.getElementById('mainId').style.backgroundImage = 'url(../img/fond_general.gif)';
		document.getElementById('mapselectorId').selectedIndex = 0;
	}
	


	for(x=0;x<this.idArray.length;x++)
	{
		if(selTab == x)
		{
			document.getElementById('subnav2Id').innerHTML = '';
			document.getElementById(this.idArray[x]).style.backgroundImage = 'url(../img/' + this.idArray[x] + '_on.jpg)';
			document.getElementById(this.idArray[x]).style.color = 'white';
			
			
			if((!oldTab || oldTab == 0 || oldTab == '') && selTab != 0)
				loadXMLDoc('mainId','textpattern.php?tab=' + x,1);
			else if(selTab != 0)
				initTab(x);
			
			oldTab = x;
		}
		else
		{
			document.getElementById(this.idArray[x]).style.backgroundImage = '';
			document.getElementById(this.idArray[x]).style.color = '#056b3f';
		}
	}
	
}

function initTab(tabNum)
{
	titleArray = new Array('','Concept','Mode d\'emploi','Icones','Glossaire','Partenaires','Espace citoyen','Contacts','Informations légales');
	linkArray = new Array('view_cartes.php','view_concept.php','view_emploi.php','view_icones.php','view_glossaire.php','view_partenaires.php','view_espace.php','view_newsletter.php','view_contact.php');
	
	document.getElementById('entete_rubriqueId').innerHTML = titleArray[tabNum];
	loadXMLDoc('txt_rubriqueId','content_' + tabNum + '.php');
}

function startMap(selTab,mapStamp)
{
	//alert(selTab + " " + mapStamp);
	
	// Ask for map - gml page
	if(mapStamp == 'a4m7q67e5eynzphmthzp' || mapStamp == 'fb25tyy7b85wabnymmz4' || mapStamp == 'vx3svsnfv4b9ge5mpmne' || mapStamp == 'abcdq67e5eynzph12345')
	{
		document.getElementById('fleche_rougeId').style.backgroundImage = 'url(../img/fleche_rouge.jpg)';
	
		if(mapStamp == 'a4m7q67e5eynzphmthzp')
			document.getElementById('titre_villeId').style.backgroundImage = 'url(../img/titre_villeurbanne.jpg)';
		if(mapStamp == 'vx3svsnfv4b9ge5mpmne')
			document.getElementById('titre_villeId').style.backgroundImage = 'url(../img/titre_nord_isere.jpg)';
		if(mapStamp == 'fb25tyy7b85wabnymmz4')
			document.getElementById('titre_villeId').style.backgroundImage = 'url(../img/titre_chambery.jpg)';
		if(mapStamp == 'abcdq67e5eynzph12345')
			document.getElementById('titre_villeId').style.backgroundImage = 'url(../img/titre_annecy.jpg)';
	
		loadXMLDoc('mainId','content_0.php?mapstamp=' + mapStamp);
		loadXMLDoc('subnav2Id','subnav.php?mapstamp=' + mapStamp);
	
	}
	else
	{
		document.getElementById('titre_villeId').style.backgroundImage = '';
		document.getElementById('fleche_rougeId').style.backgroundImage = '';
	}
	
	
	// Ask for info - Local page
	if(mapStamp == 'reg01')
	{
		document.getElementById('mainId').style.backgroundColor = '#49a643';
		loadXMLDoc('mainId','reg01.php');
	}
	if(mapStamp == 'pmap')
		loadXMLDoc('mainId','pmap.php');

	if(mapStamp == 'news')
		loadXMLDoc('mainId','news.php');
	
	if(mapStamp == '-')
	{
		oldTab='';
		navigationBar.setTab();
	}
	else
	{
		navigationBar.setTab(0);
	}
	
}
