function SetCookie (name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function getObj(name){
  if (document.getElementById){
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all){
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
}

function getTop(objectId){
	var x = (new getObj(objectId)).obj;
	xTop = x.offsetTop;
	while(x.offsetParent!=null) {
		xParent = x.offsetParent;
		xTop += xParent.offsetTop;
		x = xParent;
	}
	return xTop;
}

function getAbsoluteTop(objectId){
	var x = objectId;
	xTop = x.offsetTop;
	while(x.offsetParent!=null) {
		xParent = x.offsetParent;
		xTop += xParent.offsetTop;
		x = xParent;
	}
	return xTop;
}

function getAbsoluteLeft(objectId){
	var x = objectId;
	xLeft = x.offsetLeft;
	while(x.offsetParent!=null){
		xParent = x.offsetParent;
		xLeft += xParent.offsetLeft;
		x = xParent;
	}
	return xLeft;
}

function getWidth(objectId){
	var x = (new getObj(objectId)).obj;
	return x.offsetWidth;
}

function getHeight(objectId){
	var x = (new getObj(objectId)).obj;
	return x.offsetHeight;
}

function openPop(f,l,h,op)
{
	longueur=l;
	hauteur=h;
	haut = screen.height/2 - hauteur/2;
	dim = screen.width/2 - longueur/2;
	window.open(f,'','width='+longueur+',height='+hauteur+',left='+dim+',top='+haut+',resizable=no,'+op);
}


function OuvrirPopup(page,nom,option) 
{
       window.open(page,nom,option);
}


function swapImgin(obj){
	var ch=""+obj.src;
	var finfin=ch.substring(ch.length-3,ch.length);
	var fin=ch.substring(ch.length-5,ch.length-4);
	ch=ch.substring(0,ch.length-5);
	if(fin == "0")
	   obj.src=ch+"1."+finfin;
	else
	   obj.src=ch+"0."+finfin;
}
function changeSelect(obj){
	if (obj.options[obj.selectedIndex].value != -1)  document.location.href=obj.options[obj.selectedIndex].value;
}

function envoyer_ami() {
 var url = document.location;
 location.href = "mailto:?subject=Un ami vous recommande cette page du site SIAL&body= "+url+"%0a%0aBonne journée !"
}
