startList = function() {
  if (document.all&&document.getElementById) {
    if (navRoot = document.getElementById("nav")) {
      for (i=0; i<navRoot.childNodes.length; i++) {
        node = navRoot.childNodes[i];
          if (node.nodeName=="LI") {
             node.onmouseover=function() {
	       this.className+=" over";
  	     }
	     node.onmouseout=function() {
	       this.className=this.className.replace(" over", "");
	     }
	   }
	}
     }
   }
}
window.onload=startList; 

// 24/7 Tracking  
var refr=escape(document.referrer); 
var dom=location.hostname; 
var stURL="http://link.decideinteractive.com/n/14397/14399/www.command.com.au/3429845a0025030000000006000000000366b6de0000000000000000000000000000000100/i/c?0&1pixgif&referer="
+ refr;
if (refr && refr.search(dom) == -1) {
  imageTR = new Image();
  imageTR.src = stURL;
}

function ps(id, start, step)
{
	document.f.id.value = id;
	document.f.start.value = start;
	document.f.step.value = step;
	document.f.submit() ; 
}

function calculateTime(name) {

	var total = 0;
	var DaysOfWeek = new Array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');

	for (var i=0; i < DaysOfWeek.length; i++) {

		startmins = getTime('start', DaysOfWeek[i], true);
		endmins = getTime('end', DaysOfWeek[i], true);
		breakmins = getTime('break', DaysOfWeek[i], false);
		if (startmins > 0 && endmins > 0 && endmins > startmins) {
			total = total + (endmins - startmins - breakmins);
		}
	
	}
	hours = Math.floor(total/60);
	minutes = total - (hours * 60);

	timestr = hours + 'hr ' + minutes + 'min';
	document.timesheet.total.value = timestr;
}

function getTime(startend, day, getampm) {
	var totalminutes = 0;
	var hour = 0;
	var min = 0;
	var ampm = 0;

	str_hour = day + '_' + startend + '_hour';
	str_min = day + '_' + startend + '_minute';
	str_ampm = day + '_' + startend + '_ampm';

	hour = document.timesheet[str_hour].selectedIndex;
	min  = document.timesheet[str_min].selectedIndex;

	if (getampm) {
		ampm = document.timesheet[str_ampm].selectedIndex;
	}
	else {
		if (hour > 0) {
			hour = hour - 1; // break hour has extra '00' entry
		}
	}

	if (min > 0) {
		min = (min-1) * 5;
	}

	if (getampm) {
		if (ampm == 0) {
			ampm = 'am';
			if (hour == 12) {
				hour = 24;
			}
		}
		else {
			ampm = 'pm';
			if (hour > 0 && hour != 12) {
				hour = hour + 12;
			}
		}
	}

	totalminutes = (hour * 60) + min;
	return totalminutes;
}

function checkData() {


	if (document.timesheet.week_ending.selectedIndex > 0) {
		return true;
	}
	else {
		alert("You must select a week ending date");
		document.timesheet.week_ending.focus();
		return false;
	}
}


 
// Check if flash is installed

function flashInstalled()
{
  result = false;

  if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) {
	result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
  }
  else if (document.all && (navigator.appVersion.indexOf("Mac")==-1)) {
	// IE Windows only -- check for ActiveX control, have to hide code in eval from Netscape (doesn't like try)
	eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj)	result = true; xObj = null;	} catch (e)	{}');
  }
  return result;
}


// Write the flash to the page

function flashWrite(url,width,height) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
	document.write('  WIDTH=' + width + ' HEIGHT=' + height + '>');
	document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  '); 
	document.write(' <EMBED src="' + url + '" quality=high bgcolor=#FFFFFF  ');
	document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write(' </EMBED></OBJECT>');
}


