var defaultHeight = 0;
var defaultTop = 41;
var newHeight = 240;
var newTop = 246;

if (is.ie4comp)
	defaultHeight = 34;
else if (is.ns6comp || is.ns4comp)
	defaultHeight = 38;

function afficherMenuHaut(){
	/*
	fermerMenuGauche();
	box = getElt("menuBox");
	box2 = getElt("menuBox2");
	e = getElt("greenBox");
	c = getElt("centerContent");
	m = getElt("rub_0");
	n = getElt("topnav");
	b = getElt("bottom");
	topb = b.offsetTop ;

	
	if (is.ie4comp)
		tabdiv = n.childNodes;
	else if (is.ns6comp || is.ns4comp)
		tabdiv = n.getElementsByTagName("div");
	
	if (e.style.height == newHeight+'px') {
		e.style.height = defaultHeight+'px';
		c.style.top = defaultTop+'px';
		b.style.top = topb-(newTop-defaultTop)+'px';
		eval("setEltVisibility(box,'visible')");
		eval("setEltVisibility(box2,'visible')");
		eval("setEltVisibility(m,'hidden')");
		for (var i=0;i<tabdiv.length;i++)
		{
			eval("setEltVisibility(tabdiv["+i+"],'hidden')");
		}
		resetMenu();
	}
	else {
		n.style.zIndex = '5';
		e.style.height = newHeight+'px';
		c.style.top = newTop+'px';
		b.style.top = topb+(newTop-defaultTop)+'px';
		eval("setEltVisibility(box,'hidden')");
		eval("setEltVisibility(box2,'hidden')");
		eval("setEltVisibility(m,'visible')");
		reachMenu();
	}
	
	return true;
	*/
}

function afficherMenuGauche(i,j,code){

	box = getElt("menuBox");
	box2 = getElt("menuBox2");
	/*e = getElt("greenBox");*/
	c = getElt("centerContent");
	n = getElt("topnav");
	o = getElt("mgtopnav");
	p = getElt("abovemgtopnav");
	/*b = getElt("bottom");*/
	d = getElt('grub_'+i+'');
	/*topb = b.offsetTop ;*/
	
	if(n)
		resetMenu();
	
	if (is.ie4comp)
	{	
		if (n)
		{
			tabdiv = n.childNodes;
		}
		tabdiv2 = o.childNodes;
	}
	else if (is.ns6comp || is.ns4comp)
	{
		if (n)
		{
			tabdiv = n.getElementsByTagName("div");
		}
		tabdiv2 = o.getElementsByTagName("div");
	}

	/*
	if(e){
		if (e.style.height == newHeight+'px') {
			n.style.zIndex = '0';
			e.style.height = defaultHeight+'px';
			c.style.top = defaultTop+'px';
			b.style.top = topb-(newTop-defaultTop)+'px';
			eval("setEltVisibility(box,'visible')");
			eval("setEltVisibility(box2,'visible')");
			for (var i=0;i<tabdiv2.length;i++)
			{
					eval("setEltVisibility(tabdiv["+i+"],'hidden')");
			}
		}
	}
	*/
	if(p)
	{
		eval("setEltVisibility(p,'visible')");
	}
	if(d)
	{
		gafficherRubrique(i);
	}
	else
		fermerMenuGauche(code)

	return true;
}

function fermerImage(code){

	if (code == 1) {
		if(imag = getElt("VIEDEM")){imag.src = "/charte/accueil_VIEDEM_roll.gif";}
		if(imag = getElt("CONNORV")){imag.src = "/charte/accueil_CONNORV.gif";}
		if(imag = getElt("SERVUSA")){imag.src = "/charte/accueil_SERVUSA.gif";}
		if(imag = getElt("DETENLOI")){imag.src = "/charte/accueil_DETENLOI.gif";}
	}

	else if (code == 2) {
		if(imag = getElt("VIEDEM")){imag.src = "/charte/accueil_VIEDEM.gif";}
		if(imag = getElt("CONNORV")){imag.src = "/charte/accueil_CONNORV_roll.gif";}
		if(imag = getElt("SERVUSA")){imag.src = "/charte/accueil_SERVUSA.gif";}
		if(imag = getElt("DETENLOI")){imag.src = "/charte/accueil_DETENLOI.gif";}
	}

	else if (code == 3) {
		if(imag = getElt("VIEDEM")){imag.src = "/charte/accueil_VIEDEM.gif";}
		if(imag = getElt("CONNORV")){imag.src = "/charte/accueil_CONNORV.gif";}
		if(imag = getElt("SERVUSA")){imag.src = "/charte/accueil_SERVUSA_roll.gif";}
		if(imag = getElt("DETENLOI")){imag.src = "/charte/accueil_DETENLOI.gif";}
	}

	else if (code == 4) {
		if(imag = getElt("VIEDEM")){imag.src = "/charte/accueil_VIEDEM.gif";}
		if(imag = getElt("CONNORV")){imag.src = "/charte/accueil_CONNORV.gif";}
		if(imag = getElt("SERVUSA")){imag.src = "/charte/accueil_SERVUSA.gif";}
		if(imag = getElt("DETENLOI")){imag.src = "/charte/accueil_DETENLOI_roll.gif";}
	}
	
	else {
		if(imag = getElt("VIEDEM")){imag.src = "/charte/accueil_VIEDEM.gif";}
		if(imag = getElt("CONNORV")){imag.src = "/charte/accueil_CONNORV.gif";}
		if(imag = getElt("SERVUSA")){imag.src = "/charte/accueil_SERVUSA.gif";}
		if(imag = getElt("DETENLOI")){imag.src = "/charte/accueil_DETENLOI.gif";}
	}

}

function fermerMenuGauche(code){
	fermerImage(code);
	gresetMenu();
	gmajAffichage();
}


function afficherBottomAccueil(){
	
	hcenter = getElt("centerContent").offsetHeight + 270;
	hgauche = getElt("leftContent").offsetHeight + 270;
	if(getElt("rightContent"))
	{
		hdroite = getElt("rightContent").offsetHeight + 270;
	}
	else
	{
		hdroite = 0;
	}
	
	if(hcenter > hgauche){
		temp=hcenter;
	} else {
		temp=hgauche;
	}
	
	if(hdroite > temp){
		topMax=hdroite;
	} else {
		topMax=temp;
	}
	
	topMax = topMax+15;
	if (topMax<800)
	{
		topMax=800;
	}
	getElt("bottom").style.top = topMax+'px';
	setEltVisibility(getElt("bottom"),'visible');

}

function afficherBottomStd(){
	
	hcenter = getElt("centerContent").offsetHeight + 270;
	hgauche = getElt("leftContent").offsetHeight + 270;
	if(getElt("rightContent"))
	{
		hdroite = getElt("rightContent").offsetHeight + 270;
	}
	else
	{
		hdroite = 0;
	}
	
	if(hcenter > hgauche){
		temp=hcenter;
	} else {
		temp=hgauche;
	}
	
	if(hdroite > temp){
		topMax=hdroite;
	} else {
		topMax=temp;
	}
	
	topMax = topMax+15;
	if (topMax<800)
	{
		topMax=800;
	}
	getElt("bottom").style.top = topMax+'px';
	setEltVisibility(getElt("bottom"),'visible');

}

function changeQuartier() {
	var urlQuartier = window.document.forms["quartier"].selection.options[window.document.forms["quartier"].selection.selectedIndex].value;
	if (urlQuartier != "#") {
		window.location.href=urlQuartier;
	}
}

function afficherQuartier(code) {

switch (code) {
	
	case "1":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier1.gif";
		break;

	case "2":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier2.gif";
		break;

	case "3":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier3.gif";
		break;

	case "4":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier4.gif";
		break;

	case "5":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier5.gif";
		break;

	case "6":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier6.gif";
		break;

	case "7":
		window.document.images["carte_quartier"].src = "/charte/quartier/quartier7.gif";
		break;

	default:
		window.document.images["carte_quartier"].src = "/charte/quartier/carte_accueil.gif";
		break;

	} 

}


function afficherFond(element,code,action){

	fond1 = '#FFFFFF';
	fond2 = '#FFFFFF';
	fond3 = '#FFFFFF';
	fond4 = '#FFFFFF';

	if(code == "1"){
		if(action == "afficher"){
			element.style.backgroundColor = fond1;
		} else if(action == "retablir"){
			element.style.backgroundColor = '#98E096';
		}
	}

	if(code == "2"){
		if(action == "afficher"){
			element.style.backgroundColor = fond2;
		} else if(action == "retablir"){
			element.style.backgroundColor = '#FFBC41';
		}
	}

	if(code == "3"){
		if(action == "afficher"){
			element.style.backgroundColor = fond3;
		} else if(action == "retablir"){
			element.style.backgroundColor = '#6ABEE3';
		}
	}

	if(code == "4"){
		if(action == "afficher"){
			element.style.backgroundColor = fond4;
		} else if(action == "retablir"){
			element.style.backgroundColor = '#FF8952';
		}
	}

}