<!--//
	
	// MOT.org
	// master.js

	var url = "http://www.motopera.org/";
	
	function viewPkgDetail(id) {
		window.open(url+"pop_seriesDetail.aspx?id="+id,"prodDetails","scrollbars=yes,menu=no,location=no,resizable=yes,width=510,height=225");
	}
	
	function viewPickPkgDetail(id) {
		window.open(url+"pop_pickPackageDetail.aspx?id="+id,"prodDetails","scrollbars=yes,menu=no,location=no,resizable=yes,width=510,height=225");
	}
	
	function viewPerfDetail(id) {
		window.open(url+"pop_prodDetail.aspx?id="+id,"prodDetails","scrollbars=yes,menu=no,location=no,resizable=yes,width=400,height=350");
	}
	
	function viewPerformances_ui() {
		window.open(url+"tickets/perfDates_ui.aspx","perfDate","scrollbars=yes,menu=no,location=no,resizable=yes,width=280,height=300");
	}
	
	function viewPerformances(r,id) {
		window.open(r+"perfDates.aspx?id="+id,"perfDate","scrollbars=yes,menu=no,location=no,resizable=yes,width=280,height=400");
	}
	
	function viewPerformance(id) {
		window.opener.location.href = "reserveSeats.aspx?id="+id;
		self.close();
	}
	
	function perfTimes(id) {
		window.open("perfDates.aspx?perf="+id,"perfTimes","scrollbars=yes,menubar=no,location=no,resizable=yes,width=280,height=350");
	}
	
	function addSeatRequests_ui() {
		window.open("addSeatRequests_ui.aspx","seatReq","scrollbars=yes,menubar=no,location=no,resizable=yes,width=300,height=420");
	}
	
	function addSeatRequests() {
		window.open("addSeatRequests.aspx","seatReq","scrollbars=yes,menubar=no,location=no,resizable=yes,width=210,height=230");
	}
	
	function viewRM(sp) {
		window.open("viewRM.asp?sp=" + sp,"rmView","scrollbars=no,menubar=no,location=no,resizable=yes,width=200,height=160");
	}	
	
	function sendAddRequest() {
		var pf = window.opener.document.forms[0];
		var f = document.forms[1];
		pf.aislePref.value = f.aislePref.value;
		pf.wheelSeats.value = (f.wheelSeats.checked) ? "true" : "";
		pf.noStairs.value = pf.noStairs.value;
		self.close();
	}
	
	function popAddRequest() {
		var pf = window.opener.document.tix;
		var f = document.forms[1];
		f.wheelSeats.checked = (pf.wheelSeats.value == true) ? true : false;
		for (x = 0; x < f.aislePref_s.length; x++) {
			f.aislePref_s[x].checked = (f.aislePref_s[x].value == pf.aislePref.value) ? true : false;
		}
		f.aislePref.value = pf.aislePref.value;
	}

	function viewMapDetail(id) {
		window.open("../mapDetail.aspx?id="+id,"perfDate","scrollbars=yes,menubar=no,location=no,resizable=yes,width=550,height=500");
	}
	
	function forgotPassword() {
		window.open("forgotPassword.aspx","forgot","scrollbars=yes,menubar=no,location=no,resizable=yes,width=400,height=180");
	}
	
	function printReceipt() {
		window.open("printReceipt.aspx","print","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=620,height=600");
	}
	
	function printReceipt_ui() {
		window.open("printReceipt_ui.aspx","print","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=550,height=600");
	}
	
	function printParking() {
		window.open("../printParking.aspx","print","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=550,height=600");
	}
	
	function seatFinder_ui() {
		window.open("../seat_map.aspx","popSeatFinder","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=650,height=450");
	}
	
	function seatFinderDetail_ui(t) {
		window.open("../cart/seat_detail.aspx?" + t,"popSeatFinder","scrollbars=0,menubar=1,location=1,resizable=0,width=600,height=391");
	} // w =600, h =391
	
	function seatFinder(r,s,t) {
		window.open("../cart/seat_detail.aspx?head=Y&r=" + r + "&s=" + s + "&ct=" + t,"popSeatFinder","scrollbars=0,menubar=0,location=0,resizable=0,width=600,height=391");
	}
	
	function studioSeatFinder(id) {
		window.open("../pop_studioSeatFinder.aspx?id="+id,"popStudioSeatFinder","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=600,height=480");
	}
	
	function parkingInfo() {
		window.open("parkingFacility.aspx","parking","scrollbars=yes,menubar=yes,location=no,resizable=yes,width=400,height=200");
	}
	
	function confirmCartRemove_ui() {
		confirm("Are you sure you want to remove this item from your cart?");
	}
	
	function confirmCartRemove(p,t) {
		var loc = location.href.toString().substring(0,location.href.toString().indexOf("?"));
		if (loc.substr(loc.length-1) == "/") {
			//loc += "index.aspx";
		}
		var destURL = (p != "" && t == undefined) ? loc.replace(/\?(gift|ticket)/ig,"") + "?g=" + p : loc.replace(/\?(gift|ticket)/ig,"") + "?p=" + p +"&t=" + t;
		if (confirm("Are you sure you want to remove this item from your cart?")) {
			location.href = destURL;
		} 
	}
	
	function confirmCartRemoveSpot(t) {
		var loc = location.href.toString().substring(0,location.href.toString().indexOf("?"));
		if (loc.substr(loc.length-1) == "/") {
			//loc += "index.aspx";
		}
		var destURL = loc.replace(/\?(gift|ticket)/ig,"") + "?pkt=" + t;
		if (confirm("Are you sure you want to remove this item from your cart?")) {
			location.href = destURL;
		} 
	}
	
	function confirmCartPkgRemove(p,t,n) {
		var loc = location.href.toString().substring(0,location.href.toString().indexOf("?"));
		var destURL = loc.replace(/\?(gift|ticket)/ig,"") + "?spkg=" + p +"&sid=" + t + "&subCnt=" + n;
		if (n > 1)
		{
			if (confirm("Are you sure you want to remove this item from your cart?")) {
				location.href = destURL;
			}
		}
		else
		{
			if (confirm("Are you sure you want to remove this item from your cart, all other items will also be removed?")) {
				location.href = destURL;
			}
		}
	}
	
	function confirmCartRemovePickPackage(gn) {
		var loc = location.href.toString().substring(0,location.href.toString().indexOf("?"));
		var destURL = loc.replace(/\?(gift|ticket)/ig,"") + "?ppkgGN=" + gn;
		if (confirm("Are you sure you want to remove this item from your cart?")) {
			location.href = destURL;
		} 
	}
	
	function confirmClear_ui() {
		confirm("Are you sure you want to remove every item from your cart and cancel your order?");
	}
	
	function confirmClear() {
		if (confirm("Are you sure you want to remove every item from your cart and cancel your order?")) {
			location.href = url + "cart/index.aspx?empty";
		}
	}
	
	function contactBox() {
		window.open("contactBox.asp","contact","scrollbars=yes,menubar=no,location=no,resizable=yes,width=350,height=250");
	}
	
	function cscExp() {
		window.open("cardSecurityCode.asp","csc","scrollbars=yes,menubar=no,location=no,resizable=yes,width=500,height=500");
	}

	function promoExp() {
		window.open("promoCode.asp","csc","scrollbars=no,menubar=no,location=no,resizable=yes,width=370,height=145");
	}
	
	function listen(mp3) {
		window.open(url + "/media/" + mp3,"csc","scrollbars=yes,menubar=no,location=no,resizable=yes,width=200,height=100");
	}

	
	function cookieExp() {
		//alert("If you check 'Remember Me?' before logging in, a cookie will be set on your computer which will automatically log you into the Michigan Opera Theater website on your next visit.\n\nThis cookie does not contain any sensitive information about you or your account, and will not allow others to compromise your privacy or security.\n\nThis cookie can be removed at any time.\nPlease see our 'FAQs' for details.");
		window.open("cookieExp.asp","cexp","scrollbars=no,menubar=no,location=no,resizable=yes,width=370,height=180");
	}
	
	function cookieExp_Login() {
		window.open("cookieExpLogin.asp","cexpl","scrollbars=no,menubar=no,location=no,resizable=yes,width=370,height=240");
	}
	
	function restorationFee() {
		window.open("restorationFee.asp","rsf","scrollbars=no,menubar=no,location=no,resizable=yes,width=370,height=145");
	}

	
	/* LEGIT FUNCTIONS */
	
	function seatFinderRow(v) {
		var f = document.forms[1];
		var s = f.sect;
		var r = f.row;
		var sect = (s[s.selectedIndex].value != "") ? s[s.selectedIndex].value : "CNTR";
		var c_r = ["A","B","C","D","E","F","G","H","J","K"];
		var rl_r = ["A","B","C","D","E"];
		var d_r = ["A","B"];
		var g_r = ["A"];
		var row = c_r;
			if (sect == "RGHT" || sect == "LEFT") {
				row = rl_r;
			} else if (sect == "DRSS") {
				row = d_r;
			} else if (sect == "GAL") {
				row = g_r;
			}
		r.options.length = 0;
		var nob = new Option("","");
		r.options[0] = nob;
			for (x = 0; x < row.length; x++) {
				var no = new Option(row[x],row[x]);
				r.options[x+1] = no;
			}
	}
	
	function seatFinderSeat(v) { 
		var f = document.forms[1];
		var s = f.sect;
		var r = f.row;
		var t = f.seat;
		var sect = (s[s.selectedIndex].value != "") ? s[s.selectedIndex].value : "CNTR"
		var row = (r[r.selectedIndex].value != "") ? r[r.selectedIndex].value : "A";
		var start = 1;
		var end = 59;
			if (sect == "CNTR") {
				if (row == "A" || row == "G") {
					end = 12;
				} else if (row == "B") {
					end = 14;
				} else if (row == "C" || row == "E" || row == "F") {
					end = 18;
				} else if (row == "D") {
					end = 20;
				} else if (row == "H") {
					end = 31;
				} else if (row == "J") {
					end = 26;
				} else if (row == "K") {
					end = 24;
				}
			} else if (sect == "RGHT" || sect == "LEFT") {
				start = 101;
				if (row == "A" || row == "D") {
					end = 115;
				} else if (row == "B") {
					end = 117;
				} else if (row == "C") {
					end = 118;
				} else if (row == "E") {
					end = 111;
				}			
			} else if (sect == "DRSS") {
				if (row == "A") {
					end = 63;
				} else if (row == "B") {
					end = 40;
				}
			}
			t.options.length = 0;
			var nob = new Option("","");
			t.options[0] = nob;
				for (x = start; x <= end; x++) {
					var no = new Option(x,x);
					t.options[t.options.length] = no;
				}			
	}	
		
	function iShift(i,s) {
		document.images[i].src = s;
	}	
	
	function clearLogForm() {
		var f = document.login;
	//	alert(f.formIs.value);
		if (f.formIs.value != "log") {
			f.l_username.value = "";
			f.l_password.value = "";
			f.l_promoCode.value = "";
			f.formIs.value = "reg";
		}
	}
	
	function clearRegForm() {
		var f = document.login;
	//	alert(f.formIs.value);
		if (f.formIs.value != "reg") {
			f.r_email.value = "";
			f.r_password.value = "";
			f.r_passwordConfirm.value = "";
			f.r_firstName.value = "";
			f.r_lastName.value = "";
			f.r_email.value = "";
			f.r_addr1.value = "";
			f.r_addr2.value = "";
			f.r_city.value = "";
			f.r_state.value = "";
			f.r_country.value = "";
			f.r_zip.value = "";
			f.r_phone.value = "";
			f.r_promoCode.value = "";
			f.formIs.value = "log";
		}
	}
	
	function isReg(tf) {
		if (tf.value != "") {
			document.login.formIs.value = "reg";
		}
	}
	
	function isLog(tf) {
		if (tf.value != "") {
			document.login.formIs.value = "log";
		}
	}
	
	
	function formAction(v) {
		var f = document.forms[1];
		f.formIs.value = v;
	}
	
	function genStateList(f,sl,ssel,csel) {
		f.options.length = 0;
		f.options[0] = new Option("","");
		var sl = sl.value.split(";");
		var isSel = 0;		
		for (x = 0; x < sl.length; x++) {
			var set = sl[x].split(":");
			var sel, ct;
			if (set[0] == csel) {
				sel = (ssel == set[1]) ? true : false;
				ct = (ssel == set[1]) ? f.options.length-1 : ct;
				f.options[f.options.length] = new Option(set[1],set[1],sel,sel);
				f.options[f.options.length-1].selected = sel;
			}
		}	
	}
	
	function _genStateList(f,sl,ssel,csel) {
		f.options.length = 1;
		f.options[1] = new Option("","");
		var sl = sl.value.split(";");
		var isSel = 0;		
		for (x = 0; x < sl.length; x++) {
			var set = sl[x].split(":");
			if (set[0] == csel) {
				if (ssel == set[1]) { isSel = x; }		
				//f.options[f.options.length] = (ssel == set[1]) ? new Option(set[1],set[1],true,true) : new Option(set[1],set[1]);]
				f.options[f.options.length] = new Option(set[1],set[1]);
				//if (ssel == set[1]) { f.options[f.options.length].selected; }	
			}
		}	
		if (isSel > 0) { f.options[isSel+1].selected = true; }
	}
	
	function minSeatDropdown() {
		var f = document.forms[0];
		br = navigator.appName;
		bv = navigator.appVersion;
		f.contSeats.options.length = 0;
			//if (br.indexOf("Netscape") == -1 || (br.indexOf("Netscape") > -1 && parseInt(bv) > 4)) {
		seat = f.seatNum.value;
			if (seat == "") {
				seat = 1;
			}	
		mini = (seat == 1) ? 1 : 2;
		maxi = (seat <= 10) ? seat : 10;
		f.contSeats.options.length = maxi;
		f.contSeats.options[0] = new Option();
		f.contSeats.options[0].text = "    ";
		f.contSeats.options[0].value = "";
		
		for (x = 1; x <= maxi; x++) {
			f.contSeats.options[x] = new Option();
			f.contSeats.options[x].text = x;
			f.contSeats.options[x].value = x;
				if (x == maxi) {
					f.contSeats.options[x].selected = true;
				} else {
					f.contSeats.options[x].selected = false;
				}
		}	
			//}
		
		return true;
	}

	var textChecked = false;
	function checkText(tf) {
		if (tf.value.length > 255 && !textChecked) {
			alert("Your order notes cannot exceed 255 characters.");
			tf.focus();
			textChecked = true;
		}
	}
	
	// functions for parking
	function parkingQtyPrice() {
		var f = (document.subs) ? document.subs : document.tix;
		if (f) {
			var prkgP = Number(f.prkg_price.value);
			var totalQ = 0;
			var totalP = 0;
			var msg;
			for (x = 0; x < f.elements.length; x++) {
				if (f.elements[x].name.indexOf("prk_numSpots_") > -1) {
					totalQ += Number(f.elements[x].value);
				}
			}
			if (totalQ > 0) {
				f.totalQ.value = totalQ;
				f.totalP.value = "$" + totalQ * prkgP;
			} else {
				f.totalQ.value = 0;
				f.totalP.value = "$0";
			}
		}
	}
	
	// functions for parking
	function abbr_pkgQtyPrice() {
		var f = (document.subs) ? document.subs : document.tix;
		if (f) {
			var prkgQ = Number(f.prk_numSpots[f.prk_numSpots.selectedIndex].value);
			for (x = 0; x < f.elements.length; x++) {
				if (f.elements[x].name.indexOf("prk_numSpots_") > -1) {
					f.elements[x].value = (f.buy_parking.checked && prkgQ > 0) ? prkgQ : "";
				}
			}
		}
	}
	
//-->