function HaveGoogle()
{   
    var oGInstalled = google.earth.isInstalled();
    if(!oGInstalled)
    {
        //window.open("about:blank");
    }
    return oGInstalled;
}
function go(url)
{
	window.location=url;
};
function trim(s)
{
    return s.replace(/^\s+/, '').replace(/\s+$/, '');
};
function ltrim(s)
{
    return s.replace(/^\s+/, '');
};
function rtrim(s)
{
    return s.replace(/\s+$/, '');
};
function trim2(s)
{
	return s.replace(/\s+/ig, '');
};
function AddHandler(target, eventName, handler)
{ 
	var isIE = (navigator.appName=="Microsoft Internet Explorer"?true:false);
	if(!isIE & (eventName.length >2))
	{
		eventName=eventName.substr(2);				
	};
	if (target.attachEvent) 
	{  
		target.attachEvent(eventName, handler); 
	}
	else
	{  
		target.addEventListener(eventName, handler, false); 
	};
};
function ouvre_popup(page)
{
	var w = window.open(page);
};
function getInnerText(obj)
{ 
	if (Is_IE())
	{
		return obj.innerText; 
	} 
	else
	{ 
		return obj.textContent; 
	} 
};
function setInnerText(obj,value)
{ 
	if (Is_IE())
	{
		obj.innerText = value;
	} 
	else
	{ 
		obj.textContent = value;
	} 
};
function Is_IE()
{
	if(navigator.appName=="Microsoft Internet Explorer")
	{
		return true;
	};
	return false;
};
var newWin = null;
function closeWin()
{
	if (newWin != null)
	{
		if(!newWin.closed)newWin.close();
	}
};
function popUp(strURL,strType,strHeight,strWidth)
{
    closeWin();
    var strOptions="";
    if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
    if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
    if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
    newWin = window.open(strURL, 'newWin', strOptions);
    newWin.focus();
};
function simulateClick(Element)
{
  var cb = document.getElementById(Element);
  if(!Is_IE())
  {
      var evt = document.createEvent("MouseEvents");
      evt.initMouseEvent("click", true, true, window,
        0, 0, 0, 0, 0, false, false, false, false, 0, null);       
      cb.dispatchEvent(evt); 
  }
  else
  {
    cb.click();
  };  
}
function IsDate(sDate)
{
	var tb = null;
	var Res = false;
	var oD = null;
	try
	{
		tb = sDate.split("/");
		if(tb.length==3)
		{
			oD = new Date(tb[2],tb[1],tb[0]);
			if(oD.getFullYear()==new Number(tb[2]))
			if(oD.getMonth()==new Number(tb[1]))
			if(oD.getDate()==new Number(tb[0]))Res=true;
		}
	}
	catch(e)
	{
		Res=false;
	}
	return Res;
}
function IsTime(sTime)
{
	var tb = null;
	var Res = false;
	var oT = null;
	try
	{
		tb = sTime.split(":");
		var n = new Date();
		if(tb.length==3)
		{			
			oD = new Date(n.getFullYear(),n.getMonth(),n.getDate(),tb[0],tb[1],tb[2]);
			if(oD.getHours()==new Number(tb[0]))
			if(oD.getMinutes()==new Number(tb[1]))
			if(oD.getSeconds()==new Number(tb[2]))Res=true;
		}
		if(tb.length==2)
		{			
			oD = new Date(n.getFullYear(),n.getMonth(),n.getDate(),tb[0],tb[1]);
			if(oD.getHours()==new Number(tb[0]))
			if(oD.getMinutes()==new Number(tb[1]))Res=true;
		}
	}
	catch(e)
	{
		Res=false;
	}
	return Res;
}
function Close()
{
    http = createRequestObject();
    http.open("get", "Close?b=vrai", true);
    http.onreadystatechange = CloseHandle;
    http.send(null);
}
function CloseHandle()
{
    if(http.readyState == 4)
    {
        if(http.status == 200)
        {
			if(http.responseText == "1")
			{
				var ofrm = document.getElementById("form1");
				ofrm.action="../login.html";
				ofrm.submit();
			};
        }
    }
}
function $get(p)
{
	return document.getElementById(p);
}