// JavaScript Document
/*The following code is copyrighted and patented, 2012, Cheryl Parker, The Urban Explorer, Inc, All rights reserved.  Written permission required for re-use of code*/
var dbVer = "0112";
var corTable = "";
var corField = "";
var selLayerNo = "";
var selectedVarValue = "";
var selectedVarName = "";
var selRdoDD = "rdoAdvSrch";
var plLB2_ = "";
var bizLB4idx = "";
var rlow = "";
var rhigh = "";
var ExportTitle = "Output from EconoVue ";
var listingType = "Business Listings";
var dnbYear = "2012";
var dnbMonth = "October";
var DataSourceDnB = "Dun & Bradstreet";
var url_DnB = "www.dnb.com";
var PrintMapMsg = "";
var DataSourceCCI = "Green SIC Classification: Center for Community Innovation, UCB, http://communityinnovation.berkeley.edu/reports/cci-ucb_innovating-green-econ-ca-regions_2010.pdf";

//var IndustrySectors_DD = new Array("Industry Sector","All Sectors","Administrative and Support Services","Agriculture, Forestry, Fishing, Hunting","Arts, Entertainment, Recreation, Fitness","Bioscience","Clean and Green","Construction","Eating and Drinking","Educational Services","Finance","Health Care","Hotels and Accommodations","Information-Based Industries","Insurance Carriers and Related Activities","Legal Services","Manufacturing","Management of Companies","Mining","Professional Services","Real Estate","Rental and Leasing Services","Retail Stores","Services","Transportation","Utilities","Warehousing and Delivery","Waste Management and Remediation","Wholesale");

//var IndustrySectors_DD = new Array("Industry Sector","All Sectors","Administrative and Support Services","Agriculture, Forestry, Fishing, Hunting","Arts, Entertainment, Recreation, Fitness","Bioscience","Clean and Green","Construction","Eating and Drinking","Public Admin and Education","Finance","Health Care","Hotels and Accommodations","Information-based Industries","Insurance Carriers and Related Activities","Legal Services","Manufacturing","Mgmnt of Companies and Enterprises","Mining","Professional Services","Real Estate","Rental and Leasing Services","Retail Stores","Services","Transportation","Utilities","Warehousing and Delivery","Waste Management and Remediation","Wholesale");"Industry Sector",

var IndustrySectors_DD = new Array("Industry Sector","All Sectors","Administrative and Support Services","Agriculture, Forestry, Fishing, Hunting","Arts, Entertainment, Recreation, Fitness","Bioscience","Clean and Green","Construction","Eating and Drinking","Finance","Health Care","Hotels and Accommodations","Information-Based Industries","Insurance Carriers and Related Activities","Legal Services","Manufacturing","Management of Companies","Mining","Professional Services","Public Admin and Education","Real Estate","Rental and Leasing Services","Retail Stores","Services","Transportation","Utilities","Warehousing and Delivery","Waste Management and Remediation","Wholesale");

var NETSIndAry = new Array("4000_","4001_","4002_","4003_","4004_","4005_","4006_","4007_","4008_","4009_","4010_","4011_","4012_","4013_","4014_","4015_","4016_","4017_","4018_","4019_","4020_","4021_","4022_","4023_","4024_","4025_","4026_","4027_");

var subSectors_DD = new Array(IndustrySectors_DD.length-1);
var corTables_DD = new Array("corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_bio","corSIC_green","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb","corNaics_dnb");
var corField_DD = new Array("PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimarySIC","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics","PrimaryNaics");

var clusNoKey_DD = new Array(0,1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17,7,18,19,20,21,22,23,24,25,26,27);

//"Admin and Support:" 
subSectors_DD[0] = new Array("Select Subsector","-1","Business Support Services","GROUPCODE_ = '58'","Employment Services","GROUPCODE_ = '57'","Facilities Support Services","GROUPCODE_ = '56'","Investigation and Security","GROUPCODE_ = '60'","Office Administrative Services","GROUPCODE_ = '55'","Other Support Services","GROUPCODE_ = '62'","Services to Buildings","GROUPCODE_ = '61'","Travel and Reservation","GROUPCODE_ = '59'");
//"Agriculture, Forestry, Fishing, Hunting"
subSectors_DD[1] = new Array("Agriculture, Forestry, Fishing, Hunting","GROUPCODE_ = '0'");
//"Arts,Entertainment:
subSectors_DD[2] = new Array("All Arts and Entertainment Venues","GROUPCODE_ = '71' OR GROUPCODE_ = '180' OR GROUPCODE_ = '181' OR GROUPCODE_ = '177' OR GROUPCODE_ = '70' OR GROUPCODE_ = '69'","Amusement Parks and Venues","GROUPCODE_ = '71'","Fitness and Recreation Facilities","GROUPCODE_ = '180'","Gambling and Gaming Venues","GROUPCODE_ = '181'","Motion Picture Theaters","GROUPCODE_ = '177'","Museums,Historical Sites","GROUPCODE_ = '70'","Performing Arts,Spectator Sports","GROUPCODE_ = '69'");
//"Bioscience":
subSectors_DD[3] = new Array("All Bioscience Companies","GROUPCODE_ = '1001' OR GROUPCODE_ = '1002' OR GROUPCODE_ = '1003' OR GROUPCODE_ = '1004'","Agricultural Feedstock and Chemicals","GROUPCODE_ = '1001'","Drugs and Pharmaceuticals","GROUPCODE_ = '1002'","Medical Devices and Equipment","GROUPCODE_ = '1003'","Research, Testing and Medical Labs","GROUPCODE_ = '1004'");
//Clean and Green:
subSectors_DD[4] = new Array("All Clean and Green Companies","GROUPCODE_ = '2001' OR GROUPCODE_ = '2002' OR GROUPCODE_ = '2003' OR GROUPCODE_ = '2004' OR GROUPCODE_ = '2005' OR GROUPCODE_ = '2006'","Energy Research and Services","GROUPCODE_ = '2001'","Environmental Services","GROUPCODE_ = '2002'","Green Building","GROUPCODE_ = '2003'","Green Manufacturing","GROUPCODE_ = '2004'","Green Transportation","GROUPCODE_ = '2005'","Recycling/Remediation","GROUPCODE_ = '2006'");
//Construction","GROUPCODE_ = '3'":
subSectors_DD[5] = new Array("Select Subsector","-1","Building Construction: Non-Residential","GROUPCODE_ = '79'","Building Construction: Residential","GROUPCODE_ = '80'","Infrastructure Construction","GROUPCODE_ = '81'","Contractors: Building Equipment","GROUPCODE_ = '82'","Contractors: Building Exterior","GROUPCODE_ = '83'","Contractors: Building Finishing","GROUPCODE_ = '84'","Contractors: Specialty Trade","GROUPCODE_ = '85'");
//Drinking places,alcoholic beverages,"Restaurants":
subSectors_DD[6] = new Array("Select Subsector","-1","Caterers/Mobile Food Services","GROUPCODE_ = '96'","Drinking Places (Alcoholic)","GROUPCODE_ = '97'","Restaurants: Full Service","GROUPCODE_ = '98'","Restaurants: Limited Service","GROUPCODE_ = '99'");
//"Finance"
subSectors_DD[7] = new Array("Select Subsector","-1","Credit and Related Activities","GROUPCODE_ = '38'","Funds,Trusts,and Other","GROUPCODE_ = '40'","Securities,Commodities,Investments","GROUPCODE_ = '39'");//"All Finance Companies","GROUPCODE_ = '38' OR GROUPCODE_ = '40' OR GROUPCODE_ = '39'",
//Health Care
subSectors_DD[8] = new Array("Select Subsector","-1","Ambulatory Health Care","GROUPCODE_ = '65'","Hospitals","GROUPCODE_ = '66'","Nursing and Residential Care","GROUPCODE_ = '67'","Social Assistance","GROUPCODE_ = '68'");//"All Health Care Venues","GROUPCODE_ = '65' OR GROUPCODE_ = '66' OR GROUPCODE_ = '67' OR GROUPCODE_ = '68'",
//"Hotels and Accommodations":
subSectors_DD[9] = new Array("All Hotels and Accommodations","GROUPCODE_ = '93' OR GROUPCODE_ = '94' OR GROUPCODE_ = '95'","Hotels and Traveler Accomodations","GROUPCODE_ = '93'","Rooming and Boarding Houses","GROUPCODE_ = '94'","Trailer Parks and Campsites","GROUPCODE_ = '95'");
//"Information":
subSectors_DD[10] = new Array("Select Subsector","-1","Broadcasting (except Internet)","GROUPCODE_ = '34'","ISPs,Web Portals,Data Processing","GROUPCODE_ = '36'","Motion Picture Post Production","GROUPCODE_ = '178'","Motion Picture and Video Distribution","GROUPCODE_ = '176'","Motion Picture and Video Production","GROUPCODE_ = '175'","Other Information Industries","GROUPCODE_ = '37'","Print Publishing Industries","GROUPCODE_ = '32'","Sound Recording Industries","GROUPCODE_ = '179'","Telecommunications","GROUPCODE_ = '35'");
//Insurance:
subSectors_DD[11] = new Array("Insurance Carriers and Related Activities","GROUPCODE_ = '41'");
//"Legal services"
subSectors_DD[12] = new Array("Legal services","GROUPCODE_ = '45'");
//Manufacturing:
subSectors_DD[13] = new Array("Select Subsector","-1","Computer,Electrical Equipment,Components","GROUPCODE_ = '12'","Food & Beverage","GROUPCODE_ = '4'","Furniture & Related Products","GROUPCODE_ = '14'","Machinery","GROUPCODE_ = '11'","Metals","GROUPCODE_ = '10'","Mineral Products","GROUPCODE_ = '9'","Misc","GROUPCODE_ = '15'","Petroleum,Chemicals,Plastics,Rubber","GROUPCODE_ = '8'","Printing & Related Support Activities","GROUPCODE_ = '7'","Textile & Apparel","GROUPCODE_ = '5'","Transportation Equipment","GROUPCODE_ = '13'","Wood & Paper","GROUPCODE_ = '6'");
//"Mgmnt of Companies and Enterprises "
subSectors_DD[14] = new Array("Mgmnt of Companies and Enterprises ","GROUPCODE_ = '54'");
//"Mining","GROUPCODE_ = '1'",
subSectors_DD[15] = new Array("Mining","GROUPCODE_ = '2'");
//"Professional Services:
subSectors_DD[16] = new Array("Select Subsector","-1","Accounting and Bookkeeping","GROUPCODE_ = '46'","Advertising","GROUPCODE_ = '52'","Architecture and Engineering","GROUPCODE_ = '47'","Computer Systems Design","GROUPCODE_ = '49'","Mgmnt and Technical Consulting","GROUPCODE_ = '50'","Other Services","GROUPCODE_ = '53'","Scientific Research and Development","GROUPCODE_ = '51'","Specialized Design","GROUPCODE_ = '48'");
//Pub Admin:
subSectors_DD[17] = new Array("Select Subsector","-1","Public Administration","GROUPCODE_ = '92'","Schools: Colleges, Universities","GROUPCODE_ = '87'","Schools: Elementary and Secondary","GROUPCODE_ = '88'","Schools: Junior Colleges","GROUPCODE_ = '89'","Schools: Technical and Trade","GROUPCODE_ = '90'","Schools: Misc Instruction","GROUPCODE_ = '91'","Training: Business and Professional","GROUPCODE_ = '86'");
//"Real Estate","GROUPCODE_ = '42'",
subSectors_DD[18] = new Array("Select Subsector","-1","Lessors of Real Estate","GROUPCODE_ = '100'","Property Managers and Appraisers","GROUPCODE_ = '101'","Real Estate Agents and Brokers","GROUPCODE_ = '102'");//"All Real Estate Companies","GROUPCODE_ = '100' OR GROUPCODE_ = '101' OR GROUPCODE_ = '102'",
//"Rental and Leasing Services","GROUPCODE_ = '43'",
subSectors_DD[19] = new Array("All Rental and Leasing Services","GROUPCODE_ = '103' OR GROUPCODE_ = '104' OR GROUPCODE_ = '105' OR GROUPCODE_ = '106' OR GROUPCODE_ = '107'","Consumer Goods Rental","GROUPCODE_ = '103'","General Rental Centers","GROUPCODE_ = '104'","Lessors of Intangible Assets","GROUPCODE_ = '105'","Machinery and Equipment Rental","GROUPCODE_ = '106'","Vehicle Rental","GROUPCODE_ = '107'");
//Retail
subSectors_DD[20] = new Array("Select Subsector","-1","Bldg Matl and Garden Equip","GROUPCODE_ = '21'","Clothing and Clothing Accessories Stores","GROUPCODE_ = '25'","Electronics and Appliance Stores","GROUPCODE_ = '20'","Food and Beverage Stores","GROUPCODE_ = '22'","Furniture and Home Furnishings Stores","GROUPCODE_ = '19'","Gasoline Stations","GROUPCODE_ = '24'","General Merchandise Stores","GROUPCODE_ = '27'","Health and Personal Care Stores","GROUPCODE_ = '23'","Miscellaneous Store Retailers","GROUPCODE_ = '28'","Motor Vehicle and Parts Dealers","GROUPCODE_ = '18'","Nonstore Retailers","GROUPCODE_ = '29'","Sporting Goods,Hobby,Book,and Music","GROUPCODE_ = '26'");
//"Services: 
subSectors_DD[21] = new Array("Select Subsector","-1","Civic and Social Organizations","GROUPCODE_ = '114'","Funerals and Cemetaries","GROUPCODE_ = '109'","Grantmaking and Voluntary Organizations","GROUPCODE_ = '112'","Laundry and Drycleaning","GROUPCODE_ = '110'","Other Personal Services","GROUPCODE_ = '174'","Parking Lots and Garages","GROUPCODE_ = '173'","Personal Care Services","GROUPCODE_ = '108'","Pet Care Services","GROUPCODE_ = '171'",
"Photofinishing Laboratories","GROUPCODE_ = '172'","Professional, Labor and Political Organizations","GROUPCODE_ = '115'","Religious Organizations","GROUPCODE_ = '111'","Repair Services: Automotive","GROUPCODE_ = '167'","Repair Services: Electronics & Computers","GROUPCODE_ = '168'","Repair Services: Machinery & Equipment","GROUPCODE_ = '169'","Repair Services: Home & Garden Equipment","GROUPCODE_ = '170'","Social Advocacy Organizations","GROUPCODE_ = '113'");
//"Transportation"
subSectors_DD[22] = new Array("Select Subsector","-1","Air Transportation","GROUPCODE_ = '116'","Air Transportation Support Services","GROUPCODE_ = '117'","Buses: School, Employee, Charter","GROUPCODE_ = '118'","Freight Trucking","GROUPCODE_ = '119'","Freight Trucking Support Services","GROUPCODE_ = '120'","Misc Transportation Support Services","GROUPCODE_ = '121'","Pipeline Transportation","GROUPCODE_ = '122'","Port Activities","GROUPCODE_ = '123'","Rail Transportation","GROUPCODE_ = '124'","Rail Transportation Support Services","GROUPCODE_ = '125'","Road Transportation Support Services","GROUPCODE_ = '126'","Scenic/Sightseeing Transportation","GROUPCODE_ = '127'","Special Needs Transportation","GROUPCODE_ = '128'","Taxi Services","GROUPCODE_ = '129'","Urban Transit/Shuttles","GROUPCODE_ = '130'","Water Transportation","GROUPCODE_ = '131'");
//"Utilities":
subSectors_DD[23] = new Array("All Utilties","GROUPCODE_ = '132' OR GROUPCODE_ = '133' OR GROUPCODE_ = '134'","Electric Power","GROUPCODE_ = '132'","Natural Gas","GROUPCODE_ = '133'","Water: Supply, Irrigation, Sewage","GROUPCODE_ = '134'");
//"Warehousing",
subSectors_DD[24] = new Array("All Warehousing and Delivery Services","GROUPCODE_ = '135' OR GROUPCODE_ = '136' OR GROUPCODE_ = '137'","Couriers and Messengers","GROUPCODE_ = '135'","Postal Service","GROUPCODE_ = '136'","Warehousing and Storage","GROUPCODE_ = '137'");
//"Waste Mgmt and Remediation Service"
subSectors_DD[25] = new Array("All Waste and Remediation Services","GROUPCODE_ = '138' OR GROUPCODE_ = '139' OR GROUPCODE_ = '140'","Remediation Services","GROUPCODE_ = '138'","Solid Waste Collection","GROUPCODE_ = '139'","Solid Waste Treatment and Disposal","GROUPCODE_ = '140'");
//"Wholesale:",
subSectors_DD[26] = new Array("Select Subsector","-1","Durable Goods: Automobile-Related","GROUPCODE_ = '141'","Durable Goods: Construction Materials","GROUPCODE_ = '143'","Durable Goods: Electronics","GROUPCODE_ = '146'","Durable Goods: Equipment: Commercial/Professional","GROUPCODE_ = '144'","Durable Goods: Equipment: Transportation","GROUPCODE_ = '148'","Durable Goods: Home Furnishings","GROUPCODE_ = '142'","Durable Goods: Jewelry, Watch, Precious Stone","GROUPCODE_ = '152'","Durable Goods: Metals and Minerals","GROUPCODE_ = '145'","Durable Goods: Misc. Durable Goods","GROUPCODE_ = '151'","Durable Goods: Plumbing, HVAC","GROUPCODE_ = '147'","Durable Goods: Sporting and Recreation Goods","GROUPCODE_ = '149'","Durable Goods: Toys and Hobbies","GROUPCODE_ = '150'","Non-Durable Goods: Beer, Ale and Wine","GROUPCODE_ = '159'","Non-Durable Goods: Books, Periodicals, Newspapers","GROUPCODE_ = '161'","Non-Durable Goods: Chemicals and Plastics","GROUPCODE_ = '158'","Non-Durable Goods: Clothing","GROUPCODE_ = '155'","Non-Durable Goods: Drugs and Druggist Sundries","GROUPCODE_ = '154'","Non-Durable Goods: Farm Supplies","GROUPCODE_ = '160'","Non-Durable Goods: Flowers, Nursery Stock","GROUPCODE_ = '162'","Non-Durable Goods: Grocery and Food Products","GROUPCODE_ = '156'","Non-Durable Goods: Misc. Non-Durable Goods","GROUPCODE_ = '165'","Non-Durable Goods: Paint, Varnish, etc","GROUPCODE_ = '164'","Non-Durable Goods: Printing and Paper","GROUPCODE_ = '153'","Non-Durable Goods: Raw Farm Products","GROUPCODE_ = '157'","Non-Durable Goods: Tobacco","GROUPCODE_ = '163'","Wholesale Agents and Brokers","GROUPCODE_ = '166'");//"All Durable Goods","GROUPCODE_ = '141' OR GROUPCODE_

var aryIndustryAll = new Array(0,"All Administrative and Support Services","GROUPCODE_ = '58' OR GROUPCODE_ = '57' OR GROUPCODE_ = '56' OR GROUPCODE_ = '60' OR GROUPCODE_ = '55' OR GROUPCODE_ = '62' OR GROUPCODE_ = '61' OR GROUPCODE_ = '59'",5,"All Construction Companies","GROUPCODE_ = '79' OR GROUPCODE_ = '80' OR GROUPCODE_ = '81' OR GROUPCODE_ = '82' OR GROUPCODE_ = '83' OR GROUPCODE_ = '84' OR GROUPCODE_ = '85'",6,"All Eating and Drinking Establishments","GROUPCODE_ = '96' OR GROUPCODE_ = '97' OR GROUPCODE_ = '98' OR GROUPCODE_ = '99'",7,"All Finance Companies","GROUPCODE_ = '38' OR GROUPCODE_ = '40' OR GROUPCODE_ = '39'",8,"All Health Care Venues","GROUPCODE_ = '65' OR GROUPCODE_ = '66' OR GROUPCODE_ = '67' OR GROUPCODE_ = '68'",10,"All Information-Based Industries","GROUPCODE_ = '34' OR GROUPCODE_ = '36' OR GROUPCODE_ = '178' OR GROUPCODE_ = '176' OR GROUPCODE_ = '175' OR GROUPCODE_ = '37' OR GROUPCODE_ = '32' OR GROUPCODE_ = '179' OR GROUPCODE_ = '35'",13,"All Manufacturing Companies","GROUPCODE_ = '12' OR GROUPCODE_ = '4' OR GROUPCODE_ = '14' OR GROUPCODE_ = '11' OR GROUPCODE_ = '10' OR GROUPCODE_ = '9' OR GROUPCODE_ = '15' OR GROUPCODE_ = '8' OR GROUPCODE_ = '7' OR GROUPCODE_ = '5' OR GROUPCODE_ = '13' OR GROUPCODE_ = '6'",16,"All Professional Services","GROUPCODE_ = '46' OR GROUPCODE_ = '52' OR GROUPCODE_ = '47' OR GROUPCODE_ = '49' OR GROUPCODE_ = '50' OR GROUPCODE_ = '53' OR GROUPCODE_ = '51' OR GROUPCODE_ = '48'",17,"All Public Admin and Education","GROUPCODE_ = '87' OR GROUPCODE = '88' OR GROUPCODE = '89' OR GROUPCODE = '90' OR GROUPCODE = '91' OR GROUPCODE = '92' OR GROUPCODE = '86'",18,"All Real Estate Companies","GROUPCODE_ = '100' OR GROUPCODE_ = '101' OR GROUPCODE_ = '102'",20,"All Retail Stores","GROUPCODE_ = '21' OR GROUPCODE_ = '25' OR GROUPCODE_ = '20' OR GROUPCODE_ = '22' OR GROUPCODE_ = '19' OR GROUPCODE_ = '24' OR GROUPCODE_ = '27' OR GROUPCODE_ = '23' OR GROUPCODE_ = '28' OR GROUPCODE_ = '18' OR GROUPCODE_ = '29' OR GROUPCODE_ = '26'",21,"All Services","GROUPCODE_ = '114' OR GROUPCODE_ = '109' OR GROUPCODE_ = '112' OR GROUPCODE_ = '110' OR GROUPCODE_ = '174' OR GROUPCODE_ = '173' OR GROUPCODE_ = '108' OR GROUPCODE_ = '171' OR GROUPCODE_ = '172' OR GROUPCODE_ = '115' OR GROUPCODE_ = '111' OR GROUPCODE_ = '167' OR GROUPCODE_ = '168' OR GROUPCODE_ = '169' OR GROUPCODE_ = '170' OR GROUPCODE_ = '113'",22,"All Transportation Companies","GROUPCODE_ = '116' OR GROUPCODE_ = '117' OR GROUPCODE_ = '118' OR GROUPCODE_ = '119' OR GROUPCODE_ = '120' OR GROUPCODE_ = '121' OR GROUPCODE_ = '122' OR GROUPCODE_ = '123' OR GROUPCODE_ = '124' OR GROUPCODE_ = '125' OR GROUPCODE_ = '126' OR GROUPCODE_ = '127' OR GROUPCODE_ = '128' OR GROUPCODE_ = '129' OR GROUPCODE_ = '130' OR GROUPCODE_ = '131'",26,"All Wholesale Companies","GROUPCODE_ = '141' OR GROUPCODE_ = '143' OR GROUPCODE_ = '146' OR GROUPCODE_ = '144' OR GROUPCODE_ = '152' OR GROUPCODE_ = '145' OR GROUPCODE_ = '151' OR GROUPCODE_ = '147' OR GROUPCODE_ = '149' OR GROUPCODE_ = '150' OR GROUPCODE_ = '159' OR GROUPCODE_ = '161' OR GROUPCODE_ = '158' OR GROUPCODE_ = '155' OR GROUPCODE_ = '154' OR GROUPCODE_ = '160' OR GROUPCODE_ = '162' OR GROUPCODE_ = '156' OR GROUPCODE_ = '165' OR GROUPCODE_ = '164' OR GROUPCODE_ = '153' OR GROUPCODE_ = '157' OR GROUPCODE_ = '163' OR GROUPCODE_ = '166'");

corTable = corTables_DD[0];
corField = corField_DD[0];

function addOption_list(type)
{
	var selectbox;
	var type_;var sfx;
	if(type == '')
	{
		type_ = "Select";
		sfx = '';
	}
	else
	{
		type_ = type;
		sfx = 's';
	}
	if(document.getElementById("sector") !== undefined)
	{
		selectbox = document.getElementById("sector");
	
		for (var j=0;j<IndustrySectors_DD.length;j++)
		{
			if(j !== 1)
			{
				if(j == 0)
				{
					addOption(selectbox, type_+" "+IndustrySectors_DD[j]+sfx, IndustrySectors_DD[j]);
				}
				else
				{
					addOption(selectbox, IndustrySectors_DD[j], IndustrySectors_DD[j]);
				}
			}
		}
	}
	if(document.getElementById("bizFrame") !== null)
	{
		document.getElementById("bizFrame").src = "blank.html";
	}
	if(document.getElementById("netsFrame") !== null)
	{
		document.getElementById("netsFrame").src = "blank.html";
	}
}
function addOption(selectbox,text,value )
{
	var optn = document.createElement("option");
	optn.text = text;
	optn.value = value;
	if(selectbox !== null)
	{
		if(navigator.appName == "Microsoft Internet Explorer")
		{
			selectbox.options.add(optn);
		}
		else
		{
			selectbox.appendChild(optn);
		}
	}
}
///////////////////////////////////////////
/*function getSubSectorIDX(subsectorcode,sectorcode)
{
	var lb2;
	var lb4;
	//alert("subsectorcode = "+subsectorcode);
	//alert("sectorcode = "+sectorcode);
	for(var lk=0;lk<clusNoKey.length;lk++)
	{
		if(clusNoKey[lk] == sectorcode)
		{
			lb2 = Number(lk);
			//alert("lb2 = "+lb2);
			break;
		}
	}
	//alert(subSectors_EE[lb2].length);
	for(var lj=1;lj<subSectors_EE[lb2].length;lj+=2)//subSectors_EE[3] = new Array(1,1001,1,1002,1,1003,1,1004,2,1001,3,1002,4,1003,5,1004);
	{
		if(subSectors_EE[lb2][lj] == subsectorcode)
		{
			lb4 = subSectors_EE[lb2][lj-1];
			//alert("lb4 = "+lb4);
			break;
		}
	}
	return lb4;
}*/
////////////////////////////////////
function chLBInfoDisplayList2()
{
	document.getElementById("bizFrame").src = "blank.html";
	removeAllOptions(document.getElementById("subsector"));
	document.getElementById("subsector").style["visibility"] = "visible";
	var idx = Number(document.getElementById("sector").selectedIndex-1);
	//idx = clusNoKey_DD[idx];
	//alert("idx = "+idx);
	//alert("clusNoKey_DD[idx] = "+clusNoKey_DD[idx]);
	plLB2_ = clusNoKey_DD[idx]+1;//Number(idx +2);
	//alert("plLB2_ = "+plLB2_);
	if(idx == -1)
	{
		corTable = corTables_DD[0];
		corField = corField_DD[0];
	}
	else
	{
		corTable = corTables_DD[idx];
		corField = corField_DD[idx];
	}
	clusterNo = String(idx);
	if(idx == 3)
	{
		NETSthemTT = "bio";
		NETSpfx = 4000;
	}
	else if(idx == 4)
	{
		NETSthemTT = "grn";
		NETSpfx = 4000;
	}
	else
	{
		NETSthemTT = "clus";
		NETSpfx = 4000;
		if(idx == -1)
		{
			clusterNo = "27";
		}
	}	
	for(var z = 0; z<subSectors_DD[idx].length;z+=2)
	{
		addOption(document.getElementById("subsector"), subSectors_DD[idx][z], subSectors_DD[idx][z+1]);
	}
	for(var u=0;u<aryIndustryAll.length;u+=3)
	{
		if(idx == aryIndustryAll[u])
		{
			document.getElementById("subsector").options[0]=new Option(aryIndustryAll[u+1], aryIndustryAll[u+2], true, false)
		}
	}		
	document.getElementById("subsector").selectedIndex = 0;
}
function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		selectbox.remove(i);
	}
}
function checkLoc()
{
	var checkIt = false;
	var loc = document.getElementById("city").value;

	for(var q=1;q<AryZip.length;q+=2)
	{
		if(loc == AryZip[q])
		{
			checkIt = true;
			break;
		}
	}
	if(checkIt == true)
	{
		if((selRdoDD == "rdoAdvSrch")&&(document.getElementById("sector").selectedIndex == 0)&&(document.getElementById("subsector").style["visibility"] == "hidden"))
		{
			alert("Please select an industry sector.");
			return;
		}
		else
		{
			setUpBizListDD();
		}
	}
	else
	{
		document.getElementById("bizFrame").src = "blank.html";
		if(document.getElementById("sector").selectedIndex !== 0)
		{
			document.getElementById("sector").selectedIndex = 0;
		}
		if(document.getElementById("subsector").style["visibility"] == "visible")
		{
			document.getElementById("subsector").style["visibility"] = "hidden";
		}		
		alert("Please enter a City or Zip Code in California.  Use the dropdown list as a guide.");
		return;
	}
}
function setUpBizListDD()
{
	var arySECTOR = Array();
	var varValMC = Array();
	var varNameMC = Array("GROUPCODE");
	var varValPr = Array();
	var corcond;
	var dbase_;
	var tablePfx_ = "dnb";
	var table_;
	var limit = 500000;	
	var varName;
	var varVal;
	var netsvarVal;
	var corDatabse = "UtilDatabase";
	bizStmnt = "";
	var StartCount;
	plSO = "selObj"
	varVal = document.getElementById("city").value;
	rlow = "";
	rhigh = "";
	
	var firstDig = varVal.slice(0,1);
	if((firstDig == "8")||(firstDig == "9"))
	{
		varName = "ZCTA";
		selLayerNo = 12;
		selMsg = "Zip Code: "+varVal;
	}
	else
	{
		varName = "CITYNAME";
		selLayerNo = 6;
		selMsg = "City: "+varVal;//new
	}
	for(var g = 1;g<AryZip.length;g+=2)
	{
		if(varVal == AryZip[g])
		{
			FIPSSTCO = AryZip[g-1];
		}
	}
	if(selLayerNo == 6)
	{
		for(var g = 0;g<cityNameKeys.length;g+=2)
		{
			if(varVal == cityNameKeys[g])
			{
				netsvarVal = cityNameKeys[g+1];
			}
		}
	}
	else
	{
		netsvarVal = varVal;
	}
	selectedVarValue = varVal;
	selectedVarName = varName;
	dbase_ = "dnb"+dbVer+"Database_"+FIPSSTCO;
	table_ = tablePfx_+"table_26";
	bizStmnt = " AND "+dbase_+"."+table_+"."+corField+" = "+corDatabse+"."+corTable+"."+corField+"_";
	
	if(selRdoDD == "rdoSimpleSrch")
	{
		if(document.getElementById("txtBiz").value !== "")
		{
			PrintMapMsg = listingType+" where Business Type = ";
			corTable = "cornaics_dnb";
			varNameMC[0] = "Company";
			varValMC[0] = document.getElementById("txtBiz").value;
			var valString = String(varValMC[0]);
			var lastLetter = valString.length;
			var newVal;
			
			if(varValMC[0] !== "")
			{
				if(valString.slice(lastLetter-1,lastLetter) == "s")
				{
					newVal = valString.slice(0,lastLetter-1);
				}
				else
				{
					newVal = valString;
				}
				bizStmnt += " AND (("+varNameMC[0]+" like '%"+ newVal+"%') ||(PrimarySicDescription like '%"+ newVal+"%')||(PrimaryNaicsDescription like '%"+ newVal+"%')||(PrimaryNaics like '"+ newVal+"%')||(GROUPTEXT like '"+ newVal+"%'))";
				varValPr[0] = newVal;
				PrintMapMsg += varValPr[0];
			}
		}
		else
		{
			alert("Please enter a search term.");
		}
	}
	else if(selRdoDD == "rdoAdvSrch")
	{
		if(document.getElementById("subsector").style["visibility"] == "visible")
		{
			PrintMapMsg = listingType+" where Business Type = ";
			var index = document.getElementById("subsector").selectedIndex;
			var indexSect = document.getElementById("sector").selectedIndex;
			bizLB4idx = index;
			arySECTOR[0] = document.getElementById("subsector").options[index].value;
			varValPr[0] = document.getElementById("sector").options[indexSect].text+", "+document.getElementById("subsector").options[index].text;//new
			PrintMapMsg += varValPr[0];
		}
		else
		{
			PrintMapMsg = listingType+" where Business Type = ";
			arySECTOR[0] = varNameMC[0]+" <> 'dnm'";
			varValPr[0] = document.getElementById("sector").options[indexSect].text;
			PrintMapMsg += varValPr[0];
		}
		varValMC.push(arySECTOR);
			
		if(varValMC.length > 0)
		{
			for(var u = 0;u<varNameMC.length;u++)
			{
				if(u == 0)
				{
					if(varValMC[u] !== varNameMC[0]+" <> 'dnm'")
					{
						bizStmnt +=" AND ("+varValMC[u]+")";
					}
				}
				else if(varNameMC[u] == varNameMC[1])
				{
					if(varValMC[u] !== "-1")
					{
						bizStmnt +=" AND "+varValMC[u];
					}
				}
			}
		}
	}
	
	if((document.getElementById("rangelow").value !== "")&&(document.getElementById("rangehigh").value !== ""))
	{
		rlow = document.getElementById("rangelow").value;
		rhigh = document.getElementById("rangehigh").value;
		bizStmnt += " AND (EmploymentThisSite >= "+document.getElementById("rangelow").value+" AND EmploymentThisSite <= "+document.getElementById("rangehigh").value+")";
		PrintMapMsg += " AND (EmploymentThisSite >= "+document.getElementById("rangelow").value+" AND EmploymentThisSite <= "+document.getElementById("rangehigh").value+")";	}
	if(bizStmnt !== "")
	{
		var plSZ = "";
		var plMW = "";
		document.getElementById("db").value = dbVer;
		document.getElementById("fs").value = FIPSSTCO;
		document.getElementById("vn").value = varName;
		document.getElementById("vv").value = varVal;
		document.getElementById("bs").value = bizStmnt;
		document.getElementById("ct").value = corTable;
		
		document.getElementById("selLayerNo").value = selLayerNo;
		if(rlow == "")
		{
			plSZ = "";
		}
		else
		{
			plSZ = rlow+" to "+rhigh;
		}
		if(selRdoDD == "rdoSimpleSrch")
		{
			if(document.getElementById("txtBiz").value !== "")
			{
				plMW = document.getElementById("txtBiz").value;
			}
			document.getElementById("plLB2_").value = "0";
			document.getElementById("bizLB4idx").value = "0";
		}
		else if(selRdoDD == "rdoAdvSrch")
		{
			document.getElementById("plLB2_").value = plLB2_;
			document.getElementById("bizLB4idx").value = bizLB4idx;
		}
		document.getElementById("plMW").value = plMW;
		document.getElementById("plSZ").value = plSZ;
		document.getElementById("TTL0").value = ExportTitle;
		document.getElementById("TTL").value = "Search String: "+selMsg+", "+PrintMapMsg;
		document.getElementById("TTL2").value = "Data Source: "+DataSourceDnB+", "+url_DnB+", "+dnbMonth+", "+dnbYear;
	document.getElementById("netsvv").value = netsvarVal;
	document.getElementById("netsTTL").value = "Selected Area: "+varName+": "+varVal+", yr ";
	document.getElementById("netsTTL2").value = "Data Source: National Establishment Time Series Database (Dun and Bradstreet), Read more about NETS: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1022962";
	document.getElementById("netsyr").value = "2012";
		if(document.getElementById("qbsform") !== null)
		{
			document.getElementById("qbsform").submit();
		}
		else if(document.getElementById("inputform") !== null)
		{
			document.getElementById("inputform").submit();
		}
	}
	else
	{
		alert("Please enter a search term.");
		return;
	}
}
function setUpDataDispBizSrch(sel)
{
	selRdoDD = sel;
	document.getElementById("bizFrame").src = "blank.html";
	if (selRdoDD == "rdoSimpleSrch")
	{
		document.getElementById("sector").style["visibility"] = "hidden";
		document.getElementById("subsector").style["visibility"] = "hidden";
		document.getElementById("txtBiz").style["visibility"] = "visible";
		document.getElementById("txtBiz").value = "";
		corField = "PrimaryNaics";
		corTable = "cornaics_dnb";
	}
	else if(selRdoDD == "rdoAdvSrch")
	{
		document.getElementById("sector").style["visibility"] = "visible";
		document.getElementById("subsector").style["visibility"] = "hidden";
		document.getElementById("txtBiz").value = "";
		document.getElementById("txtBiz").style["visibility"] = "hidden";
		document.getElementById("sector").selectedIndex = 0;
	}
}
function fillNETS()
{
	
	varVal = document.getElementById("netscity").value;
	var varName;
	var varVal_ = varVal;
	var fieldName;
	var clus = "4027_";
	var firstDig = varVal.slice(0,1);
	if((firstDig == "8")||(firstDig == "9"))
	{
		selLayerNo = 12;
		varName = "Zip Code";
		fieldName = "ZCTA";
	}
	else
	{
		selLayerNo = 6;
		varName = "City";
		fieldName = "PLACE";
	}
	if(selLayerNo == 6)
	{
		for(var g = 0;g<cityNameKeys.length;g+=2)
		{
			if(varVal == cityNameKeys[g])
			{
				varVal = cityNameKeys[g+1];
			}
		}
	}
	document.getElementById("netsdb").value = dbVer;
	document.getElementById("netsvv").value = varVal;
	document.getElementById("netsCityVal").value = document.getElementById("netscity").value;
	document.getElementById("netsfn").value = fieldName;
	document.getElementById("netscn").value = clus;
	document.getElementById("netsln").value = selLayerNo;
	document.getElementById("netsTTL0").value = ExportTitle;
	document.getElementById("netsTTL").value = "Selected Area: "+varName+": "+varVal_+", yr ";
	document.getElementById("netsTTL2").value = "Data Source: National Establishment Time Series Database (Dun and Bradstreet), Read more about NETS: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1022962";
	document.getElementById("netsyr").value = "2012";
}
function loginForm()
{
	document.getElementById("loginform").submit();	
	document.getElementById("email").value = "";
	document.getElementById("password").value = "";
}
