function jumpPage(newLoc) {
newPage = newLoc.options[newLoc.selectedIndex].value
if (newPage != "") {document.forms[0].nextPage.value = newPage;
document.forms[0].submit();	}	
}


function needToSave()
{
var formNum=0;
var counter=0;
while(document.forms[counter])
{counter++;
}


for(formNum=0; formNum<counter;formNum++)
{
if(document.forms[formNum].changed.value==1)

if(document.forms[formNum].name!='searchForm')
confirmIt(document.forms[formNum].name, 'quickSearch.pca');

}
document.forms['searchForm'].submit();
}

function confirmIt(formName, which)
{
if(validForm(formName))
			{

				var agree=confirm("Save Changes on" + formName +"?");
				if (agree)
					{
						//alert(formName);
						document.forms[formName].nextPage.value=which;
						document.forms[formName].submit();
						return true ;
					}
					else
					window.location=which;
				}

}
function validForm(){
if(isFormChanged()){
//if (document.forms[0].TrafficSource.value=="")
//{alert('Please select a traffic source.');
//document.forms[0].TrafficSource.focus();
//return false;}
//if(document.forms[0].cSalName1.value=="")
//{alert('Please select a Salesperson.');
//document.forms[0].cSalName1.focus();
//return false;}
//else 
return true;}
//else return false;
}

function eMailTo(toObject)
{
var EmailObject = toObject

var address = 'mailto:'+toObject.value;
if (toObject.value)
location.href = address;
else alert("Please enter email address.");
}


function isFormChanged()
{if (document.forms[0].changed.value==1)
return true;
else 
return false;
}

function noConfirmSubmit(which) 
{ document.forms[0].nextPage.value = which; 
document.forms[0].submit(); 
return true ; } 


function changeTrue(obj)
{
var formName;
formName = obj.form.name;
//alert(formName);
document.forms[formName].changed.value=1;
}

function confirmSubmit(which)
{if(isFormChanged())
	{
		if(validForm())
			{

				var agree=confirm("Save Changes?");
				if (agree)
					{
						document.forms[0].nextPage.value=which;
						document.forms[0].submit();
						return true ;
					}
				else{
					window.location=which;
					return false ;
					}
			}
	}
else window.location=which;
}

function justSubmit(which)
{
  var agree=confirm("Are you sure?");
  if (agree)
  {
    document.forms[0].nextPage.value=which;
    document.forms[0].submit();
    return true ;
  }
}

function askToMove(which)
{
  var agree=confirm("Are you sure?");
  if (agree)
  {
    window.location=which;
    return true ;
  }
}


function redo(){
	document.forms[0].reset();
	
}

function newWindow() {
		theWindow = window.open('SAMgmt.SABuyerInfo.pca', 'theWin', 'width=375,height=175')
	}
function beBack() {
		theWindow = window.open('SAMgmt.RecordBeBack.pca', 'theWin', 'width=350,height=350')
	}
function brokerInfo() {
		if(validForm())
			{document.forms[0].nextPage.value='newcontact.AddBroker.pca';
			document.forms[0].submit();
		}
	}

function showBrokerInfo() {
		theWindow = window.open('stylesheets/SAShowBrokerInfo.htm', 'theWin', 'width=600,height=400')
	}
function cancelWindow() {
		theWindow = window.open('stylesheets/SACancellation.htm', 'theWin', 'width=600,height=400')
	}

function comma_it(target)
{
    var newtarget, decimal, pos, temp1, temp2, i;

    newtarget = "";
    /* get rid of existing commas */
    while ((pos=target.indexOf(",")) >= 0)
    {
       temp1 = target.substring(0, pos);
       temp2 = target.substring(pos+1, target.length);
       target = temp1 + temp2;
    }
    /* extract decimals for safe keeping */
    decimal = "";
    if ((pos=target.indexOf(".")) >= 0)
    {
       decimal = target.substring(pos, target.length);
       target = target.substring(0, pos);
    }
    /* here comes the real work */
    for (i = target.length-1; i >= 0; i--)
    {
       if (((target.length-i-1) % 3) == 0)
       {
           if ((target.length-i-1) > 0)
           {
              newtarget = "," + newtarget;
           }
       }
       newtarget = target.substring(i,i+1) + newtarget;
    }
    /* add on any decimals */
    newtarget = newtarget + decimal;

    return newtarget;
}

function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("That date is invalid.  Please try again.");
datefield.focus();
return false;
}
else {
return true;
   }
}

function checkDate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("That date is invalid.  Please try again.");
datefield.focus();
return false;
}
else {
return true;
   }
}

function chkdate(objName) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var today = new Date();
var strMonthArray = new Array(12);
strMonthArray[0] = "01";
strMonthArray[1] = "02";
strMonthArray[2] = "03";
strMonthArray[3] = "04";
strMonthArray[4] = "05";
strMonthArray[5] = "06";
strMonthArray[6] = "07";
strMonthArray[7] = "08";
strMonthArray[8] = "09";
strMonthArray[9] = "10";
strMonthArray[10] = "11";
strMonthArray[11] = "12";
strDate = datefield.value;
//alert(strDate);
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
//alert(strDateArray[0]+'-'+strDateArray[1]+'-'+strDateArray[2]);

if (strDateArray.length != 3){ 
strYear=today.getYear();
}
strDay = strDateArray[0];
strMonth = strDateArray[1];
if(strYear!=today.getYear())
strYear = strDateArray[2];
if(strMonth=='/' ||strDay=='/')
return true;
//alert(strYear);
booFound = true;
   }
}
if (booFound == false) {
//if (strDate.length>5)
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
//alert(strYear);
if(strDay==""&&strMonth==""&&strYear=="")
return true;
if(strYear=="")
strYear=today.getYear();

}

if (strYear){

if(strYear.length == 2) {
strYear = '20' + strYear;
}

if(strYear.length == 1)
strYear ='200' + strYear;

}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + "/" + intday+"/" + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function doDateCheck(from, to) {
if (Date.parse(from.value) <= Date.parse(to.value)) {
alert("The dates are valid.");
}
else {



if (from.value == "" || to.value == "") 
alert("Both dates must be entered.");
else 
alert("To date must occur after the from date.");

   }
}


<!-- Begin


var n;
var p;
var p1;
function ValidatePhone(){
p=p1.value
if(p.length==3){
	//d10=p.indexOf('(')
	pp=p;
	d4=p.indexOf('(')
	d5=p.indexOf(')')
	if(d4==-1){
		pp="("+pp;
	}
	if(d5==-1){
		pp=pp+")";
	}
	//pp="("+pp+")";
	document.forms[0].elements[p1.name].value="";
	document.forms[0].elements[p1.name].value=pp;
}
if(p.length>3){
	d1=p.indexOf('(')
	d2=p.indexOf(')')
	if (d2==-1){
		l30=p.length;
		p30=p.substring(0,4);
		//alert(p30);
		p30=p30+")"
		p31=p.substring(4,l30);
		pp=p30+p31;
		//alert(p31);
	document.forms[0].elements[p1.name].value="";
	document.forms[0].elements[p1.name].value=pp;

	}
	}
if(p.length>5){
	p11=p.substring(d1+1,d2);
	if(p11.length>3){
	p12=p11;
	l12=p12.length;
	l15=p.length
	//l12=l12-3
	p13=p11.substring(0,3);
	p14=p11.substring(3,l12);
	p15=p.substring(d2+1,l15);
	document.forms[0].elements[p1.name].value="";
	

	pp="("+p13+")"+p14+p15;
	document.forms[0].elements[p1.name].value=pp;
	//obj1.value="";
	//obj1.value=pp;
	}
	l16=p.length;
	p16=p.substring(d2+1,l16);
	l17=p16.length;
	if(l17>3&&p16.indexOf('-')==-1){
		p17=p.substring(d2+1,d2+4);
		p18=p.substring(d2+4,l16);
		p19=p.substring(0,d2+1);
		//alert(p19);
	pp=p19+p17+"-"+p18;
	document.forms[0].elements[p1.name].value="";
	document.forms[0].elements[p1.name].value=pp;

	//obj1.value="";
	//obj1.value=pp;
	}
}
//}
setTimeout(ValidatePhone,100)
}
function testPhone(m){
n=m.name;
p1=document.forms[0].elements[n]
//p1=m



ValidatePhone();
//goodPhone(p1);
}




var UNDEFINED; // do not assign!
        var PHONEMASK = "(###) ###-####";

        function formatPhone( fieldOrValue )         {
                if ( fieldOrValue==UNDEFINED ) return(fieldOrValue);

                s = (fieldOrValue.value==UNDEFINED) ? (""+fieldOrValue) : fieldOrValue.value;
                if ( s.length==0 ) return(s);
                s = s.replace(/[^\d]*/gi,""); // strip out all non-digits before imposing the mask
                s = (s.length>9) ? s.replace(/^([\d]{3})([\d]{3})([\d]{4})([\d]*)$/gi,"($1) $2-$3 x$4").replace(/[ex]$/,"") : PHONEMASK;
                return( (fieldOrValue.value==UNDEFINED) ? fieldOrValue=s : fieldOrValue.value=s );
        }

        function checkPhone (pStr)
        {
               
 				if (pStr.match(/^\d{3}[ -]\d{3}[ -]\d{4}$/))
                        return true;
                if (pStr.match(/^\(\d{3}\)[ -]*\d{3}[ -]\d{4}$/))
                        return true;
                if (pStr.match(/^\d{3}[ -]\d{3}[ -]\d{4}[^-].*[0-9][0-9]*$/))
                        return true;
                if (pStr.match(/^\(\d{3}\)[ -]*\d{3}[ -]\d{4}[^-].*[0-9][0-9]*$/))
                        return true;
                         if (pStr.match(/^\(\d{3}\)[ -]*\d{3}[ -]\d{4}\W$/))
                        return true;
					if (pStr.match(/^\d{10}$/))
                        return true;


                if (pStr.match(/^\d{10}[^-].*[0-9][0-9]*$/))
                        return true;              
                        return false;
                        }

       

        function goodPhone(obj)
        {
               if(obj.value){
           
               
               if (checkPhone(obj.value))
             
                obj.value = formatPhone(obj.value);
                 else {
               alert('You must enter a valid phone number with the area code in the form "123-123-1234".');
               obj.select();}
              } 
               
        }
               
       


function isNegative(obj1){
numStr=obj1.value
//alert(numStr)
if (parseInt(numStr)<0)
{
alert("Number cannot be negative!");
obj1.select();
return false;
}
else
return true;
}


function reportRange()
{var now = new Date;
var dateRange=-1; 
var newDate = new Date;
var newEndDate = new Date;

var dateForm= document.forms[0];
for(i=0;i<dateForm.Range.length; i++)
if(dateForm.Range[i].checked)
dateRange=i;
//alert(dateForm.Range[dateRange].value);


if(dateForm.Range[dateRange].value=="YearToDate"){
 newDate.setMonth(0);
 newDate.setDate(1);
 newDate.setYear(now.getYear());
 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = now.getMonth()+1+'/'+now.getDate()+'/'+now.getYear();
}
else
if(dateForm.Range[dateRange].value=="MonthToDate"){
newDate.setMonth(now.getMonth());
 newDate.setDate(1);
 newDate.setYear(now.getYear());
 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = now.getMonth()+1+'/'+now.getDate()+'/'+now.getYear();
}
else
if(dateForm.Range[dateRange].value=="WeekToDate"){

 if(now.getDay()==0)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*6*24);
 else if(now.getDay()==1)
 newDate.setMilliseconds(now.getMilliseconds());
 else if(now.getDay()==2)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*1*24);
 else if(now.getDay()==3)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*2*24);
 else if(now.getDay()==4)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*3*24);
 else if(now.getDay()==5)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*4*24);
  else if(now.getDay()==6)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*5*24);
 
 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = now.getMonth()+1+'/'+now.getDate()+'/'+now.getYear();
}
else
if(dateForm.Range[dateRange].value=="LastWeek"){
 
if(now.getDay()==0)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*312);
 else if(now.getDay()==1)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*168);
 else if(now.getDay()==2)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*192);
 else if(now.getDay()==3)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*216);
 else if(now.getDay()==4)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*240);
 else if(now.getDay()==5)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*264);
  else if(now.getDay()==6)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*288);
 

 if(now.getDay()==0)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*7);
 else if(now.getDay()==1)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*1);
 else if(now.getDay()==2)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*2);
 else if(now.getDay()==3)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*3);
 else if(now.getDay()==4)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*4);
 else if(now.getDay()==5)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*5);
  else if(now.getDay()==6)
 newEndDate.setMilliseconds(now.getMilliseconds()-1000*60*60*24*6);
  


 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}else
if(dateForm.Range[dateRange].value=="NextWeek"){
 
if(now.getDay()==0)
 newDate.setMilliseconds(now.getMilliseconds()+1000*60*60*1*24);
 else if(now.getDay()==1)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*0*24);
 else if(now.getDay()==2)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*1*24);
 else if(now.getDay()==3)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*2*24);
 else if(now.getDay()==4)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*3*24);
 else if(now.getDay()==5)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*4*24);
  else if(now.getDay()==6)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*5*24);
 

 if(now.getDay()==0)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*7*24);
 else if(now.getDay()==1)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*6*24);
 else if(now.getDay()==2)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*5*24);
 else if(now.getDay()==3)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*4*24);
 else if(now.getDay()==4)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*3*24);
 else if(now.getDay()==5)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*2*24);
  else if(now.getDay()==6)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*1*24);
  


 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}else

if(dateForm.Range[dateRange].value=="LastMonth"){
if(now.getMonth()==0){
newDate.setMonth(11);
newDate.setYear(now.getYear()-1);
}
else{
 newDate.setMonth(now.getMonth()-1);
 newDate.setYear(now.getYear());
}
 newDate.setDate(1);


newEndDate.setMonth(newDate.getMonth());
newEndDate.setYear(newDate.getYear());

if(newEndDate.getMonth()==0||newEndDate.getMonth()==2||newEndDate.getMonth()==4||newEndDate.getMonth()==6||newEndDate.getMonth()==7||newEndDate.getMonth()==9||newEndDate.getMonth()==11)
newEndDate.setDate(31);
else if(newEndDate.getMonth()==1)
	if(newEndDate.getYear()%4==0)
  	newEndDate.setDate(29);
	else
	newEndDate.setDate(28);

else
	newEndDate.setDate(30);


 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}
else
if(dateForm.Range[dateRange].value=="NextMonth"){
if(now.getMonth()==11){
newDate.setMonth(0);
newDate.setYear(now.getYear()+1);
}
else{
 newDate.setMonth(now.getMonth()+1);

 newDate.setYear(now.getYear());
}
 newDate.setDate(1);


newEndDate.setMonth(newDate.getMonth());
newEndDate.setYear(newDate.getYear());

if(newEndDate.getMonth()==0||newEndDate.getMonth()==2||newEndDate.getMonth()==4||newEndDate.getMonth()==6||newEndDate.getMonth()==7||newEndDate.getMonth()==9||newEndDate.getMonth()==11)
newEndDate.setDate(31);
else if(newEndDate.getMonth()==1)
	if(newEndDate.getYear()%4==0)
  	newEndDate.setDate(29);
	else
	newEndDate.setDate(28);

else
	newEndDate.setDate(30);


 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}


else

if(dateForm.Range[dateRange].value=="LastYear"){
 newDate.setMonth(0);
 newDate.setDate(1);
 newDate.setYear(now.getYear()-1);

 newEndDate.setMonth(11);
 newEndDate.setDate(31);
 newEndDate.setYear(now.getYear()-1);

 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}
else

if(dateForm.Range[dateRange].value=="NextYear"){
 newDate.setMonth(0);
 newDate.setDate(1);
 newDate.setYear(now.getYear()+1);

 newEndDate.setMonth(11);
 newEndDate.setDate(31);
 newEndDate.setYear(now.getYear()+1);

 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}

else


 if(dateForm.Range[dateRange].value=="All"){
 dateForm.dMin.value = "1/1/1901";
 dateForm.dMax.value ="12/31/9999";

}else
if(dateForm.Range[dateRange].value=="ThisWeek"){
 
if(now.getDay()==0)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*6*24);
 else if(now.getDay()==1)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*0*24);
 else if(now.getDay()==2)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*1*24);
 else if(now.getDay()==3)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*2*24);
 else if(now.getDay()==4)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*3*24);
 else if(now.getDay()==5)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*4*24);
  else if(now.getDay()==6)
 newDate.setMilliseconds(now.getMilliseconds()-1000*60*60*5*24);
 

 if(now.getDay()==0)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*0*24);
 else if(now.getDay()==1)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*6*24);
 else if(now.getDay()==2)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*5*24);
 else if(now.getDay()==3)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*4*24);
 else if(now.getDay()==4)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*3*24);
 else if(now.getDay()==5)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*2*24);
  else if(now.getDay()==6)
 newEndDate.setMilliseconds(now.getMilliseconds()+1000*60*60*1*24);
  

 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}else
if(dateForm.Range[dateRange].value=="ThisYear"){
 
 
 newDate.setMonth(0);
 newDate.setDate(1);
 newDate.setYear(now.getYear());
 newEndDate.setMonth(11);
 newEndDate.setDate(31);
 newEndDate.setYear(now.getYear());
 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}else 

if(dateForm.Range[dateRange].value=="ThisMonth"){

newDate.setMonth(now.getMonth());
 newDate.setDate(1);
 newDate.setYear(now.getYear());


newEndDate.setMonth(newDate.getMonth());
newEndDate.setYear(newDate.getYear());

if(newEndDate.getMonth()==0||newEndDate.getMonth()==2||newEndDate.getMonth()==4||newEndDate.getMonth()==6||newEndDate.getMonth()==7||newEndDate.getMonth()==9||newEndDate.getMonth()==11)
newEndDate.setDate(31);
else if(newEndDate.getMonth()==1)
	if(newEndDate.getYear()%4==0)
  	newEndDate.setDate(29);
	else
	newEndDate.setDate(28);

else
	newEndDate.setDate(30);


 dateForm.dMin.value = newDate.getMonth()+1+'/'+newDate.getDate()+'/'+newDate.getYear();
 dateForm.dMax.value = newEndDate.getMonth()+1+'/'+newEndDate.getDate()+'/'+newEndDate.getYear();
}




else
{ dateForm.dMin.value = "";
 dateForm.dMax.value ="";

}








}

document.WM = new Object();
document.WM.hirelist = new Object();
document.WM.hirelist.expandos = new Array();
document.WM.hirelist.heights = new Array();
document.WM.hirelist.names = new Array();

function WM_toggle(id) {
  if (document.all){
    if(document.all[id].style.display == 'none'){
      document.all[id].style.display = '';
    } else {
      document.all[id].style.display = 'none';
    }
  } else if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';
    }
  } 
}

 

function WM_initialize_toolbar(){
     if (document.all){
		for(i = 0; i < document.all('container').all.length; i++){
		    document.all('container').all[i].style.position = 'relative';
		    if(document.all('container').all[i].className == 'menuItem'){
			document.all('container').all[i].style.display = 'none';
		    }
		}
		document.all('container').style.visibility = 'visible';
    } else if (document.getElementsByTagName && document.getElementById){
		var contained = document.getElementById('container').getElementsByTagName('div');
		for(i = 0; i < contained.length; i++){
		    contained[i].style.position = 'relative';
		    if(contained[i].getAttribute('class') == 'menuItem'){
			contained[i].style.display = 'none';
		    }
		}
		document.getElementById('container').style.visibility = 'visible';
    }
}

function WM_imageToggle(daImage, src1, src2, netscape_container){
  var objStr,obj;
  // Check to make sure that images are supported in the DOM.
	  myImage = document.images[daImage];
  if(document.layers){
      myImage = document.layers['container'].document.layers[netscape_container].document.images[daImage];
  }
  if(document.images){
    // Check to see whether you are using a name, number, or object
      if(myImage.src == src1){
	  	myImage.src = src2;
      } else {
	  	myImage.src = src1;
      }
  }
}

function URLEncode(pcText){
  // escape does not change space to "+" 
  return escape(pcText.replace(/\+/g, "%2B")); 
}

function URLDecode(pcText) 
{
  // unescape does not change "+" to spaces
  return unescape(pcText.replace(/\+/g, " ")); 
}


