

var ns4 = (document.layers) ? true : false;
var ie4 = (document.all)? true:false;
var NS6 = (!document.all && document.getElementById) ? true : false;

fixedText = parent.frames.nav.document.forms["variables"].elements["fixedHomeText"].value;
var hometext = "<a href='index.html' target='_top' class='WhiteSmallLink'>" + fixedText + "</a>"

function clearnav(){

		divLast = parent.frames.nav.document.forms["variables"].elements["divLast"].value;
		divLastOUT = parent.frames.nav.document.forms["variables"].elements["divLastOUT"].value;
		textLast = parent.frames.nav.document.forms["variables"].elements["textLast"].value;
		linkLast = parent.frames.nav.document.forms["variables"].elements["linkLast"].value;
		sizeLast = parent.frames.nav.document.forms["variables"].elements["sizeLast"].value;

		parent.frames.nav.document.forms["variables"].elements["divLast"].value = 0;
		parent.frames.nav.document.forms["variables"].elements["divLastOUT"].value = 0;
		parent.frames.nav.document.forms["variables"].elements["textLast"].value = parent.frames.nav.document.forms["variables"].elements["fixedHomeText"].value;
		parent.frames.nav.document.forms["variables"].elements["linkLast"].value = 0;
		parent.frames.nav.document.forms["variables"].elements["sizeLast"].value = "START";
		
		
				if (sizeLast == "small"){
				var hColor = 'YellowSmall';          // highlight or hover color
				var aColor = 'WhiteSmallLink';       // a or link color
				}
				else if (sizeLast == "large"){
				var hColor = 'YellowLarge';          
				var aColor = 'WhiteLargeLink';       
				}


		//special case: 'home'
		if (divLastOUT == 0) var thetext = '<a href="index.html" target="_top" class="WhiteSmallLink">' + textLast +'</a>'
		
	
		//special case: 'search' needs to include arrow graphic in write statement
		else if (divLastOUT == "searchOUT") var thetext = '<a class="'+aColor+'" href="javascript:ChangeTextColor(\''+textLast+'\',\''+divLastOUT+'\',\''+divLast+'\',\''+linkLast+'\',\''+sizeLast+'\')">' + textLast + '&nbsp;&nbsp;<img src=images/g_arrow_yellow.gif width=17 height=20 border=0 align=top></A>';


		else var thetext = '<a class="'+aColor+'" href="javascript:ChangeTextColor(\''+textLast+'\',\''+divLastOUT+'\',\''+divLast+'\',\''+linkLast+'\',\''+sizeLast+'\')">' + textLast + '</A>';
		

		layerWrite(divLastOUT,divLast,thetext);
		
}



//USE TO RESET NAV TO NEUTRAL, NO HIGHLIGHTS SELECTED
function reset(pagetitle) {

 		clearnav();
		top.document.title = "Reuters Health - " + pagetitle;
			
}


//USE TO RESET NAV TO NEUTRAL, NO HIGHLIGHTS SELECTED
function resetnav(theurl,pagetitle) {

		reset(pagetitle);
		parent.frames.body.location.href = theurl;
		

}


//WRITE NEW DIV BASED ON BROWSER
function layerWrite(divOUT,id,text) {
				

        if (ns4) {

			//IF HOME NAV NEEDS TO BE RESET IN HEADER
			if (divOUT==0){
			
			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.open();		
			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.write(text);
			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.close();
			
			}
			
			else {
			
			parent.frames.nav.document.layers[divOUT].document.layers[id].document.open();		
			parent.frames.nav.document.layers[divOUT].document.layers[id].document.write(text);
			parent.frames.nav.document.layers[divOUT].document.layers[id].document.close();
			
			}
			
			
        }

        else if (ie4) {
			//IF HOME NAV NEEDS TO BE RESET IN HEADER
			if (divOUT==0) parent.frames.head.document.all["homeOUT"].innerHTML = text;
			else parent.frames.nav.document.all[divOUT].innerHTML = text;
			
			parent.frames.head.document.all["homeOUT"].innerHTML = hometext;
		
		}
		
		else if (NS6) {
		
		
			//IF HOME NAV NEEDS TO BE RESET IN HEADER
			if (divOUT==0){
			header = parent.frames.head.document.getElementById("homeOUT");
			header.innerHTML = hometext;
			}
			
			else {
			
	  		x = parent.frames.nav.document.getElementById(divOUT);
			x.innerHTML = text;
			
			}
			
		
		}

		
}

//CHANGE COLOR OF NAV TEXT
function ChangeTextColor(linktext,divOUT,divName,thelink,size) {

		syncNav(linktext,divOUT,divName,thelink,size)
		
		parent.frames.body.location.href = thelink;
	
}




function syncNav(linktext,divOUT,divName,thelink,size) {

		//GET FORM VALUES
		divLast = parent.frames.nav.document.forms["variables"].elements["divLast"].value;
		divLastOUT = parent.frames.nav.document.forms["variables"].elements["divLastOUT"].value;
		textLast = parent.frames.nav.document.forms["variables"].elements["textLast"].value;
		linkLast = parent.frames.nav.document.forms["variables"].elements["linkLast"].value;
		sizeLast = parent.frames.nav.document.forms["variables"].elements["sizeLast"].value;

		//STORE FORM VALUES
		parent.frames.nav.document.forms["variables"].elements["divLast"].value = divName;
		parent.frames.nav.document.forms["variables"].elements["divLastOUT"].value = divOUT;
		parent.frames.nav.document.forms["variables"].elements["textLast"].value = linktext;
		parent.frames.nav.document.forms["variables"].elements["linkLast"].value = thelink;
		parent.frames.nav.document.forms["variables"].elements["sizeLast"].value = size;
		

		//DETERMINE FONT SIZE OF CURRENT AND LAST NAV LINKS
		if (sizeLast != "START") {
		
			if (size == sizeLast) {
			
				if (size == "small"){
				var hColor = 'YellowSmall';          // highlight or hover color
				var aColor = 'WhiteSmallLink';       // a or link color
				}
				else if (size == "large"){
				var hColor = 'YellowLarge';          
				var aColor = 'WhiteLargeLink';       
				}
				
			}
			
			else if ((size == "small")&&(sizeLast== "large")){
				var hColor = 'YellowSmall';             
				var aColor = 'WhiteLargeLink';         
				}
			else if ((size == "large")&&(sizeLast== "small")){
				var hColor = 'YellowLarge';             
				var aColor = 'WhiteSmallLink';          
				}
		
		}
		
		else if (size == "small") var hColor = 'YellowSmall';
		else if (size == "large") var hColor = 'YellowLarge';
		
		
		
		// RESET THE LAST DIV NAV TO ORIGINAL HREF LINK

		
			//special case: 'home'
			if (divLastOUT == 0) var thetext = '<a href="index.html" target="_top" class="WhiteSmallLink">' + textLast +'</a>'
		
			//special case: 'search' needs to include arrow graphic in write statement
			else if (divLastOUT == "searchOUT") var thetext = '<a class="'+aColor+'" href="javascript:ChangeTextColor(\''+textLast+'\',\''+divLastOUT+'\',\''+divLast+'\',\''+linkLast+'\',\''+sizeLast+'\')">' + textLast + '&nbsp;&nbsp;<img src=images/g_arrow_yellow.gif width=17 height=20 border=0 align=top></A>';
				
			else var thetext = '<a class="'+aColor+'" href="javascript:ChangeTextColor(\''+textLast+'\',\''+divLastOUT+'\',\''+divLast+'\',\''+linkLast+'\',\''+sizeLast+'\')">' + textLast + '</A>';

			//rewrite new div
			layerWrite(divLastOUT,divLast,thetext);

		
		
		
		// HIGHLIGHT THE NAV COLOR TO THE PAGE IT IS ON
		
		//special case: 'search' needs to include arrow graphic in write statement
		if (divOUT == "searchOUT") var thetext = '<SPAN CLASS="'+hColor+'">' + linktext + '&nbsp;&nbsp;<img src=images/g_arrow_yellow.gif width=17 height=20 border=0 align=top></SPAN>'
		
		else var thetext = '<SPAN CLASS="'+hColor+'">' + linktext + '</SPAN>'
		
		layerWrite(divOUT,divName,thetext);
		
		top.document.title = "Reuters Health - " + linktext;
	
}


//USE TO RESET NAV TO NEUTRAL, NO HIGHLIGHTS SELECTED
function resetnavHome(pagetitle) {

		clearnav();
		
		var thetext = '<SPAN CLASS="YellowSmall">' + pagetitle +'</SPAN>'
		
		WriteHeader(thetext);

}


//WRITE NEW DIV BASED ON BROWSER
function WriteHeader(text) {
				

        if (ns4) {


			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.open();		
			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.write(text);
			parent.frames.head.document.layers["homeOUT"].document.layers["homeIN"].document.close();

        }

        else if (ie4) {
			//IF HOME NAV NEEDS TO BE RESET IN HEADER
			parent.frames.head.document.all["homeOUT"].innerHTML = text;

		
		}
		
		else if (NS6) {
			//IF HOME NAV NEEDS TO BE RESET IN HEADER

			header = parent.frames.head.document.getElementById("homeOUT");
			header.innerHTML = text;
		
		}

		
}
