//BergConfig v.20

//Turn debug on of off (true and false)
//Can be called form browser too ?debug=true
var debug = false;



//==================================================
//What is the max scale of this map ?  (1:10000) 
// Do not include the 1: * just the scale.
//==================================================
var maxScale = 255000; 

//==================================================
//ArcIMS Connection Information.
//==================================================
var service = "LewisCounty";





//==================================================
//Custom Client Settings.
//==================================================
var countyName = "Lewis County";
var countyLogoURL = "images/seal.gif";


//==================================================
// The Layer ID+ others  for the Parcel Layer in the AXL
//==================================================
	// This is a known ID we used all over
	// I try and Keep all AXL files to have a 
	// Parcel Later ID = 0 to stay consistant.
	//==================================================
var parcelAXLId = 7;
var parcelPrintKeyField = "SBL";
var parcelSBLField = 'PIN';
var parcelSwissField = "SWISCODE"


//==================================================
//Custom Legend Settings. Group Name , open or close, layer Id's
//==================================================
function  buildLegend()
{
	//example: myToc.addGroup('Group Name',showColapased ?,LayerID1, LayerID2, LayerID3...);	
	//myToc.addGroup('Base Data',true,7,6,5,4,3,2,1,0,8);	
	//myToc.addGroup('Aerial Photos',true,100,101);	
	
	myToc.addMultiImage(6,'6.gif|')
	myToc.addMultiImage(141,'141.gif|')
	//myToc.addGroup('Base Data',true,9,13,10,12,7,8);
	myToc.addGroup('Base Data',true,0,3,9,13,10,12,7);
	myToc.addGroup('Environmental',true,8,4,5,15,11,14,28,31,30,22,1,35,38,39);
	myToc.addGroup('Planning',false,36,34,33,32,29,27,25,141);
	myToc.addGroup('Recreational',false,37,24,23,26,17,21,16,18,20,19);
	myToc.addGroup('Districts',false,6,140);	
	myToc.addGroup('Orthoimagery',false,2);	
	
	
}

//==================================================
//Custom Theme Settings.
//==================================================
function  buildThemes()
{
	
	//Add themes below.
	//myTheme.Add("A Theme Name",LayerID1,LayerID2,LayerID3...);	
	//A 'Default' Theme MUST be created!!!
	myTheme.Add("County",1,2);	
	myTheme.Add("Planning",1,2,3);	
	myTheme.Add("Police",2,3);
	myTheme.Add("GIS",4,5);
	
	//finish themes and build (DO NOT MODIFY)
	myTheme.toc = myToc;
	myTheme.themeDiv = "themes";
	//myTheme.buildThemeList();
}



//==================================================
// HyperLink Set up (for HyperLinked Drill downs)
//==================================================
//myHyperLinks.Add(forToolName,layerId,fieldName,prefix,LinkTypeextension)

//myHyperLinks.Add("roadDedications",18,"LINKFILE","hyperlinks/RoadDedications/",".pdf");
//myHyperLinks.Add("CofO",0,"COFOFILE","hyperlinks/CofO/",".pdf");


//==================================================
// Zoom 2 Infomration
//==================================================
var myZoomTo = new IZoomTo();
	myZoomTo.useZoomTo = true;
	myZoomTo.layerId = 0;
	myZoomTo.fieldName = "MUNI";



//==================================================
//Coordinate System
//==================================================
//un-Comment the proper NY Coord system.
var coordSystem =102716; // NAD_1983_StatePlane_New_York_Central_FIPS_3102_Feet  	//Nad 27 East = 32015
//var coordSystem =102715; // NAD_1983_StatePlane_New_York_East_FIPS_3101_Feet  	//Nad 27 Central =32016
//var coordSystem =102717; // NAD_1983_StatePlane_New_York_West_FIPS_3103_Feet  		// NAD 27 West = 32017


//==================================================
// Mail Merge Information 
//==================================================
var myMailMerge = new IMailMerge();
	myMailMerge.layerId	= parcelAXLId;	//What layer will the mail merge collection be buffering (usually Parcels)
	myMailMerge.state   = "New York";
	myMailMerge.fields  = "OWNER1 ADDNUM ADDNAME CITY ZIP";


//==================================================
// Zoom 2 Scale Define. 
//==================================================
// What are the scales you would like to see in the drop down. (ADD AS MANY AS YOU WANT)
// This is not sorted automatically. it is outputted as you see below.
var zoom2ScaleArray = new Array();
	zoom2ScaleArray.push(250000);
	zoom2ScaleArray.push(150000);
	zoom2ScaleArray.push(100000);
	zoom2ScaleArray.push(50000);
	zoom2ScaleArray.push(10000);
	zoom2ScaleArray.push(5000);
	zoom2ScaleArray.push(1000);
	zoom2ScaleArray.push(500);



//==================================================
// PARCEL SEARCH Information
// ArrayName["Sub Title seen on screen"].properties
// SDE PATH IS REQUIRED IF USING SDE
//==================================================
var myParcelSearches = new Array();
	
	parcelSDEPath = ""

	myParcelSearches["Address"] = new ISubSearch();
	myParcelSearches["Address"].firstField = parcelSDEPath + "LOC_ST_NBR";
	myParcelSearches["Address"].firstFieldTitle = "Street No.";
	myParcelSearches["Address"].firstFieldLength = 5;
	myParcelSearches["Address"].firstFieldSuggest = false;
		
	//Second Field For address search
	myParcelSearches["Address"].secondField = parcelSDEPath + "MAIL_ST_RT";
	myParcelSearches["Address"].secondFieldTitle = "Street:";
	myParcelSearches["Address"].secondFieldLength = 20;
	myParcelSearches["Address"].secondFieldSuggest = false;
	
	myParcelSearches["Print Key"] = new ISubSearch();
	myParcelSearches["Print Key"].firstField = parcelSDEPath + "PRINT_KEY";
	myParcelSearches["Print Key"].firstFieldTitle = "Print&nbsp;Key:";
	myParcelSearches["Print Key"].firstFieldLength = 20;
	myParcelSearches["Print Key"].firstFieldSuggest = false;
	
	myParcelSearches["Owner Name"] = new ISubSearch();
	myParcelSearches["Owner Name"].firstField = parcelSDEPath + "OWNER_NAME";
	myParcelSearches["Owner Name"].firstFieldTitle = "Last&nbsp;Name:";
	myParcelSearches["Owner Name"].firstFieldLength = 20;
	myParcelSearches["Owner Name"].firstFieldSuggest = false;
	
	myParcelSearches["SBL"] = new ISubSearch();
	myParcelSearches["SBL"].firstField = parcelSDEPath + "PIN";
	myParcelSearches["SBL"].firstFieldTitle = "SBL:";
	myParcelSearches["SBL"].firstFieldLength = 20;
	myParcelSearches["SBL"].firstFieldSuggest = false;


//Create a ParcelSearch and append values.
var parcelSearch = new ISearch();
	parcelSearch.layerId = parcelAXLId; // replaces the manual edit. this is a know ID we use al over
	parcelSearch.subSearch = myParcelSearches;



//==================================================
//	STREET SEARCH Information
// ArrayName["Sub Title seen on screen"].properties
//==================================================
var myStreetSearches = new Array();

	streetSDEPath = ""

	myStreetSearches["Street Name"] = new ISubSearch();
	myStreetSearches["Street Name"].firstField = streetSDEPath + "FULLSTNAME";
	myStreetSearches["Street Name"].firstFieldTitle = "Street&nbsp;Name:";
	myStreetSearches["Street Name"].firstFieldLength = 20;
	myStreetSearches["Street Name"].firstFieldSuggest = false;


//Create a ParcelSearch and append values.
var streetSearch = new ISearch();
	streetSearch.layerId = 10;
	streetSearch.subSearch = myStreetSearches;











//*******************************************************************************************************\\
//*******************************************************************************************************\\
//*******************************************************************************************************\\
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ [ OTHER SETTINGS -> Usually will not editing ] -+-+-+-+-+-+-+-+-+-+-+-+\\
//*******************************************************************************************************\\
//*******************************************************************************************************\\
//*******************************************************************************************************\\

//Link to proserver prperty (example below)
//http://www.oarsystem.com/ny/geneseecounty/subject.asp?imslink=1&swis=180200&sbl=0840730001040000
var proServerUrl ="http://64.179.107.208/oars/clients/ny/boston/subject.asp?imslink=1";

//==================================================
//Proserve Comparables swis Code
//This sbould ONLY be true if no Swis Code is in Parcels.
//==================================================
var useHardCodeSwisCode = true;
var hardCodeSwisCode = "142600";
//==================================================




//domain of what page we are on. (possibly change if "https" and not "http"
var server = "http://"+document.domain

//==================================================
//The path to the root of the appliactions main page (default.htm);
var appPath = "http://"+document.domain+parseURLPath();

//The scale bar untis.
var ScaleBarUnits = "FEET";

//Additional Info URL
var additionalInfoURL = "Details/Default.aspx";

//Pictometry Info.
var pictometryURL = "parcelView.aspx?TabIndex=1&";

//Path info to image directories.
var imagePath = appPath + "/images";
var iconPath = imagePath + "/icons";
var legendImagePath = imagePath + "/legendImages";

//path to tool Bar Images
var toolsPath = iconPath +"/toolBarImages";

//Path to mail merge Files and delimeter.
var mailMergeFilePath = "MailMerge"
var mailSeperator =","; // use a comma because of the CSV file.






//==================================================================================================
// Special URL Parse Function (beta) has not been tested in all environments and browsers.
//==================================================================================================
// Tested On: IE 7 and FF 2.0
//==================================================

function parseURLPath()
{
	var newUrl;;
	var url=document.location.pathname;
	var dot = url.lastIndexOf('.');
	var ext = url.lastIndexOf("\/");
	if (dot != -1)
	{
		newUrl = url.substr(0,ext);
	} 
	else if (ext != url.length-1) 
	{ 
		newUrl = url.substr(0,url.length); 
	}
	else
	{
		newUrl = url.substr(0,url.length-1); 
	}
	return newUrl;
}
