winnew = null;
function interWindow(url)
{
    var w = (screen.width)-12;
    var h = (screen.height)-220;
    var winll = (screen.width-w)/2;
    var wintt = (screen.height-h)/2;
    var setting  ='height='+h+',';
    setting +='width='+w+',';
    setting +='top=0,';
    setting +='left=0,';
    setting +='scrollbars=yes,';
    setting +='resizable=yes,';
    setting +='status=yes,';
    setting +='menubar=yes,';
    setting +='toolbar=yes,';
    setting +='location=yes';
    window.open("/portal/frame/intermediate.htm?" + url,"",setting);    
}

function newWindow(url)
{
	var w = (screen.width)-12;
	var h = (screen.height)-220;
	var winll = (screen.width-w)/2;
	var wintt = (screen.height-h)/2;
	var setting  ='height='+h+',';
	setting +='width='+w+',';
	setting +='top=0,';
	setting +='left=0,';
	setting +='scrollbars=yes,';
	setting +='resizable=yes,';
	setting +='status=yes,';
	setting +='menubar=yes,';
	setting +='toolbar=yes,';
	setting +='location=yes';
	winnew = window.open(url,"",setting);
	if (winnew == null || typeof(winnew) == "undefined") {
		alert("The pop-up blocker on your machine is preventing the opening of a window. In order for the website to work properly, please disable the pop-up blocker and try again.");
	}
	else
	    winnew.focus();
}

function newSmallWindow(url)
{
	// if (checkLeavingWebsite()) {
		var w = ((screen.width)-12) * 0.7;
		var h = ((screen.height)-220) * 0.7;
		var winll = (screen.width-w)/2;
		var wintt = (screen.height-h-100)/2;
		var setting  ='height='+h+',';
		setting +='width='+w+',';
		setting +='top=' + wintt +',';
		setting +='left=' + winll + ',';
		setting +='scrollbars=yes,';
		setting +='resizable=yes,';
		setting +='status=yes,';
		setting +='menubar=yes,';
		setting +='toolbar=yes,';
		setting +='location=yes';
		winnew = window.open(url,"",setting);
		if (winnew == null || typeof(winnew) == "undefined") {
			alert("The pop-up blocker on your machine is preventing the opening of a window. In order for the website to work properly, please disable the pop-up blocker and try again.");
		}
	    else
	        winnew.focus();
	// }
}

function newPopWin(url, w, h)
{
	
	var setting  ='height='+h+',';
	setting +='width='+w+',';
	setting +='top=0';
	setting +='left=0';
	setting +='scrollbars=no,';
	setting +='resizable=no,';
	setting +='status=no,';
	setting +='menubar=no,';
	setting +='toolbar=no,';
	setting +='location=no';
	winnew = window.open(url,"",setting);
	if (winnew == null || typeof(winnew) == "undefined") {
		alert("The pop-up blocker on your machine is preventing the opening of a window. In order for the website to work properly, please disable the pop-up blocker and try again.");
	}
	else
	    winnew.focus();
	
}
// Use this function for opening the Tax Collector's website.
function vcheckWindow(url)
{
	// if (checkLeavingWebsite()) {
		var w = ((screen.width)-12) * 0.7;
		var h = ((screen.height)-90) * 0.7;
		var winll = (screen.width-w)/2;
		var wintt = (screen.height-h-100)/2;
		var setting  ='height='+h+',';
		setting +='width='+w+',';
		setting +='top=' + wintt +',';
		setting +='left=' + winll + ',';
		setting +='scrollbars=yes,';
		setting +='resizable=yes,';
		setting +='status=yes,';
		setting +='menubar=no,';
		setting +='toolbar=no,';
		setting +='location=no';
		winnew = window.open(url,"",setting);
		if (winnew == null || typeof(winnew) == "undefined") {
			alert("The pop-up blocker on your machine is preventing the opening of a window. In order for the website to work properly, please disable the pop-up blocker and try again.");
		}
	    else
	        winnew.focus();
	// }
}

function checkLeavingWebsite() {
	return confirm("You are about to leave the Los Angeles County Property Tax Portal.\n\n" +
					"Our website provides links to other organizations which may be of interest or useful to visitors of the " +
					"Los Angeles County Property Tax Portal. While we offer these electronic links for your convenience, " +
					"please be aware that we are not responsible for the content of any linked site or any link contained in " +
					"a linked site.\n\n" +
					"Are you sure you want to go to the other website?");
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function AfterItemSelected(listbar,object,e){
	object.setSelected(false);
}

function searchPortal() {
	var searchTerm = document.getElementById("search_txtQuery").value;
	var operator = "any";
	if ((searchTerm == "Enter a search term") || (searchTerm == "")) {
		alert("Please enter one or more words to search");
		return;
	}
	if (document.getElementById("search_cboQueryType").selectedIndex == 0) {
		operator = "all";
	} else if (document.getElementById("search_cboQueryType").selectedIndex == 2) {
		operator = "phrase";
	}
	newSmallWindow("http://lacountypropertytax.com/portal/search.aspx?searchString=" + searchTerm + "&operator=" + operator);
}

/* new county search */
function searchCounty() {
	var searchTerm = document.forms[0].search_txtQuery.value;
	var operator = "radio1"; // any
	if ((searchTerm == "Enter a search term") || (searchTerm == "")) {
		alert("Please enter a search term");
		return;
	}
	if (document.forms[0].search_cboQueryType.selectedIndex == 0) {
		operator = "radio2"; // all
	} else if (document.forms[0].search_cboQueryType.selectedIndex == 2) {
		operator = "radio3"; // exact
	}
	newSmallWindow("http://portal.lacounty.gov/wps/portal/lac/search?deptURL=All&department=All&Search=Search&querytext=" + searchTerm + "&radio=" + operator);
}

/* old county search
function searchCounty() {
	var searchTerm = document.forms[0].search_txtQuery.value;
	var operator = "any";
	if ((searchTerm == "Enter a search term") || (searchTerm == "")) {
		alert("Please enter a search term");
		return;
	}
	if (document.forms[0].search_cboQueryType.selectedIndex == 0) {
		operator = "all";
	} else if (document.forms[0].search_cboQueryType.selectedIndex == 2) {
		operator = "phrase";
	}
	newSmallWindow("http://search.co.la.ca.us/results.asp?coll=all&querytext=" + searchTerm + "&operator=" + operator);
}
*/
