

function toggle(divid){

	document.getElementById('MarketOverview').style.display = 'none';
	document.getElementById('DefaultBG').style.display = 'none';

	document.getElementById(divid).style.display = 'block';

}

/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/

var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos) {

	if (pos == "random") {

		LeftPosition = (screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition = (screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;

	}

	if (pos == "center") {

		LeftPosition = (screen.width)?(screen.width-w)/2:100;
		TopPosition = (screen.height)?(screen.height-h)/2:100;

	} else if ((pos != "center" && pos != "random") || pos == null) {

		LeftPosition = 0;
		TopPosition = 20

	}


	settings = 'width=' + w + ', height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=yes,resizable=no';

	win = window.open(mypage, myname, settings);
}

//Do the swap
function swap(num) {

	document.getElementById('TrafficCountDIV').style.display = 'inline';

	document.getElementById('txtPage').innerHTML = eval(num);

	document.getElementById('TrafficCount').style.visibility = 'hidden';

	if (navigator.appName == "Internet Explorer") {

		document['TrafficCount'].src = Pages[num];

	} else {

		document.getElementById('TrafficCount').src = Pages[num];	

	}

	document.getElementById('TrafficCount').style.visibility = 'visible';
}

function close() {

	document.getElementById("TrafficCountDIV").style.display = 'none';

}

var arrSaleOptions = new Array("Price");
var arrLeaseOptions = new Array("LeasePrice", "LeaseBySFOrMonth", "LeaseType");

function refreshSaleAndLease() {

  var chkSale = document.getElementById("ForSale");
  var chkLease = document.getElementById("ForLease");
  var intCount = 2;

  if (chkSale.checked != "") {

    enableFields(arrSaleOptions);

  } else {

    disableFields(arrSaleOptions);
    intCount--;

  }

  if (chkLease.checked != "") {

    enableFields(arrLeaseOptions);

  } else {

    disableFields(arrLeaseOptions);
    intCount--;

  }

  if (intCount == 0) {

    alert("You must choose to list this property as For Sale or For Lease or both.");
    intCount = 2;

  }

}

function enableFields(arrFields) {

  for (i in arrFields) {

    document.getElementById(arrFields[i]).disabled = false;

  }

}

function disableFields(arrFields) {

  for (i in arrFields) {

    document.getElementById(arrFields[i]).disabled = true;

  }

}