function addFavorites(){
	if (document.all) {
		window.external.AddFavorite( location.href, document.title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(document.title, location.href, "")
	}
}

function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(location.href);
 
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
		 {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
			alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
         }
    } 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',location.href);
 }
}

function getDocHeight() {
	var D = document;
	return Math.max(
		Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
		Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
		Math.max(D.body.clientHeight, D.documentElement.clientHeight)
	);
}
	
function getDocWidth() {
	var D = document;
	return Math.max(
		Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
		Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
		Math.max(D.body.clientWidth, D.documentElement.clientWidth)
	);
}

function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function displayGAMAd(aDivName, aSlotName) {
	if (document.getElementById(aSlotName)) {	
		document.getElementById(aDivName).style.display = "block";
		document.getElementById(aSlotName).style.height = document.getElementById(aDivName).offsetHeight;
	}
}	
	
function positionGAMAd(aDivName, aSlotName) {
	if (document.getElementById(aSlotName)) {	
		document.getElementById(aDivName).style.top = 0 - getY(document.getElementById(aDivName)) + getY(document.getElementById(aSlotName));
		document.getElementById(aDivName).style.left = 0 - getX(document.getElementById(aDivName)) + getX(document.getElementById(aSlotName));
	}
}
	
function repositionGAMAd(aDivName, aSlotName) {
	if (document.getElementById(aDivName).style.display == "block") { 
		if ( navigator.appName.indexOf("Internet Explorer") >= 0) 
		 	document.getElementById(aDivName).style.left = (0 - document.body.clientWidth/2) + (document.getElementById(aSlotName).offsetWidth /2) + getX(document.getElementById(aSlotName));
		else
			document.getElementById(aDivName).style.left = getX(document.getElementById(aSlotName));
		
	}
}

function EcrireCookieLanguage(nom, valeur) {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+10000);
  var aDomain = document.domain;
  var mySplitResult = aDomain.split(".");
  aDomain = "." + mySplitResult[mySplitResult.length -2] + "." + mySplitResult[mySplitResult.length -1];
  var path = "/";
  document.cookie = nom + "=" + escape(valeur) + "; expires=" + exdate.toGMTString() + "; path=" + path + "; domain=" + aDomain;
}

function DrapeauClick() {
  aCookieVal = 1;
  if (aSiteLanguage == 0) aCookieVal = 1;
  if (aSiteLanguage == 1) aCookieVal = 0;
  EcrireCookieLanguage(aCookieName, aCookieVal);
  return true;
}