function getCookie(c_name)
{
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 checkCookie()
{
show_notes=getCookie('show_notes');
if (show_notes!=null && show_notes!="")
  {
  // alert('Show notes status: '+show_notes+'!');
	show('other');
  }
  else 
  { // do nothing if cookie does not exist
	}
}

//browser detection 
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
//SHOW
function show(id){
// Netscape 4
if(ns4){
document.layers[id].display = "";
}
// Explorer 4
else if(ie4){
document.all[id].style.display = "";
}
// W3C - Netscape 6+
else if(ns6){
document.getElementById(id).style.display = "";
document.getElementById('showimg').style.display = "none";
document.getElementById('hideimg').style.display = "";
setCookie('show_notes',1,1);
}
// W3C - IE5
else if(ie5){
var elem=document.getElementById(id)
elem.style.display="";
var elemshowimg=document.getElementById('showimg')
elemshowimg.style.display="none";
var elemhideimg=document.getElementById('hideimg')
elemhideimg.style.display="";
setCookie('show_notes',1,1);
}
 
}
 
//HIDE
function hide(id){
// Netscape 4
if(ns4){
document.layers[id].display = "none";
}
// Explorer 4
else if(ie4){
document.all[id].style.display = "none";
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
document.getElementById(id).style.display = "none";
document.getElementById('showimg').style.display = "";
document.getElementById('hideimg').style.display = "none";
setCookie('show_notes',0,-1);
}
}
