// JavaScript Document

// Declare a global variable and initialize to null.

//var reloadTimer = null;

// This function gets called when the window has completely loaded.
// It starts the reload timer with a default time value.

//window.onload = function()
//{
//  setReloadTime(5); // Pass a default value of 5 seconds.
//}

// setReloadTime() does two different things:
// (1) If a value is passed as an argument, the function clears the current timer
//     (if its running) and starts the timer again with the new time
//     and saves a reference to the timer: reloadTimer.
// (2) If no argument is passed, the page is reloaded. The only time no argument
//     will be passed is when the 'setTimeout()' function times out and calls
//     this function.

function setReloadTime(secs)
{
  if (arguments.length == 1) {
    if (reloadTimer) clearTimeout(reloadTimer);
    reloadTimer = setTimeout("setReloadTime()", Math.ceil(parseFloat(secs) * 1000));
  }
  else {
    window.location.replace(window.location.href);
  }
}

function open_window(url, myname, wt ,ht , settings )
{
	LeftPosition = (screen.width) ? (screen.width-wt)/2 : 0 ;
	TopPosition = (screen.height) ? (screen.height-ht)/2 : 0 ;
	new_settings = 'height='+ht+',width='+wt+',top='+TopPosition+',left='+LeftPosition+','+ ',z-lock=yes,'+settings ;
	win = window.open( url, myname, new_settings ) ;
	return win ;
}

function timer(){
		var now = new Date() ;
		// let's start at 0 so we can increase each second
		var the_timer = new Date(now.getTime() - start_date.getTime() + now.getTimezoneOffset()*60000) ;
		var minutes = the_timer.getMinutes() ;
		var seconds = the_timer.getSeconds() ;

		// tack on 0 if on digit
		if( minutes <= 9 ) minutes = "0" + minutes ;
		if( seconds <= 9 ) seconds = "0" + seconds ;
		
		document.getElementById("timer").innerHTML = minutes + ":" + seconds;

		// call timer each second so we can see the cycle
		
		timeout = setTimeout("timer()", 1000);
		
}

function clear_text(obj, standard_text) {
	if (standard_text == obj.value) 
	{
		obj.value = "";
	}
}
