//************************************************************************************************
//  This function will display all rollowver images on the Armor/PROTECH website.
//  Nathan Arnold 
//  March, 2003
if (document.images) {

// ON main globals
  img1on = new Image();           
  img1on.src = "/graphics/on/gbl_home.gif";
  img2on = new Image();
  img2on.src = "/graphics/on/gbl_systems.gif";
		img3on = new Image();
  img3on.src = "/graphics/on/gbl_tactical.gif";
// OFF main globals  
  img1off = new Image();
  img1off.src = "/graphics/off/gbl_home.gif";
  img2off = new Image();
  img2off.src = "/graphics/off/gbl_systems.gif";
		img3off = new Image();
  img3off.src = "/graphics/off/gbl_tactical.gif";
  

		//globals, sub menu
						img29on = new Image();
				  img29on.src = "/globals/graphics/on/rg_1.gif";
						img30on = new Image();
				  img30on.src = "/globals/graphics/on/rg_2.gif";
		//globals, sub menu
						img29off = new Image();
				  img29off.src = "/globals/graphics/off/rg_1.gif";
						img30off = new Image();
				  img30off.src = "/globals/graphics/off/rg_2.gif";
	
}

function imgOn(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "on.src");
  }
}
                                 
function imgOff(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "off.src");
  }
}


//************************************************************************************************
// New Window Function
function launchCourse(filename)
{  window.open(filename, 'filename','scrollbars=yes,width=648,height=430');
}


//************************************************************************************************
// New Window Function
function FindARep(filename)
{  window.open(filename, 'filename','scrollbars=yes,width=548,height=320');
}

//************************************************************************
//Browser Detection
NS4     = (document.layers);
IE4     = (document.all);
ver4    = (NS4 || IE4);
IE5     = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
isMac   = (navigator.appVersion.indexOf("Mac") != -1);
isMenu  = (NS4 || (IE4 && !isMac) || (IE5 && isMac));



/*************************************************************************
 * Set table height for Netscape vs IE
 *************************************************************************/
tblHeight = NS4 ? "102%" : "100%";



/*************************************************************************
 * Handle the Netscape resize/document.write bug....
 *************************************************************************/
if (NS4) {
  origWidth = innerWidth;
  origHeight = innerHeight;
}

function reFresh() {
  if (innerWidth != origWidth || innerHeight != origHeight) 
  location.reload();
}

if (NS4) onresize = reFresh;

/*************************************************************************
 * Form Validation for Ask an Expert
 *************************************************************************/
	
		function SendForm()
		{

			// Verify a name, email and agency selected
			if (document.frmEmail.txtName.value == "" || document.frmEmail.txtEmail.value =="" || document.frmEmail.selAgency.selectedIndex == 0)
			{ 	alert("The following fields are required: \n\nName\nEmail\nDepartment or Agency");
				return false;
			}

			// If a state is selected, verify the country code is US
			if ((document.frmEmail.selAgency.value == "U.S. Licensed Law Enforcement" || document.frmEmail.selAgency.value == "Private Security" || document.frmEmail.selAgency.value == "Corrections") && document.frmEmail.cboStateZip.value == "-|-" && document.frmEmail.txtCountry.value == "us")
			{	alert("If you select United States as the country, and any of the following as Agency:\n\nU.S. Licensed Law Enforcement\nPrivate Security\nor Corrections\n\n you must select a state (or another country).\n");
				return false;

			}
	
			// Check e-mail
			var email = document.frmEmail.txtEmail.value;
			var at = email.indexOf('@');
			var dot = email.lastIndexOf('.');
			if (at<=0 || at>=email.length-1 || dot<=0 || dot>=email.length-1 || at>dot || dot==at+1)
			{       alert("Please enter a correct Email address.");
					return false;
			}
	
			return true;
	
		}
