
//***********************************************	
//***************** FUNCTIONS *******************
//***********************************************

// resize browser
function resizeWin(s) {
	bw = 1024;
	bh = 768;
	if(s == "S"){
		bw = 640;
		bh = 480;
	}else if(s == "M"){
		bw = 800;
		bh = 600;	
	}else if(s == "L"){
		bw = 1024;
		bh = 768;	
	}
   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
     top.outerWidth=bw;
     top.outerHeight=bh;
   }
   else top.resizeTo(bw,bh);
   }
}

//****************** SEARCH FUNCTIONS ***********


// show search layer
function showSearchLayer(sLayer) {
	hideSearchLayer();
	clipLayer(sLayer, 0,0, 150, 400);
	showLayer(sLayer);
	document.frmMain.searchtool.value = sLayer;
}

// hide search layer
function hideSearchLayer() {
	sLayer = document.frmMain.searchtool.value;
	if(sLayer != ""){
		hideLayer(sLayer);
	}
	document.frmMain.searchtool.value = "";
}


 // set layer list
function setLayerList(iLayer){
	var theLayers = document.frmMain.layerlist.value;
	theImg = eval('document.L'+iLayer);
	theSrc = theImg.src;
	if(theSrc.indexOf("on")!= -1){
		theImg.src = "images/c_box_off.gif";
		theNewLayers = theLayers.substring(0,iLayer-1) + "0" + theLayers.substring(iLayer, theLayers.length);
	} else {
		theImg.src = "images/c_box_on.gif";
		theNewLayers = theLayers.substring(0,iLayer-1) + "1" + theLayers.substring(iLayer, theLayers.length);
	}
	document.frmMain.cmd.value = "REFRESH";
	document.frmMain.layerlist.value = theNewLayers;
	document.frmMain.submit();
	showLayer("loadLayer");
}  

// do buffer
function doBuffer(){
	sF = document.frmMain.folio.value;
	if(sF == ""){
		alert("Please select a parcel before using the buffer function.");
	}else{
		var d
		d = parseInt(document.frmMain.dist.value);
		if((d > 0) && (d < 1000)){
			document.frmMain.cmd.value = "BUFFER";
			document.frmMain.buffdist.value = d;
			document.frmMain.submit();
			showLayer("loadLayer");
		}else{
			alert("Please enter a valid buffer distance (max allowed is 1,000 feet).");
		}
	}
	
}  

 //set zoom level
 function setZoomLevel(lvl){
 	document.frmMain.zlevel.value = lvl;
	document.frmMain.cmd.value = "ZOOMLEVEL";
	document.frmMain.submit();
	showLayer("loadLayer");
 }


//*************************************************************************************

// show help
function showHelp(){
	if (typeof helpWin == 'undefined'){
		helpWin = window.open("WebHelp/luishelp.htm", "Help", "width=500,height=400,toolbar=0,menubar=0,scrollbars=1,resizable=1,left=340,top=0");
		helpWin.opener = self;
	} else {
		if (helpWin.closed){
			helpWin = window.open("help.htm", "Help", "width=500,height=400,toolbar=0,menubar=0,scrollbars=1,resizable=1,left=340,top=0");
			helpWin.opener = self;
		} else {			
			helpWin.focus();
		}
	}
}


// show home
function showHome(){
	window.location = "default.htm";
}


// show report
function showReport(sMode){
	sFolio = document.frmMain.folio.value;
	sbuffdist = document.frmMain.buffdist.value;
	if(sFolio == ""){
		alert("No parcels currently selected. Please select a parcel to view report.");
	}else{
		if(sMode == "PARCEL"){
			sURL = "report.asp?folio="+sFolio+"&reptype=PARCEL";
			sTitle = "PReport";
		}
		if(sMode == "LUSE"){
			if(sbuffdist != ""){
				sURL = "report.asp?folio=BUFFERLIST&reptype=LUSE";
			}else{
				sURL = "report.asp?folio="+sFolio+"&reptype=LUSE";
			}
			sTitle = "LReport";
		}
		if(sMode == "LABELS"){
			if(sbuffdist != ""){
				sURL = "report.asp?folio=BUFFERLIST&reptype=LABELS";
			}else{
				sURL = "report.asp?folio="+sFolio+"&reptype=LABELS";
			}
			sTitle = "LReport";
		}
		iHeight = 530;
		iWidth = 630;
		ynScroll = 'yes';
		ynResize = 'yes';
		var objWin;
		objWin = window.open(sURL, sTitle, "height="+iHeight+",width="+iWidth+",scrollbars="+ynScroll+",resizable="+ynResize+"");
		if (parseInt(navigator.appVersion) >=4) objWin.window.focus();
	}

}


// show print map
function showPrintMap(){
	folio = document.frmMain.folio.value;
	minX = document.frmMain.minX.value;
	minY = document.frmMain.minY.value;
	maxX = document.frmMain.maxX.value;
	maxY = document.frmMain.maxY.value;
	layerlist = document.frmMain.layerlist.value;
	buffdist = document.frmMain.buffdist.value;
	theURL = "printform.asp?folio="+folio+"&minX="+minX+"&minY="+minY+"&maxX="+maxX+"&maxY="+maxY+"&layerlist="+layerlist+"&buffdist="+buffdist;
	printWin = window.open(theURL, "Print", "width=600,height=400,toolbar=0,menubar=1,scrollbars=1,resizable=1,left=20,top=0");
}


