function initcalculatecom() {
var A = 215000;
var com70 = A * .07
var com35 = A * .03
document.getElementById("calcprice").value=formatCurrency(A);
document.getElementById("sevencom").value=formatCurrency(com70);
document.getElementById("threecom").value=formatCurrency(com35);
}
function calculatecom(Atext) {
Atext = Atext.toString().replace(/\$|\,/g,'');
var A = parseFloat(Atext);
if ( isNaN(A) ) {
    A = 0;
}
var com70 = A * .07
var com35 = A * .03
document.getElementById("calcprice").value=formatCurrency(A);
document.getElementById("sevencom").value=formatCurrency(com70);
document.getElementById("threecom").value=formatCurrency(com35);
}

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);
}

function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}

function toggleElement(proptype, element1, propval) {

  element1 = document.getElementById(element1);
  if (proptype.value == propval) {

    element1.style.display = 'none';

  }
  else {
    element1.style.display = 'inline';
  }

  return;
}
function toggleElementload() {

  element2 = document.getElementById('othertype');
    element2.style.display = 'none';

}

function useBillInfo(form)
{ 
	var idx;
	

	if(form.sameadd.checked)
		{
			form.ShipTo_FName.value = form.BillTo_FName.value;
			form.ShipTo_LName.value = form.BillTo_LName.value;
			form.ShipTo_Address.value = form.BillTo_Address.value;
			form.ShipTo_City.value = form.BillTo_City.value;
			form.ShipTo_State.value = form.BillTo_State.value;
			form.ShipTo_Zip.value = form.BillTo_Zip.value;
			
		}
	else
		{
			form.ShipTo_FName.value = "";
			form.ShipTo_LName.value = "";
			form.ShipTo_Address.value = "";
			form.ShipTo_City.value = "";
			form.ShipTo_State.value = "";
			form.ShipTo_Zip.value = "";
			
		}
}

function useBillInfo2(form)
{ 
	

	if(form.sameadd2.checked)
		{
			form.ShipTo_Address.value = form.BillTo_Address.value;
			form.ShipTo_City.value = form.BillTo_City.value;
			form.ShipTo_State.value = form.BillTo_State.value;
			form.ShipTo_Zip.value = form.BillTo_Zip.value;
			
		}
	else
		{
			form.ShipTo_Address.value = "";
			form.ShipTo_City.value = "";
			form.ShipTo_State.value = "";
			form.ShipTo_Zip.value = "";
			
		}
}
function clearfield(){
    if (document.f1.City_Listing.value =='Search by City, State or Listing ID')
    document.f1.City_Listing.value = '';
}

