<!--

// Detect Type of Browser
 browser_name = navigator.appName;
 browser_version = parseFloat(navigator.appVersion); 

 if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; browser = 'netscape'}
 else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; browser = 'iexplorer';}
 else { roll = 'false';}
 var xMax = screen.width, yMax = screen.height;
 
 
// Pop-up Date Selector -- Begin
function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }

var today = new Date();
var day = today.getDate(), month = today.getMonth(), year = y2k(today.getYear()), whichOne = 0;

function restart() {
	whichForm.elements[whichOne].value = '' + padout(month - 0 + 1) + '/' + padout(day) + '/' + year;
    mywindow.close();
}

function CalWindow(objform, name) {
	var aw = ((screen.availWidth - 700)/2); 
	var ah = ((screen.availHeight -500)/2);
    whichOne = name;
	whichForm = objform
    day = today.getDate(), month = today.getMonth(), year = y2k(today.getYear());
    mywindow=open('cal.htm','myname','resizable=no,width=250,height=280');
    mywindow.location.href = 'include/cal.htm';
    if (mywindow.opener == null) mywindow.opener = self;
}
// Pop-up Date Selector -- End



// Goto URL	
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


// Open Pop-up window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function trimspace(strObj){
	while(''+strObj.value.charAt(0)==' ')
	strObj.value=strObj.value.substring(1,strObj.value.length);
	
	while(''+strObj.value.charAt(strObj.value.length-1)==' ')
	strObj.value=strObj.value.substring(0,strObj.value.length-1);
}

function CheckFloat(strObj){
var numdecs = 0;
var noOfDecPlace = 2;
var DecPosition;
keyPress = event.keyCode;
if ((keyPress >=48 && keyPress<=57) || keyPress == 46){
//if (keyPress >=48 && keyPress<=57) {
	if (keyPress == 46){
		for (i = 0; i < strObj.length; i++) {
			mychar = strObj.charAt(i)
			if (mychar == ".")
				numdecs++;
		}
		if (numdecs > 0)
			return false	
	}
	else{
		return true;
	}
	}
else{
	return false;
	}
}

function CheckInt(strObj){
var numdecs = 0;
keyPress = event.keyCode;
//if ((keyPress >=48 && keyPress<=57) || keyPress == 46){
if (keyPress >=48 && keyPress<=57) {
	if (keyPress == 46){
		for (i = 0; i < strObj.length; i++) {
			mychar = strObj.charAt(i)
			if (mychar == ".")
				numdecs++;
		}
		if (numdecs > 0)
			return false	
	}
	else{
		return true;
	}
	}
else{
	return false;
	}
}

var submitcount = 0;
function submitonce(){
	if (submitcount == 0){
		     submitcount++;
		     return true;
      	}
		  else {
		     alert("This form has already been submitted. \nPlease wait.  Thanks!");
		     return false;
      	}
}


// Format Currency
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
//return (((sign)?'':'(') + '$' + num + '.' + cents + ((sign)?'':')'));
return (((sign)?'':'(') + num + '.' + cents + ((sign)?'':')'));
}
//-->
