
//***********************************************	
//***************** FUNCTIONS *******************
//***********************************************


// do test
function doTest(sSt){
//	alert(sSt);
}
// Show Previous Sales
function ShowPreviousSales(sFolio, sAddress) {
  var detailWin;
  var sURL;
  sURL = "ShowPreviousSales.asp?folio="+sFolio+"&address="+sAddress;

  detailWin = window.open(sURL, "Detail", "width=800,height=500,toolbar=1,menubar=1,scrollbars=1,resizable=1,left=340,top=0");
}

// do owner search
function doOwnerSearch(){
	if(isNav4){
		theForm = document.SearchOwner.document.frmOwner;
	} else {
		theForm = document.frmOwner;
	}
	sOwnerL = theForm.txtownerl.value;
	sOwnerF = theForm.txtownerf.value;
	if(sOwnerL == ""){
		alert("Please enter a last name.");
	} else {
		showLayer("loadLayer");
		document.frmNavigation.cmd.value = "FINDOWNER";
		document.frmNavigation.ownerl.value = sOwnerL;
		document.frmNavigation.ownerf.value = sOwnerF;
		document.frmNavigation.startnum.value = "0";
		document.frmNavigation.submit();
	}
}


// do address search
function doAddrSearch(){
	if(isNav4){
		theForm = document.SearchAddr.document.frmAddr;
	} else {
		theForm = document.frmAddr;
	}
	sStNum = theForm.txtstnum.value;
	sStDir = theForm.selstdir.options[theForm.selstdir.options.selectedIndex].value;
	sStName = theForm.txtstname.value;
	sStType = theForm.selsttype.options[theForm.selsttype.options.selectedIndex].value;
	sStUnit = theForm.txtstunit.value;
	sStZip = theForm.txtstzip.value;
	if((sStNum == "")||(sStName == "")){
		alert("Please enter a street number and name.");
	} else {
		showLayer("loadLayer");
		document.frmNavigation.cmd.value = "FINDADDR";
		document.frmNavigation.stnum.value = sStNum;
		document.frmNavigation.stdir.value = sStDir;
		document.frmNavigation.stname.value = sStName;
		document.frmNavigation.sttype.value = sStType;
		document.frmNavigation.stunit.value = sStUnit;
		document.frmNavigation.stzip.value = sStZip;
		document.frmNavigation.startnum.value = "0";
		//alert(sStNum + " " + sStDir + " " + sStName + " " + sStType + " " + sStUnit + " " + sStZip);
		//alert("Address Search has not yet been implemented.");
		document.frmNavigation.submit();
	}
}


// do folio search
function doFolioSearch(){
	if(isNav4){
		theForm = document.SearchFolio.document.frmFolio;
	} else {
		theForm = document.frmFolio;
	}
	sFolio = theForm.txtfolio.value;
	if(sFolio == ""){
		alert("Please enter a folio number.");
	} else {
		showLayer("loadLayer");
		document.frmNavigation.cmd.value = "FINDFOLIO";
		document.frmNavigation.folio.value = sFolio;
		document.frmNavigation.startnum.value = "0";
		document.frmNavigation.submit();
	}
}

//C. Sibori (11/2007) - added to show more property information
function doMoreInfoSearch(){
	showLayer("loadLayer");
	document.frmNavigation.cmd.value = "MOREINFO";
	document.frmNavigation.submit();
}

// show more
function showMore(sCmd, sSN){
	showLayer("loadLayer");
	document.frmNavigation.cmd.value = sCmd;
	document.frmNavigation.startnum.value = sSN;
	document.frmNavigation.submit();
}


// show parcel
function showParcel(sFolio){
	showLayer("loadLayer");
	document.frmNavigation.cmd.value = "FINDFOLIO";
	document.frmNavigation.folio.value = sFolio;
	document.frmNavigation.startnum.value = "0";
	document.frmNavigation.submit();
}

// view with black and white digital orthophotography
function getORTHO(){
	showLayer("loadLayer");
	document.frmNavigation.cmd.value = "ORTHO";
	document.frmNavigation.sOrthophoto.value = "NO";
	document.frmNavigation.submit();
}

// zoom point
function zoomPoint(sX, sY){
	alert(sX + ", " + sY);
	showLayer("loadLayer");
	document.frmNavigation.cmd.value = "REFRESH";
	document.frmNavigation.minX.value = parseFloat(sX) - 1000;
	document.frmNavigation.minY.value = parseFloat(sY) - 1000;
	document.frmNavigation.maxX.value = parseFloat(sX) + 1000;
	document.frmNavigation.maxY.value = parseFloat(sY) + 1000;
	document.frmNavigation.submit();
}

// show print map
function showPrintMap(){
	theMapURL = document.frmNavigation.mapURL.value;
	theScale = document.frmNavigation.scale.value;
	theFolio = document.frmNavigation.folio.value;
	theOPhoto = document.frmNavigation.sOrthophoto.value;
	theCmd = document.frmNavigation.cmdMore.value;				//C.Sibori (11/2007) - Added
	theURL = "printmap.asp?mapurl="+theMapURL+"&scale="+theScale+"&folio="+theFolio+"&sOrthophoto="+theOPhoto+"&cmd="+theCmd;
	printWin = window.open(theURL, "Print", "width=600,height=400,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1,left=20,top=0");
}

//C.Sibori (11/2007) Links to Services Near You
function showServices(sApp, sCmd) {

	if(document.frmNavigation.searchtool.value == "RESULTS"){
		if(document.frmNavigation.searchtoolTemp.value == "ADDR"){
	    		thecmd = "ADDRESS";
		}else if(document.frmNavigation.searchtoolTemp.value == "FOLIO" || document.frmNavigation.searchtoolTemp.value == "OWNER"){
			thecmd  = "FOLIO";		
		}
	}else if(document.frmNavigation.cmd.value == "FINDADDR"){
		thecmd  = "ADDRESS";
	}else if(document.frmNavigation.cmd.value == "FINDFOLIO" || document.frmNavigation.cmd.value == "FINDOWNER"){
		thecmd  = "FOLIO";
	}else{
	      thecmd = "INIT";
	}	

	if(thecmd == "ADDRESS"){
		thestnum = document.frmNavigation.stnum.value;
		thestdir = document.frmNavigation.stdir.value;
		thestname = document.frmNavigation.stname.value;
		thesttype = document.frmNavigation.sttype.value;
		thestunit = document.frmNavigation.stunit.value;
		thestzip = document.frmNavigation.stzip.value;
		thefolio = "";
	}else{
		thestnum = "";
		thestdir = "";
		thestname = "";
		thesttype = "";
		thestunit = "";
		thestzip = "";
		thefolio = document.frmNavigation.folio.value;
	}
	
	//Services Near You links
	themap = "";
	if(sApp == "enterpriseMap"){
		themap = "703";
      }	
	if(sApp == "empowermentMap"){
		themap = "702";
      }	
	if(sApp == "CDDMap"){
		themap = "800";
      }	
	if(sApp == "CRAMap"){
		themap = "801";
      }	
  	if(sApp == "UDBMap"){
		themap = "802";
      }	

	var theURL;
	theURL = "";
	theURL += "Cmd=" + thecmd;
	theURL += "&HN1=" + thestnum;
	theURL += "&Dir1=" + thestdir;
	theURL += "&StN1=" + thestname;
	theURL += "&StT1=" + thesttype;
	theURL += "&ZC1=" + thestzip;
	theURL += "&Folio=" + thefolio;

	var theMapURL;
	if(sApp == "enterpriseMap" || sApp == "empowermentMap" || sApp == "CDDMap" || sApp == "CRAMap" || sApp == "UDBMap"){ 	
		theMapURL = "../CServices/CSMap.asp?" + theURL + "&ShowWhat=" + themap;
	}else if(sApp == "landuseMap"){
		theMapURL = "../MyNeighborhood/landusemap.asp?" + theURL;
	}else if(sApp == "zoningMap"){
		theMapURL = "../MyNeighborhood/ZoneMap.asp?" + theURL;
	}else if(sApp == "nonadMap"){
		theMapURL = "http://www.miamidade.gov/pa/tax_estimator/non_advalorem_pop_up.asp?Fol=" + thefolio;
	}

	window.open(theMapURL, "Services", "width=800,height=600,toolbar=0,location=0,menubar=0,scrollbars=1,resizable=1,left=20,top=0");
}

// show App
function showApp(){
	theApp = document.frmNavigation.app.options[document.frmNavigation.app.options.selectedIndex].value;
	if(theApp!="none"){

	if(theApp == "proptext"){
		gotoTextVersion();
	}

	if(theApp == "propmap"){
		showLayer("loadLayer");
//		theMapURL = theApp+".asp?Cmd=ZOOMIN&MinX="+theMinX+"&MinY="+theMinY+"&MaxX="+theMaxX+"&MaxY="+theMaxY;
		theMapURL = theApp+".asp?" + getURL();
		document.location = theMapURL;
	}
	
	//C.Sibori (10/2007) Link to My Neighborhood Property Sales
	//Check for RESULTS is to link from map version
	//Check for FINDADDR, FINDFOLIO, FINDOWNER is to link from text version
	if(theApp == "propsales"){
	   if(document.frmNavigation.searchtool.value == "RESULTS"){
	   		if(document.frmNavigation.searchtoolTemp.value == "ADDR"){
	         	document.frmNavigation.cmd.value = "ADDRESS";
			}else if(document.frmNavigation.searchtoolTemp.value == "FOLIO" || document.frmNavigation.searchtoolTemp.value == "OWNER"){
				document.frmNavigation.cmd.value = "FOLIO";		
	   		}
		}else if(document.frmNavigation.cmd.value == "FINDADDR"){
			document.frmNavigation.cmd.value = "ADDRESS";
		}else if(document.frmNavigation.cmd.value == "FINDFOLIO" || document.frmNavigation.cmd.value == "FINDOWNER"){
			document.frmNavigation.cmd.value = "FOLIO";
		}else{
	       document.frmNavigation.cmd.value = "INIT";
		}	

	   theMapURL = "../MyNeighborhood/salesmap.asp";
	   document.frmNavigation.action = theMapURL;
	   document.frmNavigation.submit();
    } 

	if(theApp == "proptax"){
           theFolio = document.frmNavigation.folio.value;	
	   if(theFolio == ""){
	         showLayer("loadLayer");
		     theMapURL = "http://www.miamidade.gov/proptax";
	         document.location = theMapURL;
	     }else{    
		    showLayer("loadLayer");
            taxFolio = theFolio;
		    theMapURL = "http://egvsys.miamidade.gov:1608/wwwserv/ggvt/txcaw01.dia?folio="+taxFolio;
		    document.location = theMapURL;
		 }	 
	}

	}  
}


// go to text version
function gotoTextVersion(){
    theFolio = document.frmNavigation.folio.value;
//Super Homestead Exemption    
    theSHEX = document.frmNavigation.vbMakeLink.value;	

	showLayer("loadLayer");
	theMapURL = "proptext.asp?folio="+theFolio+"&vbMakeLink="+theSHEX;
	document.location = theMapURL;
}

// Update July 2005
// Property Appraiser Tax Estimator
function GoTaxEst(theFolio){
// cmd=FROMTAXEST&Fol=&Dis=True&Mkt=450000&HexV=25000

	Dis = document.frmNavigation.Dis.value;
	Mkt = document.frmNavigation.Mkt.value;
	HexV = document.frmNavigation.HexV.value;

	if (Dis != "True") Dis = "False";
	
	theURL = "//www.miamidade.gov/pa/tax_estimator/TaxEstWorksheet.asp?fol="+theFolio+"&Dis="+Dis+"&Mkt="+ Mkt + "&HexV=" + HexV;
//	theURL = "//www.miamidade.gov/pa/taxestimator.asp";
	//alert(theURL);
	
	document.location = theURL;
}

function GoTaxComp(theFolio){
	
	theURL = "http://www.miamidade.gov/pa/tax_estimator/TaxComparisonStart.asp?Fol="+theFolio;
	//document.location = theURL;
		window.open(theURL, "Print", "width=760,height=600,toolbar=1,menubar=1,scrollbars=1,resizable=1,left=20,top=0");

}

function GoHmstd(theFolio,Addr,Mktval,Assmt){

//	theURL = "SuperHomesteadFinal.asp?fol="+theFolio+"&addr="+Addr+"&Mktval="+Mktval+"&Assmt="+Assmt;
	theURL = "http://www.miamidade.gov/pa/tax_estimator/TaxComparisonStart.asp?Fol="+theFolio+"&addr="+Addr+"&Mktval="+Mktval+"&Assmt="+Assmt;
	//theURL = "//localhost/website/MyHome/SuperHomesteadFinal.asp?fol="+theFolio+"&addr="+Addr+"&Mktval="+Mktval+"&Assmt="+Assmt;
		
	document.location = theURL;
}

//C. Sibori (01/2008) - Added 
function GoSOHCalc(theFolio){

	theURL = "//www.miamidade.gov/pa/tax_estimator/CapDiffNewTaxFinal.asp?Fol="+theFolio;
	document.location = theURL;
}

// get URL
function getURL(){
	thecmd = document.frmNavigation.cmd.value;
	thecmdTemp = document.frmNavigation.cmdTemp.value;
	thetool = document.frmNavigation.tool.value;

	thesearchtool = document.frmNavigation.searchtool.value;
	thesearchtoolTemp = document.frmNavigation.searchtoolTemp.value;

	theMinX = document.frmNavigation.minX.value;
	theMinY = document.frmNavigation.minY.value;
	theMaxX = document.frmNavigation.maxX.value;
	theMaxY = document.frmNavigation.maxY.value;

	theselX = document.frmNavigation.selX.value;
	theselY = document.frmNavigation.selY.value;

	theownerl = document.frmNavigation.ownerl.value;
	theownerf = document.frmNavigation.ownerf.value;

	thestnum = document.frmNavigation.stnum.value;
	thestdir = document.frmNavigation.stdir.value;
	thestname = document.frmNavigation.stname.value;
	thesttype = document.frmNavigation.sttype.value;
	thestunit = document.frmNavigation.stunit.value;
	thestzip = document.frmNavigation.stzip.value;

	theFolio = document.frmNavigation.folio.value;
	thereffolio = document.frmNavigation.reffolio.value;
	thestartnum = document.frmNavigation.startnum.value;
	thesOrthophoto = document.frmNavigation.sOrthophoto.value;
	// Tax Estimator June 24, 2006
	Dis = document.frmNavigation.Dis.value;
	Mkt = document.frmNavigation.Mkt.value;
	HexV = document.frmNavigation.HexV.value;
	vbMakeLink = document.frmNavigation.vbMakeLink.value;
	
	var theURL
	theURL = "";
	theURL += "Cmd=" + thecmdTemp;
	theURL += "&cmdTemp=" + thecmd;
	theURL += "&tool=" + thetool;
	theURL += "&searchtool=" + thesearchtoolTemp;
	theURL += "&searchtoolTemp=" + thesearchtool;
	theURL += "&MinX="+theMinX+"&MinY="+theMinY+"&MaxX="+theMaxX+"&MaxY="+theMaxY;
	theURL += "&selX=" + theselX + "&selY=" + theselY;
	theURL += "&ownerl=" + theownerl + "&ownerf=" + theownerf;
	theURL += "&stnum=" + thestnum + "&stdir=" + thestdir + "&stname=" + thestname + "&sttype=" + thesttype + "&stunit=" + thestunit + "&stzip=" + thestzip;
	theURL += "&folio=" + theFolio;
	theURL += "&reffolio=" + thereffolio;
	theURL += "&startnum=" + thestartnum;
	theURL += "&sOrthophoto=" + thesOrthophoto;
	// Tax Estimator June 24, 2006
	theURL += "&Dis=" + Dis;
	theURL += "&Mkt=" + Mkt;
	theURL += "&HexV=" + HexV;
	theURL += "&vbMakeLink=" + vbMakeLink;
	
	return theURL
}

// search Tool
function searchTool(theTool){
 // theTool = document.frmNavigation.bytool.options[document.frmNavigation.bytool.selectedIndex].value;
  hideSearchLayers();
  if (theTool == "OWNER"){
    showLayer("SearchOwner");
  }else if (theTool == "ADDR"){
    showLayer("SearchAddr");
  } else if (theTool == "FOLIO"){
    showLayer("SearchFolio");    
  }else if (theTool == "RESULTS"){
    showLayer("SearchResults");  
  }
  document.frmNavigation.searchtool.value = theTool;
}


// show help
function showHelp(){
	if (typeof helpWin == 'undefined'){
		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 {
		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();
		}
	}
}



