function index()
{
	loadXMLDoc('menuId','menu.php',0,'GET',menu);
	loadXMLDoc('tetiereId','tetiere_home.php',0,'GET');
	loadXMLDoc('contenuId','home.php',0,'GET',home);
	loadXMLDoc('espace_clientId','espace_client.php',0,'GET',espaceClient);
	loadXMLDoc('sous_menu_produitsId','sous_menu_produits.php',0,'GET',sousMenuProduits);
	document.getElementById('logoId').onmousedown							= startHome;
	document.getElementById('bt_mentionsId').onmousedown			= function()
	{
		loadXMLDoc('contenuId','mentions.php');
	}
}


function home()
{ /*
	document.getElementById('bt_en_savoir_plus_homeId').onmousedown 		= function () { startSplitter(startPresentation)};
	document.getElementById('bt_en_savoir_plus_pres1Id').onmousedown 		= function () { startSplitter(startPresentation,1)};
	document.getElementById('bt_en_savoir_plus_pres2Id').onmousedown 		= function () { startSplitter(startPresentation,2)};
	document.getElementById('bt_en_savoir_plus_pres3Id').onmousedown 		= function () { startSplitter(startPresentation,3)};
	document.getElementById('bt_refId').onmousedown = function () { startSplitter(startReferences)};
	startNavSelect("a_homeId");*/

}

function sousMenuProduits()
{ 
	setHover();
}


function espaceClient() 
{
	goto_login('');
	//document.getElementById('bt_demande_inscriptionId').onmousedown 	= function () { startEspaceClient(); };
	//document.getElementById('bt_ok_testId').onmousedown 		         	= function () { startConnecterEspaceClient(); 	 };
	setHover();
	
}

function goto_login(arg)
{
	loadXMLDoc('result_loginId','../front/login.php'+arg,0,'GET',login,'');
}

function login()
{
	
	if(document.getElementById('form_loginId'))
	{
		document.getElementById('form_loginId').onsubmit = login_submit;
		
		document.getElementById('bt_demande_inscriptionId').onmousedown = function()
		{
			loadXMLDoc('contenuId','../front/inscription.php',0,'GET',inscription);
		}
		
		document.getElementById('bt_mot_de_passe_oubliId').onmousedown = function()
		{
			loadXMLDoc('contenuId','../front/mdp_forget.php',0,'GET',mdp_forget);
		}
		
	}
	else
	{
		document.getElementById('bt_tarifsId').onmousedown = function()
		{
			loadXMLDoc('contenuId','../front/tarifs.php');
		}
		
		document.getElementById('bt_techopId').onmousedown = function()
		{
			loadXMLDoc('contenuId','../front/tecop.php');
		}
	}
	
	
	
	if(document.getElementById('bt_se_deconnecterId'))
	{
		document.getElementById('bt_se_deconnecterId').onmousedown = function()
		{
			loadXMLDoc('result_loginId','../front/login_check.php?unlog=1');
		}
	}
}

function login_submit()
{

	var l = document.getElementById('form_fields_loginId').value;
	var c = document.getElementById('form_fields_passwdId').value;

	loadXMLDoc('result_loginId','../front/login_check.php?login='+ l +'&code=' + c ,0,'GET','','');

	return false;
}

function inscription()
{
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereProduit);
	startStyleContenu ();
	formulaire_ins = new formToDb ('testTable','form_insId','../front/inscription_check.php','result_form_insId','btn_form_ins_okId','champ','champ_erreur');	
}



function startEspaceClient()
{
	loadXMLDoc('contenuId','inscription.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereEspaceClient);

	startStyleContenu ();
	startNavSelect("_");


	setHover();
}
function startConnecterEspaceClient()

{
	loadXMLDoc('espace_clientId','espace_client2.php');
	
	setHover();
}




/* ---------------------------------------  Menu ---------------------------------------  */

function menu() 
{
	
	document.getElementById('bt_accueilId').onmousedown 				= startHome;
	document.getElementById('bt_actuId').onmousedown 			    	= function () {	startActu();};
	document.getElementById('bt_historiqueId').onmousedown 		 	= function () { startHistorique(); 	};
	document.getElementById('bt_activiteId').onmousedown 		 		= function () { startActivite(); };
	document.getElementById('bt_galerie_photosId').onmousedown 	= function () { startGalerie('1','1'); };
	document.getElementById('bt_qualiteId').onmousedown 				= function () { startQualite(); };
	/*document.getElementById('bt_contact_mailId').onmousedown 		= function () { startContactsMail(); };*/
	document.getElementById('bt_contact_carteId').onmousedown 	= function () { startContactsCarte(); };

	document.getElementById('bt_contact_montrougeId').onmousedown 	= function () { startContactsMontrouge(); };
	document.getElementById('bt_contact_creteilId').onmousedown 		= function () { startContactsCreteil(); };	
}

function startNavSelect(funcTarget)
{

	document.getElementById("bt_accueilId").className		 	= "li_1";
	document.getElementById("bt_produitId").className			= "li_1";
	document.getElementById("bt_actuId").className			 	= "li_1";
	document.getElementById("bt_presentationId").className	= "li_1";
	document.getElementById("bt_qualiteId").className	 	 	= "li_1";
	document.getElementById("bt_contactsId").className			= "li_1";

	document.getElementById(funcTarget).className			 = "li_1_on";
}
function startStyleContenu()
{
	document.getElementById('tetiereId').style.height = '152px';
	document.getElementById('pageId').style.padding = '246px 0 0 0';
	document.getElementById('bouId').style.display = 'none';
	
	setHover();
}

function startHome()
{
	loadXMLDoc('contenuId','home.php',0,'GET',home);
	loadXMLDoc('tetiereId','tetiere_home.php');
	document.getElementById('tetiereId').style.height = '284px';
	document.getElementById('pageId').style.padding = '300px 0 0 0';
	document.getElementById('bouId').style.display = 'block';

	startNavSelect("bt_accueilId");
}
function startProduit(pageid)
{ 
	loadXMLDoc('contenuId','produit.php?pageid='+pageid);
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereProduit);
	startStyleContenu ();
	startNavSelect("bt_produitId");
}
function startActu ()
{ 
	loadXMLDoc('contenuId','list_actualite.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereActu);
	startStyleContenu ();
	startNavSelect("bt_actuId");
		
	setHover();

}

function startHistorique()
{ 
	loadXMLDoc('contenuId','historique.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetierePresentation);
	startStyleContenu ();
	startNavSelect("bt_presentationId");

}
function startChiffres()
{ 
	loadXMLDoc('contenuId','chiffres.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetierePresentation);
	startStyleContenu ();
	startNavSelect("bt_presentationId");
}
function startActivite()
{ 
	loadXMLDoc('contenuId','activite.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetierePresentation);
	startStyleContenu ();
	startNavSelect("bt_presentationId");
}
function startGalerie(photocatid,photopage,max)
{ 

		loadXMLDoc('contenuId','gallerie.php?photocatid='+photocatid+'&photopage='+photopage);
		loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetierePresentation);
		startStyleContenu ();
		startNavSelect("bt_presentationId");

}

function startCertification()
{ 
	loadXMLDoc('contenuId','certification.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereQualite);
	startStyleContenu ();
	startNavSelect("bt_qualiteId");
}
function startQualite()
{ 
	loadXMLDoc('contenuId','qualite.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereQualite);
	startStyleContenu ();
	startNavSelect("bt_qualiteId");
}

function startContactsMail()
{
	loadXMLDoc('contenuId','contacts_mail.php');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereContact);
	startStyleContenu ();
	//startNavSelect("bt_contactsId");
}
function startContactsCarte()
{
	loadXMLDoc('contenuId','contacts_carte.php',0/*,'GET',contact_carte*/);
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereContact);
	startStyleContenu ();
	startNavSelect("bt_contactsId");
}
function startContactsMontrouge()
{
	loadXMLDoc('contenuId','contacts_default.php?PAGEID=96&FCKID=98');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereContact);
	startStyleContenu ();
	startNavSelect("bt_contactsId");
}
function startContactsCreteil()
{
	loadXMLDoc('contenuId','contacts_default.php?PAGEID=98&FCKID=104');
	loadXMLDoc('tetiereId','tetiere.php' ,0,'GET',startTetiereContact);
	startStyleContenu ();
	startNavSelect("bt_contactsId");
}



function startTetiereEspaceClient ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_inscription.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}
function startTetiereActu ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_actu.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}
function startTetiereQualite ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_qualite.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}
function startTetiereContact ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_contact.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}
function startTetierePresentation ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_presentation.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}

function startTetiereProduit ()
{
	
	document.getElementById('tetiere2_pageId').style.backgroundImage = 'url(../img/tetiere_produit.jpg)';
	document.getElementById('tetiere2_pageId').style.height = '225px';
	document.getElementById('tetiere2_pageId').style.margin = '15px 0 0 0';

	
}


function setHover()
{
	document.getElementById('bodyId').style.behavior = 'url("csshover.htc")';
}

function goto_ACT(actid)
{
	loadXMLDoc('contenuId','actualite.php?actid='+actid);
}

function loadGamref(prdgamid,num,ligne)
{
	
	loadXMLDoc('table_gamrefId','produit_gammes.php?prdgamid='+prdgamid,0,'GET');
	
	
	for( var i = 0 ; i < 10 ; i++)
	{
		if(document.getElementById('vignette_produit_'+i+'_Id'))
			document.getElementById('vignette_produit_'+i+'_Id').className = "vignette_produit";
	}
	
	if(ligne == 1)
		document.getElementById('vignette_produit_'+num+'_Id').className = "vignette_produit_on";
	else
		document.getElementById('vignette_produit_'+num+'_Id').className = "vignette_produit_on2";

}

function toogleGam(id)
{	
	$('#block_gam_'+id+'_Id').toggle("blind", { direction: "vertical" }, 1000);
}

function displayTab(divId)
{
	el = document.getElementById(divId);
	
	if(el.style.display == 'none')
	{
		el.style.display = '';
		el.state = 'open';
	}
	else
	{
		el.style.display = 'none';
		el.state = 'close';
	}
}

function contact_carte()
{
	var tabArea = document.getElementById('map_carteId').getElementsByTagName('area');
	var str_bt = "";
	for(var i = 0 ; i < tabArea.length ; i++ )
	{
		
		tabArea[i].onmouseover = function()
		{
			
			if(this.on != 1 )
			{
				document.getElementById(this.getAttribute('bt')).style.backgroundPosition='0 -10px';
				document.getElementById(this.getAttribute('bt')).style.height='10px';
			}	
		}
		
		tabArea[i].onmouseout = function()
		{
		
			if(this.on != 1 )
			{                                                 
				document.getElementById(this.getAttribute('bt')).style.backgroundPosition='0 0';
				document.getElementById(this.getAttribute('bt')).style.height='10px';
				
			}
		}
		
	}
}


function activeInter(el,interid)
{
	
	document.getElementById('box_interlocuteurId').style.display = "none";
	loadXMLDoc('box_interlocuteurId','contacts_carte_details.php?i='+interid,0,'GET',displayTab,'box_interlocuteurId');
	
	var tabArea = document.getElementById('map_carteId').getElementsByTagName('area');
	for(var i = 0 ; i < tabArea.length ; i++ )
	{
		tabArea[i].on = 0;
		tabArea[i].onmouseout();
	}
	
	el.on = 1;
	document.getElementById(el.getAttribute('bt')).style.backgroundPosition='0 -19px';
	document.getElementById(el.getAttribute('bt')).style.height = '20px';

	//alert(el.id);

}

