//<!--
var topColor, subColor, ContentInfo;
ContentInfo = "";

topColor = "#AFC61C"
subColor = "#F7FCDC"

var mouse_X;
var mouse_Y;
var tip_active = 0;


function update_tip_pos(){
		document.getElementById('ToolTip').style.left = mouse_X + 10;
		document.getElementById('ToolTip').style.top  = mouse_Y;

}


var ie = document.all?true:false;
if (!ie) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;


function getMouseXY(e) {

if (ie) { // grab the x-y pos.s if browser is IE

mouse_X = event.clientX + document.body.scrollLeft;
mouse_Y = event.clientY + document.body.scrollTop;

}

else { // grab the x-y pos.s if browser is NS

mouse_X = e.pageX;
mouse_Y = e.pageY;

}

if (mouse_X < 0){mouse_X = 0;}
if (mouse_Y < 0){mouse_Y = 0;}
if(tip_active){update_tip_pos();}

}


function EnterContent(TTitle, TContent){

ContentInfo = '<table border="0" width="260" cellspacing="0" cellpadding="2">'+
'<tr><td width="100%" bgcolor="#000000">'+
'<table border="0" width="100%" cellspacing="1" cellpadding="2">'+
'<tr><td width="100%" bgcolor='+topColor+'>'+
'<table border="0" width="90%" cellspacing="0" cellpadding="2" align="center">'+
'<tr><td width="100%">'+
'<font class="tooltiptitle">&nbsp;'+TTitle+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'<tr><td width="100%" bgcolor='+subColor+'>'+
'<table border="0" width="90%" cellpadding="2" cellspacing="1" align="center">'+
'<tr><td width="100%">'+
'<font class="tooltipcontent">'+TContent+'</font>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>'+
'</td></tr>'+
'</table>';


}


function tip_it(which, TTitle, TContent){
	if(which){

		update_tip_pos();
		tip_active = 1;
		document.getElementById('ToolTip').style.visibility = "visible";
		

		EnterContent(TTitle, TContent);
		document.getElementById('ToolTip').innerHTML = ContentInfo;
	}else{
		tip_active = 0;
		document.getElementById('ToolTip').style.visibility = "hidden";

	}
}

// If the current BODY has a windowOnLoad function defined, call it.
function handleWindowOnLoad() {
	if (typeof(windowOnLoad) != "undefined") {
		windowOnLoad();
	}
}
//-->


// stopwatch script by Brothercake - http://www.brothercake.com/ (format modified by Proft, 11 Sep 04)

var base = 60;

var clocktimer,dateObj,dh,dm,ds,ms;
var readout='';
var h=1;
var m=1;
var tm=1;
var s=0;
var ts=0;
var ms=0;
var show=true;
var init=0;
var mPLUS=new Array(
	'm0',
	'm1',
	'm2',
	'm3',
	'm4',
	'm5',
	'm6',
	'm7',
	'm8',
	'm9'
	);
var ii=0;

function clearALL() {
	clearTimeout(clocktimer);
	h=1;m=1;tm=1;s=0;ts=0;ms=0;
	init=0;show=true;
	readout='00:00:00.00';
	document.data_entry.clock.value=readout;

document.data_entry.timeHours_2.value = dh; 
document.data_entry.timeMinutes_2.value = dm; 
document.data_entry.timeSeconds_2.value = '00.0'; 

	var CF = document.data_entry;
	for (ij=0;ij<=9;ij++) { CF[mPLUS[ij]].value = ''; }
	ii = 0;
	}

function addMEM() {
if (init>0) {
		var CF = document.clockform;
		CF[mPLUS[ii]].value = readout;
		readout = readoutlast + '|' + readout;
		document.clockform.text_area8.value = readout;
		readoutlast = readout;
		if (ii==9) { ii = 0; } else { ii++; }
		}
	}



function startTIME() {

var cdateObj = new Date();
var t = (cdateObj.getTime() - dateObj.getTime())-(s*1000);

if (t>999) { s++; }

if (s>=(m*base)) {
	ts=0;
	m++;
	} else {
	ts=parseInt((ms/100)+s);
	if(ts>=base) { ts=ts-((m-1)*base); }
	}

if (m>(h*base)) {
	tm=1;
	h++;
	} else {
	tm=parseInt((ms/100)+m);
	if(tm>=base) { tm=tm-((h-1)*base); }
	}

ms = Math.round(t/10);
if (ms>99) {ms=0;}
if (ms==0) {ms='00';}
if (ms>0&&ms<=9) { ms = '0'+ms; }

if (ts>0) { ds = ts; if (ts<10) { ds = '0'+ts; }} else { ds = '00'; }
dm=tm-1;
if (dm>0) { if (dm<10) { dm = '0'+dm; }} else { dm = '00'; }
dh=h-1;
if (dh>0) { if (dh<10) { dh = '0'+dh; }} else { dh = '00'; }

readout = dh + ':' + dm + ':' + ds + '.' + ms;
if (show==true) { 
document.data_entry.clock.value = readout; 

document.data_entry.timeHours_2.value = dh; 
document.data_entry.timeMinutes_2.value = dm; 
document.data_entry.timeSeconds_2.value = ds; 


}

clocktimer = setTimeout("startTIME()",1);
}

function findTIME() {
if (init==0) {
	dateObj = new Date();
	startTIME();
	init=1;
	} else {
	if(show==true) {
		show=false;
		} else {
		show=true;
		}
	}
}





function getGPS() {
	if (navigator.geolocation) {
		navigator.geolocation.getCurrentPosition(showGPS, gpsError);
	} else {
		gpsText.innerText = "No GPS Functionality.";
	}
}

function gpsError(error) {
	alert("GPS Error: "+error.code+", "+error.message);
}

function showGPS(position) {
//	gpsText.innerText = "Latitude: "+position.coords.latitude+"\nLongitude: "+position.coords.longitude;
//document.data_entry.text_151.value = position.coords.latitude; 
document.data_entry.text_152.value = position.coords.latitude+','+position.coords.longitude; 


	// alternate
	//gpsText.innerHTML = "<a href='http://maps.google.com/maps?q="+position.coords.latitude+","+position.coords.longitude+"+(Your+Location)&iwloc=A&z=17'>"+position.coords.latitude+","+position.coords.longitude+"</a>";
}



