function validate_form()
{
	valid = true;
	
	if (document.myregion_form.city.value =="")
	{
		jQuery.facebox('<p class=bluetext><center><img src="/images/oooops.gif"></center></p><p class=adboxitems>You didn&lsquo;t select a city. Use the drop-down box next to the map to select a search city.</p><br>')
		valid = false;
	}
	
	if (parseInt(document.myregion_form.min_price.value) > parseInt(document.myregion_form.max_price.value))
	{
		jQuery.facebox('<p class=bluetext><center><img src="/images/oooops.gif"></center></p><p class=adboxitems>The Min Price can&lsquo;t be larger then the Max Price.</p><br>')
		valid = false;
	}
	
	return valid;
}

function validate_result_form()
{
	valid = true;
	
	if (document.result_form.city.value =="")
	{
		jQuery.facebox('<p class=bluetext><center><img src="/images/oooops.gif"></center></p><p class=adboxitems>You didn&lsquo;t select a city. Use the drop-down box next to the map to select a search city.</p><br>')
		valid = false;
	}
	
	if (parseInt(document.result_form.min_price.value) > parseInt(document.result_form.max_price.value))
	{
		jQuery.facebox('<p class=bluetext><center><img src="/images/oooops.gif"></center></p><p class=adboxitems>The Min Price can&lsquo;t be larger then the Max Price.</p><br>')
		valid = false;
	}
	
	return valid;
}

function validate_prov()
{
	valid = true;
	
	if (document.myregion_form.myregion.value =="")
	{
		jQuery.facebox('<p class=bluetext><center><img src="/images/oooops.gif"></center></p><p class=adboxitems>You must select a province to start your search.</p><br>')
		valid = false;
	}
	
	return valid;
}


function validate_register_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.register_form.username.value ==""){
		errormessage = "<li>You didn&lsquo;t enter a username.</li>";
	}
	if (document.register_form.firstname.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your first name.</li>";
	}
	if (document.register_form.lastname.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your last name.</li>";
	}
	if (document.register_form.email.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your email address.</li>";
	}
	if (document.register_form.reemail.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t re-enter your email address.</li>";
	}
	if (document.register_form.password.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a password.</li>";
	}
	if (document.register_form.repassword.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t re-enter a password.</li>";
	}
	if (document.register_form.question.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select a question.</li>";
	}
	if (document.register_form.answer.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter an answer to your question.</li>";
	}
	if (document.register_form.recaptcha_response_field.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter the reCaptcha text.</li>";
	}
	if (document.register_form.refer.value =="0"){
		errormessage = errormessage+"<li>You did not select a referral method.</li>";
	}
	if (!document.register_form.iagree.checked){
		errormessage = errormessage+"<li>You must agree to the terms of service.</li>";
	}
			
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
}

function validate_editpersonal_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.editpersonal_form.firstname.value ==""){
		errormessage = "<li>You didn&lsquo;t enter your first name.</li>";
	}
	if (document.editpersonal_form.lastname.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your last name.</li>";
	}
	if (document.editpersonal_form.email.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your email address.</li>";
	}
	if (document.editpersonal_form.reemail.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t re-enter your email address.</li>";
	}
	
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
	
}


function validate_confirmview_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.confirmview_form.name.value ==""){
		errormessage = "<li>You didn&lsquo;t enter your name.</li>";
	}
	if (document.confirmview_form.contact.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your contact information.</li>";
	}
	
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
	
}

function validate_editsecurity_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.editsecurity_form.question.value =="0"){
		errormessage = "<li>You didn&lsquo;t select a question.</li>";
	}
	if (document.editsecurity_form.answer.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter an answer to your question.</li>";
	}
	
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
	
}

function validate_editpass_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.editpass_form.oldpassword.value ==""){
		errormessage = "<li>You didn&lsquo;t enter your old password.</li>";
	}
	if (document.editpass_form.newpassword.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a new password.</li>";
	}
	if (document.editpass_form.repassword.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t re-enter your new password.</li>";
	}
	
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
	
}


function validate_list_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.list_form.city.value ==""){
		errormessage = "<li>You didn&lsquo;t select a city.</li>";
	}
	if (document.list_form.street.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter the street address.</li>";
	}
	if (document.list_form.type.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t slect a property type.</li>";
	}
	if (document.list_form.footage.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t enter the square footage.</li>";
	}
	if (document.list_form.parking.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select the available parking spots.</li>";
	}
	if (document.list_form.bedrooms.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select the number of bedrooms.</li>";
	}
	if (document.list_form.bathrooms.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select the number of bathrooms.</li>";
	}
	if (document.list_form.pets.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select if you allow pets.</li>";
	}
	if (document.list_form.category.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select a category for your listing.</li>";
	}
	if (document.list_form.lease.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select the minimum lease length.</li>";
	}
	if (document.list_form.price.value =="0.00"){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a the rental price.</li>";
	}
	if (document.list_form.deposit.value =="0.00"){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a the security deposit.</li>";
	}
	if (document.list_form.shortdescription.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a short description of the property.</li>";
	}
	if (document.list_form.description.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a description of the property.</li>";
	}
	if (document.list_form.description.value.length > 3000){
		errormessage = errormessage+"<li>The description is limited to 3,000 characters.</li>";
	}
	if (document.list_form.terms.value.length > 500){
		errormessage = errormessage+"<li>The Special Terms is limited to 500 characters.</li>";
	}
	if (document.list_form.recaptcha_response_field.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter the reCaptcha text.</li>";
	}
	
	
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class='adboxitems'>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
	
}

function validate_listpost_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (!document.listpost_form.iagree.checked){
		errormessage = "<li>You must agree to the terms of service.</li>";
	}
			
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
}

function validate_sendmessage_form()
{
	valid = true;
	
	var errormessage="";
	var errortitle;
	var errorend;
	
	if (document.sendmessage_form.name.value ==""){
		errormessage = "<li>You didn&lsquo;t enter your name.</li>";
	}
	if (document.sendmessage_form.email.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter your email address.</li>";
	}
	if (document.sendmessage_form.subject.value =="0"){
		errormessage = errormessage+"<li>You didn&lsquo;t select a subject.</li>";
	}
	if (document.sendmessage_form.message.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter a message.</li>";
	}
	if (document.sendmessage_form.recaptcha_response_field.value ==""){
		errormessage = errormessage+"<li>You didn&lsquo;t enter the reCaptcha text.</li>";
	}
			
	if (errormessage != ""){
		
		errortitle = "<p><center><img src='/images/oooops.gif'></p></center><span class=adboxitems>Please review the following:<ul>";
		errorend = "</span></ul><br>";
		jQuery.facebox(errortitle+errormessage+errorend)
		
		valid = false;
	}
	return valid;
}

function mFormat(textObj) {
   var rPrice = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < rPrice.length; i++) {
      aChar = rPrice.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   if(decPrice.length == 1) {
      decPrice = decPrice + "0";
   }
   if(decPrice.length == 0) {
      decPrice = decPrice + "00";
   }
   
   if(rPrice.substring(0,1) != '-' ||
         (dolAmount == "0" && decPrice == "00")) {
      document.list_form.price.value = "$" + dolAmount + "." + decPrice;

   }
   else{
      document.list_form.price.value = "$" + dolAmount + "." + decPrice;
   }
}

function fFormat(textObj) {
   var rPrice = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < rPrice.length; i++) {
      aChar = rPrice.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   if(decPrice.length == 1) {
      decPrice = decPrice + "0";
   }
   if(decPrice.length == 0) {
      decPrice = decPrice + "00";
   }
   
   if(rPrice.substring(0,1) != '-' ||
         (dolAmount == "0" && decPrice == "00")) {
      document.list_form.moveinfee.value = "$" + dolAmount + "." + decPrice;

   }
   else{
      document.list_form.moveinfee.value = "$" + dolAmount + "." + decPrice;
   }
}

function sFormat(textObj) {
   var rPrice = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < rPrice.length; i++) {
      aChar = rPrice.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   if(decPrice.length == 1) {
      decPrice = decPrice + "0";
   }
   if(decPrice.length == 0) {
      decPrice = decPrice + "00";
   }
   
   if(rPrice.substring(0,1) != '-' ||
         (dolAmount == "0" && decPrice == "00")) {
      document.list_form.deposit.value = "$" + dolAmount + "." + decPrice;

   }
   else{
      document.list_form.deposit.value = "$" + dolAmount + "." + decPrice;
   }
}

function ftFormat(textObj) {
   var sFoot = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < sFoot.length; i++) {
      aChar = sFoot.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   document.list_form.footage.value = dolAmount

}


function eFormat(textObj) {
   var rPrice = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < rPrice.length; i++) {
      aChar = rPrice.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   if(decPrice.length == 1) {
      decPrice = decPrice + "0";
   }
   if(decPrice.length == 0) {
      decPrice = decPrice + "00";
   }
   
   if(rPrice.substring(0,1) != '-' ||
         (dolAmount == "0" && decPrice == "00")) {
	   if ((dolAmount+decPrice)==0){
		   document.list_form.electricity_dollar.value = dolAmount + "." + decPrice;
	   }else{
		   document.list_form.electricity_dollar.value = "$" + dolAmount + "." + decPrice;
	   }
	  document.list_form.electricity_percent.value = "0";

   }
   else{
      if ((dolAmount+decPrice)==0){
		   document.list_form.electricity_dollar.value = dolAmount + "." + decPrice;
	   }else{
		   document.list_form.electricity_dollar.value = "$" + dolAmount + "." + decPrice;
	   }
	  document.list_form.electricity_percent.value = "0";
   }
}

function gFormat(textObj) {
   var rPrice = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < rPrice.length; i++) {
      aChar = rPrice.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   
   if(decPrice.length == 1) {
      decPrice = decPrice + "0";
   }
   if(decPrice.length == 0) {
      decPrice = decPrice + "00";
   }
   
   if(rPrice.substring(0,1) != '-' ||
         (dolAmount == "0" && decPrice == "00")) {
	   if((dolAmount+decPrice)==0){
		   document.list_form.naturalgas_dollar.value = dolAmount + "." + decPrice;
	   }else{
		   document.list_form.naturalgas_dollar.value = "$" + dolAmount + "." + decPrice;
	   }
	  document.list_form.naturalgas_percent.value = "0";

   }
   else{
      if((dolAmount+decPrice)==0){
		   document.list_form.naturalgas_dollar.value = dolAmount + "." + decPrice;
	   }else{
		   document.list_form.naturalgas_dollar.value = "$" + dolAmount + "." + decPrice;
	   }
	  document.list_form.naturalgas_percent.value = "0";
   }
}

function eFormatp(textObj) {
   var sFoot = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < sFoot.length; i++) {
      aChar = sFoot.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   if(dolAmount==0){
	   document.list_form.electricity_percent.value = dolAmount;
   }else{
	   document.list_form.electricity_percent.value = dolAmount + "%";
   }
   document.list_form.electricity_dollar.value = "0.00";

}

function gFormatp(textObj) {
   var sFoot = textObj;
   var decPrice = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";
   
   for(i=0; i < sFoot.length; i++) {
      aChar = sFoot.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decPrice = "" + decPrice + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }
   

   if(dolAmount == "") {
      dolAmount = "0";
   }

   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }
   

   if(decPrice.length > 2) {
      if(decPrice.substring(2,3) > "4") {
         decPrice = parseInt(decPrice.substring(0,2)) + 1;
         if(decPrice < 10) {
            decPrice = "0" + decPrice;
         }
         else {
            decPrice = "" + decPrice;
         }
      }
      else {
         decPrice = decPrice.substring(0,2);
      }
      if (decPrice == 100) {
         decPrice = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }
   if (dolAmount==0){
	 document.list_form.naturalgas_percent.value = dolAmount;
   }else{
	   document.list_form.naturalgas_percent.value = dolAmount + "%";
   }
   document.list_form.naturalgas_dollar.value = "0.00";

}


function elecChange() {
   if (document.list_form.electricity.checked){
		document.list_form.electricity_percent.disabled=true;
   		document.list_form.electricity_dollar.disabled=true;
		
		document.list_form.electricity_percent.value="0";
   		document.list_form.electricity_dollar.value="0.00";
   }else{
	   	document.list_form.electricity_percent.disabled=false;
   		document.list_form.electricity_dollar.disabled=false;
   }
}

function gasChange() {
   if (document.list_form.naturalgas.checked){
		document.list_form.naturalgas_percent.disabled=true;
   		document.list_form.naturalgas_dollar.disabled=true;
		
		document.list_form.naturalgas_percent.value="0";
   		document.list_form.naturalgas_dollar.value="0.00";
   }else{
	   	document.list_form.naturalgas_percent.disabled=false;
   		document.list_form.naturalgas_dollar.disabled=false;
   }
}
