  var subcat;
 //-------------------------
 // Extracts the values from the url
 //-------------------------
 function getValues()   {
	var urlEnd = document.URL.indexOf('?');
	var values = new Array();
	var names;
	if (urlEnd != -1) {
		var params = document.URL.substring(urlEnd+1, document.URL.length).split('&');
		for(i=0; i<params.length; i++)
		{
			names = params[i].split('=');
			values[names[0]] = names[1];
		}
	}
   return values;
  }

values = getValues();

	 // Define your names here
subcat = unescape(values["sc"]);

//-------------------------
// Changes Sub category List based on Category/Type (Ie, Arts, Movies, etc)  selected
//-------------------------
function chngsub() {
	var objForm;
	var vflag = 0;
//	vflag = flag;
/*	if (vflag == "Ev")
		{	objForm = document.evform; }
	else
		{ return false;		objForm = document.moform; }*/
			// Look for Form "evform"

	for(i=0;i<document.forms.length;i++) {
		if(document.forms[i].name == "evform")  vflag = 1;
	}
	if(vflag == 0) return false;			// Check for tp (type) and sc (subcategory) fields

	objForm = document.evform;
	if(!(objForm.tp)) return false;	if(objForm.tp.value == '-10' || objForm.tp.value=='20') return false;
	if(!(objForm.sc)) return false;

			//Set All for subcategory list Option

	objForm.sc.options.length=0;
	if (objForm.tp.options[objForm.tp.selectedIndex].text == "All Events") {
		objForm.sc.options[0]=new Option("All", "All", true, true);
	} else {
		objForm.sc.options[0]=new Option("All " + objForm.tp.options[objForm.tp.selectedIndex].text, "All",true,true);	}

			//Build rest of options for subcategory list based on specified Type or All Events

	var Cntr = 1;
	for(i=0; i<AE.length;i++) {
		parts = AE[i].split("|");

		if (parts[0] == objForm.tp.value || objForm.tp.options[objForm.tp.selectedIndex].text == 'All Events') {
			if (subcat == parts[2])
				{objForm.sc.options[Cntr]=new Option(parts[1],parts[2],true,true);}
			else
				{objForm.sc.options[Cntr]=new Option(parts[1],parts[2]);}
			Cntr+=1;
		}
	}	switch(objForm.tp.value)  {
		case "10" : objForm.section.value = "movies"; break;
		case "20" : objForm.section.value = "dining"; break;
		case "30" : objForm.section.value = "music"; break;
		case "40" : objForm.section.value = "arts"; break;
		case "60" : objForm.section.value = "sports"; break;
	//	case "110" : objForm.section.value = "culture"; break;

		default : objForm.section.value = "entertainment";
	 }
}


function EventSelect() {	var intOptCntr
	AE = new Array("30|Acoustic & Folk|4",
	"10|Action|1000",
	"30|Alt-Country|8",
	"30|Alternative|6",
	"10|Art/Foreign|1025",
	"40|Attractions|106",
	"40|Auditions/Calls for Entries|105",
	"80|Beer Tasting|305",
	"40|Benefits|1672",
	"50|Benefits|205",
	"30|Bluegrass/Folk/Country|9",
	"30|Blues|12",
	"40|Books & Authors|107",
	"30|Celtic|40",
	"50|Charity Events|210",
	"80|Children's Events|310",
	"30|Christian/Gospel|94",
	"70|Christmas|602",
	"50|Church Fairs & Festivals|215",
	"50|Classes & Workshops|220",
	"30|Classical/World|110",
	"40|Clubs & Organizations|223",
	"30|Clubs And Lounges|2",
	"60|College Sports|454",
	"10|Comedy|1010",
	"30|Comedy|20",
	"40|Comedy|1675",
	"30|Concerts|24",
	"50|Conferences/Seminars|225",
	"80|Cooking  Classes & Demo|340",
	"30|Country|28",
	"40|Dance|115",
	"30|Dance/DJ/Electronic|30",
	"50|Dances|230",
	"10|Documentary|1030",
	"10|Drama|1035",
	"70|Easter|603",
	"40|Events|140",
	"40|Exhibit Openings|119",
	"40|Exhibitions|120",
	"80|Fairs & Festivals|315",
	"10|Family|1020",
	"40|Festivals|124",
	"40|Films|125",
	"40|Fitness|126",
	"40|Food & Wine|240",
	"40|Free Music|127",
	"40|Galleries|130",
	"40|Gallery Hop|135",
	"70|Halloween|615",
	"40|Health|1690",
	"30|Heavy Metal|36",
	"60|High School Sports|455",
	"30|Hip Hop/Rap|68",
	"50|Hobbies|250",
	"80|Home & Garden Classes|320",
	"80|Home & Garden Tours|325",
	"10|Horror|1037",
	"30|Jazz|44",
	"70|July 4th - Fireworks|605",
	"70|July 4th - Parades/Parties|610",
	"40|Kids & Family|137",
	"30|Latin|48",
	"40|Lectures/Conferences|147",
	"50|Library|255",
	"40|Literary|145",
	"50|Meetings|260",
	"50|Misc - Community|265",
	"40|Miscellaneous - Arts|150",
	"70|Mother's Day|620",
	"40|Museums|155",
	"10|Musicals|1042",
	"60|Nature & Outdoors|440",
	"70|New Year's|625",
	"40|On Broadway|160",
	"30|Open Mic/Karaoke|51",
	"40|Opera|165",
	"30|Outdoor Music|52",
	"40|Outdoor Theater|180",
	"60|Parks & Gardens|445",
	"40|Pets|181",
	"80|Points of Interest|330",
	"60|Professional Sports|460",
	"30|Punk|88",
	"30|R&B/Soul/Funk|64",
	"30|Reggae|72",
	"50|Reunions|270",
	"30|Rock/Pop|62",
	"10|Romance|1005",
	"10|SciFi|1040",
	"50|Seniors|275",
	"50|Singles|280",
	"30|Ska|86",
	"40|Spiritual|183",
	"40|Spoken Word / Poetry|182",
	"40|Sporting Events|1713",
	"60|Sports & Fitness|450",
	"70|St. Patrick's Day|627",
	"50|Support Groups|285",
	"40|Theater|185",
	"60|Theme Parks|465",
	"10|Thriller|1015",
	"80|Travel|335",
	"70|Valentine|630",
	"30|Variety|76",
	"70|Veterans Day|635",
	"50|Volunteering|295",
	"40|Volunteering/Activism|1670",
	"80|Wine Tastings/Dinners|345",
	"40|Workshops|187",
	"60|Zoo/Aquarium|452");

 chngsub();}

//		Get SubCategory Name based on a Subcategory Id

function getsubcat(scat){
	alert(scat);
	for(i=0; i<AE.length; i++) 	{
		parts = AE[i].split("|");
		if(scat == parts[2]) getsubcat = parts[1];
	}
}

