<!--


if (document.getElementById && document.createTextNode && document.createElement){canDOM=true}

function showMenu(n) {
		if(canDOM){
			u=n.getElementsByTagName('div')[0];
			u.style.visibility=u.style.visibility=='visible'?'hidden':'visible';
			}
		}
		
	
function quickFinder(n) {
if(canDOM){
	node=n.parentNode.getElementsByTagName('select')[0];
	location.href = node.value
	}
}

function showDesc(n) {
	if(canDOM){
		node=n.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div');
		a=node[0];
		var num=n.parentNode.id;
		var num_split = num.split("_");
		b=node[num_split[4]];
		a.style.display=a.style.display=='none'?'block':'none';
		b.style.display=b.style.display=='block'?'none':'block';
	}
}	

function nullLink(){
}

function ChangePassword() {
		aPopUp= window.open('/portal/password_change.cfm' ,"Password", 'width=300,height=250,scrollbars=no,resizable=yes');
}


function EditContactInfo(){
	var TempString ='/portal/contact_info_edit.cfm';
	var itemTitleDiv = document.getElementById('MasterFrameTitle');
	itemTitleDiv.innerHTML = 'Edit Contact Info';
	toggleMyEditFormDynamic(410,360,40,240,'Master',TempString);
}
function EditUserEquipment(recordID){
	var TempString ='/portal/user_equipment_edit.cfm?RecordID=' + recordID;
	var itemTitleDiv = document.getElementById('MasterFrameTitle');
	itemTitleDiv.innerHTML = 'Edit Equipment';
	toggleMyEditFormDynamic(900,400,10,10,'Master',TempString);
}

function OpenNewPage(fileName){
	TempAttributes = 'resizable=yes,menubar=yes,toolbar=no';
	aPopUp= window.open(fileName ,"NewPageWindow");		
}


function GetSelectedButton(ButtonGroup) {
	for (var i = 0; i < ButtonGroup.length; i++) {
		if (ButtonGroup[i].checked) {
			return i
		}
	}
	return 0
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}





function stripCrap(strString) {
	var strChar;
	var newString = "";	
	
	if (strString.length == 0) return "0";
	for (i = 0; i < strString.length; i++) {
		strChar = strString.charAt(i);
		if (strChar != "%" && strChar != "," && strChar != "$" && strChar != " " && strChar != "'" && strChar != "#") {
			newString = newString + strChar;
		}
	}
	return newString;
}

function trimAll(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function isNumeric(strString) {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   for (i = 0; i < strString.length && blnResult == true; i++) {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1) {
         blnResult = false;
         }
      }
   return blnResult;
}

function Reformat(field) {	
 	field.value = NumberFormat(stripCrap(field.value));
	
	if (!isNumeric(field.value)) {
		alert("Invalid number!");
		field.focus();
	}
}

function NumberFormat(_a)
{
 var _b=_a.toString().split("");
 var _c="";
 var _d=0;
 for(var i=_b.length-1;i>=0;i--)
 {
   _d++;
   _c=_b[i]+_c;
   if(_d%3==0&&i!=0)
   {
   _c=","+_c;
   }
 }
 return(_c);
}

function ltrim ( s ) {
	return s.replace( /^\s*/, "" );
}

function rtrim ( s ) {
	return s.replace( /\s*$/, "" );
}

function trim ( s ) {
	return rtrim(ltrim(s));
}

function chkdate(objName) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}


function toggleForm(FormName) {
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = document.body.offsetWidth + document.body.offsetLeft -21; 
		pageHeight = document.body.offsetHeight + document.body.offsetTop-4;
	}
	var itemDiv = document.getElementById(FormName);
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
	var selectDiv = document.getElementById("HideDiv");
	selectDiv.style.display = selectDiv.style.display == "block" ? "none" : "block";
	var greyBGDiv = document.getElementById("GreyBG");
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	toggleDisabled(document.getElementById("MasterForm"));
}
function toggleForm2(FormName) {
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = document.body.offsetWidth + document.body.offsetLeft -21; 
		pageHeight = document.body.offsetHeight + document.body.offsetTop-4;
	}
	var itemDiv = document.getElementById(FormName);
	var greyBGDiv = document.getElementById("GreyBG");
	//greyBGDiv.style.width = (pageWidth-0);
	//greyBGDiv.style.height = (pageHeight-0);
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
}
function toggleParentForm(FormName) {
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( parent.document.body.scrollHeight > parent.document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = parent.document.body.scrollWidth;
		pageHeight = parent.document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = parent.document.body.offsetWidth; 
		pageHeight = parent.document.body.offsetHeight; 
	}
	var itemDiv = parent.document.getElementById(FormName);
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
	var selectDiv = parent.document.getElementById("HideDiv");
	selectDiv.style.display = selectDiv.style.display == "block" ? "none" : "block";
	var greyBGDiv = parent.document.getElementById("GreyBG");
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	toggleDisabled(parent.document.getElementById("MasterForm"));
}
function toggleEditForm(FormName) {
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
	var itemDiv = document.getElementById(FormName);
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
	var greyBGDiv = document.getElementById("GreyBG");
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	//toggleDisabled(document.getElementById("MasterForm"));
}

function toggleDynamicEditForm(vOffset,FormName) {
	var yPosition = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
	var itemDiv = document.getElementById(FormName);
	var greyBGDiv = document.getElementById("GreyBG");
	
	itemDiv.style.top = yPosition+vOffset;
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
}

function toggleDynamicEditForm2(vOffset,itemName,PageName) {
	var yPosition = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
	var itemDiv = document.getElementById(itemName+'Div');
	var itemFrame = document.getElementById(itemName+'Frame');
	var greyBGDiv = document.getElementById("GreyBG");
	
	itemFrame.src = PageName;
	itemDiv.style.top = yPosition+vOffset;
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
}

function toggleDynamicParentEditForm(vOffset,FormName) {
	var yPosition = window.pageYOffset || parent.document.body.scrollTop || parent.document.documentElement.scrollTop;
	if ( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if ( parent.document.body.scrollHeight > parent.document.body.offsetHeight ) { // all but Explorer Mac	
		pageWidth = parent.document.body.scrollWidth;
		pageHeight = parent.document.body.scrollHeight;
	}
	else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	 	pageWidth = parent.document.body.offsetWidth + parent.document.body.offsetLeft; 
		pageHeight = parent.document.body.offsetHeight + parent.document.body.offsetTop;
	}
	var itemDiv = parent.document.getElementById(FormName);
	itemDiv.style.top = yPosition+vOffset;
	itemDiv.style.display = itemDiv.style.display == "block" ? "none" : "block";
	var greyBGDiv = parent.document.getElementById("GreyBG");
	greyBGDiv.style.width = (pageWidth-1);
	greyBGDiv.style.height = (pageHeight-1);
	greyBGDiv.style.display = greyBGDiv.style.display == "block" ? "none" : "block";
}

function toggleDisabled(el) {
	try {
		el.disabled = el.disabled ? false : true;
	}
	catch(E){}
                
	if (el.childNodes && el.childNodes.length > 0) {
		for (var x = 0; x < el.childNodes.length; x++) {
		toggleDisabled(el.childNodes[x]);
		}
	}
}

function toggleParentDisabled(el) {
	try {
		el.disabled = el.disabled ? false : true;
	}
	catch(E){}
                
	if (el.childNodes && el.childNodes.length > 0) {
		for (var x = 0; x < el.childNodes.length; x++) {
		toggleParentDisabled(el.childNodes[x]);
		}
	}
}

/******************************************
* Popup Box- By Jim Silver @ jimsilver47@yahoo.com
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety

crossobj2.style.left=tempx2+event.clientX-offsetx
crossobj2.style.top=tempy2+event.clientY-offsety

return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"

crossobj2.style.left=tempx2+e.clientX-offsetx+"px"
crossobj2.style.top=tempy2+e.clientY-offsety+"px"

return false
}
}

function drag_drop2(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e,FormName){
	crossobj= document.getElementById(FormName);
	crossobj2= document.getElementById("HideDiv");
	var firedobj=ns6? e.target : event.srcElement
	var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
	while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
	}
	if (firedobj.id=="dragbar"){
		offsetx=ie4? event.clientX : e.clientX
		offsety=ie4? event.clientY : e.clientY

		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		
		tempx2=parseInt(crossobj2.style.left)
		tempy2=parseInt(crossobj2.style.top)

		dragapproved=true
		document.onmousemove=drag_drop
	}
}

function initializedrag2(e,FormName){
	crossobj= document.getElementById(FormName);
	var firedobj=ns6? e.target : event.srcElement
	var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
	while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
	}

	if (firedobj.id=="dragbar"){
		offsetx=ie4? event.clientX : e.clientX
		offsety=ie4? event.clientY : e.clientY

		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		
		dragapproved=true
		document.onmousemove=drag_drop2
	}
}


document.onmouseup=new Function("dragapproved=false")
//-->	

