﻿onerror=unhandledException;

try
{
	var bSecure = false;
	var strURL = window.location.href.toString().toLowerCase(); 
	var strPage = window.location.pathname.toString().toLowerCase();
	strPage = strPage.substring(strPage.lastIndexOf("/")+1);
	if(SECUREPAGES.indexOf("|"+strPage+"|")>-1){bSecure=true;}
	if(bSecure&&strURL.indexOf("http://")==0)
	{
		 window.location.href=strURL.replace("http://","https://");
	}  
	else if(!bSecure&&strURL.indexOf("https://")==0)
	{
		 window.location.href=strURL.replace("https://","http://");
	}
}
catch(ex){/**/}
/* END SECURE/NON-SECURE PAGE HANDLING */


/* BEGIN AFFILIATE TRACKING */
	document.cookie = 'TCAffReferrer=' + document.referrer + '; path=/';
/* END AFFILIATE TRACKING */

/* BEGIN LIVE CHAT */
function loadLiveChat() {/**/}
/* END LIVE CHAT */

/* BEGIN UPDATE CART QTY */
function updateCartQtyDisplay()
{
    try { returnObj("spanCartItemQty").obj.innerHTML = (readCookie("CartItemQty") == "" || readCookie("CartItemQty") == null) ? "0" : readCookie("CartItemQty"); } catch (ex) { /*carry on*/ }
    try { returnObj("shopping_cart_items_inner").obj.innerHTML = (readCookie("CartItemQty") == "" || readCookie("CartItemQty") == null) ? "0" : readCookie("CartItemQty"); } catch (ex) { /*carry on*/ }
}
/* END UPDATE CART QTY */

/* BEGIN OBJECT FUNCTIONS */
function getObj(name)
{
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers)
	{
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

function returnObj(name)
{
	try
	{
		if (document.getElementById)
		{
			this.obj = document.getElementById(name);
			this.style = document.getElementById(name).style;
		}
		else if (document.all)
		{
			this.obj = document.all[name];
			this.style = document.all[name].style;
		}
		else if (document.layers)
		{
			this.obj = document.layers[name];
			this.style = document.layers[name];
		}
		return this;
	}
	catch(err)
	{
		return false;
	} 
}
/* END OBJECT FUNCTIONS */



/* BEGIN DISPLAY FUNCTIONS */
function showHide(id, method)
{
	if(method == "hide")
	{
		returnObj(id).style.display="none";
	}
	else/*show*/
	{
		returnObj(id).style.display="";
	}
}

var lastModal = 0;

function showHideModal() {
	var method = (arguments[0]) ? arguments[0] : "show";
	var message = (arguments[1]) ? arguments[1] : "Processing";
	var isClosable = (arguments[2]) ? arguments[2] : "false";
	var hideTimer = (arguments[3]) ? arguments[3] : 0;
	var hideModal = (arguments[4]) ? arguments[4] : lastModal;
	var onHide = (arguments[5]) ? arguments[5] : "";

	if (method == "hide") {
	    if (hideModal == lastModal) {
	        returnObj("divModalBG").style.display = "none";
	        returnObj("divModalMsg").style.display = "none";
	        returnObj("divModalMsg_wrapper").style.display = "none";

	        if (window["onHide_" + hideModal]) {
	            window["onHide_" + hideModal]();
	        }
	    }
	}
	else /*show*/
	{
	    lastModal++;
	    var tempHideModal = lastModal;

		returnObj("divModalBG").style.height = returnObj("divMain").obj.offsetHeight + "px";
		returnObj("divModalBG").style.display = "block";
		returnObj("divModalMsg").obj.innerHTML = ((isClosable == "true") ? "<a id=\"modalClose\">x</a>" : "") + message;
		returnObj("divModalMsg").style.display = "block";
		returnObj("divModalMsg_wrapper").style.display = "block";
		window.scrollTo(0, 0);
		if (hideTimer > 0) {
		    setTimeout(function () { showHideModal("hide", "", "", 0, tempHideModal); }, hideTimer);
		}

		if (onHide != "") {
		    window["onHide_" + tempHideModal] = Function(onHide);
        }
	}
}

function showHideModalBG(method)
{
	if(method=="hide")
	{ 
		returnObj("divModalBG").style.display="none";
	}
	else /*show*/
	{
		returnObj("divModalBG").style.height=returnObj("divMain").obj.offsetHeight + "px";
		returnObj("divModalBG").style.display="block";
	}
}
 /* FOLLOWING FOR MOUSEOVER DIV */
function myMouseOut(e) 
{ 
	try
	{
		if (!e) var e = window.event;
		var tg = (window.event) ? e.srcElement : e.target;
		if (tg.nodeName != 'DIV') return;
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		while (reltg != tg && reltg.nodeName != 'BODY')
			reltg= reltg.parentNode;
		if (reltg!= tg){
		 returnObj('divEventPop').style.display = "none";
		}
	 }
	 catch(ex){ /* carry on, people moving mouse way too fast */ }
}
/* END DISPLAY FUNCTIONS */



/* BEGIN COOKIE FUNCTIONS */
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
/* END COOKIE FUNCTIONS */



/* BEGIN EVENT FUNCTIONS */
function enterKeyClick(e,btnID)
{
	try
	{ 
		if(!e){var e = window.event;}
		if(e.keyCode){code = e.keyCode;}
		else if(e.which){code = e.which;}
		e.cancelBubble = true;
		if (e.stopPropagation){e.stopPropagation();}
		if(code==13)
		{
			returnObj(btnID).obj.click();
		}
		return false;
	}
	catch(ex){/*carry on*/}
}
/* END EVENT FUNCTIONS */



/* BEGIN HIDDEN INPUT FUNCTIONS */
function updateHiddenText(id,hid){returnObj(hid).obj.value=returnObj(id).obj.value;}
function updateHiddenSelect(id,hid){returnObj(hid).obj.value=returnObj(id).obj.options[returnObj(id).obj.options.selectedIndex].value;}
/* END HIDDEN INPUT FUNCTIONS*/

/* BEGIN STRING FUNCTIONS */
function InStr(strSearched, strSearchFor)
{
	for (i=0; i < (Len(strSearched)-Len(strSearchFor)+1); i++)
	{
		if (strSearchFor == Mid(strSearched, i, Len(strSearchFor)))
		{
			return i;
		}
	}
	return -1;
}

function Mid(str, start, len)
{
	if (start < 0 || len < 0) {return ""};
	var iEnd, iLen = String(str).length;
	if (start + len > iLen)
	{ 
		iEnd = iLen;
	}        
	else
	{ 
		iEnd = start + len;
	}
	return String(str).substring(start,iEnd);
}

function Left(str, n)
{
	if (n <= 0)
	{
		return "";
	}
	else if (n > String(str).length)
	{ 
		return str;
	}
	else
	{ 
		return String(str).substring(0,n);
	}
}

function Right(str, n)
{
	if (n <= 0)
	{ 
		return "";
	}
	else if (n > String(str).length)
	{ 
		return str;
	} 
	else
	{
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}

function Len(str)
{
	return String(str).length; 
}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function Trim(str)
{
	return str.replace(/^\s+/, "").replace(/\s+$/, "");
}

function StringBuilder(value)
{
	this.strings = new Array("");
	this.append(value);
}

/* Appends the given value to the end of this instance. */

StringBuilder.prototype.append = function (value)
{
	if (value)
	{
		this.strings.push(value);
	}
}

/* Clears the string buffer */

StringBuilder.prototype.clear = function ()
{
	this.strings.length = 1;
}

/* Converts this instance to a String. */

StringBuilder.prototype.toString = function ()
{
	return this.strings.join("");
} 

function getPageName()
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	sPage = sPage.substring(0, sPage.length - 5);
	return sPage; 
 }
/* END STRING FUNCTIONS */


/* BEGIN SEARCH FUNCTION */
function goSearch(searchTerm) {
    var q = trim(searchTerm).replace("'", "").replace("&", "%26");
    if (q != "search by team, artist or venue" && q != "") {
	    location.href = "/search.html?q=" + q;
	}
}
/* END SEARCH FUNCTION */

/* BEGIN ERROR FUNCTIONS */
function getDebugInfo()
{
	var strInfo = "<b>DEBUG INFO:</b><br />";
	try
	{  
		try{strInfo = strInfo + "<b>page:</b> " + location.href + "<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>URL:</b> " + document.URL + "<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>title:</b> " + document.title + "<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>referrer:</b> " + document.referrer + "<br />";}catch(ex){/**/}
		
		try{strInfo = strInfo + "<b>platform:</b> "+navigator.platform+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>appCodeName:</b> "+navigator.appCodeName+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>appName:</b> "+navigator.appName+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>appVersion:</b> "+navigator.appVersion+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>appMinorVersion:</b> "+navigator.appMinorVersion+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>userAgent:</b> "+navigator.userAgent+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>browserLanguage:</b> "+navigator.browserLanguage+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>systemLanguage:</b> "+navigator.systemLanguage+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>userLanguage:</b> "+navigator.userLanguage+"<br />";}catch(ex){/**/}
		try{strInfo = strInfo + "<b>cpuClass:</b> "+navigator.cpuClass+"<br />";}catch(ex){/**/}
	}
	catch(exx){strInfo=strInfo+"...couldn't retrieve all debug info<br />";}
	strInfo = strInfo + "<hr />";
	strInfo = strInfo + getCookieInfo() + getFormInfo(); 
	return strInfo; 
}

function getExceptionInfo(ex)
{
	var strException = "<b>JAVASCRIPT EXCEPTION:</b><br />";
	try
	{  
		try{strException = strException + "<b>name:</b>" + ex.name + "<br /><b>message:</b>" + ex.message + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>description:</b>" + ex.description + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>number:</b>" + ex.number + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>fileName:</b>" + ex.fileName + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>lineNumber:</b>" + ex.lineNumber + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>stack:</b>" + ex.stack + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>toSource:</b>" + escape(ex.toSource) + "<br />";}catch(e){/**/}
		try{strException = strException + "<b>toString:</b>" + ex.toString() + "<br />";}catch(e){/**/}
	}
	catch(exx){strException=strException+"...couldn't retrieve all exception info<br />";} 
	return strException;
}

function unhandledException(msg,url,line) {
    if (msg.indexOf("rfhelper32.js ") < 0){
	    var strInfo = "<b>Message:</b> "+msg+"<br /><b>URL:</b> "+url+"<br /><b>Line Number:</b> "+line + "<hr />";
	    var eventInfo = "";
	    try {eventInfo = windowAlert(arguments[0]);}catch(ex){/**/}
	    var strParams = "strErrorMsg=" + strInfo.replace("&", "%26") + getDebugInfo().replace("&", "%26")+ eventInfo + "<br /><hr />" +stackTrace(arguments.callee)+"&strSubject=JS_UNHANDLED-EXCEPTION&bIsHtmlMsg=true";
	    ajaxPost(strParams,location.protocol+"//"+location.hostname+"/ws/tcws.asmx/LogError", null);
    }
}
function windowAlert(errorEvent)
{
	var windowInfo = "";
	try {windowInfo = windowInfo + "<b>EventType: </b>" + errorEvent.type != 'undefined' ? errorEvent.type+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventTarget: </b>" + errorEvent.target != 'undefined' ? errorEvent.target+ "<br />": '' } catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventCurTarget: </b>" + errorEvent.currentTarget !='undefined' ? errorEvent.currentTarget+ "<br />": '' } catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventTimeStamp: </b>" + errorEvent.timeStamp != 'undefined' ? errorEvent.timeStamp+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventButton: </b>" + errorEvent.button != 'undefined' ? errorEvent.button+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventRelatedTarget: </b>" + errorEvent.relatedTarget != 'undefined' ? errorEvent.relatedTarget+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventAlt: </b>" + errorEvent.altKey != 'undefined' ? errorEvent.altKey+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventCtrl: </b>" + errorEvent.ctrlKey != 'undefined' ? errorEvent.ctrlKey+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventShift: </b>" + errorEvent.shiftKey != 'undefined' ? errorEvent.shiftKey+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventBubbles: </b>" + errorEvent.bubbles != 'undefined' ? errorEvent.bubbles+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventCancelable: </b>" + errorEvent.cancelable != 'undefined' ? errorEvent.cancelable+ "<br />": ''} catch(e){/**/}
	try {windowInfo = windowInfo + "<b>EventMetaKey: </b>" + errorEvent.metaKey != 'undefined' ? errorEvent.metaKey + "<br />": ''} catch(e){/**/}
	return windowInfo;
}
function getFormInfo()
{
	var strInfo = "<b>FORM FIELDS:</b><br />";
	for(n in document.forms[0].elements)
	{
		try
		{
			switch(document.forms[0].elements[n].type)
			{
				case "text":
				case "hidden":
					if(document.forms[0].elements[n].id.toString().toUpperCase().indexOf("CVV")==-1) // do not log CVV info
					{
						if(document.forms[0].elements[n].id.toString().indexOf("txtCCNu")!=-1) // do not log CCNumber info
						{
							var masked = returnObj(document.forms[0].elements[n].id).obj.value.substr(returnObj(document.forms[0].elements[n].id).obj.value.length-4, returnObj(document.forms[0].elements[n].id).obj.value.length);
							if (masked != "")
							{
								strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> XXXXXXXXXXXX" + masked + "<br />";
							}
							else
							{
								strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> Saved CC Info used.<br />";
							}
						}
						else
						{
							strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> " + returnObj(document.forms[0].elements[n].id).obj.value + "<br />";
						}
					}
					break;
				case "radio":
					strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> " + returnObj(document.forms[0].elements[n].id).obj.value + " [" + returnObj(document.forms[0].elements[n].id).obj.checked + "]<br />";
					break;
				case "checkbox":
					strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> " + " [" + returnObj(document.forms[0].elements[n].id).obj.checked + "]<br />";
					break;
				case "select-one":
					strInfo = strInfo + "<b>" + document.forms[0].elements[n].id + ":</b> " + returnObj(document.forms[0].elements[n].id).obj.options[returnObj(document.forms[0].elements[n].id).obj.selectedIndex].text + "<br />";
					break;
			}
		}
		catch(ex){/*carry on*/}
	}
	return strInfo + "<hr />"; 
}

function getCookieInfo()
{
	var strInfo = "<b>COOKIE VALUES:</b><br />";
	var strCookies = document.cookie.split(";");   
	for(n in strCookies)
	{
		strInfo = strInfo + escape(strCookies[n]) + "<br />";
	}
	return strInfo + "<hr />"; 
}

//function printStackTrace() 
//{
//    var callstack = [];
//    var isCallstackPopulated = false;
//    try 
//    {
//        i.dont.exist+=0; //doesn't exist- that's the point
//    } 
//    catch(e) 
//    {
//        if (e.stack) 
//        { //Firefox
//            var lines = e.stack.split('\n');
//            for (var i=0, len=lines.length; i<len; i++) 
//            {
//                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) 
//                {
//                    callstack.push(lines[i]);
//                }
//            }
//            //Remove call to printStackTrace()
//            callstack.shift();
//            isCallstackPopulated = true;
//        }
//        else if (window.opera && e.message) 
//        { //Opera
//            var lines = e.message.split('\n');
//            for (var i=0, len=lines.length; i<len; i++) 
//            {
//                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) 
//                {
//                    var entry = lines[i];
//                    //Append next line also since it has the file info
//                    if (lines[i+1]) 
//                    {
//                        entry += ' at ' + lines[i+1];
//                        i++;
//                    }
//                    callstack.push(entry);
//                }
//            }
//            //Remove call to printStackTrace()
//            callstack.shift();
//            isCallstackPopulated = true;
//        }
//    }
//    if (!isCallstackPopulated) 
//    { //IE and Safari
//        var currentFunction = arguments.callee.caller;
//        while (currentFunction) 
//        {
//            var fn = currentFunction.toString();
//            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf('')) || 'anonymous';
//            callstack.push(fname);
//            currentFunction = currentFunction.caller;
//        }
//    }
//    return callstack.join('\n\n');
//}

	function stackTrace(startingPoint)
	{
		var stackTraceMessage = "<b>STACK TRACE:</b> <br>\n";
		var nextCaller = startingPoint;
		while(nextCaller)
		{
			stackTraceMessage += getSignature(nextCaller) + "<br>\n";
			nextCaller = nextCaller.caller;
		}
		stackTraceMessage += "<br>\n\n";
		
		// return message
		return stackTraceMessage; 
	}
	
	function getSignature(theFunction)
	{
		var signature = getFunctionName(theFunction);
		signature += "(";
		for(var x=0; x<theFunction.arguments.length; x++)
		{
			// trim long arguments
			var nextArgument = theFunction.arguments[x];
			if(nextArgument.length > 30)
				nextArgument = nextArgument.substring(0, 30) + "...";
			
			// apend the next argument to the signature
			signature += "'" + nextArgument + "'"; 
			
			// comma seperator
			if(x < theFunction.arguments.length - 1)
				signature += ", ";
		}
		signature += ")";
		return signature;
	}
	
	function getFunctionName(theFunction)
	{
		// mozilla makes it easy. I love mozilla.
		if(theFunction.name)
		{
			return theFunction.name;
		}
		
		// try to parse the function name from the defintion
		var definition = theFunction.toString();
		var name = definition.substring(definition.indexOf('function') + 8,definition.indexOf('('));
		if(name)
			return name;

		// sometimes there won't be a function name 
		// like for dynamic functions
		return "anonymous";
	}

/* END ERROR FUNCTIONS */

/* BEGIN PAGE LOGGING */
function LogPageRequest()
{
	try
   { 
		getClick2C_ID();
		var strServiceURL =  location.protocol+"//"+location.hostname+"/ws/tcws.asmx/LogPageRequest";
		var strParams = "RefURL="+URLencode(document.referrer)+"&ReqURL="+URLencode(document.URL);

		var strYahoo = "search.yahoo.com/";
		var strGoogle = ".google.com/search?";
		var strMSN = "search.msn.com";
		var strLive = "search.live.com";
				
		// ignore no referrar; Yahoo/Overture PPC; Google PPC
		if (document.referrer != ''&&window.location.href.indexOf("s_kwcid=")<0&&window.location.href.indexOf("ovcrn=")<0&&window.location.href.indexOf("gclid=")<0&&(document.referrer.indexOf(strYahoo) > 0 || document.referrer.indexOf(strGoogle) > 0 || document.referrer.indexOf(strMSN) > 0 || document.referrer.indexOf(strLive) > 0))
	   {
			strParams = strParams+"&SERef=TRUE";
		}
		else
		{
			strParams = strParams+"&SERef=FALSE";
		}

		ajaxPost(strParams,strServiceURL);
	}
   catch(e) {}
}

function URLencode(sStr)
{
	return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27');
}

/* END PAGE LOGGING */

/* BEGIN Click2 TRACKING DETECTION */
function getClick2C_ID()
{
   var strC2CampaignID = parseQueryString('BrCg'); 
   var strC2RecipientID = parseQueryString('BrRc');
   var strC2CustomerID = parseQueryString('BrCs'); 
  
   if(readCookie('c2cid')!='' && readCookie('c2cid')!=null) //cookie exists
   {
		if (strC2CampaignID != false) // it is in the querystring // 
		{
			if (readCookie('c2cid')!= strC2CampaignID)
			{
				eraseCookie('c2cid');
				createCookie('c2cid', strC2CampaignID);
			}
			else if (readCookie('c2rid')!= strC2RecipientID)
			{
				eraseCookie('c2rid'); 
				createCookie('c2rid', strC2RecipientID); 
			}
			else if (readCookie('c2custID')!=strC2CustomerID)
			{ 
				eraseCookie('c2custID');  
				createCookie('c2custID', strC2CustomerID);               
			} 
		 }
   }
   else
   {
		if(strC2CampaignID != false) //c2cid is in the qs
		{
			createCookie('c2cid', strC2CampaignID);
			createCookie('c2rid', strC2RecipientID); 
			createCookie('c2custID', strC2CustomerID);  
		}
   }     
}
/* END Click2 TRACKING DETECTION */


/* BEGIN EMAIL FORM FUNCTIONS */
function submitEmailForm(id)
{
	var strFormData = "";
	var n;
	var bPost = true;
	 
	var strInputs = returnObj("hidEF_"+id+"_text").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			if(validateEmailForm(1,strInputs[n]))
			{
				strFormData = strFormData + strInputs[n] + "=" + escape(returnObj(strInputs[n]).obj.value) + "::";
			}
			else
			{
				bPost = false;
			}
		}
	}
	
	strInputs = returnObj("hidEF_"+id+"_textarea").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			if(validateEmailForm(1,strInputs[n]))
			{
				strFormData = strFormData + strInputs[n] + "=" + escape(returnObj(strInputs[n]).obj.value) + "::";
			}
			else
			{
				bPost = false;
			}
		}
	}

	strInputs = returnObj("hidEF_"+id+"_select").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			if(validateEmailForm(2,strInputs[n]))
			{
				strFormData = strFormData + strInputs[n] + "=" + escape(returnObj(strInputs[n]).obj.options[returnObj(strInputs[n]).obj.selectedIndex].value) + "::";
			}
			else
			{
				bPost = false;
			}
		}
	}
	
	strInputs = returnObj("hidEF_"+id+"_checkbox").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			if(validateEmailForm(4,strInputs[n]))
			{
				strFormData = strFormData + strInputs[n] + "=" + escape(returnObj(strInputs[n]).obj.checked) + "::";
			}
			else
			{
				bPost = false;
			}
		}
	}

	strInputs = returnObj("hidEF_"+id+"_radio").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			if(validateEmailForm(3,strInputs[n]))
			{
				var rdos = getElementsByAttribute(document.documentElement,"input","name",strInputs[n]);
				for(var x = 0; x < rdos.length; x++)
				{
					if(rdos[x].checked)
					{
						strFormData = strFormData + strInputs[n] + "=" + escape(rdos[x].value) + "::";
					} 
				}
			}
			else
			{
				bPost = false;
			}
		}
	}
	
	strInputs = returnObj("hidEF_"+id+"_hidden").obj.value.split("|");
	if(strInputs.length>0&&strInputs[0]!="")
	{
		for(n in strInputs)
		{
			strFormData = strFormData + strInputs[n] + "=" + escape(returnObj(strInputs[n]).obj.value) + "::";
		}
	}
		
	if(bPost)
	{ 
		var strServiceURL =  location.protocol+"//"+location.hostname+"/ws/tcws.asmx/EmailForm";
		var strParams = "ID="+id+"&FormData="+strFormData;

		ajaxPost(strParams,strServiceURL,"confirmEmailForm");
	}
	else
	{
		alert("There was a problem with your request!\n\nPlease fill out the form completely and try again.\n\n");
	}
}

function confirmEmailForm(xml)
{
	var bActiveX=true;
	if (document.implementation && document.implementation.createDocument)
	{
		bActiveX=false;
		xmlDoc = document.implementation.createDocument("", "", null);
		parser=new DOMParser();
		xmlDoc=parser.parseFromString(xml,"text/xml");
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.loadXML(xml);
	}
	else
	{
		alert("Your browser is having problems with our website!\n\nPlease call us to resolve this issue.");
		return;
	}

	switch(xmlDoc.getElementsByTagName("EmailForm")[0].getAttribute("Status"))
	{
		case "0":
			returnObj("divEF_"+xmlDoc.getElementsByTagName("EmailForm")[0].getAttribute("ID")).style.display="none";
			returnObj("divEFC_"+xmlDoc.getElementsByTagName("EmailForm")[0].getAttribute("ID")).style.display="";
			break;
		default:
			alert("There was a problem with your request!\n\nPlease fill out the form completely and try again or call 1-800-521-9616 to speak with a representative.\n\n");
			break;
	}
}

function validateEmailForm(nType,id)
{
	switch(nType)
	{
		case 1: /* text, textarea */
			if(returnObj("validator-"+id))
			{
				if(returnObj(id).obj.value.search(returnObj("validator-"+id).obj.value)!=-1)
				{ 
					returnObj("validator-"+id+"-msg").style.display="none";
					return true;
				}
				else
				{
					returnObj("validator-"+id+"-msg").style.display="";
					return false;
				}
			}
			else
			{
				return true;
			}
			break;
		case 2: /* dropdown */
			if(returnObj("validator-"+id))
			{
				if(returnObj(id).obj.options[returnObj(id).obj.selectedIndex].value.search(returnObj("validator-"+id).obj.value)!=-1)
				{
					returnObj("validator-"+id+"-msg").style.display="none";
					return true;
				}
				else
				{
					returnObj("validator-"+id+"-msg").style.display="";
					return false;
				}
			}
			else
			{
				return true;
			}
			break;
		case 3: /* radio */
			/* only validates that something was selected */
			if(returnObj("validator-"+id))
			{
				var rdos = getElementsByAttribute(document.documentElement,"input","name",id);
				for(var x = 0; x < rdos.length; x++)
				{
					if(rdos[x].checked)
					{
						returnObj("validator-"+id+"-msg").style.display="none";
						return true;
					}
				}
				returnObj("validator-"+id+"-msg").style.display="";
				return false;
			}
			else
			{
				return true;
			}
			break;
		case 4: /* checkbox */
			/* only validates that the checkbox is selected */
			if(returnObj("validator-"+id))
			{
				if(returnObj(id).obj.checked)
				{
					returnObj("validator-"+id+"-msg").style.display="none";
					return true;
				}
				else
				{
					returnObj("validator-"+id+"-msg").style.display="";
					return false;
				}
			}
			else
			{
				return true;
			}
			break;
	}
	return true;
}

/* END EMAIL FORM FUNCTIONS */


/* BEGIN QUERYSTRING DETECTIION */
function parseQueryString( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return false;
  else
	return results[1];
} 

/* END QUERYSTRING DETECTION */

/* BEGIN ELEMENT FUNCTIONS */
function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue)
{
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
	var oCurrent;
	var oAttribute;
	for(var i=0; i<arrElements.length; i++){
		oCurrent = arrElements[i];
		/*oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);*/
		oAttribute = oCurrent.getAttribute(strAttributeName);
		if(typeof oAttribute == "string" && oAttribute.length > 0){
			if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
				arrReturnElements.push(oCurrent);
			}
		}
	}
	return arrReturnElements;
}

document.getElementsByClassName = function(cl)
{
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++)
	{
		var classes = elem[i].className;
		if (myclass.test(classes)){retnode.push(elem[i]);}
	}
	return retnode;
}
/* END ELEMENT FUNCTIONS */


/* BEGIN POPUP FUNCTIONS */
function exitPop()
{
	try
	{
		switch(arguments[0])
		{
			case 0:
				window.onbeforeunload = null;
				break;
			case 1: /* newsletter signup */
				/* cmCreateConversionEventTag("Exit Checkout Try","2","Pop Up");
				window.open(location.protocol+"//"+location.hostname+"/email-updates.html?nst=2","emailupdates", "height=300, width=425, toolbar=no, location=no, resizeable=no, status=no, scrollbars=no, menubar=no");
				*/break;
		}
	}
	catch(ex){/*alert(ex.message);*/}
}
/* END POPUP FUNCTIONS */





/*temp place for sub menu and subheader functions*/
$(document).ready(function () {
    /*set up cachable variable for menu*/
    var submenu = $("#submenu");

    if (readCookie("lastShoppingPage") == null || readCookie("lastShoppingPage") == "") {
        createCookie("lastShoppingPage", "http://" + location.hostname + "/", 0);
    }

    $("#modalClose").live("click", function () {
        showHideModal("hide");
    });

    //show menu
    $("#tabMore").mouseenter(function (e) {
        submenu.show();
    });


    /*hide menu on mouse out*/
    submenu.mouseleave(function (e) {
        submenu.fadeOut();
    });

    /*add phone number*/
    var soldOutPhone = $('#divSoldOut .b').text();
    function updateSubHeadPhone() {
        $('#subhead_phone').text(soldOutPhone);
    }


    /*search with subheader*/
    var subsearch = $('#sub_search');
    $("#subhead_submit").click(function subSearch() {
        var subSearchString = subsearch.val();
        location.href = '/search.html?q=' + subSearchString;
    });

    /*allow user to just press enter*/
    subsearch.keydown(function (event) {
        var subSearchString = $('#sub_search').val();
        if (event.keyCode === 13) {
            $('#q').val(subSearchString);
            location.href = '/search.html?q=' + subSearchString;
        }
    });

    /*fire functions on doc. ready*/
    //updateSubHead();
    updateSubHeadPhone();
});


/*write content into TC guarantee modal*/
function writeModalContent(pageID, failPath, showTab) {
    var modalContentURL = "/ws/tcws.asmx/GetCMSContentBlockHTML?";
    var modalContentParams = "pPageID=" + pageID + "&pPageType=" + 1;
    
    showHideModal("show", guarantee_btn_modalContent);
    var modalNavTabItem = $('#modalLeftNav li');

    modalNavTabItem.removeClass('selectedModalNavTab');
    $(showTab).addClass('selectedModalNavTab');

    $.ajax({
        url: modalContentURL + modalContentParams,
        dataType: "xml",
        success: function (data) {
            $(data).each(function () {
                var modalString = $(this).text();
                $('#tcGuaranteeModal_inner').html(modalString);
            });
        },
        error: function () {
            window.open = failPath;
        }
    });
}


/*content skeleton*/
var modalLeftNav =
'<ul id="modalLeftNav">' +
    '<li id="modal_contactUsTab">Contact Us</li>' +
    '<li id="modal_guaranteeTab">Guarantee</li>' +
    '<li id="modal_faqTab">FAQ</li>' +
    '<li id="modal_buyTab">Buying Tickets</li>' +
'</ul>';

var guarantee_btn_modalContent =
'<a id="modalClose">x</a>' +
'<div id="tcGuaranteeModal_wrapper">' +
    modalLeftNav +
    '<div id="tcGuaranteeModal_inner"></div>' +
'</div>' +
'<div class="clearfixer"></div>';


/*in-page triggers*/
$("#guarantee").live("click", function() {
    writeModalContent(24, "/helpful-links/guarantee.html", "#modal_guaranteeTab");
});

$("#foot_guarantee").live("click", function () {
    writeModalContent(24, "/helpful-links/guarantee.html", "#modal_guaranteeTab");
});


/*event page triggers*/
$("#bvBox_buy").live("click", function () {
    writeModalContent(199778, "/helpful-links/faq.html", "#modal_buyTab");
});

$("#bvBox_faq").live("click", function () {
    writeModalContent(22, "/helpful-links/faq.html", "#modal_faqTab");
});

$("#bvBox_contact").live("click", function () {
    writeModalContent(21, "/helpful-links/contact-us.html", "#modal_contactUsTab");
});



/*in-modal triggers*/
$("#modal_guaranteeTab").live("click", function() {
    writeModalContent(24, "/helpful-links/guarantee.html", "#modal_guaranteeTab");
});

$("#modal_faqTab").live("click", function () {
    writeModalContent(22, "/helpful-links/faq.html", "#modal_faqTab");
});

$("#modal_aboutUsTab").live("click", function () {
    writeModalContent(23, "/helpful-links/guarantee.html", "#modal_aboutUsTab");
});

$("#modal_contactUsTab").live("click", function () {
    writeModalContent(21, "/helpful-links/contact-us.html", "#modal_contactUsTab");
});

$("#modal_buyTab").live("click", function () {
    writeModalContent(199778, "/helpful-links/contact-us.html", "#modal_buyTab");
});


/*cms accordion*/
$(document).ready(function () {
    //move this to config.js when ready
    var accordionIsEnabled = "true";
    if (accordionIsEnabled == "true") {
        var $extendedAccordionContent = $('.cms_accordian_group_content_extended');
        var $accordionContentGroup = $('.cms_accordian_content_group');
        var $accordionGroupHeader = $('.cms_accordian_group_header');

        $extendedAccordionContent.first().show();
        $accordionContentGroup.first().addClass('cms_selected_accordian_group');

        $accordionGroupHeader.click(function () {
            $extendedAccordionContent.hide();
            $accordionContentGroup.removeClass('cms_selected_accordian_group');
            $(this).parent().addClass('cms_selected_accordian_group');
            $(this).siblings().last().animate({
                height: 'toggle',
                opacity: 'toggle'
            }, "fast");
        });
    }
});
