
function updateStylesheets()
{
	var i,a,s;
	a=document.getElementsByTagName('link');
	for(i=0;i<a.length;i++)
	{
		s=a[i];
		if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href)
		{
	    var h=s.href.replace(/(&|\\?)forceReload=d /,'');
	    s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf());
		}
	}
}

function index(direct)
{
	
	if(direct != '-1' )
		goto_mainBody(direct);
	else
		goto_Home();

	var liste_images = new Array(
		'fond_ecl.gif',
		'fond_met.gif',
		'fond_job.gif',
		'fond_act.gif',
		'fond_faq.gif'
	);
	
	document.image_chargee = new Array();
	for ( i = 0; i < liste_images.length; i++ )
	{
		document.image_chargee[i] = new Image;
		document.image_chargee[i].src = "../img/" + liste_images[i];
	}
}

function goto_headerHome()
{
	loadXMLDoc('headerId','header.php',0,'GET',header,1);
}

function goto_header()
{
	loadXMLDoc('headerId','header.php?nav=1',0,'GET',header,0);
}

function header(home)
{
	if(home)
		starter('',home);
	else
		nav('starter');
		
}

function goto_Home()
{	
	mainColor('home');
	goto_headerHome();
	loadXMLDoc('main_bodyId','home.php',0,'GET',home,'');
}

function goto_mainBody(direct)
{
	goto_header();
	loadXMLDoc('main_bodyId','mainBody.php',0,'GET',main,direct);
}

function home()
{
	
	if(typeof(JobactuTimer) == "number")
		clearInterval(JobactuTimer);

	if(typeof(EclactuTimer) == "number")
		clearInterval(EclactuTimer);
	
	JobactuTimer = setInterval('movebox(\'HOME_JOB_moveBoxId\')',80)
	EclactuTimer = setInterval('movebox(\'HOME_ECL_moveBoxId\')',80)
	
	startFlash();
	goto_homeNwl();
	nav();
}

function movebox(moveBoxId,offsetname)
{
	if(moveBoxEl = document.getElementById(moveBoxId))
	{
		moveBoxStyle = moveBoxEl.style;
		
		minTop = - (moveBoxEl.getAttribute('nbact') * 70);
		
		if( minTop >= 0)
			minTop = 220;
	
		offset = moveBoxEl.getAttribute('offset');
	
		if(offset > minTop)
			offset -= 1;
		else
			offset = 65.00;
	
		moveBoxEl.setAttribute('offset',offset);
	
		moveBoxStyle.top = offset + "px";
	}
	else
	{
		if(typeof(JobactuTimer) == "number")
			clearInterval(JobactuTimer);
	
		if(typeof(EclactuTimer) == "number")
			clearInterval(EclactuTimer);
	}
		
}

function goto_homeNwl()
{
	loadXMLDoc('HOMEtext_news_Id','../front/home_nwl.php',0,'GET',home_nwl,'');
}

function home_nwl()
{

	document.getElementById('form_nwl_OkId').onmousedown = function()
	{
		email = document.getElementById('form_nwl_emailId').value;
		loadXMLDoc('HOMEtext_news_Id','../front/home_nwl_check.php?email='+escape(email),0,'GET','','');
	}
	
	/*
	document.getElementById('to_NWL_001Id').style.cursor = "pointer";
	
	document.getElementById('to_NWL_001Id').onmousedown = function()
	{
		loadXMLDoc('main_bodyId','main_nav.php',0,'GET',main_nav,'home_C,NWL_001');
	}*/
}

function nav(_starter)
{

	if(_starter == "starter")
		starter(0);
	
	document.getElementById("bt_nav_homeId").onmouseover 				= function(){ loadNavTxt(0) };
	document.getElementById("bt_nav_homeId").onmouseout 				= function(){ loadNavTxt(10) };
	//document.getElementById("bt_nav_homeId").onmousedown			= function(){ index('-1') };
	
	document.getElementById("bt_nav_contactId").onmouseover 		= function(){ loadNavTxt(1) };
	document.getElementById("bt_nav_contactId").onmouseout 			= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_contactId").onmousedown 		= function(){ goto_COM_005() };
	
	document.getElementById("bt_nav_planSiteId").onmouseover 		= function(){ loadNavTxt(2) };
	document.getElementById("bt_nav_planSiteId").onmouseout 		= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_planSiteId").onmousedown 		= function(){ goto_COM_003() };
	
	document.getElementById("bt_nav_mentionId").onmouseover 		= function(){ loadNavTxt(3) };
	document.getElementById("bt_nav_mentionId").onmouseout 			= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_mentionId").onmousedown 		= function(){ goto_COM_002() };
	
	document.getElementById("bt_nav_faqId").onmouseover 				= function(){ loadNavTxt(4) };
	document.getElementById("bt_nav_faqId").onmouseout 					= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_faqId").onmousedown 				= function(){ goto_COM_006() };
	
	document.getElementById("bt_nav_abusId").onmouseover 				= function(){ loadNavTxt(5) };
	document.getElementById("bt_nav_abusId").onmouseout 				= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_abusId").onmousedown 				= function(){ goto_COM_008() };
		
	document.getElementById("bt_nav_recommanderId").onmouseover = function(){ loadNavTxt(6) };
	document.getElementById("bt_nav_recommanderId").onmouseout 	= function(){ loadNavTxt(10) };
	document.getElementById("bt_nav_recommanderId").onmousedown = function(){ goto_COM_009() };
	
	document.getElementById("bt_nav_quiId").onmousedown = function(){ goto_COM_007() };
	document.getElementById("bt_nav_baoId").onmousedown = function(){ goto_COM_001() };
	//document.getElementById("bt_nav_homedId").onmousedown = function(){ index('-1') };
}

function starter(_type,home)
{

	if(_type == "ENT")
	{
		loadXMLDoc('logzoneId','deskIdentity_ENT.php',0,'GET');
		if(home)
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_ENT_home.gif)';
		else
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_ENT.gif)';
	}
	else if(_type == "ECL")
	{
		loadXMLDoc('logzoneId','deskIdentity_ECL.php',0,'GET');
		
		if(home)
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_ECL_home.gif)';
		else
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_ECL.gif)';
	}
	else if(_type == "TLT")
	{
		loadXMLDoc('logzoneId','deskIdentity_TLT.php',0,'GET');
		if(home)
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_TLT_home.gif)';
		else
			document.getElementById('logId').style.backgroundImage = 'url(../img/log_TLT.gif)';
	}
	else
	{
		if(home)
		{
			loadXMLDoc('logzoneId','login.php?home=1',0,'GET',login,'');
			document.getElementById('logId').style.backgroundImage = 'url(../img/nolog_home.gif)';
		}
		else
		{
			loadXMLDoc('logzoneId','login.php',0,'GET',login,'');
			document.getElementById('logId').style.backgroundImage = 'url(../img/nolog.gif)';
		}
	}
}

function rollPart(btn)
{
	var i = 1;

	var tabBtn = Array();

	tabBtn[0] = document.getElementById('btPart_1_Id');
	tabBtn[1] = document.getElementById('btPart_2_Id');
	tabBtn[2] = document.getElementById('btPart_3_Id');
	
	if(document.getElementById('btPart_logENT_Id'))
		tabBtn[3] = document.getElementById('btPart_logENT_Id');
	else if(document.getElementById('btPart_logTLT_Id'))
		tabBtn[3] = document.getElementById('btPart_logTLT_Id');
	else if(document.getElementById('btPart_logECL_Id'))
		tabBtn[3] = document.getElementById('btPart_logECL_Id');
	
	for(var i = 0 ; i < tabBtn.length ; i++)
	{
		if(tabBtn[i])
		{
			tabBtn[i].className = "bt_mainBody" ;
		}
	}

	if(btn != 'reset')
	{
		if(document.getElementById(btn))
		{
			document.getElementById(btn).className = "bt_mainBody on";
		}
	}

}

function load_main_colG(type)
{
	if(document.getElementById('main_colG_loadedId'))
	{
		colGIllu(type);
	}
	else
	{
		loadXMLDoc('main_colGId','main_colG.php',0,'GET',colGIllu,type);
	}
}

function load_srh_colG(type)
{
	loadXMLDoc('main_colGId','srh_colG.php?t='+type,0,'GET',srh_colG,type);
}

function load_desk_colG(type)
{
	loadXMLDoc('main_colGId','srh_colG.php?t='+type,0,'GET',colGIllu,type);
}

function load_faq_colG()
{
	loadXMLDoc('main_colGId','faq_colG.php');
}

function load_bao_colG()
{
	loadXMLDoc('main_colGId','bao_colG.php');
}

function colGIllu(type)
{
	img = document.getElementById('col_g_illuId');
	img.src = '../img/'+ type +'_colg_illu.jpg';
	img.style.display = "";
}

function mainColor(type)
{
	main_body = document.getElementById('main_bodyId');
	main_body.style.backgroundImage = 'url(../img/fond_'+ type +'.gif)';
}

function srh_colG(type)
{
	colGIllu(type);
	load_carto();
}

/*/////// Les goto *///////////////
/*
function goto_Home()
{
	loadXMLDoc('mainId','home.php');
}

function goto_mainBody(callback)
{
	loadXMLDoc('main_bodyId','mainBody.php',0,'GET',main,callback);
}

function goto_main(callback)
{
	loadXMLDoc('mainId','main.php',0,'GET',goto_mainBody,callback);
}
*/

function main(callback)
{
	//starter();
	//loadXMLDoc('logzoneId','login.php',0,'GET',login,'');

	var args = callback.split(',');
	
	switch(args[0])
	{
		
		case 'ecl' : 
			args.shift();
			load_main_colG('ecl');
			goto_ECL_1(args.concat());
		break;
		
		case 'met' : 
			args.shift();
			load_main_colG('met');
			goto_MET_1(args.concat());
		break;
		
		case 'job' : 
			args.shift();
			load_main_colG('job');
			goto_JOB_1(args.concat());
		break;
		
		case 'act' : 
			args.shift();
			load_main_colG('act');
			goto_ACT_1(args.concat());
		break;
		
		case 'com' : 
			args.shift();
			eval("goto_COM_00"+args.concat()+"()");
		break;
		
		case 'par' : 
			goto_PAR_001();
		break;
		
		case 'ins' : 
			load_main_colG('job');
			goto_INS_001();
		break;

		case 'TINSOK' : 
			args.shift();
			load_main_colG('job');
			goto_TINS(args.concat());
		break;

		case 'EINSOK' : 
			args.shift();
			load_main_colG('job');
			goto_EINS(args.concat());
		break;

		case 'LOG_003' : 
			load_main_colG('job');
			goto_LOG_003();
		break;

		case 'LOG_002' : 
			load_main_colG('job');
			goto_LOG_002();
		break;

		case 'REC' : 
			args.shift();
			load_main_colG('job');
			goto_REC_001(args.concat());
		break;
		

		case 'SRH' : 
			
			load_main_colG('job');
			
			switch(args[1])
			{
				
				case "ENTREPRISE" :
					goto_SRH_1();
				break;

				case "TALENT" :
					goto_SRH_2();
				break;

				case "JOB" :
					goto_SRH_3();
				break;

				case "FORMATION" :
					goto_SRH_4();
				break;

				default :
					goto_SRH_3();
				break;

			}
		
			
		break;
		
		case 'DESK' :
			args.shift();
			
			if(args[1])
				goto_Desk(args[0],eval(args[1]),args[2]);
			else
				goto_Desk(args[0]);
				
		break;
	
		default : 
			eval(args[0]+"()");
		break;
	}
	
}

function loadNavTxt(i)
{
	if(var_nav[i])
		document.getElementById("navTxtId").innerHTML = var_nav[i];	
	else
		document.getElementById("navTxtId").innerHTML = "";	
	
}

function goto_ECL_1(callback)
{
	rollPart('btPart_1_Id');
	load_main_colG('ecl');
	mainColor('ecl');
	loadXMLDoc('main_contentId','ECL_1.php',0,'GET',ECL_1,'');
}

function goto_MET_1(callback)
{
	
	rollPart('btPart_2_Id');	
	load_main_colG('met');
	mainColor('met');
	
	if(callback)
	{

		callback = new String(callback);

		var args = callback.split(',');
		
		if(args[0] == 'met111')
			goto_MET_1_1_1(args[1]);
		else if(args[0] == 'met11')
			goto_MET_1_1();
		else
			loadXMLDoc('main_contentId','MET_1.php',0,'GET',MET_1,'');
	}
	else
		loadXMLDoc('main_contentId','MET_1.php',0,'GET',MET_1,'');
	
}

function goto_JOB_1(callback)
{
	rollPart('btPart_3_Id');	
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','JOB_1.php',0,'GET',JOB_1,callback);
	
}

function goto_ACT_1(type)
{
	load_main_colG('act');
	mainColor('act');
	loadXMLDoc('main_contentId','ACT_1.php?t='+type,0,'GET',JOB_1,'');
}

function goto_MET_1_1(callback)
{
	loadXMLDoc('main_contentId','MET_1_1.php',0,'GET',MET_1_1,callback);
}

function goto_MET_1_1_1(id)
{
	if(id)
	{
		loadXMLDoc('main_contentId','MET_1_1_1.php?id='+id,0,'POST',MET_1_1_1,id);
	}
}

function goto_SRH_1(rsl)
{
	rollPart('btPart_3_Id');	
	mainColor('job');
	load_srh_colG('srh_ent');
	loadXMLDoc('main_contentId','SRH_1.php',0,'GET',SRH_1,rsl);
}

function goto_SRH_2(rsl)
{
	rollPart('btPart_3_Id');	
	mainColor('job');
	load_srh_colG('srh_tal');
	loadXMLDoc('main_contentId','SRH_2.php',0,'GET',SRH_2,rsl);
}

function goto_SRH_3(rsl)
{
	rollPart('btPart_3_Id');	
	mainColor('job');
	load_srh_colG('srh_emp');
	loadXMLDoc('main_contentId','SRH_3.php',0,'GET',SRH_3,rsl);
}

function goto_SRH_4(rsl)
{
	rollPart('btPart_1_Id');	
	mainColor('ecl');
	load_srh_colG('srh_ecl');
	loadXMLDoc('main_contentId','SRH_4.php',0,'GET',SRH_4,rsl);
}

function goto_COM_002()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		mainColor('act');
		load_main_colG('com');
		loadXMLDoc('main_contentId','COM_002.php');
	}
	else
		goto_mainBody('goto_COM_002');
}

function goto_COM_003()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		mainColor('act');
		load_main_colG('com');
		loadXMLDoc('main_contentId','COM_003.php');
	}
	else
		goto_mainBody('goto_COM_003');	
}

function goto_COM_005()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		load_main_colG('com');
		mainColor('act');
		loadXMLDoc('main_contentId','COM_005.php',0,'GET',COM_005,'');
	}
	else
		goto_mainBody('goto_COM_005');
}

function goto_COM_006()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		mainColor('faq');
		load_faq_colG('faq');
		loadFAQ(0,3);
	}
	else
		goto_mainBody('goto_COM_006');	
}

function goto_COM_008()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		load_main_colG('com');
		mainColor('act');
		loadXMLDoc('main_contentId','COM_008.php',0,'GET',COM_008,'');
	}
	else
		goto_mainBody('goto_COM_008');	
}

function goto_COM_009()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		load_main_colG('com');
		mainColor('act');
		loadXMLDoc('main_contentId','COM_009.php',0,'GET',COM_009,'');
	}
	else
		goto_mainBody('goto_COM_009');	
}

function goto_COM_007()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		load_main_colG('com');
		mainColor('act');
		loadXMLDoc('main_contentId','COM_007.php');
	}
	else
		goto_mainBody('goto_COM_007');	
}

function goto_COM_001()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		load_bao_colG();
		mainColor('faq');
		loadBAO(0,7);
	}
	else
		goto_mainBody('goto_COM_001');	
}

function goto_PAR_001()
{
	if(document.getElementById('main_contentId'))
	{
		rollPart('reset');
		mainColor('act');
		loadXMLDoc('main_contentId','PAR_001.php');
	}
	else
		goto_mainBody('goto_PAR_001');	
}

function goto_INS_001()
{
	rollPart('btPart_3_Id');	
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','INS_001.php',0,'GET',INS_001,'');
}

function goto_TINS(arg)
{
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','TINS.php?t='+arg,0,'GET');
}

function goto_EINS(arg)
{
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','EINS.php?t='+arg,0,'GET');
}

function goto_LOG_002()
{
	rollPart('reset');	
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','LOG_002.php',0,'GET',LOG_002,'');
}

function goto_LOG_003()
{
	rollPart('reset');	
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','LOG_003.php',0,'GET',LOG_003,'');
}

function goto_REC_001(arg)
{
	rollPart('reset');	
	load_main_colG('job');
	mainColor('job');
	loadXMLDoc('main_contentId','REC_001.php?tsamp='+arg,0,'GET',REC_001,'');
}

/*//////////////////////////////////////////*/
/*/////// fonction de page *////////////////*/
/*//////////////////////////////////////////*/


function login()
{
	if(document.getElementById('form_loginId'))
	{
		formulaireLogin = new formToDb ('testTable','form_loginId','../front/form_check.php','logzoneId','form_login_submitId','form_select','form_error');
	}
}

/*/////////// INS_001 //////////////*/

function INS_001()
{
	form_tins001 = new formToDb ('testTable','form_tins001Id','../front/TINS_001_check.php','tins001_contentId','form_tins001_btnOkId','form_select','form_error');
	form_eins001 = new formToDb ('testTable','form_eins001Id','../front/EINS_001_check.php','eins001_contentId','form_eins001_btnOkId','form_select','form_error');
}


/*/////////// LOG_002 //////////////*/

function LOG_002()
{
	form_log002 = new formToDb ('testTable','form_log002Id','../front/LOG_002_check.php','form_log002_resultId','log_002_okId','form_select','form_error');
}

/*/////////// LOG_003 //////////////*/

function LOG_003()
{
	form_log003 = new formToDb ('testTable','form_log003Id','../front/LOG_003_check.php','form_log003_resultId','log_003_okId','form_select','form_error');
}


/*/////////// REC_001 //////////////*/

function REC_001()
{
	form_rec001 = new formToDb ('testTable','form_rec001Id','../front/REC_001_check.php','form_rec001_resultId','form_rec_001_okId','form_select','form_error');
}

/*/////////// ECL //////////////*/

function ECL_1()
{
	
}

/*/////////// MET //////////////*/

function MET_1()
{
	document.getElementById('bt_baseMetierId').onmousedown = goto_MET_1_1;
	//document.getElementById('bt_baseMetierId').onmousedown = function(){goto_MET_1_1('')};
}

function MET_1_1(callback)
{
	
	bt_listing 	= document.getElementById('met_bt_listingId');
	bt_listing.nivid = 0;
	
	args = callback.split(',');
	
	if(args.length != '')
		loadMetNiv2(args[0],args[1],args[2]);
	
}

function MET_1_1_1(id)
{
	loadFiches('met','add','MET_1_1_selectId',id);
}

function loadMetNiv2(numLigne,nbLignes,id)
{
	
	for(i = 0 ;  i < nbLignes ; i++ ){
		ligne = document.getElementById('MET_1_1_colg_ligne_'+i+'_Id');
		if(ligne)
			ligne.className = "";
	}

	ligne = document.getElementById('MET_1_1_colg_ligne_'+numLigne+'_Id');
	ligne.className = "on";
	
	bt_listing 	= document.getElementById('met_bt_listingId');
	bt_listing.nivid = id;
	bt_listing.style.display = "";
	
	goto_MetNiv2(id);
	switchInfoListing('1',id);
}

function goto_MetNiv2(id)
{
	loadXMLDoc('MET_1_1_cold_contentId','MET_1_1_niv2.php?id='+id);
}


/*/////////// JOB //////////////*/

function COM_005()
{
	form_com_005 = new formToDb ('testTable','com005_formId','COM_005_check.php','COM_005_resultId','COM_005_OkId','form_select','form_error');
}

function loadFAQ(num,up)
{
	
	for(var i = 0 ; i < 20 ; i++)
	{
		if(el = document.getElementById('bt_faq_'+ i + '_Id'))
			el.className = "bt_faq";
	}
	
	if(el = document.getElementById('bt_faq_'+ num + '_Id'))
			el.className = "bt_faq on";
	
	loadXMLDoc('main_contentId','COM_006.php?up='+up);
}

function loadBAO(num,up)
{
	
	for(var i = 0 ; i < 20 ; i++)
	{
		if(el = document.getElementById('bt_bao_'+ i + '_Id'))
			el.className = "bt_faq";
	}
	
	if(el = document.getElementById('bt_bao_'+ num + '_Id'))
			el.className = "bt_faq on";
	
	loadXMLDoc('main_contentId','COM_001.php?up='+up);
}

function COM_008()
{
	form_com_008 = new formToDb ('testTable','com008_formId','COM_008_check.php','COM_008_resultId','COM_008_OkId','form_select','form_error');
}

function COM_009()
{
	form_com_009 = new formToDb ('testTable','com009_formId','COM_009_check.php','COM_009_resultId','COM_009_OkId','form_select','form_error');
}

/*/////////// JOB //////////////*/

function JOB_1(callback)
{
	if(callback)
	{
		calltest = new String(callback);
		var args = calltest.split(',');
		
		switch(args[0])
		{
			case "TLT" :
				popupTal(args[1]);
			break;

			case "EMP" :
				popupEmp(args[1]);
			break;
		}
	}
}

/*/////////// SRH //////////////*/

function SRH_1(rsl)
{
	loadingSearch();
	loadSearch('ent',1);
	
	if(rsl == 1)
	{
		loadSearchCarto('ent');
		switchSrhPanel('rsl')
	}

	goto_SrhSaNiv2(0);

	AGTformulaire = new formToDb ('testTable','form_agtId','../front/AGT_check.php','result_agtId','bt_agtOKId');

}

function SRH_2(rsl)
{
	loadingSearch();
	loadSearch('tal',1);
	
	if(rsl == 1)
	{
		loadSearchCarto('tal');
		switchSrhPanel('rsl')
	}

	goto_SrhMetNiv2('tal',0);
	goto_SrhCompNiv2(0);
	AGTformulaire = new formToDb ('testTable','form_agtId','../front/AGT_check.php','result_agtId','bt_agtOKId');

}

function SRH_3(rsl)
{
	loadingSearch();
	loadSearch('emp',1);
	
	if(rsl == 1)
	{
		loadSearchCarto('emp');
		switchSrhPanel('rsl')
	}

	goto_SrhMetNiv2('emp',0);
	AGTformulaire = new formToDb ('testTable','form_agtId','../front/AGT_check.php','result_agtId','bt_agtOKId');

}

function SRH_4(rsl)
{
	loadingSearch();
	loadSearch('ecl',1);
	
	if(rsl == 1)
	{
		loadSearchCarto('ecl');
		switchSrhPanel('rsl')
	}

	goto_SrhMetNiv2('ecl',0);
	AGTformulaire = new formToDb ('testTable','form_agtId','../front/AGT_check.php','result_agtId','bt_agtOKId');

}

function loadEntMetNiv2(type,numLigne,nbLignes,id)
{

	for(i = 0 ;  i < nbLignes ; i++ ){
		ligne = document.getElementById('ent_met_ligne_' + i + '_Id');
		if(ligne)
			ligne.className = "";
	}

	ligne = document.getElementById('ent_met_ligne_' + numLigne + '_Id');
	ligne.className = "on";
	
	//bt_listing 	= document.getElementById('met_bt_listingId');
	//bt_listing.nivid = id;
	//bt_listing.style.display = "";
	
	goto_EntMetNiv2(type,id);        
	//switchInfoListing('1',id);
}

function loadSrhMetNiv2(type,numLigne,nbLignes,id)
{

	bt_listing 	= document.getElementById('bt_met_listingId');
	bt_listing.nivid = id;
	bt_listing.style.display = "";

	for(i = 0 ;  i < nbLignes ; i++ ){
		ligne = document.getElementById('srh_met_ligne_' + i + '_Id');
		if(ligne)
			ligne.className = "";
	}

	ligne = document.getElementById('srh_met_ligne_' + numLigne + '_Id');
	ligne.className = "on";
	
	//bt_listing 	= document.getElementById('met_bt_listingId');
	//bt_listing.nivid = id;
	//bt_listing.style.display = "";
	
	goto_SrhMetNiv2(type,id);        
	//switchInfoListing('1',id);
}

function loadSrhCompNiv2(numLigne,nbLignes,id)
{

	bt_listing 	= document.getElementById('bt_comp_listingId');
	bt_listing.nivid = id;
	bt_listing.style.display = "";
	
	for(i = 0 ;  i < nbLignes ; i++ ){
		ligne = document.getElementById('srh_comp_ligne_' + i + '_Id');
		if(ligne)
			ligne.className = "";
	}

	ligne = document.getElementById('srh_comp_ligne_' + numLigne + '_Id');
	ligne.className = "on";
	
	//bt_listing 	= document.getElementById('met_bt_listingId');
	//bt_listing.nivid = id;
	//bt_listing.style.display = "";
	
	goto_SrhCompNiv2(id);        
	//switchInfoListing('1',id);
}


function loadSrhSaNiv2(numLigne,nbLignes,id)
{
	
	bt_listing 	= document.getElementById('bt_sa_listingId');
	bt_listing.nivid = id;
	bt_listing.style.display = "";

	//document.getElementById('bt_sa_listingId').style.display = "";
	//document.getElementById('bt_sa_listingId').nivid = id;
	
	for(i = 0 ;  i < nbLignes ; i++ ){
		ligne = document.getElementById('srh_sa_ligne_' + i + '_Id');
		if(ligne)
			ligne.className = "";
	}

	ligne = document.getElementById('srh_sa_ligne_' + numLigne + '_Id');
	ligne.className = "on";
	
	//bt_listing 	= document.getElementById('met_bt_listingId');
	//bt_listing.nivid = id;
	//bt_listing.style.display = "";
	
	goto_SrhSaNiv2(id);
}

function goto_SrhMetNiv2(type,id)
{
	loadXMLDoc('srh_met_coldId','SRH_met_niv2.php?type=' + type + '&id=' + id);
}
function goto_EntMetNiv2(type,id)
{
	loadXMLDoc('ent_met_coldId','ENT_met_niv2.php?type=' + type + '&id=' + id);
}

function goto_SrhCompNiv2(id)
{
	loadXMLDoc('srh_comp_coldId','SRH_comp_niv2.php?id=' + id);
}

function goto_SrhSaNiv2(id)
{
	loadXMLDoc('srh_sa_coldId','SRH_sa_niv2.php?id='+id);
}

function sendField(type,varname,value)
{
	if(value != "" && value != "undefined")
	{
		loadingSearch();
		loadXMLDoc('srh_resultId','SRH_check.php?a=ajout&t=' + type + '&varname=' + varname + '&value=' +  value,0,'POST');
	}
}

function sendEntField(type,varname)
{
	loadingSearch();
	loadXMLDoc('srh_criteres_contentId','ent_panier.php?a=ajout&varname=' + varname,0,'POST');
}

function sendFieldById(type,varname,id)
{
	
	el = document.getElementById(id);
	value = el.value;
	
	if(value != "" && value != "undefined")
	{
			loadingSearch();
			loadXMLDoc('srh_resultId','SRH_check.php?a=ajout&t=' + type + '&varname=' + varname + '&value=' +  value,0,'POST');
	}
}



function updateStarField(args)
{
	
	//alert(args);
	argsTab = args.split(',');

	var el;
	if(el = document.getElementById(argsTab[3]))
	{
		loading('rsl_contentId',1);
		
		value = el.value;
		
   	loadXMLDoc('srh_resultId','SRH_check.php?a=update&t=' + argsTab[0] + '&varname=' + argsTab[1] + '&varname2=' + argsTab[2] + '&value=' + value ,0,'POST');
	}

}

function updateEntField(args)
{
	
	//alert(args);
	argsTab = args.split(',');

	var el;
	if(el = document.getElementById(argsTab[3]))
	{
		value = el.value;
		loadXMLDoc('ent_resultId','ent_updateField.php?varname=' + argsTab[2] + '&value=' + value ,0,'POST');
	}

}


function delField(type,varname,varname2)
{

	loadingSearch();

	//alert('type-> ' + type + ' | varname -> ' + varname + ' | varname2 -> ' + varname2);
	loadXMLDoc('srh_resultId','SRH_check.php?a=del&t=' + type + '&varname=' + varname + '&varname2=' + varname2 ,0,'POST');
}

function delEntField(varname)
{
	loadingSearch();
	loadXMLDoc('srh_criteres_contentId','ent_panier.php?a=delete&varname=' + varname,0,'POST');
}

function loading(id,center)
{
	var el;
	
	if(el = document.getElementById(id))
	{
		if(center == 1)
			el.innerHTML = '<div style="text-align:center;padding:10px;"><img src="../img/ico_waiting.gif" border="0"></div>';
		else
			el.innerHTML = '<img src="../img/ico_waiting.gif" border="0">';
	}
}

function loadingSearch()
{
	loading('srh_criteres_contentId',1);
	loading('srh_nbResultatsId');
	loading('rsl_contentId',1);
}

function loadPanier(type)
{
	loadXMLDoc('srh_criteres_contentId','SRH_panier.php?t='+type,0,'GET');
}

function loadSearch(type,panier)
{
	
	if(panier == 1)
	{
		loadXMLDoc('srh_resultId','SRH_check.php?a=search&t=' + type,0,'POST',loadPanier,type);
		application.clearMap();
	}
	else
		loadXMLDoc('srh_resultId','SRH_check.php?a=search&t=' + type,0,'POST');
}

function loadSearchCarto(type)
{
	loadXMLDoc('srh_resultId','SRH_check.php?a=carto&t=' + type,0,'POST');
}

function searchSendResult(type,count)
{ 
	document.getElementById('srh_nbResultatsId').innerHTML = count;
	goto_RSL(type,0,0,0);
}

function loadNbResult(type)
{
	document.getElementById('srh_nbResultatsId').innerHTML = count;
}

function goto_RSL(type,limit1,limit2,num)
{
	loadXMLDoc('rsl_contentId','RSL_' + type + '.php?limit1='+ limit1 +'&limit2='+ limit2 + '&num=' +num,0,'GET');
}

function searchViewResult(type,count)
{
	loadXMLDoc('rsl_contentId','RSL_result.php');
}

function rollSrh(btn)
{
	var i = 1;

	var tabBtn = Array();

	tabBtn[0] = document.getElementById('srh_bt_rechercheId');
	tabBtn[1] = document.getElementById('srh_bt_resultatsId');
	tabBtn[2] = document.getElementById('srh_bt_ficheId');
	
	for(var i = 0 ; i < tabBtn.length ; i++)
	{
		tabBtn[i].className = "" ;
	}

	if(btn != 'reset')
	{
		if(document.getElementById(btn))
		{
			document.getElementById(btn).className = "on";
		}
	}

}

function switchSrhPanel(type)
{
	
	switch(type)
	{
		case 'srh' :
			rollSrh('srh_bt_rechercheId');
			document.getElementById('rsl_contentId').style.display = "none";
			document.getElementById('fch_contentId').style.display = "none";
			document.getElementById('srh_contentId').style.display = "";
		break;
		
		case 'rsl' :
			rollSrh('srh_bt_resultatsId');
			document.getElementById('fch_contentId').style.display = "none";
			document.getElementById('srh_contentId').style.display = "none";
			document.getElementById('rsl_contentId').style.display = "";
		break;
		
		case 'fch' :
			rollSrh('srh_bt_ficheId');
			document.getElementById('srh_contentId').style.display = "none";
			document.getElementById('rsl_contentId').style.display = "none";
			document.getElementById('fch_contentId').style.display = "";
		break;
	}
}

function previsuEnt(limit1,limit2,num)
{
	
	//alert("limit1 "+limit1+" limit2 "+limit2+" num "+num);
	
	start = parseInt(limit1);
	end = parseInt(limit2);
	
	//str = "";
	for(i = start ; i < end ; i++)
	{
		//str += i+" ";
		if(a = document.getElementById('rsl_ligne_'+ i +'_Id'))
			a.className = "rsl_ligne";
	}
	
	//alert(str);
	
	if(a = document.getElementById('rsl_ligne_'+ num +'_Id'))
		a.className = "rsl_ligne on";
	
	loadXMLDoc('rsl_previsuId','RSL_ent_previsu.php?limit1=' + limit1 + '&limit2=' + limit2 + '&num=' + num);
	
}

function previsuTal(limit1,limit2,num)
{
	if(typeof(talprevisuTimer) != "undefined")
		talprevisuTimer = clearInterval(talprevisuTimer);
	
	//alert("limit1 "+limit1+" limit2 "+limit2+" num "+num);
	
	start = parseInt(limit1);
	end = parseInt(limit2);
	
	//str = "";
	for(i = start ; i < end ; i++)
	{
		//str += i+" ";
		if(a = document.getElementById('rsl_ligne_'+ i +'_Id'))
			a.className = "rsl_ligne";
	}
	
	//alert(str);
	
	if(a = document.getElementById('rsl_ligne_'+ num +'_Id'))
		a.className = "rsl_ligne on";
	
	talprevisuIndex = 1;
	loadXMLDoc('rsl_previsuId','RSL_tal_previsu.php?limit1=' + limit1 + '&limit2=' + limit2 + '&num=' + num);
	
}

function previsuEmp(limit1,limit2,num)
{
	
	//alert("limit1 "+limit1+" limit2 "+limit2+" num "+num);
	
	start = parseInt(limit1);
	end = parseInt(limit2);
	
	//str = "";
	for(i = start ; i < end ; i++)
	{
		//str += i+" ";
		if(a = document.getElementById('rsl_ligne_'+ i +'_Id'))
			a.className = "rsl_ligne";
	}
	
	//alert(str);
	
	if(a = document.getElementById('rsl_ligne_'+ num +'_Id'))
		a.className = "rsl_ligne on";
	
	loadXMLDoc('rsl_previsuId','RSL_emp_previsu.php?limit1=' + limit1 + '&limit2=' + limit2 + '&num=' + num);
	
}

function previsuEcl(limit1,limit2,num)
{
	
	//alert("limit1 "+limit1+" limit2 "+limit2+" num "+num);
	
	start = parseInt(limit1);
	end = parseInt(limit2);
	
	//str = "";
	for(i = start ; i < end ; i++)
	{
		//str += i+" ";
		if(a = document.getElementById('rsl_ligne_'+ i +'_Id'))
			a.className = "rsl_ligne";
	}
	
	//alert(str);
	
	if(a = document.getElementById('rsl_ligne_'+ num +'_Id'))
		a.className = "rsl_ligne on";
	
	loadXMLDoc('rsl_previsuId','RSL_ecl_previsu.php?limit1=' + limit1 + '&limit2=' + limit2 + '&num=' + num);
	
}

function goto_ENT_1(entid)
{
	if(entid)
	{
		
		if(application.marker['ent'+entid+'Id'])
			application.markerView('ent'+entid+'Id');
			
		loading('fch_contentId',1);
		loadXMLDoc('fch_contentId','ENT_1.php?id=' + entid,0,'POST',ENT_1,entid);
		switchSrhPanel('fch');
		toggle_map('petit');
	}
	
}

function ENT_1(id)
{
	loadFiches('ent','add','fch_selectId',id);
}

function srhUpdateNiv(type,varname,value)
{
	loadXMLDoc('srh_resultId','srh_updateNiv.php?type=' + type + '&varname='+ varname + '&value='+ value ,0,'POST');
}

function entUpdateNiv(type,varname,value)
{
	loadXMLDoc('ent_resultId','ent_updateNiv.php?type=' + type + '&varname='+ varname + '&value='+ value ,0,'POST');
}
 
function goto_TAL_1(id,addrid)
{	
	if(id)
	{
		if(addrid)
			application.markerView('taladdr'+addrid+'Id');
		
		loading('fch_contentId',1);
		loadXMLDoc('fch_contentId','TAL_1.php?id=' + id,0,'POST',TAL_1,id);
		switchSrhPanel('fch');
		toggle_map('petit');
	}
}
 
function TAL_1(id)
{
	if(document.getElementById('tal_1_starId'))
	{
		loadXMLDoc('tal_1_starId','star_niv0.php?lnktable=lnktalmet&mod=show&typetable=tal&id='+ id +'&formid=SRH_2_star_formId',0,'GET');
		loadXMLDoc('tal_1_starCompId','starcomp_niv0.php?lnktable=lnktalcomp&mod=show&typetable=tal&id=' + id + '&formid=form2Id',0,'GET');
	}
	
	if(document.getElementById('form_tal001Id'))
	{
		form_tlt001 = new formToDb ('testTable','form_tal001Id','TAL_1_check.php','tal_1_formId','form_tal1_btnOkId','form_select','form_error');
	}
	
	loadFiches('tal','add','fch_selectId',id);
	
}

function talPrevisuSlide(imgId,tab)
{
	
	if(talprevisuIndex >= tab.length - 1)
		talprevisuIndex = 0;
			
	if(img = document.getElementById(imgId))
	{
		img.src = tab[talprevisuIndex++];
	}
}

function goto_EMP_1(id)
{
	if(id)
	{
		
		if(application.marker['emp'+id+'Id'])
			application.markerView('emp'+id+'Id');

		loading('fch_contentId',1);
		loadXMLDoc('fch_contentId','EMP_1.php?id=' + id,0,'POST',EMP_1,id);
		switchSrhPanel('fch');
		toggle_map('petit');
	}
} 
 
function EMP_1(id)
{
	if(document.getElementById('emp_1_starId'))
	{
		loadXMLDoc('emp_1_starId','star_niv0.php?lnktable=lnkempmet&mod=show&typetable=emp&id='+ id +'&formid=SRH_2_star_formId',0,'GET');
	}


	if(document.getElementById("[insert][lnktalempmotiv]"))
	{
		empFCK = new FCKeditor("[insert][lnktalempmotiv]");
		empFCK.BasePath = "../fckLight/" ;
		empFCK.ReplaceTextarea();
		/*div.innerHTML = empFCK.CreateHtml("eh eh");*/
	}
	
	if(document.getElementById('form_lnktalempId'))
		EMP001formulaire = new formToDb ('testTable','form_lnktalempId','../front/EMP_001_check.php','postulId','bt_lnktalempOkId','form_select','form_error');

	loadFiches('emp','add','fch_selectId',id);


}

function loadTallet(elId)
{
	var f = FCKeditorAPI.GetInstance('[insert][lnktalempmotiv]') ;
	
	if(el = document.getElementById(elId))
	{
		if(el.options[el.selectedIndex].value != 0 )
		{
			f.SetHTML(el.options[el.selectedIndex].value);
		}
	}
}

function goto_ECL_1_fiche(id)
{
	if(id)
	{
		
		if(application.marker['ecl'+id+'Id'])
			application.markerView('ecl'+id+'Id');
			
		loading('fch_contentId',1);
		loadXMLDoc('fch_contentId','ECL_1_fiche.php?id=' + id,0,'POST',ECL_1_fiche,id);
		switchSrhPanel('fch');
		toggle_map('petit');
		
	}
}
 
function ECL_1_fiche(id)
{
	loadFiches('ecl','add','fch_selectId',id);
}

/*/////// Divers fonction *///////////////

function switchInfoListing(type,id)
{
	bt_info 		= document.getElementById('met_bt_infoId');
	bt_listing 	= document.getElementById('met_bt_listingId');
	
	if(type == 0)
	{
		bt_info.className = "on";
		bt_listing.className = "";
		goto_MetNiv2('');
	}
	else
	{
		bt_info.className = "";
		bt_listing.className = "on";
		goto_MetNiv2(id);
	}
}

function switchInfoListing_Sa(type,id)
{
	bt_info 		= document.getElementById('bt_sa_infoId');
	bt_listing 	= document.getElementById('bt_sa_listingId');
	
	if(type == 0)
	{
		bt_info.className = "information on";
		bt_listing.className = "srh_bt_listing";
		goto_SrhSaNiv2('');
	}
	else
	{
		bt_info.className = "information";
		bt_listing.className = "srh_bt_listing on";
		goto_SrhSaNiv2(id);
	}
}

function switchInfoListing_Met(type,etat,id)
{
	bt_info 		= document.getElementById('bt_met_infoId');
	bt_listing 	= document.getElementById('bt_met_listingId');
	
	if(etat == 0)
	{
		bt_info.className = "information on";
		bt_listing.className = "srh_bt_listing";
		goto_SrhMetNiv2(type,'0');
	}
	else
	{
		bt_info.className = "information";
		bt_listing.className = "srh_bt_listing on";
		goto_SrhMetNiv2(type,id);
	}
}

function switchInfoListing_Comp(etat,id)
{
	bt_info 		= document.getElementById('bt_comp_infoId');
	bt_listing 	= document.getElementById('bt_comp_listingId');
	
	if(etat == 0)
	{
		bt_info.className = "information on";
		bt_listing.className = "srh_bt_listing";
		goto_SrhCompNiv2('0');
	}
	else
	{
		bt_info.className = "information";
		bt_listing.className = "srh_bt_listing on";
		goto_SrhCompNiv2(id);
	}
}
function filtreMetiers(type)
{
	loadXMLDoc('MET_1_1_filtre_resultId','MET_1_1_filtre_check.php?type='+type);
}

function load_carto()
{
	application = new GISResult('srh_colG_mapId',45.77518618352103,4.8284912109375,'7');
}

function toggle_map(force)
{
	mapZone = document.getElementById('srh_colG_mapId');
	tirette = document.getElementById('srh_mapZone_tiretteId');
	
	if(mapZone.style.width != '717px' && force != "petit")
	{
		mapZone.style.width = '717px';
		tirette.className = "on";
		application.map.panDirection(4.9,0);
		application.map.checkResize();
	}
	else
	{
		mapZone.style.width = '165px';
		tirette.className = "";
		application.map.panDirection(-1.2,0);
		application.map.checkResize();
	}
}


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

function popupTal(id)
{
	GB_showCenter('Fiche Talent','../front/fiche_loader2.php?type=TAL_1&id='+ id, 1000, 800);
}

function popupEmp(id)
{
	GB_showCenter('Fiche Emploi','../front/fiche_loader2.php?type=EMP_1&id='+ id, 1000, 780);
}

function popupEnt(id)
{
	GB_showCenter('Fiche Entreprise','../front/fiche_loader2.php?type=ENT_1&id='+ id, 1000, 780);
}

function popupEcl(id,desk)
{
	GB_showCenter('Fiche École','../front/fiche_loader2.php?type=ECL_1_fiche&id='+ id + '&desk=' + desk, 1000, 780);
}

function popupMet(id)
{
	GB_showCenter('Fiche Métier','../front/fiche_loader2.php?type=MET_1_1_1&id='+ id, 1000, 780);
}

function popupNewOffre()
{
	GB_showCenter('Nouvelle Offre','../front/popup_newOffre.php', 300, 300);
}

function loadFiches(type,action,divId,id)
{
	if(document.getElementById(divId))
	{
		loadXMLDoc(divId,'../front/lastFiches_check.php?type='+ type +'&action='+ action +'&id='+ id,0,'POST');
	}
}

function srhLoader(metid,home)
{
	loadXMLDoc('srhLoader_resultId','../front/SRH_loader.php?home='+ home +'&metid='+ metid,0,'GET');
}

function agtLoader(agttable,agtid)
{
	loadXMLDoc('agtLoader_resultId','../front/AGT_loader.php?home='+ home +'&' + agttable + 'id='+ agtid,0,'GET');
}