<!--
// FONCTIONS COMMUNES FRONTEND

/* DOM
------------------------------------------------ */

var nn4 = (document.layers) ? true : false;
var ie5 = (document.all) ? true : false;
var dom = (document.getElementById && !document.all) ? true : false;

function getId(id){
	if(nn4)			path = document.layers[id];
	else if(ie5) 	path = document.all[id];
	else if(dom)	path = document.getElementById(id);
	else				path = false;
	
	return path;
}

function elemResize(elem,w,h){
	var obj = getId(elem);
	if(document.layers && obj){
		obj.resizeTo(w,h);
	}else{
		obj.style.width	= w;
		obj.style.height	= h;
		if(document.getElementById("fl")){
			document.getElementById("fl").style.height = h;
		}else if(document.getElementsByName("fl")[0]){
			document.getElementsByName("fl")[0].style.height = h;
		}
	}
}

/* Fonctions -> Historique 
------------------------------------------------ */

function setHistory(valeur){
	var nom	= "pg";
	var argv	= setHistory.arguments;
	var argc	= setHistory.arguments.length;
	var expires	= (argc > 2) ? argv[2] : null;
	var path		= (argc > 3) ? argv[3] : null;
	var domain	= (argc > 4) ? argv[4] : null;
	var secure	= (argc > 5) ? argv[5] : false;
	document.cookie = nom + "=" + escape(valeur) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

/* Popup
------------------------------------------------ */

function addFav() { 
	if(document.all) window.external.AddFavorite(location.href, document.title);
} 

function popup(p,n,w,h){
	l	= (screen.availWidth-w)/2;
	t	= (screen.availHeight-h)/2;
	x 	= window.open(p,n,'toolbars=0,resizable=1,scrollbars=1,width='+w+',height='+h+',left='+l+',top='+t);
	x.focus();
}

function pop_fr(){
	w	= screen.availWidth;
	h	= screen.availHeight;
	x	= window.open('rub_fr/index.html','mainWindow','resizable=1, scrollbars=1');
	x.moveTo(0,0);
	x.resizeTo(w,h);
	x.focus();
}

function pop_uk(){
	w	= screen.availWidth;
	h	= screen.availHeight;
	x	= window.open('rub_en/index.html','mainWindow','resizable=1, scrollbars=1');
	x.moveTo(0,0);
	x.resizeTo(w,h);
	x.focus();
}

function popCarte(){
	window.open('carte.html','carte','left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-250)+',width=650,height=500,resizable=1,toolbar=0');
}

function popPrint(page){
	window.open(page,'','left='+(screen.availWidth/2-400)+',top='+(screen.availHeight/2-320)+',width=800,height=560,resizable=1,menubar=1,toolbar=1,scrollbars=1');
}

var sitesWindow = '';
function popSites(r) {
	var url = 'sites.php?r=' + r;
	if(sitesWindow.closed == false && sitesWindow.location){
		sitesWindow.close();
	}
	
	sitesWindow = window.open(url, 'sites', 'left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-250)+',width=650,height=500,resizable=1,toolbar=0');

	if(window.focus){
		sitesWindow.focus();
	}
}

// -->