
// JavaScript Document
<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function setImages()
{
x = randNum(4);
y = randNum(5);

document.MainImage.src = "../images/headerimages/image" + x + ".jpg";
document.SmallImage.src = "../images/pageelements/homeimage" + y + ".jpg";

}
function randNum (num) 
{
    var now = new Date();                                 
    var rand = Math.round(num * Math.cos(now.getTime())); 
    if (rand < 0) rand = - rand; if (rand == 0) rand++;
    return rand;
}

function validate()
{		
		if (document.login_form.username.value == '' || document.login_form.username.value == 'User Name' || document.login_form.password.value == '' || document.login_form.password.value == 'Password')
		{
			alert ('Please enter a username and password');
		}
		else
		{			
			document.login_form.submit();
		}
	
	
}

function doAttach(bMultiple,strDocType)
{
	//alert (bMultiple);
	//window.open('includes/upload.asp?bMultiple=' + bMultiple, 'Upload','height=300,width=400')
	window.open('includes/upload.asp?DocType=' + strDocType + '&amp;bMultiple=' + bMultiple, 'Upload','height=300,width=400')
}

function clearTextBox(box)
{		
	box.value = '';
}

function savecontent()
{

	if (document.frmEditContent.content_title.value == '')
		{
		alert ('Please enter a content title');			
		document.frmEditContent.content_title.focus();
		}
	else
		{
		document.frmEditContent.form_action.value = "save";	
		document.frmEditContent.submit();
		}
}

function deletecontent()
{	
	document.frmEditContent.form_action.value = "delete";
	
	document.frmEditContent.submit();
}




function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function setImages()
{
x = randNum(6);

document.MainImage.src = "images/headerimages/image" + x + ".jpg";


}
function randNum(num) 
{
    var now = new Date();                                 
       if (rand < 0) rand = - rand; if (rand == 0) rand++;
    return rand;
}
 //var rand = Math.round(num * Math.cos(now.getTime())); 

//bStatus = window.attachEvent('onresizeend', phaseMenus)
//-->

//-->

<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//-->

// JavaScript Document
// ## globalNav.js
// 	Contains the dynamic functionality for the drop down navigation found at the top of most templates.

// FUNCTION LIST:
// 	init();
// 	menuOn();
// 	menuOff();
//	menuLinkOn();
// 	menuLinkOff();
// 	linkSwap();
// 	arrowSwap();

// TEMPLATE(S) USED:
// 	products.htm
// 	online.asp
// 	company.htm
// 	contact.htm
// 	feedback.htm
// 	recruit.htm

var menuTimeout;
var currentMenu;
var imgPathNav = "../images/nav/";	// Image path location for Global Nav menu images.
var imgPath = "../images/";			// Image path location for all other images.
var navIsLoaded = false;



// Initializing the global navigation

// change init() to globalNavInit()
function init() {
	DynLayerInit()
	//phaseMenus()
	navIsLoaded = true;	// boolean to true when initialization is complete
}

// Display the dropdown menu.
// inputs: menuName  - name of the menu DIV layer without the Div.  ie. vehicles
// output: none
function menuOn(menuName) {
	var theMenu
	if (!navIsLoaded) return;	// check if initialization is complete
	if (menuTimeout) clearTimeout(menuTimeout);	// clear the timeout
	
	if (currentMenu) {			// hide the current menu
		theMenu = eval(currentMenu);
		theMenu.hide();
	}
	currentMenu = menuName;	
	theMenu = eval(currentMenu);
	theMenu.show();				// display menuName
	menuTimeout = setTimeout(currentMenu + '.hide()', 3000);		// set the timeout 
}

// Hides the dropdown menus
// inputs: menuName - name of the menu DIV layer without the Div.  ie. vehicles
// outputs: none
function menuOff(menuName) {
	
	if (!navIsLoaded) return	// check if initialization is complete
	
	if (menuTimeout) clearTimeout(menuTimeout)	// clear the current timeout
	menuTimeout = setTimeout(menuName + '.hide()', 205)		// set the new timeout
}

// Swaps the menu image to the ON state.
// input: imgName - name of the image to turn on
// output: swaps the image to the ON state
function menuLinkOn(imgName) {
	var theImage;
	
	if (menuTimeout) clearTimeout(menuTimeout);
	theImage = (is.ns4) ? eval("document.layers['" + currentMenu + "Div'].document.images['" + imgName + "']") : eval("document." + imgName);
	theImage.src = imgPathNav + imgName + "Roll.gif";
}

// Swaps the menu image to the OFF state.
function menuLinkOff(imgName) {
	var theImage;
	theImage = (is.ns4) ? eval("document.layers['" + currentMenu + "Div'].document.images['" + imgName + "']") : eval("document." + imgName);
	theImage.src = imgPathNav + imgName + ".gif";
	menuOff(currentMenu);
}

// Swaps the link image.
// input: 	imgName - name of the image
//			ON - on or off state
function linkSwap(imgName, ON) {
	var theImage = eval("document." + imgName);
	theImage.src = imgPath + imgName + "_lnk" + ((ON) ? "_on":"") + ".gif"
}

// Swaps the arrow image.
// input: 	imgName - name of the image
//			ON - on or off state
function arrowSwap(linkName, ON, obj, obj2) {
	var theImage = 'document.'
	
	if (obj && is.ie) {
		theImage += 'all.'
	} else if (obj && is.ns) {
	 	theImage += obj + '.document.'
	} 
	
	if (obj2 && is.ns) {
		theImage += obj2 + '.document.'
	}

	theImage += linkName
	theImageObj = eval(theImage);

	theImageObj.src = imgPath + "g_arrow" + ((ON) ? "_on":"") + ".gif";
}


// Swaps the arrow image.
// input: 	imgName - name of the image
//			ON - on or off state
function arrowSwapUp(linkName, ON, obj, obj2) {
	var theImage = 'document.'
	
	if (obj && is.ie) {
		theImage += 'all.'
	} else if (obj && is.ns) {
	 	theImage += obj + '.document.'
	} 
	
	if (obj2 && is.ns) {
		theImage += obj2 + '.document.'
	}

	theImage += linkName
	theImageObj = eval(theImage);

	theImageObj.src = imgPath + "page_up" + ((ON) ? "_on":"") + ".gif";
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function setImages()
{
x = randNum(3);

document.MainImage.src = "images/rotating/image" + x + ".jpg";


}
function randNum (num) 
{
    var now = new Date();                                 
    var rand = Math.round(num * Math.cos(now.getTime())); 
    if (rand < 0) rand = - rand; if (rand == 0) rand++;
    return rand;

}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function clearTextBox(obj)
{
	if (obj.value == '')
	{
		if (obj.name == 'username')
		{
			obj.value = 'User Name'
		}
		else if (obj.name == 'password')
		{
			obj.value = 'password'
		}
		else if (obj.name == 'email')
		{
			obj.value = 'Email'
		}
		else if (obj.name == 'name')
		{
			obj.value = 'Name'
		}
		else if (obj.name == 'number')
		{
			obj.value = 'Number'
		}
	}
	else if (obj.value == 'User Name' || obj.value == 'Password' || obj.value == 'Email' || obj.value == 'Name' || obj.value == 'Number')
	{
		
			obj.value = '';
	}

}

function validate(form_name)
{
	if (form_name == 'newsletter')	
	{
		if (document.newsletter.email.value == '' || document.newsletter.email.value == 'Email')
		{
			alert ('Please enter your email address');
			return false;
		}
		else if (document.newsletter.email.value.indexOf("@") == -1)
		{
			alert('Please enter a valid email address');
			return false;			
		}
		document.newsletter.submit();			
	}
	if (form_name == 'login_form')
	{
		if (document.login_form.username.value == '' || document.login_form.username.value == 'User Name' || document.login_form.password.value == '' || document.login_form.password.value == 'Password')
		{
			alert ('Please enter a username and password');
			return false;			
		}
		else
		{
			document.login_form.submit();
		}
	}
	if (form_name == 'callback')
	{
		if (document.callback.name.value == '' || document.callback.name.value == 'Name' || document.callback.number.value == '' || document.callback.number.value == 'Number')
		{
			alert ('Please enter your name and number');
			return false;
		}
		else
		{
			document.callback.submit();
		}
	}
	if (form_name == 'audit')
	{
		if (document.audit_form.contact_email.value == '')
		{
			alert ('Please enter your email address');
			return false;
		}
		else if (document.audit_form.contact_email.value.indexOf("@") == -1)
		{
			alert('Please enter a valid email address');
			return false;			
		}
		else
		{
			document.audit_form.submit();
		}
	}
}