	//ver = navigator.appVersion.substring(0,1)
    //if (ver >= 4) {
    //	//document.write('<DIV ID="cache"><TABLE WIDTH=400 BGCOLOR=#000000 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><TABLE WIDTH=100% BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle CLASS=arial1><B>SEARCHING ...</B></TD> </TR></TABLE></TD> </TR></TABLE></DIV>');
    //	var navi = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
    //	var HIDDEN = (navi) ? 'hide' : 'hidden';
    //	var VISIBLE = (navi) ? 'show' : 'visible';
    //	var cache = (navi) ? document.cache : document.all.cache.style;
    //	largeur = screen.width;
    //	cache.left = Math.round(100);
    //	cache.visibility = VISIBLE;
    //}

    // function cacheOff() {
    	// if (ver >= 4) {
    		// cache.visibility = HIDDEN;
    	// }
    // }
	function bimgflip(filename, imagename) {
		document[imagename].src = "/images/" + filename; }

	var myimages = new Array();
	function preloadimages() {
		for (i = 0; i < preloadimages.arguments.length; i++) {
			myimages[i] = new Image();
			myimages[i].src = preloadimages.arguments[i];
		}
	}

	function MM_preloadImages() { //v3.0
		// cacheOff();
  		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_swapImgRestore() { //v3.0
  		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_findObj(n, d) { //v4.01
  		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 && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() { //v3.0
  		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function switchmain_image(newimage, width, height) {
		document.main_image.src = newimage;
		document.main_image.width = width;
		document.main_image.height = height;
	}

	function btn_Form(frm) {
	// Function to handle dynamically submitting a form
		frm.submit();
	}

	function btn_Form_rate(frm, act) {
	// Function to handle dynamically editing rates
	    frm.frm_act.value = act;
		frm.submit();
	}

	function btn_Form_continue(frm, savetype) {
	// Function to handle dynamically submitting a form
		frm.save.value = savetype;
		frm.submit();
	}

	function btn_PropertySearchForm(frm) {
	// Function to handle dynamically submitting property search state
		qs5=frm.Prop_State.options[frm.Prop_State.selectedIndex].value;
		document.frm.PropertyState.value=qs5;
		frm.submit();
	}

	function btn_image_Form(frm, act) {
	// Function to handle dynamically submitting image edit or delete form
		frm.frm_act.value=act;
		frm.submit();
	}

	function btn_ecard_Form(frm) {
	// Function to handle dynamically submitting image edit or delete form
		i=document.main_image.src;
		frm.img.value=i;
		frm.submit();
	}

	function handlePricingChange(propnum, promo, nnex) {
	        var baserate, addto, total, total2;
	        baserate = 99;  // usually 149, but not until Feb 04
		addto = 0; total = 0;
	             if ((nnex + propnum) > 49) baserate = baserate * 0.25; // 75% for 21+
	        else if ((nnex + propnum) > 1) baserate = baserate * 0.5;  // 50% for 2-5
	        featcheck = eval("document.renewal_verify.featured" + propnum + ".checked");
	        sponscheck = eval("document.renewal_verify.sponsored" + propnum + ".checked");
	        if (featcheck == true) addto = addto + 50;
	        if (sponscheck == true) addto = addto + 99;
	        if (addto > 100) addto = addto - 30;
	        
	        newval = baserate + addto;

		if (Math.floor(newval) == newval) stradd = ".00";
	        else if (Math.floor(newval*10) == (newval*10)) stradd = "0";
	        else stradd = "";

	        eval("document.renewal_verify.price" + propnum + ".value = newval + stradd");
	        eval("document.renewal_verify.pricetext" + propnum + ".value = newval + stradd");
	        for (i = 1; i <= document.renewal_verify.numprops.value; i++) {
	        	total = total + parseFloat(eval("document.renewal_verify.price" + i + ".value"));
	        }

		if (Math.floor(total) == total) stradd2 = ".00";
	        else if (Math.floor(total*10) == (total*10)) stradd2 = "0";
	        else stradd2 = "";

	        if (promo > 0) {
		        document.renewal_verify.subtotal.value = total + stradd2;
			document.renewal_verify.subtotaltext.value = total + stradd2;

	        	total2 = total * (1 - (promo / 100));
			if (Math.floor(total2) == total2) stradd2 = ".00";
		        else if (Math.floor(total2*10) == (total2*10)) stradd2 = "0";
		        else stradd2 = "";

		        document.renewal_verify.total.value = total2 + stradd2;
			document.renewal_verify.totaltext.value = total2 + stradd2;
	        } else {
		        document.renewal_verify.total.value = total + stradd2;
			document.renewal_verify.totaltext.value = total + stradd2;
		}
	}

	function handleForm(frm) {
	// Function to handle dynamically altering the contents of the qk_search form elements
		var qs, qc, qt;
		qs=frm.qk_state.options[frm.qk_state.selectedIndex].value;
		qc=frm.qk_city.options[frm.qk_city.selectedIndex].value;
		qt=frm.qk_type.options[frm.qk_type.selectedIndex].value;
		document.qk_search.qk_state.value=qs;
		document.qk_search.qk_city.value=qc;
		document.qk_search.qk_type.value=qt;
		document.qk_search.submit();
	}

	function handlePropertyForm2(frm) {
	// Function to handle dynamically altering the contents of the qk_search2 form elements on insert property
		//var qs2, qc2;
		//qs2=frm.Prop_State.options[frm.Prop_State.selectedIndex].value;
		//qc2=frm.Prop_City.options[frm.Prop_City.selectedIndex].value;

		//if (typeof(document.prop_form1) == "object")
		//{
			//document.prop_form1.PropertyState.value=qs2;
			//document.prop_form1.PropertyCity.value=qc2;
		//}
	}

	function handleOwnerForm1(frm) {
	// Function to handle dynamically altering the contents of the qk_search2 form elements on insert property
		var qs2, qc2;
		qs2=frm.Owner_State.options[frm.Owner_State.selectedIndex].value;
		qc2=frm.Owner_City.options[frm.Owner_City.selectedIndex].value;

		document.owner_form1.State.value=qs2;
		document.owner_form1.City.value=qc2;
	}

	function handlePropertySearchForm(frm) {
	// Function to handle dynamically altering the contents of the qk_search3 form elements on search page
		var qs3, qc3;
		qs3=frm.Prop_State.options[frm.Prop_State.selectedIndex].value;
		qc3=frm.Prop_City.options[frm.Prop_City.selectedIndex].value;
		qt3=document.prop_search_form.Prop_Type.options[document.prop_search_form.Prop_Type.selectedIndex].value;

		document.prop_search_form.PropertyState.value=qs3;
		document.prop_search_form.PropertyCity.value=qc3;
		frm.PropertyTypeId.value=qt3;
	}

	function submitPropertyForm2(frm, savetype) {
	// Function to handle dynamically altering the contents of the qk_search2 form elements
		//var qs2, qc2;
		//qs2=document.qk_search2.Prop_State.options[document.qk_search2.Prop_State.selectedIndex].value;
		//qc2=document.qk_search2.Prop_City.options[document.qk_search2.Prop_City.selectedIndex].value;

		//frm.PropertyState.value=qs2;
		//frm.PropertyCity.value=qc2;
		frm.save.value=savetype;
		frm.submit();
	}

	function handlePropTypeSearch() {
		//pt=document.prop_search_form.Prop_Type.options[document.prop_search_form.Prop_Type.selectedIndex].value;
		//pt2=document.qk_search3.PropertyTypeId.options[document.qk_search3.PropertyTypeId.selectedIndex].value;
		handlePropertySearchForm(document.forms['qk_search3']);
		//if (pt == pt2) {
		//} else if (pt == '0000000001' && (pt2 == '0000000002' || pt2 == '0000000003')) {
		//} else if (pt == '0000000005' && pt2 == '0000000006') {
		//} else {
			btn_Form(document.forms['qk_search3']);
		//}
	}

	function popUp(URL, w, h) {
		var bottom = screen.availHeight;
   		var right = screen.availWidth;
   		var pos_x = (right/2) - 100;
   		var pos_y = (bottom/2) - 125;
		str = "window.dateField = document.prop_det.Block_ToDate;calendar=window.open('" + URL + "','cal','WIDTH=" + w + ",HEIGHT=" + h + ",LEFT=";
		str += pos_x + ",TOP=" + pos_y + "');return false";
		alert(str);
		eval(str);
	}
	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]; val=MM_findObj(args[i]);
    		if (val) {
    			nm=val.name;
    			if ((val=val.value)!="") {
      				if (test.indexOf('isEmail')!=-1) {
      					p=val.indexOf('@');
        				if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      				} 
      				else if (test!='R') { 
      					num = parseFloat(val);
        				if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        				if (test.indexOf('inRange') != -1) { 
        					p=test.indexOf(':');
          					min=test.substring(8,p); 
          					max=test.substring(p+1);
          					if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    					} 
        			} 
        		}
        		else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
        	}
  		}
  		if (errors) alert('The following error(s) occurred:\n'+errors);
  		document.MM_returnValue = (errors == '');
	}
	
	function uploadclose() {
	        //if (!window.closed('uploadnotify')) window.close('uploadnotify');
	        window.open('uploadnotify2.php', 'uploadnotify', 'width=240,height=210');
	        return;
	}
	
	function selectuser() {
	        document.login_form.username.focus();
	}
	
	function selectpw() {
	        document.login_form.passwd.focus();
	}
	
	function helppop(url, w, h) {
	       window.open('/closepop.php','ndovrhelp','width='+w+',height='+h);
           window.open(url,'ndovrhelp','width='+w+',height='+h+',scrollbars=1');
           return false;
	}
	
	function rateformfilled() {
	       var t1, t2, t3, t4, t5, t6;
	       t1 = document.prop_form5.Criteria.value;
	       t2 = document.prop_form5.Price_FromDate.value;
	       t3 = document.prop_form5.Price_ToDate.value;
	       t4 = document.prop_form5.Night.value;
	       t5 = document.prop_form5.Week.value;
	       t6 = document.prop_form5.Month.value;
	       if (t1 == "") { alert("Please specify a rate name."); return false; }
           if (t2 == "") { alert("Please specify a start date."); return false; }
           if (t3 == "") { alert("Please specify an end date."); return false; }
           if (t4 == "") { alert("Please specify a nightly rate."); return false; }
           if (t5 == "") { alert("Please specify a weekly rate."); return false; }
           if (t6 == "") { alert("Please specify a monthly rate."); return false; }
	       return true;
	}

	function rateformempty() {
	       var t1, t2, t3, t4, t5, t6;
	       t1 = document.prop_form5.Criteria.value;
	       t2 = document.prop_form5.Price_FromDate.value;
	       t3 = document.prop_form5.Price_ToDate.value;
	       t4 = document.prop_form5.Night.value;
	       t5 = document.prop_form5.Week.value;
	       t6 = document.prop_form5.Month.value;
	       if (t1 != "" || t2 != "" || t3 != "" || t4 != "" || t5 != "" || t6 != "") { alert("Please complete adding a rate before continuing,\nor clear all \"Add Rate\" fields."); return false; }
	       return true;
	}

	function dateformfilled() {
	       var t1, t2;
	       t1 = document.prop_form6.Block_FromDate.value;
	       t2 = document.prop_form6.Block_ToDate.value;
	       if (t1 == "") { alert("Please specify a start date."); return false; }
           if (t2 == "") { alert("Please specify an end date."); return false; }
	       return true;
	}

	function dateformempty() {
	       var t1, t2;
	       t1 = document.prop_form6.Block_FromDate.value;
	       t2 = document.prop_form6.Block_ToDate.value;
	       if (t1 != "" || t2 != "") { alert("Please click Reserve Date before continuing,\nor clear all \"Reserve Date\" fields."); return false; }
	       return true;
	}

	function imageformfilled() {
	       var t1, t2;
	       t1 = document.prop_form7.ImageDescription.value;
	       t2 = document.prop_form7.imageFile.value;
	       if (t1 == "") { alert("Please specify a photo description."); return false; }
           if (t2 == "") { alert("Please select a file to upload."); return false; }
	       return true;
	}

	function imageformempty() {
	       var t1, t2;
	       t1 = document.prop_form7.ImageDescription.value;
	       t2 = document.prop_form7.imageFile.value;
	       if (t1 != "" || t2 != "") { alert("Please click Add Photo before continuing,\nor clear all \"Add Photo\" fields."); return false; }
	       return true;
	}

	function mng_renter_filled() {
	       var t1, t2, t3;
	       t1 = document.manageform.FirstName.value;
	       t2 = document.manageform.LastName.value;
	       t3 = document.manageform.Email.value;
	       if (t1 == "") { alert("Please specify the renter's first name."); return false; }
           if (t2 == "") { alert("Please specify the renter's last name."); return false; }
           //if (t3 == "") { alert("Please specify the renter's email address."); return false; }
	       return true;
	}

	function mng_res_filled(calclink) {
	       var t1, t2, t3;
	       t1 = document.manageform2.RenterId.value;
	       t2 = document.manageform2.FromDate.value;
	       t3 = document.manageform2.ToDate.value;
	       t4 = document.manageform2.RentalRate.value;
	       t5 = document.manageform2.WaitingList.checked;
	       t6 = document.manageform2.dchange.value;
	       if (t1 == "NEW" || t1 == "" || t1 == "-") { alert("Please select a renter, or select\n'No Renter Information'."); return false; }
           if (t2 == "") { alert("Please specify an arrival date\nfor this reservation."); return false; }
           if (t3 == "") { alert("Please specify a departure date\nfor this reservation."); return false; }
           if (calclink != 1) {
               if (t4 == 0 && t5 != true && t1 != "X") { return confirm("Your cost of stay is $0.  Are you sure you want\nto use this value for this reservation?"); }
               if (t6 == "yes") { return confirm("You have updated the arrival and/or departure date\nwithout updating the cost of stay.  Do you want to\nuse the current cost of stay?"); }
	       }
           return true;
	}

	function mng_payment_filled(edit) {
	       var t1, t2, t3, t4, t5, t6, tval1;
	       t1 = document.manageform.TDate.value;
	       t2 = document.manageform.Amount.value;
	       t22 = document.manageform.DepIncluded.value;
	       t3 = document.manageform.Method.value;
	       t4 = document.manageform.Ref.value;
	       t5 = document.manageform.Memo.value;
	       t6 = document.manageform.AvailabilityId.value;
           if (t6 == "" || t6 == "-") { alert("Please select a reservation to which you\nwould like the payment applied."); return false; }
           if (t1 == "") { alert("Please specify a payment date\nfor this payment."); return false; }
           if (t2 == "") { alert("Please specify an amount\nfor this payment."); return false; }
	       if (t22 == "" || t22 == "-") { alert("Please specify whether or not\nthe deposit is included."); return false; }
	       if (t3 == "" || t3 == "-") { alert("Please select a payment method."); return false; }
           //if (t4 == "") { alert("Please specify a reference\nnumber for this payment."); return false; }
           if (edit == true) return true;
	       eval("tval1 = document.manageform.balanceval"+document.manageform.AvailabilityId.value+".value;");
           if (parseFloat(t2) > parseFloat(tval1)) { return confirm("The payment amount is greater than the balance due.\nDo you wish to continue?"); }
	       return true;
	}

	function cl_filled() {
	       var t1;
	       t1 = document.manageform.ContactInfo.value;
	       if (t1 == "") { alert("Please enter at least your contact information."); return false; }
	       return true;
	}

	function recalc_res() {
	       var total = 0;
           var t2, t3;
           var taxable;
           //if (parseFloat(manageform2.AmountPaid.value) == "NaN" || manageform2.AmountPaid.value.length == 0) manageform2.AmountPaid.value = "0.00";
           if (manageform2.deptype.value == '1') {
               manageform2.Deposit.value = dollarize(manageform2.RentalRate.value * (manageform2.depvalue.value / 100));
           } else {
               manageform2.Deposit.value = dollarize(manageform2.depvalue.value);
           }

           manageform2.RentalRate.value = dollarize(manageform2.RentalRate.value);
           manageform2.Deposit.value = dollarize(manageform2.Deposit.value);
           manageform2.Security.value = dollarize(manageform2.Security.value);
           manageform2.CleaningFee.value = dollarize(manageform2.CleaningFee.value);
           manageform2.MiscFees.value = dollarize(manageform2.MiscFees.value);
           manageform2.MiscFees2.value = dollarize(manageform2.MiscFees2.value);

           taxable = parseFloat(manageform2.RentalRate.value);
           if (manageform2.TaxableSCF.value == '1') { taxable += parseFloat(manageform2.CleaningFee.value); }
           if (manageform2.TaxableM1.value == '1') { taxable += parseFloat(manageform2.MiscFees.value); }
           if (manageform2.TaxableM2.value == '1') { taxable += parseFloat(manageform2.MiscFees2.value); }

           manageform2.Tax1.value = dollarize(taxable * parseFloat(manageform2.TaxRate1.value) / 100);
           manageform2.Tax2.value = dollarize(taxable * parseFloat(manageform2.TaxRate2.value) / 100);
           manageform2.Tax3.value = dollarize(taxable * parseFloat(manageform2.TaxRate3.value) / 100);

	       total = parseFloat(manageform2.RentalRate.value);
	       //total += parseFloat(manageform2.Deposit.value);
	       //total += parseFloat(manageform2.Security.value);
	       total += parseFloat(manageform2.CleaningFee.value);
	       total += parseFloat(manageform2.MiscFees.value);
	       total += parseFloat(manageform2.MiscFees2.value);
	       total += parseFloat(manageform2.Tax1.value);
	       total += parseFloat(manageform2.Tax2.value);
	       total += parseFloat(manageform2.Tax3.value);
	       /*total *= (1 +
               (parseFloat(manageform2.TaxRate1.value) / 100) +
               (parseFloat(manageform2.TaxRate2.value) / 100) +
               (parseFloat(manageform2.TaxRate3.value) / 100));*/

           //manageform2.AmountDue.value = dollarize(total);
           manageform2.Balance.value = dollarize(total); // - parseFloat(manageform2.AmountPaid.value));

           manageform2.RentalRate.value = dollarize(manageform2.RentalRate.value);
           manageform2.Deposit.value = dollarize(manageform2.Deposit.value);
           manageform2.Security.value = dollarize(manageform2.Security.value);
           manageform2.CleaningFee.value = dollarize(manageform2.CleaningFee.value);
           manageform2.MiscFees.value = dollarize(manageform2.MiscFees.value);
           manageform2.MiscFees2.value = dollarize(manageform2.MiscFees2.value);
           //manageform2.AmountDue.value = dollarize(manageform2.AmountDue.value);
           //manageform2.AmountPaid.value = dollarize(manageform2.AmountPaid.value);
           manageform2.Balance.value = dollarize(parseFloat(manageform2.Balance.value) + parseFloat(manageform2.Security.value));
           manageform2.Deposit.value = dollarize(parseFloat(manageform2.Deposit.value) + parseFloat(manageform2.Security.value));

	       return true;
	}
	
	function recalc_res_date() {
           // date calculation stuff -- this isn't used as of a least 12/24/2003
           manageform2.dchange.value = "yes";
           var today = new Date();
           var dv = new Date();
           if (manageform2.FromDate.value != "") {
               if (today.getYear() > 100 && today.getYear() < 1900) {
                   if (manageform2.FromDate.value.lastIndexOf("/") < 3) manageform2.FromDate.value += "/" + (today.getYear() + 1900);
               } else {
                   if (manageform2.FromDate.value.lastIndexOf("/") < 3) manageform2.FromDate.value += "/" + today.getYear();
               }
               if (manageform2.FromDate.value.lastIndexOf("/") == (manageform2.FromDate.value.length - 1)) {
                   if (today.getYear() > 100 && today.getYear() < 1900) {
                       manageform2.FromDate.value += (today.getYear() + 1900);
                   } else {
                       manageform2.FromDate.value += today.getYear();
                   }
               }
               var ddval = manageform2.vDepositDue.value;
               var bdval = manageform2.vFinalPaymentDue.value;
               var skval = manageform2.vSentKeyNotify.value;
               if (ddval > 0) {
                   // deposit due
                   dv.setTime(Date.parse(manageform2.FromDate.value) - (1000*60*60*24*ddval));
                   //alert(dv.getYear);
                   if (dv.getYear > 100 && dv.getYear < 1900) {
                       manageform2.DepositDue.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + (dv.getYear() + 1900);
                   } else {
                       manageform2.DepositDue.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + dv.getYear();
                   }

               } else {
                   if (ddval == -1 && manageform2.DepositDue.value.length == 0) manageform2.DepositDue.value = "Immediately";
                   if (ddval == -2 && manageform2.DepositDue.value.length == 0) manageform2.DepositDue.value = "On Arrival";
               }
               if (bdval > 0) {
                   // balance due
                   dv.setTime(Date.parse(manageform2.FromDate.value) - (1000*60*60*24*bdval));
                   //alert(dv.getYear);
                   if (dv.getYear > 100 && dv.getYear < 1900) {
                       manageform2.BalanceDue.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + (dv.getYear() + 1900);
                   } else {
                       manageform2.BalanceDue.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + dv.getYear();
                   }
               } else {
                   if (bdval == -1 && manageform2.BalanceDue.value.length == 0) manageform2.BalanceDue.value = "Immediately";
                   if (bdval == -2 && manageform2.BalanceDue.value.length == 0) manageform2.BalanceDue.value = "On Arrival";
               }
               // send key by
               if (skval > 0) {
                   dv.setTime(Date.parse(manageform2.FromDate.value) - (1000*60*60*24*skval));
                   //alert(dv.getYear);
                   if (dv.getYear > 100 && dv.getYear < 1900) {
                       manageform2.SendKeyBy.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + (dv.getYear() + 1900);
                   } else {
                       manageform2.SendKeyBy.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + dv.getYear();
                   }
               }
           }
           if (manageform2.ToDate.value != "") {
               if (manageform2.ToDate.value.lastIndexOf("/") < 3) {
                   if (today.getYear() > 100 && today.getYear() < 1900) {
                       manageform2.ToDate.value += "/" + (today.getYear() + 1900);
                   } else {
                       manageform2.ToDate.value += "/" + today.getYear();
                   }
               }
               if (manageform2.ToDate.value.lastIndexOf("/") == (manageform2.ToDate.value.length - 1)) {
                   if (today.getYear() > 100 && today.getYear() < 1900) {
                       manageform2.FromDate.value += (today.getYear() + 1900);
                   } else {
                       manageform2.ToDate.value += today.getYear();
                   }
                }
               //alert(manageform2.ToDate.value.lastIndexOf("/"));
               //alert(manageform2.ToDate.value.length - 1);
               var krval = manageform2.vReturnKeyNotify.value;
               // key returned by
               if (krval > 0) {
                   dv.setTime(Date.parse(manageform2.ToDate.value) + (1000*60*60*24*krval));
                   //alert(dv.getYear);
                   if (dv.getYear > 100 && dv.getYear < 1900) {
                       manageform2.KeyReturnedBy.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + (dv.getYear() + 1900);
                   } else {
                       manageform2.KeyReturnedBy.value = (dv.getMonth()+1) + "/" + dv.getDate() + "/" + dv.getYear();
                   }
               }
           }
	}

	function recalc_res_rem() {
	        if (manageform2.DDActive.checked) document.all["DDRemind"].innerText = "on";
	        else document.all["DDRemind"].innerText = "off";
	        if (manageform2.BDActive.checked) document.all["BDRemind"].innerText = "on";
	        else document.all["BDRemind"].innerText = "off";
	        if (manageform2.SKActive.checked) document.all["SKRemind"].innerText = "on";
	        else document.all["SKRemind"].innerText = "off";
	        if (manageform2.KRActive.checked) document.all["KRRemind"].innerText = "on";
	        else document.all["KRRemind"].innerText = "off";
	        return true;
	}

	function fix_block_dates() {
           // date calculation stuff
           var today = new Date();
           if (prop_form6.Block_FromDate.value != "") {
               if (prop_form6.Block_FromDate.value.lastIndexOf("/") == (prop_form6.Block_FromDate.value.length - 1)) prop_form6.Block_FromDate.value += today.getYear();
               if (prop_form6.Block_FromDate.value.lastIndexOf("/") < 3) prop_form6.Block_FromDate.value += "/" + today.getYear();
           }
           if (prop_form6.Block_ToDate.value != "") {
               if (prop_form6.Block_ToDate.value.lastIndexOf("/") == (prop_form6.Block_ToDate.value.length - 1)) prop_form6.Block_ToDate.value += today.getYear();
               if (prop_form6.Block_ToDate.value.lastIndexOf("/") < 3) prop_form6.Block_ToDate.value += "/" + today.getYear();
           }
    }

	function fix_rate_dates() {
           // date calculation stuff
           var today = new Date();
           if (prop_form5.Price_FromDate.value != "") {
               if (prop_form5.Price_FromDate.value.lastIndexOf("/") < 3) prop_form5.Price_FromDate.value += "/" + today.getYear();
               if (prop_form5.Price_FromDate.value.lastIndexOf("/") == (prop_form5.Price_FromDate.value.length - 1)) prop_form5.Price_FromDate.value += today.getYear();
           }
           if (prop_form5.Price_ToDate.value != "") {
               if (prop_form5.Price_ToDate.value.lastIndexOf("/") < 3) prop_form5.Price_ToDate.value += "/" + today.getYear();
               if (prop_form5.Price_ToDate.value.lastIndexOf("/") == (prop_form5.Price_ToDate.value.length - 1)) prop_form5.Price_ToDate.value += today.getYear();
           }
    }

	function fix_special_dates() {
           // date calculation stuff
           var today = new Date();
           if (addspecial.FromDate.value != "") {
               if (addspecial.FromDate.value.lastIndexOf("/") < 3) addspecial.FromDate.value += "/" + today.getYear();
               if (addspecial.FromDate.value.lastIndexOf("/") == (addspecial.FromDate.value.length - 1)) addspecial.FromDate.value += today.getYear();
           }
           if (addspecial.ToDate.value != "") {
               if (addspecial.ToDate.value.lastIndexOf("/") < 3) addspecial.ToDate.value += "/" + today.getYear();
               if (addspecial.ToDate.value.lastIndexOf("/") == (addspecial.ToDate.value.length - 1)) addspecial.ToDate.value += today.getYear();
           }
    }

    function check_addspecial() {
        if (addspecial.Criteria.value.length < 1) { alert("Please select a type for this special."); return false; }
        if (addspecial.FromDate.value.length < 1) { alert("Please enter a start date for this special."); return false; }
        if (addspecial.ToDate.value.length < 1) { alert("Please enter an end date for this special."); return false; }
        if (addspecial.Night.value.length < 1) { alert("Please enter a nightly rate for this special."); return false; }
        if (addspecial.Week.value.length < 1) { alert("Please enter a weekly rate for this special."); return false; }
        if (addspecial.Month.value.length < 1) { alert("Please enter a monthly rate for this special."); return false; }
        return true;
    }

	function dollarize(num) {
	    // returns a "0.00" format string based on any int or float
	    var n2, stradd;
	    n2 = num;

	    if (parseFloat(n2) == "NaN" || n2 == "") n2 = 0;
	    n2 = (parseInt(n2 * 100) / 100);

        if (Math.floor(n2) == n2) stradd = ".00";
        else if (Math.floor(n2*10) == (n2*10)) stradd = "0";
        else stradd = "";

        n2 = n2 + stradd;
        return n2;
    }

    // COST OF STAY CALCULATOR FUNCTIONS
    function returnCalc() {
    // set form field value to the date selected
        opener.totalField.value = calcform.costtotal.value;
        opener.recalc_res();
        opener.dcfield.value = "no";
    	window.close();
    }

	function change_season(pn, pw, pm) {
	       var varr = document.calcform.season.value.split("/");
	       //pn.innerText = varr[0];
	       calcform.pnightly.value = varr[0];
	       //pw.innerText = varr[1];
	       calcform.pweekly.value = varr[1];
	       //pm.innerText = varr[2];
	       calcform.pmonthly.value = varr[2];
	       calcform.ntval.value = varr[0];
	       calcform.wkval.value = varr[1];
	       calcform.mtval.value = varr[2];
	       return true;
    }
    
    function fix_values() {
           calcform.pnightly.value = dollarize(calcform.pnightly.value);
           calcform.pweekly.value = dollarize(calcform.pweekly.value);
           calcform.pmonthly.value = dollarize(calcform.pmonthly.value);
           calcform.ntval.value = calcform.pnightly.value;
           calcform.wkval.value = calcform.pweekly.value;
           calcform.mtval.value = calcform.pmonthly.value;
           return true;
    }

	function recalc_rates() {
	       var val;

	       if (document.calcform.rate[0].checked) {
	           val = document.calcform.ntval.value * document.calcform.days.value;
    	       document.calcform.costtotal.value = dollarize(val);
	       }
	       if (document.calcform.rate[1].checked) {
    	       val = document.calcform.wkval.value * document.calcform.weeks.value;
               document.calcform.costtotal.value = dollarize(val);
	       }
	       if (document.calcform.rate[2].checked) {
    	       val = document.calcform.mtval.value * document.calcform.months.value;
               document.calcform.costtotal.value = dollarize(val);
	       }
	       return true;
	}

	function renew_all() {
	        var numElements = document.renewal_form.elements.length;
	        for (var i = 0; i < numElements; i++) {
	            if (document.renewal_form.elements[i].type.indexOf("select") != -1) {
	                document.renewal_form.elements[i].value = 'Yes'; }
	        }
	        renewal_form.frm_act.value = "Verify";
	        renewal_form.submit();
	        return true;
	}

	function reset_search_form() {
	        var numElements = document.prop_search_form.elements.length;
	        var ts1, ts2, ts3;
	        ts1 = document.prop_search_form.PropertyState.value;
	        ts2 = document.prop_search_form.action.value;
	        ts3 = document.prop_search_form.Prop_Type.value;
	        //var back1 = document.prop_search_form.elements
	        for (var i = 0; i < numElements; i++) {
	            if (document.prop_search_form.elements[i].type.indexOf("checkbox") != -1) {
	                document.prop_search_form.elements[i].checked = false; }
	            if (document.prop_search_form.elements[i].type.indexOf("text") != -1) {
                    document.prop_search_form.elements[i].value = "";
                }
	            if (document.prop_search_form.elements[i].type.indexOf("select") != -1) {
	                document.prop_search_form.elements[i].value = ""; }
	            if (document.prop_search_form.elements[i].type.indexOf("hidden") != -1) {
  	                document.prop_search_form.elements[i].value = "";
                }
                //alert(document.prop_search_form.elements[i].name);
	        }
	        document.qk_search3.Prop_City.value = "";

	        document.prop_search_form.PropertyState.value = ts1;
	        document.prop_search_form.action.value = ts2;
	        document.prop_search_form.Prop_Type.value = "ANY";
	        return true;
	}

 /**
 * DHTML textbox character counter (IE4+) script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function taLimit() {
	var taObj=event.srcElement;
	if (taObj.value.length==taObj.maxLength*1) return false;
}

function taCount(visCnt) {
	var taObj=event.srcElement;
	if (taObj.value.length>taObj.maxLength*1) taObj.value=taObj.value.substring(0,taObj.maxLength*1);

	if (visCnt) visCnt.innerText=(taObj.maxLength-(taObj.value.length));
}

function exc_package() {
    if (exclusive.Position.value == 1) {
        exclusive.MaxProps.value = 50;
        exclusive.Amount.value = dollarize(1999);
        exclusive.Amount.value = dollarize(1999);
        exclusive.Featured.value = 50;
        exclusive.Sponsored.value = 50;
    }
    else if (exclusive.Position.value == 2) {
        exclusive.MaxProps.value = 25;
        exclusive.Amount.value = dollarize(1499);
        exclusive.Total.value = dollarize(1499);
        exclusive.Featured.value = 25;
        exclusive.Sponsored.value = 25;
    }
    else if (exclusive.Position.value == 3) {
        exclusive.MaxProps.value = 15;
        exclusive.Amount.value = dollarize(999);
        exclusive.Total.value = dollarize(999);
        exclusive.Featured.value = 15;
        exclusive.Sponsored.value = 15;
    }
    else if (exclusive.Position.value == 4) {
        exclusive.MaxProps.value = 10;
        exclusive.Amount.value = dollarize(499);
        exclusive.Total.value = dollarize(499);
        exclusive.Featured.value = 10;
        exclusive.Sponsored.value = 10;
    }
    else {
        exclusive.MaxProps.value = 0;
        exclusive.Amount.value = dollarize(0);
        exclusive.Total.value = dollarize(0);
        exclusive.Featured.value = 0;
        exclusive.Sponsored.value = 0;
    }
    exc_recalc();
    return true;
}

function exc_recalc() {
    exclusive.Total.value = dollarize(parseFloat(exclusive.Amount.value) * (1 - (parseFloat(exclusive.Discount.value) / 100)));
    return true;
}

function exc_recalc_all(totalprops) {
    var num, tmp, totalprops;
    var baserate = 99;
    num = (baserate * totalprops);
    if (totalprops > 1) num -= ((baserate / 2) * (totalprops - 1));
    if (totalprops > 49) num -= ((baserate / 4) * (totalprops - 49));
    num += (50 * parseFloat(exclusive.Featured.value));
    num += (99 * parseFloat(exclusive.Sponsored.value));
    tmp = 0;
    if (parseFloat(exclusive.Featured.value) >= parseFloat(exclusive.Sponsored.value)) {
        tmp = parseFloat(exclusive.Sponsored.value);
    }
    if (parseFloat(exclusive.Sponsored.value) >= parseFloat(exclusive.Featured.value)) {
        tmp = parseFloat(exclusive.Featured.value);
    }
    num -= (30 * tmp);
    exclusive.Amount.value = dollarize(num);
    exc_recalc();
    return true;
}

function reset_exclusive() {
    if (exclusive.Address) {
        exclusive.Address.value = "";
        exclusive.City.value = "";
        exclusive.State.value = "";
        exclusive.Zip.value = "";
        exclusive.CCType.value = "";
        exclusive.Name.value = "";
        exclusive.CC.value = "";
        exclusive.Exp.value = "";
        exclusive.Check.checked = false;
        exclusive.Position.value = "";
        exclusive.MaxProps.value = "";
        exclusive.Amount.value = "";
    }
    return true;
}

function citypic_preview() {
    var id = news.cityimage.value;
    timg = id;
    timg.replace("\.", "t\.");
    if (id != "") {
        news.ipreview.src = '/imagesup/' + timg;
    } else {
        news.ipreview.src = '/images/spacer.gif';
    }
    return true;
}

