<!--
var FYStartDate="11/2/2003" //Change this each fiscal year!
var numStyleSheets=0;

 if (top.location != location) {
    top.location.href = document.location.href ;
  }
  
function CheckThisDate(ObjectName){
if (ObjectName.value.substr(1,1)=="/"){
	ObjectName.value="0"+ObjectName.value;
	}
		
if (ObjectName.value.substr(4,1)=="/"){
	ObjectName.value=ObjectName.value.substr(0,3)+"0"+ObjectName.value.substr(3);
	}
			
if ((!ObjectName.value.substr(8,1))&&(ObjectName.value.substr(1,1))) {
	ObjectName.value=ObjectName.value.substr(0,6)+"20"+ObjectName.value.substr(6,2);
	}
}

function CheckValidDate(Field,Alert) {
if (!Field)Field=event.srcElement;
var DateToCheck = UnSqlDate(Field.value);
//alert(DateToCheck);
var TestDate = new Date( DateToCheck );
var CheckDay=DateToCheck.substr(3,2);
var TestDateString = TestDate.toUTCString();
var myDateArray = TestDateString.split( ' ' );
//alert (CheckDay);
if ( myDateArray[1]*1 != CheckDay*1 ) {
	  if (Alert=="Y"){
		alert( 'I\'m sorry, but "' + DateToCheck + '" is NOT a valid date.' );
		}
  return false;
	} 
 return true;
} 

/*function DisplayLink() {
	
		if ((top==self) && (document.ShowLink))
	  {
 		ShowLink.style.display='block';
		}
}
*/

function SqlDate(D){
var Date;
if(!D){
	var Element=event.srcElement;
	D=Element;
	}
var Date=D.value
var myDateArray = Date.split('\/' );
if(!myDateArray[2]) return;
while(myDateArray[0].length<2){
	myDateArray[0]="0"+myDateArray[0];
	}
	
while(myDateArray[1].length<2){
	myDateArray[1]="0"+myDateArray[1];
	}
	
if(myDateArray[2].length<4)myDateArray[2]="20"+myDateArray[2];
Date=myDateArray[2]+"-"+myDateArray[0]+"-"+myDateArray[1];

if (Element){
	Element.value=Date;
	CheckValidDate(Element,'Y'); 
	}
 else{
  return Date; 
  }
}

function UnSqlDate(D){
  return D.replace(/(\d+)\-(\d+)\-(\d+)/, "$2/$3/$1"); 
}

function PadDate(size){
var field=event.srcElement.value;
if (size==4 && field.length==2){
	field="19"+field;
	}
while (field.length<size){
	field="0"+field;
	}

event.srcElement.value=field;
}

function TextCounter(maxlimit) {
    var field=event.srcElement;
	var name=field.name;
	if(!maxlimit) {
		status=event.srcElement.name+": No Character Limit "+field.value.length+" used." ;
		return;
	};
   
	status=name+": "+maxlimit+" Characters Allowed, "+(maxlimit-field.value.length)+" Remaining";
	if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
};

function gotoURL(URL) {
		location=URL;

	}
	
function PadThisDate(PassedDate){
if (PassedDate.substr(1,1)=="/"){
	PassedDate="0"+PassedDate;
	}
		
if (PassedDate.substr(4,1)=="/"){
	PassedDate=PassedDate.substr(0,3)+"0"+PassedDate.substr(3);
	}
			
if ((!PassedDate.substr(8,1))&&(PassedDate.substr(1,1))) {
	PassedDate=PassedDate.substr(0,6)+"20"+PassedDate.substr(6,2);
	}
	return(PassedDate);
}	
	



function SelectToday(StartObject, EndObject){

EnableAll(StartObject, EndObject);

ThisDate = new Date();

StartObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());
EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());


}

	
function SelectYesterday(StartObject, EndObject){

EnableAll(StartObject, EndObject);

ThisDate = new Date();
MilliSeconds=ThisDate.getTime()-(1000*60*60*24);
ThisDate.setTime(MilliSeconds);

StartObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());

EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());

}

function SelectThisWeek(StartObject, EndObject){

EnableAll(StartObject, EndObject);

ThisDate = new Date();
StartDate = new Date();

ThisDow = ThisDate.getDay();
ThisDate.setTime(ThisDate.getTime() - (1000*60*60*24));
StartDate.setTime(ThisDate.getTime() - (1000*60*60*24*(ThisDow-1))); 

StartObject.value=PadThisDate(StartDate.getMonth()+1 + "/" + StartDate.getDate() + "/" + StartDate.getFullYear());
 
EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());

}

function SelectLastWeek(StartObject, EndObject){

EnableAll(StartObject, EndObject);

ThisDate = new Date();
StartDate = new Date();
ThisDow = ThisDate.getDay()+1;
ThisDate.setTime(ThisDate.getTime() - ((1000*60*60*24)*ThisDow));
StartDate.setTime(ThisDate.getTime() - ((1000*60*60*24)*6)); 

StartObject.value=PadThisDate(StartDate.getMonth()+1 + "/" + StartDate.getDate() + "/" + StartDate.getFullYear());

EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());

}

function SelectLastWeekEnd(StartObject, EndObject){

EnableAll(StartObject, EndObject);

ThisDate = new Date();
StartDate = new Date();
ThisDow = ThisDate.getDay();
StartDate.setTime(StartDate.getTime() - ((1000*60*60*24)*(ThisDow+1))); 
ThisDate.setTime(StartDate.getTime() + ((1000*60*60*24)));

StartObject.value=PadThisDate(StartDate.getMonth()+1 + "/" + StartDate.getDate() + "/" + StartDate.getFullYear());

EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());

}



function SelectYTD(StartObject, EndObject){

EnableAll(StartObject, EndObject)

ThisDate = new Date()
MilliSeconds=ThisDate.getTime()-(1000*60*60*24);
ThisDate.setTime(MilliSeconds);
StartDate = new Date(FYStartDate);

StartObject.value=PadThisDate(StartDate.getMonth()+1 + "/" + StartDate.getDate() + "/" + StartDate.getFullYear());

EndObject.value=PadThisDate(ThisDate.getMonth()+1 + "/" + ThisDate.getDate() + "/" + ThisDate.getFullYear());
}

function SelectRange(StartObject, EndObject){
StartObject.disabled=false;
EndObject.disabled=false;
}

function SelectOneDay(StartObject, EndObject){
StartObject.disabled=false;
EndObject.value="";
EndObject.disabled=true;
}


function EnableAll(StartObject, EndObject){
StartObject.disabled=false;
EndObject.disabled=false;
}

function IsFloat (Field)
{

for (var i=0, len=Field.length, valid='0123456789.' ; i<len ; i++) {
        if (valid.indexOf(Field.substring(i,i+1)) == -1) {
              return 0;
        }
    
}	
return 1;
}

function Get_Cookie(name) {
  var start = document.cookie.indexOf(name + '=');
  var len = start + name.length + 1;
  if ((!start) && (name != document.cookie.substring(0,name.length)))
    return null;
  if (start == -1)
    return null;
  var end = document.cookie.indexOf(';',len);
  if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(len,end));
}


//The following function can be used to require fields in forms.  To make it work, create a hidden field call "Required" and list all the required fields separated by "|".  You can use "=Field Text" where Field Text is the description of the field the user will see.  For example "LastName=Last Name"  will result in the user seeing "Last Name is required".  If no = value  provided, the user will see the field name.  Call this function by including: onSubmit='return CheckRequired(frmName);'  in the form tag.
function CheckRequired(theEvent, ResponseID){
//return true
 
var Message="";
var HTMLMessage="";
var Form=theEvent?theEvent:event.srcElement;
var TestFieldValue=false;
//var Form=FormEvent.srcElement;


//for (var i=0;i<Form.length;i++)
// {
// alert(Form.elements[i].name);
// }


if (!Form.Required.value) return true;
var Fields=Form.Required.value.split("|");
var Count=0;
for (FieldNo in Fields)
	{
	var TestFieldValue=false;	
	TestFieldArray=Fields[FieldNo].split("=");
	TestFieldName=TestFieldArray[0];
		
	var TestFieldType="text";
	if(TestFieldName.indexOf("[]")>0)TestFieldType="check";
	
	TestFieldText=TestFieldArray[1];
	if(!TestFieldText)TestFieldText=TestFieldName;
  
	if("text"==TestFieldType)
		{
 		var TestFieldValue=Form.elements[TestFieldName].value;
		}
		
	if("check"==TestFieldType)
		{	
		for (var i=0; i < Form.elements[TestFieldName].length; i++) {
		if(Form.elements[TestFieldName][i].checked)TestFieldValue=true;
		}
			
		}	
	if(!TestFieldValue)
		{
		Message+=TestFieldText+"\r\n";
		HTMLMessage+=TestFieldText+"<br />";
		}

	if((TestFieldName=="Password") && (TestFieldValue.length<5) )Message+="Password of 5 or more characters\r\n";	
	if((TestFieldName=="Password") && (Form.Password.value != Form.Password1.value ) )Message+="Passwords must match\r\n";	
}

//Check Email fields
if(typeof(Form.EmailFields) !== 'undefined') {
	EmailAddressArray=Form.EmailFields.value.split("|");
	if(Form.elements[EmailAddressArray[0]].value != Form.elements[EmailAddressArray[1]].value){
		Message+="Email addresses must match\r\n";
		HTMLMessage+="Email addresses must match.<br />";
		}	
	}

if(ResponseID && Message)
	{
	document.getElementById(ResponseID).innerHTML="<strong>Please complete the following:</strong><br />"+HTMLMessage+"<br />";
	alert ("Please complete the following:\r\n"+Message);
	return false;	
	}	
if(Message)
	{
	alert ("Please complete the following:\r\n"+Message);
	return false;
	}
	else
	{
	return true;
	}
}

//to disable submit button on form submission
function disableForm(theform) {
if (document.all || document.getElementById) {
	for (i = 0; i < theform.length; i++) {
	var tempobj = theform.elements[i];
	//alert(tempobj.name);
	if (tempobj.type.toLowerCase() == "submit" ) tempobj.disabled = true;
	}
}

}

function CheckPasswords(Password1, Password2){
var Output="";
 if (Password.length<5) Output="Password must be at least 5 characters long.";
 if(Password != Password1)Output="Passwords must match, please enter them again.";

return Output;
}

function toggle(elementID){
var target1 = document.getElementById(elementID)
if (target1.style.display == 'none') {
target1.style.display = 'block'
} else {
target1.style.display = 'none'
}
}
// -->