<!--
function setColor(el)
{
	if (el.style) el.style.backgroundColor = "#ee5555"; // red
}

function unsetColor(el)
{
	if (el.style) el.style.backgroundColor = "#eeeeee"; // white
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() 
{ //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  { 
    test=args[i+2];
    vname=args[i+1];
    val=MM_findObj(args[i]);
    myobj = val
    if (val) 
    {
     unsetColor(myobj);	 
     nm=vname; 
     if (test.indexOf('isList')!=-1) 
     { 
       if (val.selectedIndex<1)
		{
		setColor(myobj); 
		errors+='- '+nm+' must be selected.\n'; 
		}
     } 
     else if (test.indexOf('isMultiList')!=-1) 
     { 
       if (val.selectedIndex<0)
		{
		setColor(myobj);  
		errors+='- '+nm+' must be selected.\n'; 
		}
     } 
     else if ((val=val.value)!="") 
     {
	      if (test.indexOf('isEmail')!=-1) 
	      { 
	      p=val.indexOf('@');
	      if (p<1 || p==(val.length-1))
		{
		setColor(myobj); 
		errors+='- '+nm+' must contain an e-mail address.\n';
		}
	      }//END IF
	      else if (test.indexOf('isPInt')!=-1) 
	      { 
	        num = parseInt(Math.abs(val));
	        if (val!=''+num)
		{
		setColor(myobj);  
	      	errors+='- '+nm+' must be a positive number.\n';
		}
	      } 
      	      else if (test!='R') 
      	      {
		if (isNaN(val)) 
			{
			setColor(myobj);  
			errors+='- '+nm+' must contain a numeric value.\n';
			}
	        if (test.indexOf('inRange') != -1)
        	{ 
	          p=test.indexOf(':');
        	  min=test.substring(8,p);
	          max=test.substring(p+1);
        	  if (num<min || max<num) 
		     {
		     setColor(myobj);  
	             errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		     }
        	}//END IF
	      }//END ELSE
     }//END ELSE IF
     else if (test.charAt(0) == 'R')
	{
	setColor(myobj);  
        errors += '- '+nm+' is required.\n'; 
	} 
    }//END IF
  }//END FOR
 if (errors) alert('Please Correct the following error(s) :\n'+errors);
  document.MM_returnValue = (errors == '');
}

function checkDate(inDate) {
//No date is valid
    if (inDate + "HQ" == "HQ")
	return true;
//If date is passed then validate
    if (inDate.indexOf('/')) {
            var inDay = inDate.substring(0,inDate.indexOf("/"));
            var inMonth = inDate.substring(inDate.indexOf("/") + 1, inDate.lastIndexOf("/"));
            var inYear = inDate.substring(inDate.lastIndexOf("/") + 1, inDate.length);	
    }
    if (isNaN(inDay) || isNaN(inMonth) || isNaN(inYear))   	        
	{
	alert("Nonnumeric Date !! Date should be in dd/mm/ccyy format...");
	return false;
	}
    if (inDay.length != 2)
	{
	alert("Invalid Length Day !! Date should be in dd/mm/ccyy format...");
	return false;
	}  
    if (inMonth.length != 2)
	{
	alert("Invalid Length Month !! Date should be in dd/mm/ccyy format...");
	return false;
	} 
    if (inYear.length != 4)
	{
	alert("Invalid Length Year !! Date should be in dd/mm/ccyy format...");
	return false;
	}     	
    if ((inDay > 31) || (inMonth > 12))
	{
	alert("Invalid Day or Month !! Date should be in dd/mm/ccyy format...");
	return false;
	}	    
    if (getDaysInMonth(inMonth,inYear) < inDay)
	{
	alert("Invalid Date !! Date should be in dd/mm/ccyy format...");
	return false;
	}
}
// GET NUMBER OF DAYS IN MONTH
function getDaysInMonth(month,year)  {
    var days;
    if (month==1 || month==3 || month==5 || month==7 || month==8 ||
        month==10 || month==12)  days=31;
    else if (month==4 || month==6 || month==9 || month==11) days=30;
    else if (month==2)  {
        if (isLeapYear(year)) {
            days=29;
        }
        else {
            days=28;
        }
    }
    return (days);
}
// CHECK TO SEE IF YEAR IS A LEAP YEAR
function isLeapYear (Year) {
    if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
        return (true);
    }
    else {
        return (false);
    }
}

function PrintPage(){  
	if (window.print) {
	    window.print() ;  
	} 
	else {
	    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
	    WebBrowser1.ExecWB(6, 2);
	    WebBrowser1.outerHTML = "";  
	}
}
//-->

