	function imgshow(obj, n) {
		var imgs= obj.getElementsByTagName("img");
		if(imgs.length==0)
			return;
		var diapo= document.getElementsByName("diapo");
		if(diapo.length==0)
			return;
		imgs[0].src= imgsmall[0];
		diapo[0].src= imglarge[n];
		var s= imgsmall[0];
		imgsmall[0]= imgsmall[n];
		imgsmall[n]= s;
		var s= imglarge[0];
		imglarge[0]= imglarge[n];
		imglarge[n]= s;
	}
	
	function preloader(images) {
     var i = 0;

     imageObj = new Image();
     for(i= 0; i<images.length; i++) {
          imageObj.src= images[i];
     }
  }
  
  function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
      window.onload = func;
    } else {
      window.onload = function() {
        if (oldonload) {
          oldonload();
        }
        func();
      }
    }
  }

	function openWindow(url, w, h, o) {
		var options= "width=" + w + ",height=" + h + ",";
    if(o)
      options+= o;
    else {
  		options += "resizable=yes,scrollbars=yes,status=yes,";
  		options += "menubar=no,toolbar=no,location=no,directories=no";
  	}
		var newWin = window.open(url, 'newWin', options);
		newWin.focus();
	}

	function openURL(obj) {
		var s= obj.value;
		if(s!="#")
			window.location.href= s;
	}

  var cookieEnabled=(navigator.cookieEnabled)? true : false
  if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
    document.cookie="testcookie"
    cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
  }

  function getCookie(c_name)
  {
    if (!cookieEnabled)
      return null;
    if (document.cookie.length>0) {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1) {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
      }
    }
    return "";
  }
  
  function setCookie(c_name,value,expiredays)
  {
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  }

  function appendPage(p) {
    var c, ca, idx, cname, txt, d;

    cname= "Safran_Pages"; 
    c= getCookie(cname);
    if(c==null)
      return;
    d= new Date();
    txt= d.toLocaleTimeString() + " : " + p
    ca= c.split("~");
    if(ca[0]=="")
      ca[0]= txt;
    else
      ca.push(txt);
    while(ca.length>10)
      ca.shift();
    c= ca.join("~")
    setCookie(cname, c, 1);
  }    
  
  function getPage() {
    var c= getCookie("Safran_Pages");
    return c.replace(/~/g, "\n");
  }

  function eqheight() {
    omenu= document.getElementById("pgmenu");
    obody= document.getElementById("pgbody");
    if(omenu==null || obody==null)
      return;
    hmenu= omenu.offsetHeight;
    hbody= obody.offsetHeight;
    h= hmenu>hbody? hmenu: hbody;
    omenu.style.height= h+"px";
    obody.style.height= h+"px";   
  }

addLoadEvent(eqheight);