/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cyanide_7 |  */
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}


/*   verify   */

<!-- Begin
function verify() {
var themessage = "Minimum length of 3 characters is required for";

if (document.form.searchtext.value.length < 3) {
themessage = themessage + " search field";
}
//alert if fields are empty and cancel form submit
if (themessage == "Minimum length of 3 characters is required for") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}
//  End -->



/* email   */

var user;
var domain;
var suffix;
 
function liam(user, domain, suffix, name){
 
document.write('<a class="L5" href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + name + '</a>');
 
}

 /* TARR 24.asp Functions      */

function OnChangeSub1(dropdown)
{

	var county = document.FrontPage_Form1.county.value;

var baseURL= "Tarr24Reports.asp?Step=1"

if (document.FrontPage_Form1.county.value == 'DURHAM')

	var baseURL= "Tarr24Reports.asp?Step=1&type=H"

if (document.FrontPage_Form1.county.value == 'CHATHAM')

	var baseURL= "Tarr24Reports.asp?Step=1&type=H"


 top.location.href = baseURL + "&county="+county+"#Market";   
    return true;  
}
//-->



function OnChangeSub3(dropdown)
{


	var subdivision = document.FrontPage_Form1.subdivision.value;
	var county = document.FrontPage_Form1.county.value;
	



if (document.FrontPage_Form1.type)

var  Type = document.FrontPage_Form1.type.value;

if (document.FrontPage_Form1.type[0])
	
		var Type1 = document.FrontPage_Form1.type[0].checked;
		if (Type1 == true)
		{
		var Type = "H"
		}


if (document.FrontPage_Form1.type[1])
		var Type2 = document.FrontPage_Form1.type[1].checked;
		if (Type2 == true)
		{
		var Type = "L"
		}
else
var Type = "H";

if (document.FrontPage_Form1.county.value == 'DURHAM')
	var Type = "H"
	
	var baseURL= "Tarr24Reports.asp?Step=3"
    top.location.href = baseURL + "&subdivision="+subdivision+"&Type="+Type+"&county="+county+"#Market";   
    return true;  
}
//-->


function OnChangeSub2(dropdown)
{


	var county = document.FrontPage_Form1.county.value;
	
if (document.FrontPage_Form1.county.value == 'CHATHAM')
{
		
		var Type = "H"
		

}

if (document.FrontPage_Form1.county.value == 'WAKE')
{
		var Type1 = document.FrontPage_Form1.type[0].checked;
		if (Type1 == true)
		{
		var Type = "H"
		}

		var Type2 = document.FrontPage_Form1.type[1].checked;
		if (Type2 == true)
		{
		var Type = "L"
		}

}

if (document.FrontPage_Form1.county.value == 'DURHAM')
{
		var Type = "H"
		
		

}

	var baseURL= "Tarr24Reports.asp?Step=2"
    top.location.href = baseURL + "&county="+county+"&Type="+Type+"#Market";   
    return true;  
}
//-->

function OnChangeSub5(dropdown)
{

	
if (document.FrontPage_Form1.subdivision)

var subdivision = document.FrontPage_Form1.subdivision.value;
else
var subdivision = "";


if (document.FrontPage_Form1.section)
var section = document.FrontPage_Form1.section.value;
else
var section = "";

	var county = document.FrontPage_Form1.county.value;

if (document.FrontPage_Form1.squareFootage)
var squareFootage = document.FrontPage_Form1.squareFootage.value;
else
var squareFootage = "";
	


if (document.FrontPage_Form1.zone)
	var zone = document.FrontPage_Form1.zone.value;

else
var zone = "";

if (document.FrontPage_Form1.county.value == 'CHATHAM')
{
var Type = "H"

}
if (document.FrontPage_Form1.county.value == 'WAKE')
{
var Type1 = document.FrontPage_Form1.type[0].checked;
if (Type1 == true)
{
var Type = "H"
}

var Type2 = document.FrontPage_Form1.type[1].checked;
if (Type2 == true)
{
var Type = "L"
}
}

if (document.FrontPage_Form1.county.value == 'DURHAM')
{
var Type = "H"

}

if (document.FrontPage_Form1.Report)

if (document.FrontPage_Form1.Report[0])
   

var Report1 = document.FrontPage_Form1.Report[0].checked;
if (Report1 == true)
{
var Report = "100"
}

if (Report1 == false)
{
var Report = "0"
}


else
var Report = Report+"";
if (document.FrontPage_Form1.Report)
if (document.FrontPage_Form1.Report[1])

var Report2 = document.FrontPage_Form1.Report[1].checked;
if (Report2 == true)
{
var Report = Report+",101"
}

else
var Report =  Report+"";

if (document.FrontPage_Form1.Report)
if (document.FrontPage_Form1.Report[2])


var Report3 = document.FrontPage_Form1.Report[2].checked;
if (Report3 == true)
{
var Report = Report+",105"
} 

else
var Report =  Report+"";
if (document.FrontPage_Form1.Report)
if (document.FrontPage_Form1.Report[3])

var Report4 = document.FrontPage_Form1.Report[3].checked;
if (Report4 == true)
{
var Report = Report+",102"
} 

else
var Report =  Report+"";
if (document.FrontPage_Form1.Report)
if (document.FrontPage_Form1.Report[4])


var Report5 = document.FrontPage_Form1.Report[4].checked;
if (Report5 == true)
{
var Report = Report+",106"
} 
else
var Report =  Report+"";
if (document.FrontPage_Form1.Report)
if (document.FrontPage_Form1.Report[5])


var Report6 = document.FrontPage_Form1.Report[5].checked;
if (Report6 == true)
{
var Report = Report+",104"
} 
else
var Report =  Report+"";


var marketsnap1 = document.FrontPage_Form1.marketsnapshot.checked;
if (marketsnap1 == true)
{
var marketsnap = "1"
}
if (marketsnap1 == false)
{
var marketsnap = "0"
}
	
	var baseURL= "Tarr24Reports.asp?Step=5"
    top.location.href = baseURL + "&subdivision="+subdivision+"&county="+county+"&Type="+Type+"&section="+section+"&squareFootage="+squareFootage+"&Report="+Report+"&marketsnapshot="+marketsnap+"&zone="+zone+ "#snapshot";   
    return true;  
}
//-->



function OnChangeSub4(dropdown)
{

	var county = document.FrontPage_Form1.county.value;
	var subdivision = document.FrontPage_Form1.subdivision.value;
	var section = document.FrontPage_Form1.section.value;
		
if (document.FrontPage_Form1.squareFootage)
var squareFootage = document.FrontPage_Form1.squareFootage.value;
else
var squareFootage = "";

if (document.FrontPage_Form1.zone)
	var zone = document.FrontPage_Form1.zone.value;

else
var zone = "";


	
if (document.FrontPage_Form1.county.value == 'CHATHAM')

{
var Type = "H"
}


if (document.FrontPage_Form1.county.value == 'WAKE')
{
var Type1 = document.FrontPage_Form1.type[0].checked;
if (Type1 == true)
{
var Type = "H"
}

var Type2 = document.FrontPage_Form1.type[1].checked;
if (Type2 == true)
{
var Type = "L"
}
}

if (document.FrontPage_Form1.county.value == 'DURHAM')
{
var Type = "H"
}




if (document.FrontPage_Form1.marketsnapshot)


var marketsnap1 = document.FrontPage_Form1.marketsnapshot.checked;
if (marketsnap1 == true)
{
var marketsnap = "1"
}
if (marketsnap1 == false)
{
var marketsnap = "0"
}

else
var marketsnap = "";


	var baseURL= "Tarr24Reports.asp?Step=4"
    top.location.href = baseURL + "&subdivision="+subdivision+"&county="+county+"&Type="+Type+"&section="+section+"&squareFootage="+squareFootage+"&marketsnapshot="+marketsnap+"&zone="+zone+ "#Market";   
    return true;  
}
//-->


function OnChangeDefineBy(dropdown)
{

if (document.market.county)
	var county = document.market.county.value;

else
var county = "";

var defineby1 = document.market.defineby[0].checked;
if (defineby1 == true)
{
var defineby= "A"
}

var defineby2 = document.market.defineby[1].checked;
if (defineby2 == true)
{
var defineby = "S"
}

if (document.market.defineby[2])

var defineby3 = document.market.defineby[2].checked;
if (defineby3== true)
{
var defineby = "B"
}

if (document.market.defineby[3])
var defineby4 = document.market.defineby[3].checked;
if (defineby4 == true)
{
var defineby = "Z"
}

if (document.market.defineby[4])
var defineby5 = document.market.defineby[4].checked;
if (defineby5 == true)
{
var defineby = "C"
}
var RPage =  document.market.RPage.value;

	var baseURL= RPage + "?Step=1"
    top.location.href = baseURL + "&county="+county+"&defineby="+defineby;   
    return true;  
}
//-->



function OnChangePropType(dropdown)
{

if (document.market.county)
	var county = document.market.county.value;

else
var county = "";


var proptype1 = document.market.proptype[0].checked;
if (proptype1 == true)
{
var proptype= "A"
}

var proptype2 = document.market.proptype[1].checked;
if (proptype2 == true)
{
var proptype = "D"
}

var proptype3 = document.market.proptype[2].checked;
if (proptype3 == true)
{
var proptype = "C"
}

var proptype4 = document.market.proptype[3].checked;
if (proptype4 == true)
{
var proptype = "T"
}

var defineby1 = document.market.defineby[0].checked;
if (defineby1 == true)
{
var defineby= "A"
}

var defineby2 = document.market.defineby[1].checked;
if (defineby2 == true)
{
var defineby = "S"
}

if (document.market.defineby[2])
{
var defineby3 = document.market.defineby[2].checked;
if (defineby3== true)
{
var defineby = "B"
}
}
if (document.market.defineby[3])
{
var defineby4 = document.market.defineby[3].checked;
if (defineby4 == true)
{
var defineby = "Z"
}
}

if (document.market.defineby[4])
{
var defineby5 = document.market.defineby[4].checked;
if (defineby5 == true)
{
var defineby = "C"
}
}
var RPage =  document.market.RPage.value;

	var baseURL= RPage + "?Step=1"
    top.location.href = baseURL + "&county="+county+"&proptype="+proptype+"&defineby="+defineby;   
    return true;  
}
//-->





function OnChangeArea(dropdown)
{

if (document.market.county)
	var county = document.market.county.value;

else
var county = "";

	var area = document.market.area.value;

	var proptype1 = document.market.proptype[0].checked;
if (proptype1 == true)
{
var proptype= "A"
}

var proptype2 = document.market.proptype[1].checked;
if (proptype2 == true)
{
var proptype = "D"
}

var proptype3 = document.market.proptype[2].checked;
if (proptype3 == true)
{
var proptype = "C"
}

var proptype4 = document.market.proptype[3].checked;
if (proptype4 == true)
{
var proptype = "T"
}

var defineby1 = document.market.defineby[0].checked;
if (defineby1 == true)
{
var defineby= "A"
}

var defineby2 = document.market.defineby[1].checked;
if (defineby2 == true)
{
var defineby = "S"
}
if (document.market.defineby[2])
var defineby3 = document.market.defineby[2].checked;
if (defineby3 == true)
{
var defineby = "B"
}
if (document.market.defineby[3])
var defineby4 = document.market.defineby[3].checked;
if (defineby4 == true)
{
var defineby = "Z"
}


if (document.market.defineby[4])
var defineby5 = document.market.defineby[4].checked;
if (defineby5 == true)
{
var defineby = "C"
}
var RPage =  document.market.RPage.value;

	var baseURL= RPage + "?Step=2"
    top.location.href = baseURL + "&county="+county+"&proptype="+proptype+"&defineby="+defineby+"&area="+area;   
    return true;  
}





function OnChangeCounty(dropdown)
{

var county = document.market.county.value;


if (document.market.proptype)
{	
if (document.market.proptype[0])	
var proptype1 = document.market.proptype[0].checked;
if (proptype1 == true)
{
var proptype= "A"
}
if (document.market.proptype[1])	
var proptype2 = document.market.proptype[1].checked;
if (proptype2 == true)
{
var proptype = "D"
}
if (document.market.proptype[2])	
var proptype3 = document.market.proptype[2].checked;
if (proptype3 == true)
{
var proptype = "C"
}
if (document.market.proptype[3])	
var proptype4 = document.market.proptype[3].checked;
if (proptype4 == true)
{
var proptype = "T"
}

}

if (document.market.defineby)
{	
if (document.market.defineby[0])	
var defineby1 = document.market.defineby[0].checked;
if (defineby1 == true)
{
var defineby= "A"
}
if (document.market.defineby[1])
var defineby2 = document.market.defineby[1].checked;
if (defineby2 == true)
{
var defineby = "S"
}
if (document.market.defineby[2])
var defineby3 = document.market.defineby[2].checked;
if (defineby3 == true)
{
var defineby = "B"
}
if (document.market.defineby[3])
var defineby4 = document.market.defineby[3].checked;
if (defineby4 == true)
{
var defineby = "Z"
}

if (document.market.defineby[4])
var defineby5 = document.market.defineby[4].checked;
if (defineby5 == true)
{
var defineby = "C"
}

}
var RPage =  document.market.RPage.value;


var baseURL= RPage + "?Step=1"

if (defineby)
{
	var baseURL = baseURL + "&defineby="+defineby;
}

if (proptype)
{
	var baseURL = baseURL + "&proptype="+proptype;
}

    top.location.href = baseURL + "&county="+county;   
	    
return true;  
}




function submitGraph(elemName){
document.graphs.action = "HistoricalClosingsGraphs.asp?graph="+elemName;
document.graphs.submit();
}


//-->


function OnChangeSoldYear(soldyear)
{

	
if (document.lotsales.SoldYear)
{	
if (document.lotsales.SoldYear[0])	
var soldyear1 = document.lotsales.SoldYear[0].checked;
if (soldyear1 == true)
{
var soldyear= "2008"
}
if (document.lotsales.SoldYear[1])	
var soldyear2 = document.lotsales.SoldYear[1].checked;
if (soldyear2 == true)
{
var soldyear= "2009"
}


if (document.lotsales.SoldYear[2])	
var soldyear1 = document.lotsales.SoldYear[2].checked;
if (soldyear1 == true)
{
var soldyear= "2010"
}

var baseURL= "Tarr24Reports.asp?SoldStep=2"


 top.location.href = baseURL + "&SoldYear="+soldyear+"#";   
    return true;  
}
}
//-->

function OnChangePriceChange(pcCounty)
{

	
if (document.pricechange.pcCounty)
{	
if (document.pricechange.pcCounty[0])	
var pcCounty1 = document.pricechange.pcCounty[0].checked;
if (pcCounty1 == true)
{
var pcounty= "WAKE"
}
if (document.pricechange.pcCounty[1])	
var pcCounty2 = document.pricechange.pcCounty[1].checked;
if (pcCounty2 == true)
{
var pcounty= "DURHAM"
}

if (document.pricechange.pcCounty[2])	
var pcCounty3 = document.pricechange.pcCounty[2].checked;
if (pcCounty3 == true)
{
var pcounty= "CHATHAM"
}

var baseURL= "Tarr24Reports.asp?pcStep=2"


 top.location.href = baseURL + "&pcCounty="+pcounty+"#pc";   
    return true;  
}
}
//-->
