<!--
function ImageLoadFailed() {
  window.event.srcElement.style.display = "None";
}

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) { //v3.0
  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); 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_openBrWindow(theURL,winName,features) { //v2.0
	var str = new String(features);
	var hStartPos, hEndPos, hVal 
	var wStartPos, wEndPos, wVal	
	var x, y
	
	if((str.indexOf("height") >= 0)&&(str.indexOf("width") >= 0)) {
		hStartPos = str.indexOf("height");	
		hEndPos = str.indexOf(",", hStartPos);
		hVal = str.substring(hStartPos + 7, hEndPos);
	
		wStartPos = str.indexOf("width");	
		wEndPos = str.indexOf(",", wStartPos);
		wVal = str.substring(wStartPos + 6, wEndPos);
	
		x = (screen.availWidth / 2) - (wVal / 2)
		y = (screen.availHeight / 2) - (hVal / 2)
		
		var newWin = window.open(theURL,winName,features);
		newWin.moveTo(x, y);
	}
	else {
		window.open(theURL,winName,features);
	}
}

function close_window() {
    window.close();
}

function MM_showHideLayers() { //v3.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 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 confirmDelete() {
	if(confirm("Are you sure you want to DELETE this item?")){
		return true;
	}else{
		return false;
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function moveup(uSel) {
   var intNewValue;
   var strNewText;
	for (i=1;i<uSel.options.length;i++)
		if (uSel.options[i].selected)
		{
		   intNewText = uSel.options[i-1].text;
		   intNewValue = uSel.options[i-1].value;
		   uSel.options[i-1].text = uSel.options[i].text;
		   uSel.options[i-1].value = uSel.options[i].value;
		   uSel.options[i].text = intNewText;
		   uSel.options[i].value = intNewValue;
		   uSel.options[i].selected = false;    
		   uSel.options[i-1].selected = true;    
		}
		
}
function movedown(uSel) {
   var intNewValue;
   var strNewText;
	for (i=uSel.options.length - 2;i>=0;i--)
		if (uSel.options[i].selected)
		{
		   intNewText = uSel.options[i+1].text;
		   intNewValue = uSel.options[i+1].value;
		   uSel.options[i+1].text = uSel.options[i].text;
		   uSel.options[i+1].value = uSel.options[i].value;
		   uSel.options[i].text = intNewText;
		   uSel.options[i].value = intNewValue;
		   uSel.options[i].selected = false;    
		   uSel.options[i+1].selected = true;    
		   
		}
}		

function showStatus(uSel, uSelEdit) {

	if(uSel.selectedIndex==-1)
		return false;
	
	var str = new String(uSel(uSel.selectedIndex).text);
	var iPos;
	
	// index position of the 'A' or 'I' char
	// find the space char and add 1
	iPos = str.indexOf(" ") + 1
	
	if(str.substr(iPos) == 'Active') {
		//set to Active
		uSelEdit.options[0].selected = true;
		}
	else {
		//set to Inactive
		uSelEdit.options[1].selected = true;
		}		
}

function updateStatus(uSel, uSelEdit) {

	if(uSel.selectedIndex==-1)
		return;
				
	var str = new String(uSel(uSel.selectedIndex).text);
	var iPos;
	var strBegin;
	var strEnd; 
	
	// index position of the 'A' or 'I' char
	// find the space char and add 1
	iPos = str.indexOf(" ") + 1

	// store the first part of the string (i.e. "1, ") 
	strBegin = str.substr(0,iPos)
	strEnd = uSelEdit(uSelEdit.selectedIndex).text

	uSel(uSel.selectedIndex).text = strBegin + strEnd;
}

function updateline(uSel,uTxt) {
       if (uTxt.value.length > 0) {
		  // uSel(uSel.selectedIndex).value = uTxt.value;  
		   uSel(uSel.selectedIndex).text = uTxt.value;
		}   
}

function editline(uSel,uTxt) {
		   uTxt.value = uSel(uSel.selectedIndex).text 
}

function addline(uSel,uTxt) {
   var intLength;
       if (uTxt.value.length > 0) {
           intLength = uSel.options.length;   
		   uSel.options[intLength] = new Option("prompt");
		   uSel(intLength).value = "-1";  
		   uSel(intLength).text = uTxt.value;
		   uTxt.value = "";  
       }   
}
function deleteline(uSel,uTxt,dTxt) {
	for (i=uSel.options.length - 1;i>=0;i--){
		if (uSel.options[i].selected){
			if ((dTxt.value.length) < 1){ 
				dTxt.value = uSel(uSel.selectedIndex).value
			    }
			else {
				dTxt.value = dTxt.value + "," + uSel(uSel.selectedIndex).value
			    }  
	   		for (x=i;x<uSel.options.length - 1;x++){
			   uSel.options[x].text = uSel.options[x+1].text;
			   uSel.options[x].value = uSel.options[x+1].value;
			}
		    uSel.options[x] = null;
        }
    }        		  

//   var intSelected;
//   if (uTxt.value.length > 0) {
//		intSelected = uSel.selectedIndex;/
//		if ((dTxt.value.length) < 1){ 
//			dTxt.value = uSel(uSel.selectedIndex).value
//		    }
//		else {
//			dTxt.value = dTxt.value + "," + uSel(uSel.selectedIndex).value
//		    }  
//		for (i=1;i<uSel.options.length - 1;i++)
//			if (i == intSelected )
//			{
//			   uSel.options[i].text = uSel.options[i+1].text;
//			   uSel.options[i].value = uSel.options[i+1].value;
//		       intSelected++
//			}   
  //     	   uSel.options[i].selected = false;    
//			uSel.options[intSelected] = null;
//		   uTxt.value = "";  
		   
//     }   		   
		    
}

function submitform(uSel,uTxt) {
	var strSubmitString
    strSubmitString = "";
  	for (i=0;i<uSel.options.length;i++)
  	    {
  		if (i == 0) {
  	       strSubmitString = uSel.options[i].value
           }
           else
           {
  	       strSubmitString = strSubmitString + "|" + uSel.options[i].value
           }
        }   
       //alert('test');    
       uTxt.value = strSubmitString; 
        
      // document.hostform.submit();  
      // return true;   		   
		    
}

function deleteall(uSel,uTxt,dTxt) {
	   
		var i;
		for (i = uSel.options.length -1 ; i >= 0; i--) {

			if ((dTxt.value.length) < 1){ 
				dTxt.value = uSel(i).value
			    }
			else {
			    dTxt.value = dTxt.value + "," + uSel(i).value
			    }             
 			uSel.options[i] = null;
           }
            uTxt.value = "";  
}

        function Left(str, n)
        /***
                IN: str - the string we are LEFTing
                    n - the number of characters we want to return

                RETVAL: n characters from the left side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);
        }

function selectitem(uSel,uSeld) {
   var intNewValue;
   var strNewText;
	for (i=uSel.options.length - 1;i>=0;i--){
		if (uSel.options[i].selected){
			intNewText = uSel.options[i].text;
			intNewValue = uSel.options[i].value;
	   		for (x=i;x<uSel.options.length - 1;x++){
			   uSel.options[x].text = uSel.options[x+1].text;
			   uSel.options[x].value = uSel.options[x+1].value;
			}
			uSeld.options[uSeld.options.length] = new Option("Prompt");
			uSeld.options[uSeld.options.length - 1].text = intNewText
			uSeld.options[uSeld.options.length - 1].value = intNewValue
		    uSel.options[x] = null;
        }
    }        		  
}

function selectall(uSel) {
       // alert('test');
		for (i = uSel.options.length -1 ; i >= 0; i--) {
				uSel.options[i].selected = true;
			    }
}

function moveToNextField(uTxt,sVal,iLen){
	if(String(sVal).length == iLen){
		uTxt.focus();
		uTxt.select();
	}
}

// Check whether string s is empty.
function isEmpty(s) {
   return ((s == null) || (s.length == 0))
}

// whitespace characters
var whitespace = " \t\n\r";

// Returns true if string s is empty or
// whitespace characters only.
function isWhitespace (s) {   
	var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function isDigit (c) {   
	return ((c >= "0") && (c <= "9"))
}

function isInteger (s) {   
	var i;

    if (isEmpty(s))
		return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.
    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}


// fieldList is comma separated, no whitespace
function chkReqdFields(formName, fieldList) {
	var arrFields;
	var i = 0
//	alert('Checking ' + formName);

	arrFields = fieldList.split(',');
	for(i = 0; i<arrFields.length; i++) {
		//alert('Checking ' + arrFields[i]);
		if(isWhitespace(eval('document.forms["' + formName + '"].' + arrFields[i] + '.value'))) {
			alert("Please fill in all required fields.");
			return false;
		}
	}
	return true;
}


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 tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  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; }}
}

//-->

//
// Copyright (c) 2000-2001 by experITy
//       All Rights Reserved
//

function Currency_int_onChange(field)
{
	field.value = Currency_int_Format(field.value);
}

function Currency_int_onInput(inputChar, field, bPositive)
{		
	if(	
		(inputChar < 48 || inputChar > 57) &&	// not a number 
		((!bPositive && inputChar!= 45) || bPositive))// If allow Negative and not "-"
	{
		return false;
	}	

	var strInput = field.value;
	if( inputChar == 45 && strInput.length >1) // "-" only allow at the beginning
	{
		return false;
	}	

	if ((strInput.length == 1 && strInput != "$") ||			
		(inputChar == 45 && strInput.length == 1 && strInput != "$"))	
		field.value = "$" + strInput	
		
	return true;
}

function Currency_int_Format(strInput)
{		
	if(strInput.length == 0)
		return strInput;
			
	if(strInput.substring(0, 1) != "$") 		
		strInput = "$" + strInput;
		
	if(strInput.indexOf("-", 0) == 1)
	{
		strHead = strInput.substring(0, 2);
		strInput = strInput.substring(2); 		
	}
	else
	{
		strHead = strInput.substring(0, 1);	
		strInput = strInput.substring(1); 
	}	

	if (strInput.length == 0)
		strInput = "0";

	strTail = "";

	if(strInput.indexOf(",", 0) == -1 && strInput.length >= 4)  // not formated yet
	{	
		while(strInput.indexOf("0", 0) == "0")
		{
			strInput = strInput.substring(1);
		}
		
		while(strInput.length >= 4)
		{
			pos = strInput.length - 3		
			strTail = "," + strInput.substring(pos) + strTail;		
			strInput = strInput.substring(0, pos);		
		}
	}
	
	return strHead + strInput + strTail;		
}

function processKeypresses(intHandler, bPositive, bInt, objEvent, field) {

    var inputChar = objEvent.which ? objEvent.which : objEvent.keyCode;

    var returnVal;

   if (inputChar == 8 || inputChar == 9) return true;
   if(intHandler == 0) {
        returnVal = Number_onInput(inputChar, field, bPositive, bInt);
    } else if(intHandler == 1) {
        returnVal = Currency_onInput(inputChar, field, bPositive);
    } else if(intHandler == 2) {
        returnVal = Date_onInput(inputChar, field);
    } else if(intHandler == 3) {
        returnVal = Phone_onInput(inputChar, field);
    } else if(intHandler == 4) {
        returnVal = Zip_onInput(inputChar, field);
    } else if(intHandler == 5) {
        returnVal = SSN_onInput(inputChar, field);
    } else if(intHandler == 6) {
        returnVal = Time_onInput(inputChar, field);
    } else if(intHandler == 7) {
        returnVal = Rate_onInput(inputChar, field);
    } else if(intHandler == 8) {
        returnVal = Year_onInput(inputChar, field, bPositive, bInt);
    } else if(intHandler == 9) {
        returnVal = TinyintonInput(inputChar, field, bPositive, bInt);
    } else if(intHandler == 10) {
        returnVal = Currency_int_onInput(inputChar, field, bPositive);
    } else if(intHandler == 11) {
        returnVal = TextBox_onInput(inputChar, field, bPositive);
    } else {
        returnVal = false;
    }
    return returnVal;
}

function hasOptions(obj) {
	if (obj!=null && obj.options!=null) { return true; }
	return false;
	}

function sortSelect(obj) {
	var o = new Array();
	if (!hasOptions(obj)) { return; }
	for (var i=0; i<obj.options.length; i++) {
		o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
		}
	if (o.length==0) { return; }
	o = o.sort( 
		function(a,b) { 
			if ((a.text+"") < (b.text+"")) { return -1; }
			if ((a.text+"") > (b.text+"")) { return 1; }
			return 0;
			} 
		);

	for (var i=0; i<o.length; i++) {
		obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
		}
	}
	
	
function moveSelectedOptions(from,to) {
	// Unselect matching options, if required
	//alert(to.name);
	if(to.options.length == 5 && to.name == 'activeCallouts')
	{
	alert('You can only have 5 active callouts at once.');
	}
	else
	{
		if (arguments.length>3) {
			var regex = arguments[3];
			if (regex != "") {
				unSelectMatchingOptions(from,regex);
				}
			}
		// Move them over
		if (!hasOptions(from)) { return; }
		for (var i=0; i<from.options.length; i++) {
			var o = from.options[i];
			if (o.selected) {
				if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
				to.options[index] = new Option( o.text, o.value, false, false);
				}
			}
		// Delete them from original
		for (var i=(from.options.length-1); i>=0; i--) {
			var o = from.options[i];
			if (o.selected) {
				from.options[i] = null;
				}
			}
		if ((arguments.length<3) || (arguments[2]==true)) {
			//sortSelect(from);
			//sortSelect(to);
			}
		from.selectedIndex = -1;
		to.selectedIndex = -1;
	}
} 
//-->
