<!--
function toggle (b,nestref,id){
	if (document.layers)
		{
//		var myElement = document.envelope.layers[id];
		var myElement = (nestref)? eval('document.'+nestref+'.document.'+id) : document.layers[id];
		if (b)
			{
			myElement.visibility = "show";
			}
		else
			{
			myElement.visibility = "hidden";
			}
		//alert(myElement.visibility)
		}
	else
		{
		var myElement = document.getElementById(id);
		if (b)
			myElement.style.visibility = "visible";
		else
			myElement.style.visibility = "hidden";
		}
}
function check (ID){
	var myElement = document.getElementById(ID);
	alert(myElement.style.visibility);
}


var CurrentTerm="";

//Cookies, code borrowed from Netscape
function GetCookie(Name)
{
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }}
}
function SetCookie(name, value, days)
{
   var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*days);
   document.cookie = name + "=" + escape(value)
   + ((days == 0) ? "" : ("; expires=" + expires.toGMTString()))
   + ("localhost","");
}

function OpenNewWindow(URL,name)
	{
	if (name=="MeSH")
		{
		var msg="Enter term to check. ";
		msg+="If this leads to a term with a comma, retype as:\n";
		msg+="     'anemia, sickle cell' -> CHANGE TO -> 'sickle cell anemia'";
		//dfault=CurrentTerm;
		var dfault=prompt(msg,CurrentTerm);
		//URL="http://www.ncbi.nlm.nih.gov/entrez/meshbrowser.cgi?retrievestring=&mbdetail=n"
		//Below 2006-08-17
		URL="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=mesh&orig_db=mesh&cmd=search&cmd_current=&"
		URL+="&term="+Replacer(dfault," ","+");
		document.SEARCHFORM.MESH.value+=dfault+"+";
		MeSH="yes";
		}
	if (dfault==null && (name=="MeSH" || name=="traducir"))
		{
		//eg do nothing if they entered nothing in the prompt
		return;
		}
	else
		{
		var WindowFeatures;
		if (navigator.appName.substring(0,1)=="N")
			{
			WindowFeatures="scrollbars=yes,menubar=yes,toolbar=yes,location=yes,resizable=yes,width=640,height=480"
			}
		else
			{
			WindowFeatures="scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,width=640,height=480"
			}
		NWindow=window.open(URL,name,WindowFeatures);
		}
		//if(NWindow==null) {return;};
	}
function DisplayScope ()
	{
	document.getElementById('envelopeDisplayScope').style.display = "block";
	}
function InfoWindow(title,msg)
	{
	if (navigator.appName.substring(0,1)=="N")
		{
		WindowFeatures="scrollbars=yes,menubar=no,toolbar=no,location=no,resizable=yes,width=300,height=250"
		}
	else
		{
		WindowFeatures="scrollbars=yes,menubar=no,toolbar=no,location=no,resizable=yes,width=300,height=250"
		}
	var InfoWindow=window.open('','InfoWindow',WindowFeatures);
	if(InfoWindow==null) {return;};
	InfoWindow.document.open();
	InfoWindow.document.write( "<HTML>"
	+"\n<HEAD><TITLE>EviDents - hint:</TITLE></HEAD>"
	+"\n<BODY BGCOLOR=white>"
	+msg
	+"\n<BR><BR><BR><CENTER><FORM><INPUT TYPE=button value=\"Close Window\" onClick=\"window.close()\"></FORM>"
	+"\n</BODY>")
	InfoWindow.document.close();
	}
function sysrevguides()
	{
	var msg="Guidelines by these authors are based on systematic review of relevant research."
	msg+="\nOnly about 1/3 of all guidelines do this."
	msg+="\n\nShaneyfelt et al. JAMA 1999;281:1900-5.\nPMID: 10349893"
	alert(msg)
	}

function PrepareSearch()
	{
	document.SEARCHFORM.SearchString.value="";
	if (document.SEARCHFORM.PTerm.value.length>1)
		{
		document.SEARCHFORM.SearchString.value+=document.SEARCHFORM.PTerm.value+"+AND+";
		}
	if (document.SEARCHFORM.ITerm.value.length>1)
		{	
		document.SEARCHFORM.SearchString.value+=document.SEARCHFORM.ITerm.value+"+AND+";
		}
	if (document.SEARCHFORM.CTerm.value.length>1)
		{	
		document.SEARCHFORM.SearchString.value+=document.SEARCHFORM.CTerm.value+"+AND+";
		}
	if (document.SEARCHFORM.OTerm.value.length>1)
		{	
		document.SEARCHFORM.SearchString.value+=document.SEARCHFORM.OTerm.value
		}
	//alert(document.SEARCHFORM.SearchString.value+"\n\n"+document.SEARCHFORM.SearchString.value.length)
	//alert(document.SEARCHFORM.SearchString.value.substring(document.SEARCHFORM.SearchString.value.length-5,document.SEARCHFORM.SearchString.value.length))
	if (document.SEARCHFORM.SearchString.value.substring(document.SEARCHFORM.SearchString.value.length-5,document.SEARCHFORM.SearchString.value.length)=="+AND+")
		{
		document.SEARCHFORM.SearchString.value=document.SEARCHFORM.SearchString.value.substring(0,document.SEARCHFORM.SearchString.value.length-5)
		}
	//alert(document.SEARCHFORM.SearchString.value);
	}
//Replacer
function Replacer(itxt,OldChars,NewChars)
	{
	if (itxt==null){itxt=""};
	var i=0;
	while (i!=-1)
		{
		i = itxt.indexOf(OldChars, i);
		if (i>-1){itxt=itxt.substring(0,i)+NewChars+itxt.substring(i+OldChars.length)};
		}
	return itxt;
	}

// Fix NS4 resize bug
if(navigator.appVersion.substring(0,1)>3)
	{
	if (document.layers)
		{
		origWidth=innerWidth;
		origHeight=innerHeight;
		window.onresize=NS4Resize
		}
	}
function NS4Resize(){
	if (innerWidth!=origWidth||innerHeight!=origHeight)
		{
		location.reload()
		}
}

function init(){
	if (document.getElementById('allissues').checked)
		{
		document.getElementById('envelopeDisplayScope').style.display = "none";
		}
	else
		{
		document.getElementById('envelopeDisplayScope').style.display = "block";
		}
}

//window.onload = init();

// end hiding from old browsers-->
