function old_header (showlogin)
{
	document.writeln("<table border='0' cellpadding='0' cellspacing='0' width='906px' bgcolor='#f7f7ee'>");
	document.writeln("	<tr><td width='378px' valign='bottom'><img src='images/holder.gif' border='0'></td>");
	document.writeln("		<td style='padding-bottom:15px;'><a href='index.htm'><img src='images/logo.gif' border='0'></a></td>");
	document.writeln("		<td><img src='images/spacer.gif' border='0' height='1px' width='163px'></td>");
	if (showlogin == 0)
	{	// Don't show the login form
		document.writeln("	<td><img src='images/spacer.gif' border='0' height='1px' width='200px'></td>");
	} else {
		// Show the login form
		document.writeln("	<td valign='bottom'>");
		document.writeln("		<form action='director.cgi' method='post' style='margin:0px;'>");
		document.writeln("		<input type='hidden' name='licenid' value='1'>");
		document.writeln("		<table border='0' cellpadding='0' cellspacing='0' width='200px'>");
		document.writeln("			<tr><td width='70px'></td><td width='130px'></td></tr>");
		document.writeln("			<tr><td style='font:14px Arial; color:#c11924; padding-right:5px;' ");
		document.writeln("					colspan='2' align='right'>Already a member?</td></tr>");
		document.writeln("			<tr><td colspan='2'><img src='images/spacer.gif' border='0' height='4px'></td></tr>");
		document.writeln("			<tr><td style='font:12px Arial; color:#444444;'>Username</td>");
		document.writeln("				<td><input type='text' name='username' style='font:12px Arial; color:#444444; ");
		document.writeln("					width:125px; border:1px solid #d3d4aa;'></td></tr>");
		document.writeln("			<tr><td colspan='2'><img src='images/spacer.gif' border='0' height='5px'></td></tr>");
		document.writeln("			<tr><td style='font:12px Arial; color:#444444;'>Password</td>");
		document.writeln("				<td><input type='password' name='password' style='font:12px Arial; color:#444444; ");
		document.writeln("					width:125px; border:1px solid #d3d4aa;'></td></tr>");
		document.writeln("			<tr><td colspan='2'><img src='images/spacer.gif' border='0' height='2px'></td></tr>");
		document.writeln("			<tr><td align='right' colspan='2' style='padding-right:5px;'>");
		document.writeln("					<input type='image' src='images/button/login_off.gif' border='0' ");
		document.writeln("					onmouseover=\"this.src='images/button/login_on.gif'\" ");
		document.writeln("					onmouseout=\"this.src='images/button/login_off.gif'\"></td></tr>");
		document.writeln("			<tr><td colspan='2'><img src='images/spacer.gif' border='0' height='2px'></td></tr>");
		document.writeln("		</table></form></td>");
	}
	document.writeln("	<td><img src='images/spacer.gif' border='0' height='1px' width='15px'></td></tr>");
	document.writeln("</table>");
}

function header (showlogin)
{
	document.writeln("<table border='0' cellpadding='0' cellspacing='0' width='906px' bgcolor='#f7f7ee'>");
	document.writeln("	<tr><td><img src='images/spacer.gif' border='0' height='1px' width='378px'></td>");
	document.writeln("		<td style='padding-bottom:15px;' align='center'><a href='index.htm'><img src='images/logo.gif' border='0'></a></td>");
	document.writeln("		<td><img src='images/spacer.gif' border='0' height='1px' width='378px'></td></tr>");
	document.writeln("</table>");
}

function nav_menu (ontab)
{	document.writeln("	<table border=0 cellpadding=0 cellspacing=0 width='906px' width='34px' background='images/nav/nav_b.gif'>");
	document.writeln("		<tr><td><img src='images/nav/nav_l.gif' border=0></td>");
	document.writeln("			<td><img src='images/spacer.gif' height='34px' width='140px'></td>");
		
	navtabs = new Array("", "services", "about", "hospitals", "healthcare", "qna", "contact");
	navlink = new Array("", "services.htm", "aboutus.htm", "hospitals.htm", "healthcare_prof.htm", "qna.htm", "contact.cgi");
	for (i=1; i<=6; i++)
	{	if (ontab == i)
		{	document.writeln("	<td><img src='images/nav/"+navtabs[i]+"_on.gif'></td>");
		} else {
			  document.write("	<td><a href='"+navlink[i]+"'><img src='images/nav/"+navtabs[i]+"_off.gif' border=0 ");
			  document.write("onmouseover=\"this.src='images/nav/"+navtabs[i]+"_on.gif'\" ");
			document.writeln("onmouseout=\"this.src='images/nav/"+navtabs[i]+"_off.gif'\"></a></td>");
		}
	}
	
	document.writeln("			<td><img src='images/spacer.gif' height='34px' width='140px'></td>");
	document.writeln("			<td><img src='images/nav/nav_r.gif' border=0></td></tr>");
	document.writeln("	</table>");
}

function right_buttons ()
{	document.writeln("<table border='0' cellpadding='0' cellspacing='0' width='246px'>");
	document.writeln("	<tr><td><img src='images/spacer.gif' border='0' height='10px'></td></tr>");
	
	navtabs = new Array("", "five_star", "tools");
	navlink = new Array("", "five_star_qual.htm", "tools_for_success.htm");
	for (i=1; i<=2; i++)
	{	  document.write("	<tr><td><a href='"+navlink[i]+"'><img src='images/sidenav/"+navtabs[i]+"_off.gif' border=0 ");
		  document.write("onmouseover=\"this.src='images/sidenav/"+navtabs[i]+"_on.gif'\" ");
		document.writeln("onmouseout=\"this.src='images/sidenav/"+navtabs[i]+"_off.gif'\"></a></td></tr>");
	}

	document.writeln("</table>");
}

function hosp_subnav_menu (ontab)
{
		document.writeln("<table border=0 cellpadding=0 cellspacing=0 width='906px' background='images/subnav/bg.gif'>");
		document.writeln("	<tr><td><img border=0 src='images/subnav/left.gif'></td>");
		document.writeln("		<td><img border=0 src='images/spacer.gif' height='30px' width='603px'></td>");
	if (ontab == 1)
	{	document.write("		<td><a href='hospital.cgi?what='><img border='0' src='images/subnav/hd_home_on.gif'></a></td>");
	} else {
		document.write("		<td><a href='hospital.cgi?what=land'><img border='0' src='images/subnav/hd_home_off.gif' ");
		document.write("				onmouseover=\"this.src='images/subnav/hd_home_on.gif'\" ");
		document.writeln("				onmouseout=\"this.src='images/subnav/hd_home_off.gif'\"></a></td>");
	}
	if (ontab == 2)
	{	document.write("		<td><a href='hospital.cgi?what='><img border='0' src='images/subnav/nd_settings_on.gif'></a></td>");
	} else {
		document.write("		<td><a href='hospital.cgi?what=accset'><img border='0' src='images/subnav/nd_settings_off.gif' ");
		document.write("				onmouseover=\"this.src='images/subnav/nd_settings_on.gif'\" ");
		document.writeln("				onmouseout=\"this.src='images/subnav/nd_settings_off.gif'\"></a></td>");
	}
		document.write("		<td><a href='hospital.cgi?what=logout'><img src='images/subnav/logout_off.gif' ");
		document.write("				border='0' onmouseover=\"this.src='images/subnav/logout_on.gif'\" ");
		document.writeln("				onmouseout=\"this.src='images/subnav/logout_off.gif'\"></a></td>");
		document.writeln("		<td><img border=0 src='images/subnav/right.gif'></td></tr>");
		document.writeln("</table>");
}

function nurse_subnav_menu (ontab)
{
	imagelist = new Array("", "profile", "searchjobs", "settings", "resources", "timesheets", "payment");
	linklist = new Array("", "prof", "search", "accset", "resources", "timeslip", "payhist");

		document.writeln("<table border=0 cellpadding=0 cellspacing=0 width='906px' background='images/subnav/bg.gif'>");
		document.writeln("	<tr><td><img border=0 src='images/subnav/left.gif'></td>");
		document.writeln("		<td><img border=0 src='images/spacer.gif' height='30px' width='140px'></td>");
		
	for (i=1; i<7; i++)
	{	if (ontab == i)
		{	  document.write("		<td><a href='nurse.cgi?what="+linklist[i]+"'><img border='0' ");
			document.writeln("				src='images/subnav/nd_"+imagelist[i]+"_on.gif'></a></td>");
		} else {
			document.write("		<td><a href='nurse.cgi?what="+linklist[i]+"'><img ");
			document.write("				border='0' src='images/subnav/nd_"+imagelist[i]+"_off.gif' ");
			document.write("				onmouseover=\"this.src='images/subnav/nd_"+imagelist[i]+"_on.gif'\" ");
			document.writeln("				onmouseout=\"this.src='images/subnav/nd_"+imagelist[i]+"_off.gif'\"></a></td>");
		}
	}
					
		document.writeln("		<td><img border=0 src='images/spacer.gif' height='30px' width='76px'></td>");
		document.write("		<td><a href='nurse.cgi?what=logout'><img src='images/subnav/logout_off.gif' ");
		document.write("				border='0' onmouseover=\"this.src='images/subnav/logout_on.gif'\" ");
		document.writeln("				onmouseout=\"this.src='images/subnav/logout_off.gif'\"></a></td>");
		document.writeln("		<td><img border=0 src='images/subnav/right.gif'></td></tr>");
		document.writeln("</table>");
}

// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 

function clear_input (field)
	{ document.getElementById(field).value = ""; }

function disp_calendar (field)
{	if (document.layers)
		document.layers["date_calendar"].visibility='show';
	else
		document.getElementById("date_calendar").style.visibility='visible';
	
	var myElement = document.getElementById("date_calendar");
	var myInput = document.getElementById(field);
	myElement.style.left = (findPosX(myInput)+1) + 'px';
	myElement.style.top = ( findPosY(myInput) + myInput.offsetHeight + 5 ) + 'px';

	search_calendar_init(field);
}

function input_date (field, value)
{	document.getElementById(field).value = value;
	if (field.substring(0,6) == "TSDate") { timesheet_datefill(value); }
	hide_calendar();
}

function hide_calendar ()
{	if (document.layers)
		document.layers["date_calendar"].visibility='hide';
	else
		document.getElementById("date_calendar").style.visibility='hidden';
}

function timesheet_datefill (testdate)
{	// Set the start date
	dateparts = testdate.split("/");
	var initdate = new Date;
	initdate.setMonth(dateparts[0]-1);
	initdate.setDate(dateparts[1]);
	initdate.setFullYear(dateparts[2]);
	
	// Now rewind to that Sunday
	initdate.setDate(initdate.getDate() - initdate.getDay());
	
	for (i=0; i<7; i++)
	{	month = initdate.getMonth() + 1;
		datestr = month+"/"+initdate.getDate()+"/"+initdate.getFullYear();
		document.getElementById("TSDate"+i).value = datestr;
		
		initdate.setDate(initdate.getDate() + 1);
	}
}

// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 

function findPosX(obj)
{	var curleft = 0;
	if ( typeof obj == 'string' ) { var obj = document.getElementById(obj); }
	if (obj.offsetParent)
	{	while (obj.offsetParent)
		{	curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if(obj.x) {
		curleft += obj.x
	}
	return curleft;
}

function findPosY(obj)
{	var curtop = 0;
	if ( typeof obj == 'string' ) { var obj = document.getElementById(obj); }
	if (obj.offsetParent)
	{	while (obj.offsetParent)
		{	curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if(obj.y) {
		curtop += obj.y
	}
	return curtop;
}


