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 = '';
}
NewsDelay=10000		//Time each story is displayed for
NewsFadeDelay=1000	//Time taken to fade from one story to the next
NewsFont='Verdana'	//Ticket font family
NewsFontSize='10pt'	//Ticket font size
NewsTextColor=new Array("#444444","#555555","#666666","#777777","#888888","#999999","#aaaaaa","#bbbbbb","#cccccc","#dddddd","#eeeeee","#ffffff")
NewsStory=0		//Working Variable
LastNewsStory=0		//Working Variable
NewsColor=0		//Working Variable
NewsArray=new Array(
'<table cellspacing="0" cellpadding="0"><tr><td align="left">Your company proved to be a success.  We sold our house in one week at full asking price. Appreciate your help!</td></tr><tr><td align="right">- Matt H.</td></tr></table>' , '',
'<table cellspacing="0" cellpadding="0"><tr><td align="left">I really like your site! It was well set up & easy to use...thanks!</td></tr><tr><td align="right">- Audra W.</td></tr></table>' , '',
'<table cellspacing="0" cellpadding="0"><tr><td align="left">The video of our house was great! I loved the aerial map at the beginning and the narration. I will definitely recommend you guys to anyone I know selling by owner. What a great option and service to offer.</td></tr><tr><td align="right">- Jody L.</td></tr></table>' , '',
'<table cellspacing="0" cellpadding="0"><tr><td align="left">The video package sold me.  I’ve never seen anything that professional.  All I can say is WOW!</td></tr><tr><td align="right">- Dan U.</td></tr></table>' , '',
'<table cellspacing="0" cellpadding="0"><tr><td align="left">I wanted to let you know that your website is very nice and easy to navigate.  I am also impressed with your virtual office.  Making changes to my listing is a snap.</td></tr><tr><td align="right">- Dave R.</td></tr></table>' , '',
'')


function DisplayNews(){
	LastNewsStory=NewsStory
	NewsStory++; if( NewsStory>(Math.floor(NewsArray.length/2)) ){NewsStory=1}
	FadeNews()
}



function FadeNews(){
	if (NewsColor<(NewsTextColor.length)/2){var NewsLayer=1}
	else {var NewsLayer=2}
	//Old Story
	if (LastNewsStory>0){
		var NewsText = '<FONT color="'+ NewsTextColor[NewsColor] +'" face="'+ NewsFont +'"><i>'+ NewsArray[(LastNewsStory-1)*2] +'</i></FONT>'
			if(document.layers){ document.eval('newslayer'+(3-NewsLayer)).document.write(NewsText); document.eval('newslayer'+(3-NewsLayer)).document.close() }//NN4
			if(document.all){ eval('newslayer'+(3-NewsLayer)).innerHTML=NewsText }//IE
			if(!document.all && document.getElementById){ document.getElementById('newslayer'+(3-NewsLayer)).innerHTML=NewsText }//NN6
	}
	//New Story
		var NewsText = '<FONT color="'+ NewsTextColor[(NewsTextColor.length)-NewsColor-1] +'" face="'+ NewsFont +'"><i>'+ NewsArray[(NewsStory-1)*2] +'</i></FONT>'
			if(document.layers){ document.eval('newslayer'+NewsLayer).document.write(NewsText); document.eval('newslayer'+NewsLayer).document.close() }//NN4
			if(document.all){ eval('newslayer'+NewsLayer).innerHTML=NewsText }//IE
			if(!document.all && document.getElementById){ document.getElementById('newslayer'+NewsLayer).innerHTML=NewsText; }//NN6
	NewsColor++
	if (NewsColor>=NewsTextColor.length){ NewsColor=0; setTimeout('DisplayNews()',NewsDelay) }
	else { setTimeout('FadeNews()',NewsFadeDelay/NewsTextColor.length) }
}

