function EarnBusiness()
{
	var url = "earn_business.aspx"
	var options = "width=650,height=620,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0"

	if (event.clientY<0){	
		window.open( url, "EarnBusiness", options );
	}
	if ( event.altKey==true && event.F4==true )
	{
		window.open( url, "EarnBusiness", options );	
	}
}

function startclock()
{
var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";
var monthName="";

if (nhours>=12)
    AorP="P.M.";
else
    AorP="A.M.";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
   nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

if (nmonth==0)
  monthName="January";
if (nmonth==1)
  monthName="February";
if (nmonth==2)
  monthName="March";
if (nmonth==3)
  monthName="April";
if (nmonth==4)
  monthName="May";
if (nmonth==5)
  monthName="June";
if (nmonth==6)
  monthName="July";
if (nmonth==7)
  monthName="August";
if (nmonth==8)
  monthName="September";
if (nmonth==9)
  monthName="October";
if (nmonth==10)
  monthName="November";
if (nmonth==11)
  monthName="December";

//nmonth+=1;

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

document.all.clock.innerHTML=monthName+" "+ntoday+", "+nyear+" "+nhours+":"+nmins+":"+nsecn+" "+AorP+" PST";

setTimeout('startclock()',1000);
} 
/**************************************************************
 AllowOnly: This function allow entering just the specified
            Expression to a textbox or textarea control.

 Parameters:
      Expression = Allowed characters.
                   a..z => ONLY LETTERS
                   0..9 => ONLY NUMBERS
                   other symbols...

 Example: use the onKeyPress event to make this function work:
          //Allows only from A to Z
          onKeyPress="AllowOnly('a..z');"

          //Allows only from 0 to 9
          onKeyPress="AllowOnly('0..9');"

          //Allows only A,B,C,1,2 and 3
          onKeyPress="AllowOnly('abc123');"

          //Allows only A TO Z,@,#,$ and %
          onKeyPress="AllowOnly('a..z|@#$%');"

		  //Allows only A,B,C,0 TO 9,.,,,+ and -
          onKeyPress="AllowOnly('ABC|0..9|.,+-');"

 Remarks: Use the pipe "|" symbol to separate a..z from 0..9 and symbols

 Returns: None
***************************************************************/
function AllowOnly(Expression)
{
	Expression = Expression.toLowerCase();
	Expression = Replace(Expression, 'a..z', 'abcdefghijklmnopqrstuvwxyz');
	Expression = Replace(Expression, '0..9', '0123456789');
	Expression = Replace(Expression, '|', '');

	var ch = String.fromCharCode(window.event.keyCode);
	ch = ch.toLowerCase();
	Expression = Expression.toLowerCase();
	var a = Expression.indexOf(ch);
	if (a == -1) 
		window.event.keyCode = 0;
}
/**************************************************************
 Replace: Returns a string in which a specified substring has 
          been replaced with another substring a specified 
          number of times.

 Parameters:
      Expression = String expression containing substring to 
                   replace
      Find       = Substring being searched for.
      Replace    = Replacement substring.

 Returns: String
***************************************************************/
function Replace(Expression, Find, Replace)
{
	var temp = Expression;
	var a = 0;

	for (var i = 0; i < Expression.length; i++) 
	{
		a = temp.indexOf(Find);
		if (a == -1)
			break
		else
			temp = temp.substring(0, a) + Replace + temp.substring((a + Find.length));
	}

	return temp;
}
function getHeader()
{
	links = new Array();
	
	links[0] = "<a href=index.htm>Live Mortgage Leads</a>"
	links[1] = "<a href=MortgageLeadGeneration.htm>Generation Methods</a>"
	links[2] = "<a href=MortgageLeadTransfer.htm>Transfer Methods</a>";
	links[3] = "<a href=Dictionary.htm>Dictionary</a>";
	links[4] = "<a href=ContactUs.htm>Contact</a>"

	document.write("<div id=tab>");
	document.write("<ul>");
	
	for (i=0; i < 5; i++)
	{
		document.write("<li>"+links[i]+"</li>");	
	}

	document.write("</ul></div>");
	
}
function getFooter()
{

	var sep;
	links = new Array();
	sep = "&nbsp;&nbsp;";
	
	links[0] = "<a href=index.htm>Live Mortgage Leads</a>"
	links[1] = "<a href=MortgageLeadGeneration.htm>Generation Methods</a>"
	links[2] = "<a href=MortgageLeadTransfer.htm>Transfer Methods</a>";
	links[3] = "<a href=Dictionary.htm>Dictionary</a>";
	links[4] = "<a href=ContactUs.htm>Contact</a>"
		
	document.write("<table id=footerlinks width=100% align=center cellpadding=5 cellspacing=5 border=0>");
	document.write("<td align=center>");
	for (i=0; i < 5; i++)
	{
		document.write(links[i]+sep)
	}
	document.write("</td>");
	document.write("<tr><td align=center>");
	document.write("&copy; 2007 <a href=index.htm>MortgageTraffic.net.</a>  All rights reserved.");
	document.write("</td></tr>");
	document.write("</table>");
	
}
function getLinks()
{
	var sep;
	links = new Array();
	
	sep = "&nbsp;&nbsp;";
	
	links[0] = "<a href=index.htm>Live Mortgage Leads</a>"
	links[1] = "<a href=MortgageLeadGeneration.htm>Generation Methods</a>"
	links[2] = "<a href=MortgageLeadTransfer.htm>Transfer Methods</a>";
	links[3] = "<a href=Dictionary.htm>Dictionary</a>";
	links[4] = "<a href=ContactUs.htm>Contact</a>"
	
	document.write("<table border=0 cellspacing=0 cellpadding=0 width=100% id=whitelinks>");
	document.write("<tr>")
	for (i=0; i < 5; i++)
	{
		document.write("<td align=middle>");
		document.write(links[i]);
		document.write("</td>");
	}
	document.write("</table>");
}
function toCurrency( Field ) {

	var num = Field.value;
	
	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));
	
	var retValue = (((sign)?'':'-') + '$' + num + '.' + cents);
	
	Field.value = retValue;
	//eval("document.all." + FieldToFormat + ".value = '" + retValue + "'");
}