Window.keepMultiModalWindow=false;
// open a popup window whit url in it and refresh marker display
function showMyPopup(wUrl, wWidth, wHeight)
{
	Window.keepMultiModalWindow=false;
	Windows.closeAll();
	win = new Window({className: "default", width:wWidth, height:wHeight, resizable:false, closable:true, minimizable:false, maximizable:false, opacity:1, recenterAuto:false, destroyOnClose:true});
	win.setURL(wUrl);
	win.showCenter();
	myObserver = {onClose: function(eventName, newWin){sendRequest2('db/dbMarker.php5',true,true);updateMenu();Windows.removeObserver(myObserver);}} 
	Windows.addObserver(myObserver);
}

// init popup window
function initMyPupop()
{
	win = new Window();
	win.showCenter();
	Windows.closeAll();
	win = null;
}

// closeMyWindow
function closeMyWindow(element)
{
	if(element != null && element.id == 'cancel')
	{		
		if(myObserver)
			Windows.removeObserver(myObserver);
		
		Windows.closeAll();
		win.close(true);
		updateMenu();
	}
}

function getRequestHttp() // object requestHttp
{
	var requestHttp;
	if (window.XMLHttpRequest)
	{	// Mozilla
		requestHttp=new XMLHttpRequest();
		if(requestHttp.overrideMimeType)
		{ // firefox
			requestHttp.overrideMimeType('text/xml');
		}
	}
	else
	{
		if (window.ActiveXObject)
		{	//Internet explorer < IE7
			try
			{
				requestHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					requestHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e)
				{
					requestHttp=null;
				}
			}
		}
	}
	return requestHttp;
}

function updateMenu()
{
	updateLogin();
	updateFooter();
	var requestHttp=getRequestHttp();
	if (requestHttp==null)
	{
		alert(VARUNABLEDTOUSEAJAX);
	}
	else
	{
		requestHttp.open('POST','menu/menu.php5',true);
		requestHttp.onreadystatechange=function() {responseMenu(requestHttp);};
		requestHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		requestHttp.send(null);
	}
return;
}

function responseMenu(requestHttp) // lesten the state of request to lunch handle when it done
{
	if (requestHttp.readyState==4)
	{
		if (requestHttp.status==200)
		{
			document.getElementById("menu").innerHTML=requestHttp.responseText;
		}
		else
		{
			alert(VARREQUESTCANNOTBEEXECUTED);
		}
	}
}

function updateLogin()
{
	var requestHttp=getRequestHttp();
	if (requestHttp==null)
	{
		alert(VARUNABLEDTOUSEAJAX);
	}
	else
	{
		requestHttp.open('POST','menu/login.php5',true);
		requestHttp.onreadystatechange=function() {responseLogin(requestHttp);};
		requestHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		requestHttp.send(null);
	}
return;
}

function responseLogin(requestHttp) // lesten the state of request to lunch handle when it done
{
	if (requestHttp.readyState==4)
	{
		if (requestHttp.status==200)
		{
			document.getElementById("login").innerHTML=requestHttp.responseText;
		}
		else
		{
			alert(VARREQUESTCANNOTBEEXECUTED);
		}
	}
}

function updateFooter()
{
	var requestHttp=getRequestHttp();
	if (requestHttp==null)
	{
		alert(VARUNABLEDTOUSEAJAX);
	}
	else
	{
		requestHttp.open('POST','footer/footer.php5',true);
		requestHttp.onreadystatechange=function() {responseFooter(requestHttp);};
		requestHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		requestHttp.send(null);
	}
return;
}

function responseFooter(requestHttp) // lesten the state of request to lunch handle when it done
{
	if (requestHttp.readyState==4)
	{
		if (requestHttp.status==200)
		{
			document.getElementById("bottom").innerHTML=requestHttp.responseText;
		}
		else
		{
			alert(VARREQUESTCANNOTBEEXECUTED);
		}
	}
}

function welcomeWindows()
{
	Dialog.alert({url: "utils/info.php5", options: {method: 'get'}}, {className: "alphacube", width:800,top:20, okLabel: "Close", maxHeight:window.innerHeight-140});
}
	
function licenceFrWindows()
{
	Dialog.alert({url: "utils/licenceFr.txt", options: {method: 'get'}}, {className: "alphacube", width:800,top:80, okLabel: "Close", maxHeight:window.innerHeight-140});
}

function licenceEnWindows()
{
	Dialog.alert({url: "utils/licenceEn.txt", options: {method: 'get'}}, {className: "alphacube", width:800,top:80, okLabel: "Close", maxHeight:window.innerHeight-140});
}

function noticeWindows()
{
	Dialog.alert({url: "utils/notice.php5", options: {method: 'get'}}, {className: "alphacube", width:800,top:80, okLabel: "Close", maxHeight:window.innerHeight-140});
}

function alertWindows(pageUrl)
{
	Dialog.alert({url: pageUrl, options: {method: 'get'}}, {className: "alphacube", width:800,top:80, okLabel: "Close", maxHeight:window.innerHeight-140});
}

function NoWelcomeWindowsCoockie()
{
	if(document.getElementById("noWelcomeWindows").checked) {
		document.getElementById("noWelcomeWindows").checked=false;
		date=new Date;
		date.setMonth(date.getMonth()+1);
		ecrire_cookie("noWelcomeWindows", "true", date);
	}
	else {
		document.getElementById("noWelcomeWindows").checked=true;
		date=new Date;
		date.setMonth(date.getMonth()+1);
		ecrire_cookie("noWelcomeWindows", "false", date);
	}
}

function ecrire_cookie(nom, valeur, expires) {
  document.cookie=nom+"="+escape(valeur)+
  ((expires==null) ? "" : ("; expires="+expires.toGMTString()));
}

function arguments_cookie(offset){
  var endstr=document.cookie.indexOf (";", offset);
  if (endstr==-1) endstr=document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr)); 
}

function lire_cookie(nom) {
  var arg=nom+"=";
  var alen=arg.length;
  var clen=document.cookie.length;
  var i=0;
  while (i<clen){
    var j=i+alen;
    if (document.cookie.substring(i, j)==arg)
       return arguments_cookies(j);
    i=document.cookie.indexOf(" ",i)+1;
    if (i==0) break;
  }
  return null; 
}

function iedetected(){
	if (!confirm(VARIEMESSAGE)){
		alert(VARRESTRICTEDUSE);
    };

}

	

