function updateCheckoutUrl(brokerId, siteNumber, ticketId, eventId, price, ticketQuantity) {
	var sessionId = makeSessionId();
	var url = "https://tickettransaction2.com/Checkout.aspx" + "?brokerid=" + brokerId + "&sitenumber=" + siteNumber + "&tgid=" + ticketId + "&evtid=" + eventId + "&price=" + price + "&treq=" + ticketQuantity + "&SessionId=" + sessionId;
	return url;
}

function makeSessionId() {
	var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'; 
	var sid_length = 5;
	var sid = '';
	for (var i=0; i<sid_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		sid += chars.substring(rnum,rnum+1);
	}
	return sid;
} 

function showVenueMap(venueMapURL) {
	  var w = window.open("","","menubar=no,toolbar=no,width=550,height=550,resizeable=yes");
	  w.document.writeln("<body bgcolor='#1D282D'>");
	  w.document.writeln("<img src='" + venueMapURL + "'>");
	  w.document.writeln("<\/body>");
	  w.document.close();
}

function updateChildCategories() {
	var selectedIndex = document.getElementById('category').selectedIndex;
	var category = document.getElementById('category').options[selectedIndex].value;
	var childCategoriesSelect = document.getElementById('childCategory');
	childCategoriesSelect.options.length = 0;
	if (category == "1") { //Sports
		childCategoriesSelect.options.length = 9;
		childCategoriesSelect.options[0].value = "65";
		childCategoriesSelect.options[0].text = "Football";
		childCategoriesSelect.options[1].value = "63";
		childCategoriesSelect.options[1].text = "Baseball";
		childCategoriesSelect.options[2].value = "66";
		childCategoriesSelect.options[2].text = "Basketball";
		childCategoriesSelect.options[3].value = "68";
		childCategoriesSelect.options[3].text = "Hockey";
		childCategoriesSelect.options[4].value = "69";
		childCategoriesSelect.options[4].text = "Racing";
		childCategoriesSelect.options[5].value = "67";
		childCategoriesSelect.options[5].text = "Golf";
		childCategoriesSelect.options[6].value = "27";
		childCategoriesSelect.options[6].text = "Tennis";
		childCategoriesSelect.options[7].value = "71";
		childCategoriesSelect.options[7].text = "Soccer";
		childCategoriesSelect.options[8].value = "39";
		childCategoriesSelect.options[8].text = "Wrestling";
	} else if (category == "2") { //Concerts
		childCategoriesSelect.options.length = 9;
		childCategoriesSelect.options[0].value = "62";
		childCategoriesSelect.options[0].text = "Pop/Rock";
		childCategoriesSelect.options[1].value = "36";
		childCategoriesSelect.options[1].text = "Rap/Hip Hop";
		childCategoriesSelect.options[2].value = "23";
		childCategoriesSelect.options[2].text = "Country";
		childCategoriesSelect.options[3].value = "45";
		childCategoriesSelect.options[3].text = "R&B";
		childCategoriesSelect.options[4].value = "22";
		childCategoriesSelect.options[4].text = "Alternative";
		childCategoriesSelect.options[5].value = "24";
		childCategoriesSelect.options[5].text = "Comedy";
		childCategoriesSelect.options[6].value = "34";
		childCategoriesSelect.options[6].text = "Las Vegas Shows";
		childCategoriesSelect.options[7].value = "49";
		childCategoriesSelect.options[7].text = "Classical";
		childCategoriesSelect.options[8].value = "61";
		childCategoriesSelect.options[8].text = "Hard Rock/Metal";
	} else if (category == "3") { //Theatre
		childCategoriesSelect.options.length = 4;
		childCategoriesSelect.options[0].value = "70";
		childCategoriesSelect.options[0].text = "Broadway";
		childCategoriesSelect.options[1].value = "35";
		childCategoriesSelect.options[1].text = "Las Vegas";
		childCategoriesSelect.options[2].value = "75";
		childCategoriesSelect.options[2].text = "Opera";
		childCategoriesSelect.options[3].value = "60";
		childCategoriesSelect.options[3].text = "Ballet";
	}
	updateGrandchildCategories();
}

function updateGrandchildCategories() {
	var selectedIndex = document.getElementById('childCategory').selectedIndex;
	var childCategory = document.getElementById('childCategory').options[selectedIndex].value;
	var grandchildCategoriesSelect = document.getElementById('grandchildCategory');
	grandchildCategoriesSelect.options.length = 0;    
	if (childCategory == "65") { //Football
		grandchildCategoriesSelect.options.length = 2;
		grandchildCategoriesSelect.options[0].value = "32";
		grandchildCategoriesSelect.options[0].text = "NFL Football";
		grandchildCategoriesSelect.options[1].value = "17";
		grandchildCategoriesSelect.options[1].text = "NCAA Football";
	} else if (childCategory == "63") { //Baseball
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "16";
		grandchildCategoriesSelect.options[0].text = "MLB Baseball";
	} else if (childCategory == "66") { //Basketball
		grandchildCategoriesSelect.options.length = 2;
		grandchildCategoriesSelect.options[0].value = "30";
		grandchildCategoriesSelect.options[0].text = "NBA Basketball";
		grandchildCategoriesSelect.options[1].value = "32";
		grandchildCategoriesSelect.options[1].text = "NCAA Basketball";
	} else if (childCategory == "68") { //Hockey
		grandchildCategoriesSelect.options.length = 2;
		grandchildCategoriesSelect.options[0].value = "19";
		grandchildCategoriesSelect.options[0].text = "NHL Hockey";
		grandchildCategoriesSelect.options[1].value = "17";
		grandchildCategoriesSelect.options[1].text = "NCAA Hockey";
	} else if (childCategory == "69") { //Racing
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "20";
		grandchildCategoriesSelect.options[0].text = "NASCAR";
	} else if (childCategory == "67") { //Golf
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "18";
		grandchildCategoriesSelect.options[0].text = "PGA";
	} else if (childCategory == "27") { //Tennis
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "Professional Tennis";
	} else if (childCategory == "71") { //Soccer
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "22";
		grandchildCategoriesSelect.options[0].text = "MLS Soccer";
	} else if (childCategory == "39") { //Wrestling
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "26";
		grandchildCategoriesSelect.options[0].text = "WWE Wrestling";
	} else if (childCategory == "62") { //Pop/Rock
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "36") { //Rap/Hip Hop
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "23") { //Country
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "45") { //R&B
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "22") { //Alternative
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "24") { //Comey
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "34") { //Las Vegas Shows
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "49") { //Classical
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "61") { //Hard Rock/Metal
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "70") { //Broadway
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "35") { //Las Vegas
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "75") { //Opera
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	} else if (childCategory == "60") { //Ballet
		grandchildCategoriesSelect.options.length = 1;
		grandchildCategoriesSelect.options[0].value = "25";
		grandchildCategoriesSelect.options[0].text = "N/A";
	}
}