<!--- hide script from old browsers

var newWin = null;
var version4 = false
if(navigator.appVersion.charAt(0) == "4") version4 = true

function displayPopup(url,name,height,width,evnt) {
 	var properties = "toolbar=0,location=0,height="+height
 	properties = properties+",width="+width
 	if(evnt != null) {
  		if(navigator.appName == "Microsoft Internet Explorer") {
  			properties = properties+",left="+(evnt.screenX + 10)
   			properties = properties+",top="+(evnt.screenY + 10)			
  		}
		else {
			// Navigator coordinates must be adjusted for scrolling
   			properties = properties+",left="+(evnt.screenX - pageXOffset + 10)
   			properties = properties+",top="+(evnt.screenY - pageYOffset + 10)
  		}
 	}
	//alert(url +"    " + name +"    " + properties)
 	popupHandle = open(url,name,properties)
}

function closePopup() {
 	// mouseOut was introduced with JavaScript 1.1, so Navigator 2 users will
 	// have to manually close the window
 	if(popupHandle != null && !popupHandle.closed) popupHandle.close()
}

function password(form) {
  if(document.mainform.userPassword1.value != document.mainform.userPassword2.value) {  
    alert("Two passwords not equal please renter!");
    document.mainform.userPassword1.focus();
    document.mainform.userPassword1.select();	
  }	
}

function checkAll() {
for (var j = 1; j <= 14; j++) {
box = eval("document.checkboxform.C" + j); 
if (box.checked == false) box.checked = true;
   }
}

function uncheckAll() {
for (var j = 1; j <= 14; j++) {
box = eval("document.checkboxform.C" + j); 
if (box.checked == true) box.checked = false;
   }
}

function switchAll() {
for (var j = 1; j <= 14; j++) {
box = eval("document.checkboxform.C" + j); 
box.checked = !box.checked;
   }
}


var checkflag = "false";
function check(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = "true";
		return "Uncheck All"; 
	}
	else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false; 
		}
		checkflag = "false";
		return "Check All"; 
	}
}

function validate(field,theValue) {
  var ok = "yes";
  var temp;
  for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (theValue.indexOf(temp) == "-1") ok = "no";
  }
  if (ok == "no") {
    msg = "Invalid entry!  Only ";
	msg += theValue;
	msg += " characters are accepted!";
    alert(msg);
    field.focus();
  }
}

function isblank(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

// This is the function that performs form verification. It will be invoked
// from the onSubmit() event handler. The handler should return whatever
// value this function returns.
function verify(f)
{
    var msg;
    var empty_fields = "";
    var errors = "";
	var first=1;
	var checkThis=0;
	var name="";

    // Loop through the elements of the form, looking for all 
    // text and textarea elements that don't have an "optional" property
    // defined. Then, check for fields that are empty and make a list of them.
    // Also, if any of these elements have a "min" or a "max" property defined,
    // then verify that they are numbers and that they are in the right range.
    // Put together error messages for fields that are wrong.
    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];
		
        if (((e.type == "text") || (e.type == "textarea") || (e.type == "password") || (e.type == "radio") || (e.type == "file") || (e.type == "checkbox")) && !e.optional) {
            // first check if the field is empty
			
			if(name !="" && e.name != name) {
				if(checkThis==0)
					empty_fields += "\n          " + name;
				first=1;
			}
			if(e.type=="radio") {
				if(first==1) {
					name=e.name;
					first=0;
				}
				if(e.checked)
					checkThis=1;
				continue;
			}
            if ((e.value == null) || (e.value == "") || isblank(e.value) || (e.type == "radio" && e.checked == false)) {
                empty_fields += "\n          " + e.name;
                continue;
            }

            // Now check for fields that are supposed to be numeric.
					
            if (e.numeric || (e.min != null) || (e.max != null)) { 
                var v = parseFloat(e.value);
                if (isNaN(v) || 
                    ((e.min != null) && (v < e.min)) || 
                    ((e.max != null) && (v > e.max))) {
                    errors += "- The field " + e.name + " must be a number";
                    if (e.min != null) 
                        errors += " that is greater than " + e.min;
                    if (e.max != null && e.min != null) 
                        errors += " and less than " + e.max;
                    else if (e.max != null)
                        errors += " that is less than " + e.max;
                    errors += ".\n";
                }
            }
        }
    }

    // Now, if there were any errors, display the messages, and
    // return false to prevent the form from being submitted. 
    // Otherwise return true.
    if (!empty_fields && !errors) return true;

    msg  = "______________________________________________________\n\n"
    msg += "The form was not submitted because of the following error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
}
/*
var newWin = null;
function newWindow(hiddenWindow, WindowName,theWidth,theHeight) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=700,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes");
		}
		else{
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=700,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
*/
var newWin = null;
function newWindow(hiddenWindow, WindowName,theWidth,theHeight) {
	newWin = window.open(hiddenWindow, WindowName, "width=700,height=700,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes");
}

function pageWindow(hiddenWindow, WindowName) {
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=700,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}else{
			newWin = window.open(hiddenWindow, WindowName, "width=700,height=700,toolbars=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}

function linkSelect(form) {
  window.parent.location = form.link.options[form.link.selectedIndex].value
}
function linkSelect1(form) {
  window.parent.location = form.link1.options[form.link1.selectedIndex].value
}
function PrintPage() {
if (navigator.appName.indexOf("Microsoft")>=0 && navigator.appVersion.substring(22,23) == 4 || navigator.platform.substring(0,3) == "Mac") {
		alert("Your current browser does not support this button.  Please choose File/Print from your browser's menu.");
	} else {
		window.print();
	}
}

function SetChecked(val,fld) {
	dml=document.myForm;
	len = dml.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (dml.elements[i].name==fld) {
			dml.elements[i].checked=val;
		}
	}
}

function openWindow(hiddenWindow, WindowName) {
	w=Math.round(WindowName/1000);
	h=((WindowName/1000)-(Math.round(WindowName/1000))) * 1000;
	if(h < 0)
		h=h*-1;
	if (!newWin || newWin.closed){
		if (WindowName == "login"){
			newWin = window.open(hiddenWindow, WindowName, 'width=700,height=700,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes');
		}else{
			newWin = window.open(hiddenWindow, WindowName, 'width=700,height=700,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes');
		}
	}else{
		newWin.location.href = hiddenWindow;
		newWin.focus();
	}
}
//--> Stop hiding

