window.hasFlash = 0;

function deb(t) {
	gid("debug").innerHTML = t+"<br/>"+gid("debug").innerHTML;
}

function gid(t) {
	return document.getElementById(t);
}


function doblank (atag) {
	window.open(atag.href);
	return false;
}

function doBlank (atag) {
	return doblank(atag);
}


function findPosX(obj)
{
    var curleft = 0;
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}


function findPosY(obj)
{
    var curtop = 0;
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}



function getElementHeight(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelHeight;
		} else {
			xPos = elem.offsetHeight;
		}
		return xPos;
	}
}

function getElementWidth(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) {
			xPos = elem.style.pixelWidth;
		} else {
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
}


function checkSize() {
 		if (self.innerWidth)
	    {
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	    }

	    else if (document.documentElement && document.documentElement.clientWidth)

	    {
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	    }

	    else if (document.body)

	    {
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	    }
	    //deb(frameWidth+" : "+frameHeight);
}



function goBack() {
	window.history.go(-1);
	return false;
}

function smallPopup(obj) {
	var a = window.open(obj.href,'popup','width=280,height=340,scrollbars=1');
	return false;
}


function popup(hrefe,w,h) {
	var a = window.open(hrefe,'popup','width='+w+',height='+h+'');
	return false;
}
function dopopup(obje,w,h) {
	return popup(obje.href,w,h);
}




linkedBlank = 0;
function linkBlank(atag) {
	linkedBlank++;
	window.open(atag.href,'link_blank_'+linkedBlank);
	return false;
}


function swapImg(url,obj) {
	obj.oldsrc=obj.src;
	obj.src=url;

}

function swapRestore(obj) {
	obj.src = obj.oldsrc;
}

function showhide(ide) {
	var obj = gid(ide);

	if(obj.style.display=="none" || obj.style.display=="") {
		obj.style.display='block';
	} else {
		obj.style.display='none';
	}

}


function show(ide) {
	var obj = gid(ide);	
	
	obj.style.display='block';
}

function hide(ide) {
	var obj = gid(ide);
	obj.style.display='none';
}



function XHR(url, paramsUrl, divToFill,dosomethingelse,obj) {

	if(window.XMLHttpRequest) // Firefox
		var http = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
		var http = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non support矰ar le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	}



	http.open("GET", url+paramsUrl, true);

	http.onreadystatechange = function()
	  {



	    if (http.readyState == 4)
	    {


		if(typeof dosomethingelse == 'string') {
			if(dosomethingelse.length > 0) {
				//alert(dosomethingelse);
				eval(dosomethingelse);
			}
		}
		if ( typeof divToFill == 'string') {
			if(divToFill == 'none') {

				return;
			} else if(divToFill == 'javascript_eval') {
				eval(http.responseText);
				return;
			}
	        if(gid(divToFill))
				divToFill = gid(divToFill);
		}

		divToFill.innerHTML = http.responseText;


	    }
	  };
  			http.send(null);
}


/** 
 * Fonctions swapImage 
 */
/*
function swapImage ( src , obj ) {
	
	if ( window._curObj != '' ) {
		
		restoreImage ( window._curObj ) ;
	}
	
	obj.oldSrc = obj.src ;
	
	obj.src = src ;
	
	window._curObj = obj ;

}

function swapImageAuto ( src , obj ) {

	if ( window._curObj !== false ) {
		
		restoreImage ( window._curObj ) ;
		
	}
	
	obj.oldSrc = obj.src ;
	
	obj.src = src ;
	
	window._curObj = obj ;
	
	obj.onmouseout = function() {
		
		restoreImage ( obj ) ;
		
	}

}

function restoreImage ( obj ) {
	
	obj.src = obj.oldSrc ;
	
}

function swapImageBg ( src , obj ) {
	
	obj.oldSrc = obj.style.background ;
	
	obj.style.background = 'url( "' + src + '" ) no-repeat' ;
	
}

function restoreImageBg ( obj ) {
	
	obj.style.background = obj.oldSrc ;
	
}*/


 function CreateBookmarkLink() {

 	title = document.title; 
 	url = window.location;

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
		
 }

