
	var idioma = "";
	var thisEmpresasPage = 0;

	var id_origen = 0;
	var tipo_oferta = 0;
	var id_pais = 0;
	var id_ciudad = 0;
	var id_empresa = 0;


	
	function LoadMap()
	{
		var Map = new SWFObject("flash/map.swf", "Map", "423", "445", "9", "#FFFFFF", true); 
		Map.addParam("rutaSWF", "flash/where_we_are_uk.swf");
		Map.addVariable("rutaSWF", "flash/where_we_are_uk.swf");
		Map.write("Map");
	}
	
	function changeTo(Id)
	{ 
		thisEmpresasPage = 0;
		
		new Ajax.Updater('Empresas','empresas/'+$('thisIdioma').value+'/'+Id+'.aspx');
		
			thisEmpresasPage = Id;
			id_empresa = 0;
			
			ofertasCheck('');
	}
	
	
	
	function centroCheck(Id)
	{
		if($('centro_'+Id).checked) { id_empresa = Id; }
		else { id_empresa = 0; }
		
		for(var Index = 1; Index <= 40; Index ++)
		{ if($('centro_'+Index)) { $('centro_'+Index).checked = false; } }

		if(id_empresa > 0) { $('centro_'+id_empresa).checked = true; }
	}
	
	function ofertasCheck(Id)
	{
		if(Id == '')
		{
			if(thisEmpresasPage > 0)
			{
				$('hdn_ofertasInternshipProgram').value = "false"; $("check_ofertasInternshipProgram").src = 'img/check_off.gif';
				$('hdn_ofertasGraduateProgram').value = "false"; $("check_ofertasGraduateProgram").src = 'img/check_off.gif';
				$('hdn_ofertasMasterProgram').value = "false"; $("check_ofertasMasterProgram").src = 'img/check_off.gif';
				$('hdn_ofertasExperiencedJobs').value = "false"; $("check_ofertasExperiencedJobs").src = 'img/check_off.gif';
			}
		}
		else
		{
			if( $("hdn_"+Id).value == "true" ) { var thisCheck = false; }
			else { var thisCheck = true; }
		
			$('hdn_ofertasInternshipProgram').value = "false"; $("check_ofertasInternshipProgram").src = 'img/check_off.gif';
			$('hdn_ofertasGraduateProgram').value = "false"; $("check_ofertasGraduateProgram").src = 'img/check_off.gif';
			$('hdn_ofertasMasterProgram').value = "false"; $("check_ofertasMasterProgram").src = 'img/check_off.gif';
			$('hdn_ofertasExperiencedJobs').value = "false"; $("check_ofertasExperiencedJobs").src = 'img/check_off.gif';

			if(!thisCheck) { $("hdn_"+Id).value = "false"; $("check_"+Id).src = 'img/check_off.gif'; }
			else { $("hdn_"+Id).value = "true"; $("check_"+Id).src = 'img/check_on.gif'; }
		}
	}


	
	function requestOfertas(Id)
	{
		if(Id == "All") { window.open('https://careers.gcelsa.com/candidato/ofertas/lista_de_ofertas/lista_de_ofertas.asp?id_origen='+gup('id_origen')+'&tipo_oferta=0&id_pais=0&id_ciudad=0&id_empresa='+id_empresa+'&id_idioma='+idioma,'Ofertas','resizable=yes,width=1024,height=768,scrollbars=yes'); }
		else
		{
			tipo_oferta = 0;
			
			if($('hdn_ofertasInternshipProgram').value == "true") { tipo_oferta = 3; }
			if($('hdn_ofertasGraduateProgram').value == "true") { tipo_oferta = 2; }
			if($('hdn_ofertasMasterProgram').value == "true") { tipo_oferta = 4; }
			if($('hdn_ofertasExperiencedJobs').value == "true") { tipo_oferta = 1; }
			
			window.open('https://careers.gcelsa.com/candidato/ofertas/lista_de_ofertas/lista_de_ofertas.asp?id_origen='+gup('id_origen')+'&tipo_oferta='+tipo_oferta+'&id_pais=0&id_ciudad=0&id_empresa='+id_empresa+'&id_idioma='+idioma,'Ofertas','resizable=yes,width=1024,height=768,scrollbars=yes');
		}
	}
	
	
	
	function sendCv()
	{
		/*	_origenId = '47';
		if ( (document.location.href.search('careers.gcelsa.com') > 0) || (document.location.href.search('intranet.gcelsa.com') > 0) ) { _origenId = '46'; }
		
		window.open('https://careers.gcelsa.com/default.asp?id_origen='+_origenId+'&id_empresa='+id_empresa+'&id_idioma='+idioma,'CV','resizable=yes,width=1024,height=768,scrollbars=yes');
		*/
		window.open('https://careers.gcelsa.com/default.asp?id_origen='+gup('id_origen')+'&id_empresa='+id_empresa+'&id_idioma='+idioma,'CV','resizable=yes,width=1024,height=768,scrollbars=yes');
	}
	
	function gup( name )
	{
		name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var results = regex.exec( window.location.href );
		if( results == null )
		return '47';
		else
			return results[1];
}
	
