/* Compatibilite */
function checkBrowser()
{
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie55=((this.ver.indexOf("MSIE 5.5")>-1 || this.ie6) && this.dom)?1:0;
	this.ie5=((this.ver.indexOf("MSIE 5")>-1 || this.ie5 || this.ie6) && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.ie4plus=(this.ie6 || 	this.ie5 || this.ie4);
	this.ie5plus=(this.ie6 || this.ie5)
	this.bw=(this.ie8 || this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns5);	
	return this;
}
			
bw = new checkBrowser();
			
if (!document.getElementById) 
{
document.getElementById = getObjectById;
}

function position(e) {
x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
//window.status = "Souris x:"+x+" | y:"+y;
}


/* POPUPS */
var multi;
var width = screen.width;
if(width < 1024) multi = 0.75;
else multi = 1;

function popup(url, name, width, height) {	
	var w = width * multi;
	var h = height * multi;
	var neo=window.open(url, name, "left=0,top=0, width="+w+"px,height="+h+"px,resizable=no,toolbar=no,scrollbars=yes");	
	if(neo.focus){neo.focus();}
}



var interval;
var playing = false;
var spacer = '<img src="imgs/spacer.gif" width=30px />';
	
function getObjectById(ID) 
{
	var obj;
	if (bw.dom)
		return document.getElementById(ID);
	else if (bw.ie4)
		return document.all(ID);
	else if (bw.ns4)
		return eval('document.' + ID);
}

function getOpenerObjectById(ID) 
{
	var doc = window.opener.document;
	var obj;
	if (bw.dom)
		return doc.getElementById(ID);
	else if (bw.ie4)
		return doc.all(ID);
	else if (bw.ns4)
		return eval('doc.' + ID);
}

function getParentObjectById(ID) 
{
	var doc = window.parent.document;
	var obj;
	if (bw.dom)
		return doc.getElementById(ID);
	else if (bw.ie4)
		return doc.all(ID);
	else if (bw.ns4)
		return eval('doc.' + ID);
}

function isArray(obj) {
   if (obj.constructor.toString().indexOf("Array") == -1)
      return false;
   else
      return true;
}

// divers
String.prototype.trim = function()
{
    return this.replace(/(?:^\s+|\s+$)/g, "");
}

// Fonction de "http://www.pbdr.com/vbtips/asp/JavaNumberValid.htm"
function is_numeric( strString )
//  check for valid numeric strings	
{
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;
	
		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++)
		{
			strChar = strString.charAt(i);
			
			if (strValidChars.indexOf(strChar) == -1)
			{
				blnResult = false;
			}
		}

		return blnResult;
}

function DateInt()
{
	var now = new Date();

		var h = now.getHours();
	        var m = now.getMinutes();
       		var s = now.getSeconds();
				
	return ( h * 60 * 60 ) + ( m * 60 ) + s;
}

function sleep( intTime )
{
	if( !is_numeric( intTime ) )
	{
		return;  // Arret de l'éxecution
	}
		
	intTime = ( intTime / 1000 );
	var Exp = DateInt() + intTime; // TimeOut
		
		while( Exp > DateInt() )
		{
			;
		}
}