// JavaScript Document

if (navigator.userAgent.indexOf('Opera') != -1 ) {
document.write('<link rel="stylesheet" type="text/css" href="/css/operahack.css">');
}

if (navigator.userAgent.indexOf("Safari") != -1) {
document.write('<link rel="stylesheet" type="text/css" href="/css/safarihack.css">');
}




// Block News

var mes_news=new Array();

function showHide(id){
	for (var x=0;x<mes_news.length;x++){
		$("news_"+mes_news[x]).style.display="none";	
		$("img_"+mes_news[x]).src="/design/marker_plus.gif";	
	}

	$("news_"+id).style.display="block";
	$("img_"+id).src="/design/marker_minus.gif";
}



var mes_actu=new Array();

function showHide2(id){
	for (var x=0;x<mes_actu.length;x++){
		$("actu_"+mes_actu[x]).style.display="none";	
		$("imga_"+mes_actu[x]).src="/design/marker_plus.gif";	
	}

	$("actu_"+id).style.display="block";
	$("imga_"+id).src="/design/marker_minus.gif";
}

function ex_category_switch(id,id2) {
	document.location.href="?news_cat="+id2;
}


function redir_emplois(obj,value){

	var localisation="";
	var activite="";
	var contrat="";
	var category="";

	var from=obj.parentNode.parentNode.getAttribute("id");

	if (from=="attr_loc_options") {
		if (document.getElementById("attr_loc_options").getElementsByClassName("selected")[0]) {
			localisation=document.getElementById("attr_loc_options").getElementsByClassName("selected")[0].innerHTML;
			if (value=="") localisation="";
		}
	} else localisation=document.getElementById("attr_loc").value;

	if (from=="attr_act_options") {
		if (document.getElementById("attr_act_options").getElementsByClassName("selected")[0]) {
			activite=document.getElementById("attr_act_options").getElementsByClassName("selected")[0].innerHTML;
			if (value=="") activite="";
		}
	} else activite=document.getElementById("attr_act").value;


	if (from=="attr_con_options") {
		if (document.getElementById("attr_con_options").getElementsByClassName("selected")[0]) {
			contrat=document.getElementById("attr_con_options").getElementsByClassName("selected")[0].innerHTML;
			if (value=="") contrat="";
		}
	} else 	contrat=document.getElementById("attr_con").value;

	if (from=="attr_cat_options") {
		if (document.getElementById("attr_cat_options").getElementsByClassName("selected")[0]) {
			category=document.getElementById("attr_cat_options").getElementsByClassName("selected")[0].getAttribute("id");
			if (value=="") category="";
		}
	} else 	category=document.getElementById("attr_cat").value;

	document.location.href="?news_cat="+category+"&attr[localisation]="+localisation+"&attr[type_de_contrat]="+contrat+"&attr[secteur_activite]="+activite;
}

// end block news

function gal_refresh() {
	if ($("scroller").offsetLeft==0) $("left_slider").style.display="none";
	else $("left_slider").style.display="table-cell";
	
	if (Math.abs($("scroller").offsetLeft)>=(max_gal_scroll-200)) $("right_slider").style.display="none";
	else $("right_slider").style.display="table-cell";
}


function load_acc() {

	var bottomAccordion = new Accordion('vertical_container',1);
	if ($("scroller")) setInterval("gal_refresh()",1000);
}

StkFunc(load_acc);

var max_bottom;
var sens=1;

function scroll_bottom() {
	if ($("bottom_slider")) {
		max_bottom=$("bottom_slider").scrollWidth;
		max_bottom=max_bottom-880;
		setInterval("go_scroll_bottom()",50);
	}
}

function go_scroll_bottom() {
	if ($("bottom_slider").scrollLeft>=max_bottom) sens=-1;
	if ($("bottom_slider").scrollLeft<=0) sens=1;	
	$("bottom_slider").scrollLeft=$("bottom_slider").scrollLeft+sens
}


var max_gal_scroll=200;

function move_that_gal(direction) {
	if (Math.abs($("scroller").offsetLeft)%200==0) {
		new Effect.Move($("scroller"),{x: -(direction*200), y: 0, duration: 1, mode:'relative'});

	}
}





StkFunc(scroll_bottom);

function open_light_flash () {

	document.getElementById('overlay').style.display="block";

}


function open_light_contact (myObj) {
	document.getElementById('overlay2').style.display="block";
	document.getElementById('overlaytool2').style.display="block";
	document.getElementById('overlay_inner2').style.display="block";

	document.getElementById('overlay_text').innerHTML=document.getElementById('news_content'+myObj).innerHTML;
	document.getElementById('pageTitleZone').innerHTML=document.getElementById('news_title'+myObj).innerHTML;
 
}


function closebox2() {
	document.getElementById('overlay2').style.display="none";
	document.getElementById('overlaytool2').style.display="none";
	document.getElementById('overlay_inner2').style.display="none";
}



