  var up, down;
  var min1, sec1;
  var cmin1, csec1, cmin2, csec2;

    function AutoTab(obj,len,next,nest)
	{
		
		nest=(!nest) ? "":'document.'+nest+'.'
		evnt = document.getElementById?document.getElementById(obj):document.all?document.all[obj]:document.layers?eval(nest+'document.'+obj):0;
		if (evnt.value.length == len)
		{
			nxt_evnt = document.getElementById?document.getElementById(next):document.all?document.all[next]:document.layers?eval(nest+'document.'+next):0;
			nxt_evnt.focus();
		}
		return;
	}
	
	function OpenCourseWindow(url, name, expand)
	{
		new_window = window.open(url,name,'width=766, height=538, resizable='+expand+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+expand);
		new_window.focus();
	}
	
	function OpenWindow(url,name)
	{
		new_window = window.open(url,name,'width=766, height=538, resizable=no, location=no, menubar=no, status=no, toolbar=no, scrollbars=no');
		new_window.focus();
	}
	
	function OpenWindow2(url,name)
	{
		new_window = window.open(url,name,'width=766, height=538, resizable=yes, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes');
		new_window.focus();
	}
	
	function alert_msg(msg)
	{
		var quote = /\$/g;
		msg = msg.replace(quote,"\n");
		alert(msg);	
	}	

  function contact_check(obj,nest)
  {
	nest=(!nest) ? "":'document.'+nest+'.';
	evnt = document.getElementById?document.getElementById(obj):document.all?document.all[obj]:document.layers?eval(nest+'document.'+obj):0;
	if ( (evnt.value.search(/\d{3}-\d{3}-\d{4}/) == -1)) //
	{
		alert('Contact # must be in the format of 111-222-3333');
		return false;
	}
	return true;
  }
  
  function popup(url, width, height)
  {
      day = new Date();
      id = day.getTime();
      eval("page" + id + " = window.open(url, '" + id + "', 'toolbar = 0, scrollbars = 1, location = 0, statusbar = 0, menubar = 0, resizable = 1, width = " + width + ", height = " + height + "');");
  }

  function goto_url(object)
  {
      window.location.href = object.options[object.selectedIndex].value;
  }

  function minutes(data)
  {
      for (var i = 0; i <data.length; i++) if (data.substring(i, i + 1) == ":") break;
      return (data.substring(0, i));
  }

  function seconds(data)
  {
      for (var i = 0; i <data.length; i++) if(data.substring(i, i + 1) == ":") break;
      return (data.substring(i + 1, data.length));
  }

  function Display(min, sec)
  {
      var disp;
      if (min <= 9) disp = "0";
      else disp = " ";
      disp += min + ":";
      if (sec <= 9) disp += "0" + sec;
      else disp += sec;
      return (disp);
  }

  function Down()
  {
      cmin2 = 1 * minutes(document.countdown.start_time.value);
      csec2 = 0 + seconds(document.countdown.start_time.value);
      DownRepeat();
  }

  function DownRepeat()
  {
      if (--csec2 == -1) {
          csec2 = 59;
          cmin2--;
      }

      document.countdown.time.value = Display(cmin2, csec2);
      if ((cmin2 == 0) && (csec2 == 0)) alert("Time's up!");
      else down = setTimeout("DownRepeat()", 1000);
  }
  
  function WriteLayer(sText,obj,nest)
{ 
	var evnt = document.getElementById?document.getElementById(obj):document.all?document.all[obj]:document.layers?eval(nest+'document.'+obj):0;	
	if (document.layers)
	{ 
		evnt.document.open(); 
		evnt.document.write('<CENTER><font color="#ff0000"><B>WARNING</B></font></CENTER><BR>' + sText + '<BR><BR><CENTER>Do you want to continue?<BR><BR><INPUT type="button" value="Yes" onClick="submitForm(1);" style="width:50px;">&nbsp;&nbsp;<INPUT type="button" value="No" onClick="CloseError(' + "'filterdiv','warningdiv',''" + ');" style="width:50px;"></CENTER>');
		evnt.document.close(); 
	} 
	else 
	{ 
		evnt.innerHTML = '<CENTER><font color="#ff0000"><B>WARNING</B></font></CENTER><BR>' + sText + '<BR><BR><CENTER>Do you want to continue?<BR><BR><INPUT type="button" value="Yes" onClick="submitForm(1);" style="width:50px;">&nbsp;&nbsp;<INPUT type="button" value="No" onClick="CloseError(' + "'filterdiv','warningdiv',''" + ');" style="width:50px;"></CENTER>';
	} 
} 

function ResetLayer(obj,nest)
{ 
	var evnt = document.getElementById?document.getElementById(obj):document.all?document.all[obj]:document.layers?eval(nest+'document.'+obj):0;	
	if (document.layers)
	{ 
		evnt.document.open(); 
		evnt.document.write('');
		evnt.document.close(); 
	} 
	else 
	{ 
		evnt.innerHTML = '';
	} 
} 

function OpenError(obj1,obj2,nest)
{
	var filter_height = 4300;
	var warning_height = 400;
	var warning_width = 400;
	//filter div	
	var evnt = document.getElementById?document.getElementById(obj1):document.all?document.all[obj1]:document.layers?eval(nest+'document.'+obj1):0;
	var css = evnt.style?evnt.style:evnt;	
	
	//warning div
	var evnt2 = document.getElementById?document.getElementById(obj2):document.all?document.all[obj2]:document.layers?eval(nest+'document.'+obj2):0;
	var css2 = evnt2.style?evnt2.style:evnt2;
	
	
	if (document.all)
	{
		css.width=document.body.clientWidth;
		//css.height=document.body.clientHeight;
		css.height=filter_height;
		css2.pixelLeft = ((document.body.clientWidth - warning_width) / 2);
		css2.pixelTop = ((document.body.scrollTop + (document.body.clientHeight - warning_height)) / 2 );
	}
	else if (document.layers)
	{
		css.width=window.innerWidth;
		//css.height=window.innerHeight;
		css.height=filter_height;
		css2.left = ((window.innerWidth - warning_width - 15) / 2);
		css2.top = ( (window.pageYOffset + (window.innerHeight - warning_height - 15)) / 2);
	}
	else if (document.getElementById)
	{
		css.width=window.innerWidth;
		//css.height=window.innerHeight;
		css.height=filter_height;
		css2.left = ((window.innerWidth - warning_width - 20) / 2) + 'px';
		css2.top = ( (window.pageYOffset + (window.innerHeight - warning_height - 20)) / 2) + 'px';
	}
	
	css.visibility='visible';
	css.display='block';
	css2.visibility='visible';
	css2.display='block';
}

function CloseError(obj1,obj2,nest)
{
	ResetLayer(obj2,nest);
	
	var evnt = document.getElementById?document.getElementById(obj1):document.all?document.all[obj1]:document.layers?eval(nest+'document.'+obj1):0;
	var css = evnt.style?evnt.style:evnt;	
	var evnt2 = document.getElementById?document.getElementById(obj2):document.all?document.all[obj2]:document.layers?eval(nest+'document.'+obj2):0;
	var css2 = evnt2.style?evnt2.style:evnt2;

	css2.visibility='hidden';
	css2.display='none';
	css.visibility='hidden';
	css.display='none';
}