<!--
// This javascript function opens a new window used by the virtual tours.
function open_vtwindow(url)
{
	vtwin = window.open(url,"","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,height=600,width=640");
}
// This javascript function opens a new window used by the mortgage calculator.
function open_mcwindow(url)
{
	mcwin = window.open(url,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=300,width=320");
}
// This javascript function opens a new window used by the affordability calculator.
function open_acwindow(url)
{
	acwin = window.open(url,"","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=285,width=320");
}
// This javascript function opens a new window used by the agency disclosure.
function open_discwindow(url)
{
	discwin = window.open(url,"","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,height=425,width=550");
}
                                
// This javascript function opens a new window used for the office map.
function open_ofcmapwindow(url)
{
	ofcmapwindow = window.open(url,"","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,height=400,width=550");
}
// Javascript function for Region Selection Block:
function region_selection(regionselect_form)
{
    var baseurl = "";
    selecteditem = regionselect_form.nextpage.selectedIndex;
    nextpage = regionselect_form.nextpage.options[selecteditem].value;
    if (nextpage && nextpage.indexOf('class=new_window') != -1)
	{
		var target = 'new_window';
		nextpage = nextpage.replace("class=new_window",""); 
	}
	if (nextpage.length != 0)
	{
		if (target != 'new_window')
		{
    			window.location.href = baseurl + nextpage;
    		}
		else
		{
			//window.location.reload();
			region_mapsearch = baseurl + '/custom/select_search_region.php';
			window.location.href = region_mapsearch;
			window.open(nextpage);
		}
	}
}
function region_selection_quicksearch(regionselect_form)
{
	//var baseurl = "";
	selecteditem = regionselect_form.nextpage.selectedIndex;
	nextpage = regionselect_form.nextpage.options[selecteditem].value;
	if (nextpage && nextpage.indexOf('class=new_window') != -1)
	{
		var target = 'new_window';
		nextpage = nextpage.replace("class=new_window",""); 
	}
	if (nextpage.length != 0) {
		if (target != 'new_window')
		{
			//location.href = baseurl + nextpage;
			window.location.href = nextpage;
		}
		else
		{
			window.location.reload();
			window.open(nextpage);
		}
	}
}
// following 3 functions are for the Quicksearch Block:
function transtype_selection_quicksearch(transtypeselect_form)
{
    var baseurl = "";
    selecteditem = transtypeselect_form.nextpage.selectedIndex;
    nextpage = transtypeselect_form.nextpage.options[selecteditem].value;
    if (nextpage.length != 0) {
      location.href = baseurl + nextpage;
    }
}
function transtype_checked_quicksearch(transtypechecked_form)
{
	var baseurl = "";
	for (var i=0; i<transtypechecked_form.elements.length; i++)
	{
		if (transtypechecked_form.elements[i].checked == true)
		{
			nextpage = transtypechecked_form.elements[i].value;
			if (nextpage.length != 0)
			{
				location.href = baseurl + nextpage;
			}
		}
	}
}
//Javascript below is for the compensaton calculator								
function cleanIntField(onchangeField)
{
	var patternNonNum = /\D/;
	for (iz=0; iz<onchangeField.length; iz++)
	{
		onchangeField = onchangeField.replace(patternNonNum,""); 
	}
	return onchangeField;
}
function cleanPctField(onchangeField)
{
	var patternNonNum = /[$,%a-z]/;
	for (iz=0; iz<onchangeField.length; iz++)
	{
		onchangeField = onchangeField.replace(patternNonNum,""); 
	}
	return onchangeField;
}

function franchisefee()
{
	var calcvalue03 = Number(document.commcalc.formfield03.value);
	if (calcvalue03 < 0)
	{
		alert('Franchise Fee must be a number from 0 to 100.');
	}
	else if (calcvalue03 > 100)
	{
		alert('Franchise Fee must be a number from 0 to 100.');
	}
	else
	{
		document.commcalc.formfield03.value = calcvalue03;
	}
}
function commissionsplit()
{
	var calcvalue04 = Number(document.commcalc.formfield04.value);
	if (calcvalue04 < 0)
	{
		alert('Commission Split must be a number from 0 to 100.');
	}
	else if (calcvalue04 > 100)
	{
		alert('Commission Split must be a number from 0 to 100.');
	}
	else
	{
		document.commcalc.formfield04.value = calcvalue04;
	}
}
function expenses()
{ 
	var calcvalue02 = Number(document.commcalc.formfield02.value);
	if (calcvalue02 < 0)
	{
		alert('Additional expenses must be 0 or greater.');
	}
	else
	{
		document.commcalc.formfield02.value = calcvalue02;
	}
}
function calculate()
{
	document.commcalc.formfield02.value = Math.round(Number(cleanIntField(document.commcalc.formfield02.value)));
	document.commcalc.formfield01.value = Math.round(Number(cleanIntField(document.commcalc.formfield01.value)));
	var calcvalue06 = Number(document.commcalc.formfield01.value) * 0.03;
	document.commcalc.formfield06.value = Math.round(calcvalue06);
	document.commcalc.formfield09.value = Math.round(calcvalue06);
	document.commcalc.formfield03.value = Number(cleanPctField(document.commcalc.formfield03.value));
	document.commcalc.formfield07.value = Math.round(document.commcalc.formfield06.value * (1 - document.commcalc.formfield03.value/100));
	document.commcalc.formfield04.value = Number(cleanPctField(document.commcalc.formfield04.value));
	document.commcalc.formfield08.value = Math.round(document.commcalc.formfield07.value * document.commcalc.formfield04.value/100);
	document.commcalc.formfield05.value = Math.round(document.commcalc.formfield08.value - document.commcalc.formfield02.value);
	document.commcalc.formfield10.value = Math.round(document.commcalc.formfield02.value);
	document.commcalc.formfield11.value = 3600;
	document.commcalc.formfield12.value = document.commcalc.formfield09.value - document.commcalc.formfield10.value - document.commcalc.formfield11.value;
} //End Javascript for compensation calculator

function doBlink()
{
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
	{
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
	} 
}

function startBlink()
{
	if (document.all)
	{
		setInterval("doBlink()",2000)
	}
}
function newagents()
{
	DispWin1 = window.open('http://www.mlsplug-in.com/mlsplugin/signup.asp?Office=555','detail','height=525,width=600,scrollbars=1,resizable=1,toolbar=no,menubars=0');
}
function featured()
{
	DispWin = window.open('http://mlsplug-in.com/intramls/results.asp?Office=555','Wind','height=525,width=640,resizable=1,scrollbars=1,toolbar=no');
}
function members()
{
	DispWin1 = window.open('http://www.mlsplug-in.com/mlsplugin/default.asp?Office=555','detail','height=525,width=600,scrollbars=1,resizable=1,toolbar=no,menubars=0');
}
function mylistings()
{
	DispWin = window.open('http://www.mlsplug-in.com/featured/default.asp?office=555','featured','height=525,width=600,resizable=yes,scrollbars=yes,toolbar=no');
}
//window.onload = startBlink;
// -->