

nv_cont = 0; nv_coul = 0; nv_title = 0; rx = 0; ry = 0; nv_url = 0; url_curr = 0; url_prec = 0; nv_h = 0; nv_s = 0; nv_c = 0;



if(url_start == ""){
	

	//alert("session expiree");
	window.location.href="/site/page/cnsad"

	}




function pageView(n){

	url_prec = url_curr;
	url_curr = n;

	src = n;

	
	top.frames['ifram'].location.href = src;	
}




// onload au niveau TOP


function displFromTop(){

//top.document.title.text = "cc"
//alert(nv_title2.text)

// changement de couleur

	//alert(nv_c)
	c = "#980000";
	switch(nv_c){
	
		case "palette1.css" : c = "#00545B"; break;
		case "palette2.css" : c = "#143d5a"; break;
		case "palette3.css" : c = "#322369"; break;
		case "palette4.css" : c = "#820626"; break;
		case "palette5.css" : c = "#980000"; break;
		case "palette6.css" : c = "#71333f"; break;
		case "palette7.css" : c = "#5D3928"; break;
		case "palette8.css" : c = "#4e3914"; break;
		case "palette9.css" : c = "#9F2D20";
	
	}



	document.getElementById('contenu').style.backgroundColor = c;

	zone = document.getElementById('zoneContenu');

	//page = document.getElementById('contenuPage');
	
	cibl = document.getElementById('droite');
	
	if(nv_s == "e"){
	
		cibl.className = "entete"
	
	}
	
	

// gestion de la hauteur de la boite du contenu

	if(nv_h < 590){
	
		document.getElementById('droite').style.height = "590px";
	
	}

// affichage du contenu

	cibl.innerHTML = nv_cont.innerHTML;


// gestion de la hauteur de la boite du contenu

	ht = 0; ps = 0;

	if(top.nv_s == "n"){

		ht = document.getElementById('texte').offsetHeight;
		document.getElementById('droite').className = "";
		document.getElementById('droite').style.backgroundImage = "none";

		ps = document.getElementById('droite').getElementsByTagName('p').item(document.getElementById('droite').getElementsByTagName('p').length-1);


	}
	
	
	if(ht > 590){
	
		document.getElementById('droite').style.height = "auto";
	
		if(ps!=0){ps.style.display = "block"}

	}
	
	else{

	document.getElementById('droite').style.height = "590px";	
	
	if(ps!=0){ps.style.display = "none"}
	

		if(top.nv_s == "n"){	
	
			document.getElementById('texte').style.height = "550px";	
		
		}
		
	}


if(document.getElementById('divPhotos')!= null){

document.getElementById('droite').style.height = "auto";
document.getElementById('texte').style.height = "auto";
document.getElementById('droite').getElementsByTagName('p').item(document.getElementById('droite').getElementsByTagName('p').length-1).style.display = "block";


}

		
// changement du titre		
		
	document.title = nv_title; 
	
	document.getElementsByTagName('body').item(0).className = "f";
	
	// bug IE n'enregistre pas la premiere page dans l'historique
	
	window.scrollTo(0,0)
	
}

// envoi de commande au Flash

function cnsad(rx,ry) {


if (navigator.userAgent.indexOf("MSIE") >= 0) {

	try
		{
			window.document.flashcnsad.SetVariable("rx",rx);

			window.document.flashcnsad.SetVariable("ry",ry);
		}
	catch(errorObject)
		{		
			msg = "" ;
			msg += "Error number: " + 
			(errorObject.number & 0xffff) + "\n" ;
			msg += "Description: " + 
			errorObject.description + 
			"\n\n" ;
		}
} 
else {
		window.document.flashcnsad.SetVariable("rx",rx);

		window.document.flashcnsad.SetVariable("ry",ry);
	}

}



function mnflash(){


	if(navigator.userAgent.indexOf('MSIE')>=0)
	
		{

			document.getElementById('flashcnsad').removeNode(true);

			Fla = document.createElement('embed');
			Fla.setAttribute('src','http://www.cnsad.fr/menu.swf?xmurl=http://www.cnsad.fr/menu.xml.php');
			Fla.setAttribute('width','300');
			Fla.setAttribute('height','650');
			Fla.setAttribute('quality','low');
			Fla.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer');
			Fla.setAttribute('type','application/x-shockwave-flash');
			Fla.setAttribute('wmode','transparent');
			Fla.setAttribute('swLiveConnect','true');
			Fla.setAttribute('id','flashcnsad');
			Fla.setAttribute('allowScriptAccess','always');
			Fla.setAttribute('name','flashcnsad');
	

			document.getElementById('menuCNSAD').appendChild(Fla);
			document.getElementById('flashcnsad').setAttribute('name','flashcnsad')


		}
	else
	if(navigator.userAgent.indexOf('Gecko')>=0 || navigator.userAgent.indexOf('Safari')<0 )
	
		{

			//document.getElementById('flashcnsad').removeNode(true);

			Fla = document.createElement('embed');
			Fla.setAttribute('src','http://www.cnsad.fr/menu.swf?xmurl=http://www.cnsad.fr/menu.xml.php'); /* modif chemin relatif passé en absolu*/
			Fla.setAttribute('width','300');
			Fla.setAttribute('height','650');
			Fla.setAttribute('quality','low');
			Fla.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer');
			Fla.setAttribute('type','application/x-shockwave-flash');
			Fla.setAttribute('wmode','transparent');
			Fla.setAttribute('swLiveConnect','true');
			Fla.setAttribute('id','flashcnsad');
			Fla.setAttribute('allowScriptAccess','sameDomain');
			Fla.setAttribute('name','flashcnsad');
	

			document.getElementById('menuCNSAD').appendChild(Fla);

		}


}

function entete(imghck){

	document.getElementById('droite').style.backgroundImage = "url("+imghck+")";

}


function zoom(t,n){

	t.blur();
	
	//alert(t.offsetTop)
	
	
	gr = document.createElement('div');
	gr.id = "calqueZoom";
	gr.style.height = document.getElementById('texte').offsetHeight+"px";
	document.getElementById('droite').appendChild(gr);
	
	zo = document.createElement('div');
	zo.id = "imZoom";


	if(navigator.userAgent.indexOf('MSIE 8')>=0){

		zoTop = t.getElementsByTagName('img').item(0).offsetTop;

	}
	else if(navigator.userAgent.indexOf('MSIE 7')>=0){

		zoTop = t.parentNode.parentNode.offsetTop+30;

	}
	else if(navigator.userAgent.indexOf('MSIE')>=0){

		zoTop = t.getElementsByTagName('img').item(0).offsetTop+t.parentNode.parentNode.offsetTop;

	}

	else {
	
		zoTop = t.getElementsByTagName('img').item(0).offsetTop;
	
	}

	if(navigator.userAgent.indexOf('MSIE 6')>=0){zoTop+=15}


	zo.style.top = zoTop + "px";

	imb = document.createElement('a');
	imb.setAttribute('href','javascript:closeZoom()')		
	
	im = document.createElement('img');
	im.setAttribute('src',t.href);	
	im.setAttribute('onload','adapt()');	
	imb.appendChild(im)
	
	cl = document.createElement('a');
	cl.setAttribute('href','javascript:closeZoom()');
	cl.id = "close";
	
	lg = document.createElement('div');
	lg.id = "legendZoom";
	if(t.getAttribute('title') != null){
	txtlg = document.createTextNode(t.getAttribute('title'));
	lg.appendChild(txtlg);
	}
	
	
	zo.appendChild(imb);
	zo.appendChild(cl);
	zo.appendChild(lg);
	
	document.getElementById('droite').appendChild(zo);
	
if(navigator.userAgent.indexOf('MSIE 6')>=0){

adapt()

}
}


function adapt(){

//alert(document.getElementById('texte').offsetHeight+"/"+(document.getElementById('imZoom').offsetHeight+parseInt(document.getElementById('imZoom').style.top)))

//alert((document.getElementById('imZoom').offsetHeight+parseInt(document.getElementById('imZoom').style.top))-document.getElementById('texte').offsetHeight)

df = (document.getElementById('imZoom').offsetHeight+parseInt(document.getElementById('imZoom').style.top))-document.getElementById('texte').offsetHeight;

	if(df > 0){

	document.getElementById('texte').style.height = (document.getElementById('imZoom').offsetHeight+parseInt(document.getElementById('imZoom').style.top)-49) + "px";

	document.getElementById('calqueZoom').style.height = document.getElementById('texte').offsetHeight+"px";

	}


}

function closeZoom(){


	document.getElementById('droite').removeChild(document.getElementById('imZoom'))
	document.getElementById('droite').removeChild(document.getElementById('calqueZoom'))

	document.getElementById('texte').style.height = "auto";

}

/*
function prnt(){

	//window.open(top.frames['ifram'].location.href,'prnt','')
	window.print()

}


function envoi(nav, langue){

	if(navigator.userAgent.indexOf('MSIE')<0){
		sX = window.screenX;
		sY = window.screenY;
	}
	else {
		sX = window.screenLeft;
		sY = window.screenTop;
	}
	
	wW = 300;
	wH = 300;
	
	lX = (screen.width / 2) - (wW / 2);
	lY = (screen.height / 2) - (wH / 2);
	
	url = 'http://www.cnsad.fr/sendmail' + '.php?nav=' + nav ;

	send = window.open(url,'sendMail','width='+wW+', height='+wH+', resizable=yes, scrollbar=no, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no, left='+lX+', top='+lY)
	
	send.focus()

}






function addToFavorites() 
	{ 
		
		url = top.frames['ifram'].location.href; 
		title = window.document.title; 


	if (window.sidebar) 
		
	{ // Mozilla Firefox Bookmark
	
		window.sidebar.addPanel(title, url,"");
	
	} 
	
	else if( window.external ) 
		
	{ // IE Favorite
	
		window.external.AddFavorite( url, title); 
		
	}
	
	else if(window.opera && window.print) 
		
	{ // Opera Hotlist
	
		return true; 
		
	}

	 else 
			
		{ 
			
			alert("Sorry! Your browser doesn't support this function.\nL'adresse de la page est: "+url); 


		} 
		
		
	}
*/

window.onload = init;


function init(){

formu = document.getElementsByTagName('form');

if(document.getElementsByTagName('form').length>1){
for(i=1;i<formu/length;i++){
formu.item(i).setAttribute('target','ifram')
}
}

}