// JavaScript Document
var lan1;
var lan;
function mypopup(pagelink)
{
	//mywindow = window.open (pagelink,"mywindow","toolbar=0,location=0,menubar =0,status=0,scrollbars=1,width=700,height=600");
	mywindow = window.open (pagelink,"mywindow");
	return false;
} 

function page(location)
{
	
	if(location==null)
	{
		document.getElementById('action').value="ajaxfiles/accueil_fr.php";
		
	}
	else
	{
		document.getElementById('action').value=location
	}
}

function test(lang)
{
var test
test=lang;
if(test=='fr')
	{   ajaxpage(document.getElementById('action').value, 'content',1)
		ajaxpage('ajaxfiles/menu_fr.php', 'blueblock')
		ajaxpage('ajaxfiles/footer_fr.php', 'footer')
		
	   	ajaxpage('ajaxfiles/header_fr.php', 'header')
		soun1=document.getElementById('action').value.replace(/_fr.php/,"_en.php")
		document.getElementById('action').value=soun1
		
	}
	else if (test=='en')
	{   ajaxpage(document.getElementById('action').value, 'content',1)
		ajaxpage('ajaxfiles/menu_en.php', 'blueblock')
		ajaxpage('ajaxfiles/footer_en.php', 'footer')
		
		ajaxpage('ajaxfiles/header_en.php', 'header')
		soun1=document.getElementById('action').value.replace(/_en.php/,"_fr.php")
		document.getElementById('action').value=soun1
	}
}

function getviewpoint()
{ //get window viewpoint numbers
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 
	//Preliminary doc width in non IE browsers
	
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body 
	//create reference to common "body" across doctypes
	
	this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
	this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
	this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
}
var loadedobjects="";
var rootdomain="http://"+window.location.hostname;
function ajaxpage(url, containerid,anim){

getviewpoint()
this.docheightcomplete=(window.standardbody.offsetHeight>window.standardbody.scrollHeight)? window.standardbody.offsetHeight : window.standardbody.scrollHeight
document.getElementById('veil').style.width = docwidth;

document.getElementById('veil').style.height = docheightcomplete;
document.getElementById('veil').style.display = 'block';	
if(anim){
document.getElementById(containerid).innerHTML = '<div style="height:250px; padding-top:75px;text-align:center;"><img src="img/loading.gif"></div>';
}

var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
{
document.getElementById(containerid).innerHTML=page_request.responseText;
document.getElementById('veil').style.display = 'none';
}
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""

if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

