	/*-------------------------------GLOBAL VARIABLES------------------------------------*/
	var siteDomain = document.location.href;
	var siteSpecific = "thegarden.thegarden";
	var siteInsider = "tg";
	var siteOmniture = "thegarden_s_code";
	
	if(siteDomain.indexOf("radiocity")>-1) {
		siteSpecific = "radiocity.thegarden";
		siteInsider = "rc";
		siteOmniture = "radiocity_s_code";
	}
	else if(siteDomain.indexOf("beacontheatre")>-1 || siteDomain.indexOf("beacontheater")>-1) {
		siteSpecific = "beacontheatre.thegarden";
		siteInsider = "bt";
		siteOmniture = "beacontheatre_s_code";
	}
	else if(siteDomain.indexOf("wamuatmsg")>-1) {
		siteSpecific = "wamuatmsg.thegarden";
		siteInsider = "wamu";
		siteOmniture = "wamu_s_code";
	}
	else if(siteDomain.indexOf("thechicagotheatre")>-1 || siteDomain.indexOf("thechicagotheater")>-1) {
		siteSpecific = "thechicagotheatre.thegarden";
		siteInsider = "ct";
		siteOmniture = "chicagotheatre_s_code";
	}
	else if(siteDomain.indexOf("knickspoetryslam")>-1) {
		siteSpecific = "knickspoetryslam.thegarden";
		siteOmniture = "knickspoetryslam_s_code";
	}
	else if(siteDomain.indexOf("msg.com") > -1) {
	  if (siteDomain.indexOf("blogs") > -1) {
	    if (siteDomain.indexOf("/howtoroll") > -1) {
	       siteSpecific = "howtoroll.thegarden";
	       siteOmniture = "howtoroll_s_code";
	    } else if (siteDomain.indexOf("/gameon") > -1) {
	       siteSpecific = "gameonblog.thegarden";
	       siteOmniture = "gameon_s_code";
	    } else if (siteDomain.indexOf("/themonitor") > -1) {
	       siteSpecific = "checkthemonitor.thegarden";
	       siteOmniture = "themonitor_s_code";
	    }
	  } else {
	    siteSpecific = "msg.thegarden";
		siteInsider = "msg";
		siteOmniture = "msg_s_code";
	  }
	}
	
	var ord=Math.random()*10000000000000000;
	ord = ord=Math.round(ord);
	var demandletsList = 'reProducts,commentCounter,userSubmission,quiz,blogArchives,latestFanCom,tagCloud,eventsSchedule,quickBuy,upcomingEvents,eventDates,eventAudio,relProducts,recEvents,eventLinks,siteSearch,searchResults,promotions,photoGallery,photoGalleryAll,userComments,poll,relGalleries,showNavigation,showHosts,daylifeCovers,daylifeCoversfb,gallery,dayLifeWidget,promoBox,jspWidget';
	
	/* start lightbox global variables */
	var lightBox;
	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;
	// declaring a global variable to rewrite in case of multiple lightboxes on  blog email to friend links
	var sendFriendBlogRefUrl;
	/* end lightbox global variables */

	
	
	
	/*-----------------------------------------------------------------------------------*/
	/* removing dom:loaded event observe */
	//document.observe('dom:loaded',function(){

	 
	 
	Event.observe (window, 'load', function() {
		
	 	demandletManager.load(demandletsList);
	 	rounded_corners();
	 	//below code overrides default google search values in templates
	 	if(siteDomain.indexOf("radiocity")>-1) {
			if ($('cx')) {$('cx').value = 'partner-pub-6982552296688877:jqdzk5-2cj5';
			if($('flashcontent-breakingnews'))getXMLbreakingNews();
			}
		} else if(siteDomain.indexOf("beacontheatre")>-1 || siteDomain.indexOf("beacontheater")>-1) {
			if ($('cx')) {$('cx').value = 'partner-pub-6982552296688877:t5lo26-ixl2';
			if($('flashcontent-breakingnews'))getXMLbreakingNews();
			}
		} else if(siteDomain.indexOf("wamuatmsg")>-1 || siteDomain.indexOf("wamuatmsg")>-1) {
			if ($('cx')) {$('cx').value='partner-pub-6982552296688877:d3jtty-v5a5';
			if($('flashcontent-breakingnews'))getXMLbreakingNews();
			}
		} else if(siteDomain.indexOf("thechicagotheatre")>-1 || siteDomain.indexOf("thechicagotheater")>-1) {
			if ($('cx')) {$('cx').value='partner-pub-6982552296688877:5u30bq-fzjg';
			if($('flashcontent-breakingnews'))getXMLbreakingNews();
			}
		} else if(siteDomain.indexOf("thegarden")>-1 || siteDomain.indexOf("thegarden")>-1) {
			if ($('cx')) {$('cx').value = '008862950578594113492:njfbmskcpku';
			if($('flashcontent-breakingnews'))getXMLbreakingNews();
			}
		}  
		$$('a.btn-buy-now').each(function(elem) {
			if (elem.href.indexOf('ticketmaster.com') > -1) {
			elem.onclick = function(elem){ 
				window.open(pageTracker._getLinkerUrl(this.href)); 
				return false; }
			}
		})
		$$('a.btn-get-tickets').each(function(elem) {
			if (elem.href.indexOf('ticketmaster.com') > -1) {
			elem.onclick = function(elem){ 
				window.open(pageTracker._getLinkerUrl(this.href)); 
				return false; 
				}
			}
		})
		$$('a.btn-get-tickets-large').each(function(elem) { 
			if (elem.href.indexOf('ticketmaster.com') > -1) {
				elem.onclick = function(elem){
					window.open(pageTracker._getLinkerUrl(this.href));
					return false;
				}
			}
		})
		
	});
	
	
function promoMessageModal() {
		var url = '/ajax/interstitial.jsp';

		new Ajax.Request(url, {
				onFailure: function(){
					return;
				},
				onSuccess: function(xhr){
					var firstNode = get_firstchild(xhr.responseXML.documentElement);
					var x = xhr.responseXML.getElementsByTagName(firstNode.nodeName);
					if (!x.length || x[0].nodeName.toLowerCase() == 'xml') {
						return; 
					} else {
						var promoData = xhr.responseXML.getElementsByTagName('interstitials')[0];
						var promoID = getNodeValueByChildName(promoData, 'interstitial_id');
						if (readCookie('promo-lb') && readCookie('promo-lb') == promoID) {
					
		  					return;
						} else {
					
							createCookie('promo-lb', promoID, (8/100));
						}
						var tmp = new Element('a');  
						tmp.data = promoData;
						tmp.href = '/ipui/demandlets/layout/promoBox.html'
						lightBox = new lightbox(tmp, {
							oncomplete: function(){
								var tmpDiv = new Element('div');
								tmpDiv.innerHTML = $('lbContent').innerHTML;
								
								tmpDiv.getElementsByTagName('h2')[0].innerHTML = (getNodeValueByChildName(tmp.data, 'lightbox_title')) ? getNodeValueByChildName(tmp.data, 'lightbox_title') : ''
								var closeButtonHldr = new Element('span');
								var closeButton = new Element('a');
								closeButton.id = "lbclose"
								closeButton.href = "#";
								
								closeButtonHldr.appendChild(closeButton);
								tmpDiv.getElementsByTagName('h2')[0].appendChild(closeButtonHldr);
								
								var gamesData = tmp.data.getElementsByTagName('game');
								var gamesDiv = tmpDiv.getElementsByTagName('div')[1];
								var gamesTmp = new Element('div');
								var template = new Template(gamesDiv.innerHTML.replace(/#%7B([a-zA-Z0-9_-]+)%7D/gi, "#{$1}"));
								for (var i =0; i<gamesData.length; i++) {
									gamesTmp.innerHTML += template.evaluate( {
										teamnameclass : getNodeValueByChildName(gamesData[i], 'team_name') ? getNodeValueByChildName(gamesData[i], 'team_name').toLowerCase().replace(' ','') + '-lg': '',
										teamname: getNodeValueByChildName(gamesData[i], 'team_name') ? getNodeValueByChildName(gamesData[i], 'team_name') : '',
										oppname: getNodeValueByChildName(gamesData[i], 'opponent_name') ? getNodeValueByChildName(gamesData[i], 'opponent_name'): '',
										channel: getNodeValueByChildName(gamesData[i], 'network_name') ? getNodeValueByChildName(gamesData[i], 'network_name'): '',
										time: getNodeValueByChildName(gamesData[i], 'time') ? getNodeValueByChildName(gamesData[i], 'time'): '',
										moreinfolk: getNodeValueByChildName(gamesData[i], 'link') ? getNodeValueByChildName(gamesData[i], 'link'): '',
										moreinfo: getNodeValueByChildName(gamesData[i], 'text') ? getNodeValueByChildName(gamesData[i], 'text'): ''
										}
								)
						} 
								tmpDiv.getElementsByTagName('div')[1].innerHTML = gamesTmp.innerHTML; 
								$('lbContent').innerHTML = tmpDiv.innerHTML;
								$('lbclose').onclick = function() {closeLightBox(); return false; }

								if (getNodeValueByChildName(tmp.data, 'custom_html') && getNodeValueByChildName(tmp.data, 'custom_html') != '') {

									var customDiv = new Element('div');
									customDiv.className = "custom-html";
									customDiv.innerHTML = getNodeValueByChildName(tmp.data, 'custom_html');
									$('lbContent').getElementsByTagName('div')[0].appendChild( customDiv );
								}
								
		
								
								}
						})
				}
			}
		})

	}


	
	function makeXML(content) 
	{
		var xmlDoc;
		try 
		{ //IE
		    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.loadXML(content);
		}
		catch(e) 
		{ 
			try 
			{ //The Rest
			
				xmlDoc = (new DOMParser()).parseFromString(content, "text/xml");
		  	}
		  	catch(e){}
		}
		return xmlDoc;
	}
	
	function handleResponse(response)
	{ 	//extract xml from HTML response or XML response - fix for .nvManaged caching issue
		return (! (('responseXML' in response) && response.responseXML != null) 
						&& response.responseXML.firstChild ) ? makeXML(response.responseText) : response.responseXML;
	};
	
	
	
	//cdaCommon.js
 	var server_time='';
 	
	function setSeatingId() {
		var seatingId = getMetaValue('seating_id');
		if (seatingId) {
			var lnk = $('seating-menu');
			if (lnk) {
				lnk.onclick = function() {
					this.href += '?seating_id='+seatingId;
				}
			}
		}
	};
	function addMetaNode(name, content) {
		if (!name || !content) return;
		var head = document.getElementsByTagName('head');
		if (head.length) {
			var metaTag = document.createElement('meta');
			metaTag.setAttribute('name', name);
			metaTag.setAttribute('content', content);
			head[0].appendChild(metaTag);
		}
	};
	function sfHover(){
		if(document.getElementById('main_navigation')){
			new Ajax.Request
			(
			'/global/subnav.xml',
			{
				method: 'get',
				parameters:'nC='+noCache(),
				onFailure:ajaxRequest_Error,
				onSuccess:function(t){
					var mainNav = $('main_navigation');
					mainNav.innerHTML=renderMainNavigation(t,0);
					mainNav.firstChild.lastChild.firstChild.className += ' last';
					setSeatingId();
				}
			});	
		}
	};
	function sfIeHover(){
		if(document.getElementById('main_navigation')){
			new Ajax.Request
			(
			'/global/subnav.xml',
			{
				method: 'get',
				parameters:'nC='+noCache(),
				onFailure:ajaxRequest_Error,
				onSuccess:function(t){
					$('main_navigation').innerHTML=renderMainNavigation(t,0);
					$('main_navigation').firstChild.lastChild.firstChild.className += ' last';
					setSeatingId();
					// Support the standard nav without a class of nav.
					var el = document.getElementById("nav");
					if(!/\bnav\b/.test(el.className) && el.tagName == "UL")
						setIeHover(el);
				
					// Find all unordered lists.
					var ieNavs = document.getElementsByTagName('ul');
					for(i=0; i<ieNavs.length; i++) {
						var ul = ieNavs[i];
						// If they have a class of nav add the menu hover.
						if(/\bnav\b/.test(ul.className))
							setIeHover(ul);
					}
				}
			});	
		}
	};
	function setIeHover(nav) {
		var ieULs = nav.getElementsByTagName('ul');
		if (navigator.appVersion.substr(22,3)!="5.0") {
			// IE script to cover <select> elements with <iframe>s
			for (j=0; j<ieULs.length; j++) {
				var ieMat=document.createElement('iframe');
				if(document.location.protocol == "https:")
					ieMat.src="//0";
				else if(window.opera != "undefined")
					ieMat.src="";
				else
					ieMat.src="javascript:false";
				ieMat.scrolling="no";
				ieMat.frameBorder="0";
				ieMat.style.width=ieULs[j].offsetWidth+"px";
				ieMat.style.height=ieULs[j].offsetHeight+"px";
				ieMat.style.zIndex="-1";
				ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
				ieULs[j].style.zIndex="101";
			}
			// IE script to change class on mouseover
			var ieLIs = nav.getElementsByTagName('li');
			for (var i=0; i<ieLIs.length; i++) {
				if (ieLIs[i]) { 
					// Add a sfhover class to the li
					ieLIs[i].onmouseover=function() { 
						if(!/\bsfhover\b/.test(this.className)) {
							this.className+=" sfhover";
						}
					}
					ieLIs[i].onmouseout=function() {
						if(!this.contains(event.toElement)) {
							this.className=this.className.replace(' sfhover', '');
						}
					}
				}
			}
		}
	};
	
	function rounded_corners() {
		$A(document.getElementsByClassName('rounded')).each(function(el,i){
		new Insertion.Top(el, '<b class="tl"></b><b class="bl"></b>');
		new Insertion.Bottom(el, '<b class="tr"></b><b class="br"></b>');
		});
	};
	
	function prepareSendLinks(){
		if ($('send-email')) {
			$('send-email').onclick = function() { 
				newWindow('/send-to-friend.html','sendtoFriend',320,360,false,false,true);
        		this.blur();
        		return false; 
        	}
		}
		if ($('send-im')) {
			$('send-im').onclick = function() {  
				var siteUrl = window.location.href;
	   			var siteName = window.location.href.split('://')[1].split('/')[0];
    			sendIM(siteName, siteUrl); 
    			return false; 
  			}
    	}
    	if ($('send-print')) {
	    	$('send-print').onclick = function() { 
	    		window.print(); 
	    		return false; 
	    	}
	    }
	};
	function autoRedirect(siteIdentifier,redirectURL){if(readCookie('defaultSite')==siteIdentifier) document.location.href=redirectURL;};
	function siteRedirect(siteURL){document.location.href=siteURL;};
	function prepareSendFriendLink(lnk, f) {
		if (lnk) {
			lnk.onclick = function() {
				if (f) { 
					var s = $('response_panel');
					submit_FriendPopup(f, s);
				}
				return false;
			}
		}
	};
	function submit_FriendPopup(formObj,responseElem){
		if (!formObj) return false;
		if (checkForm(formObj)) {
			var loc = window.opener.location.href;
			if (!getMetaValue('siteIdentifier')) {
				var site = new Site();
				var site_id = site.getSiteId();
			} else {
				var site_id = getMetaValue('siteIdentifier');
			}
            loc = loc.split('://');
            var link = loc[1];
			var params = formObj.serialize();
			new Ajax.Request(
				'/ajax/sendFriend.jsp', 
				{
					parameters:'nC='+noCache()+'&'+params+'&site_id='+site_id+'&link='+link,
					onSuccess: function(xml) 
					{
						Element.hide(formObj);
						if (responseElem) {
							var response = xml.responseXML.getElementsByTagName(get_firstchild(xml.responseXML.documentElement).nodeName);
							var responseContent = responseElem.innerHTML;
							if (getNodeValue(response[0]) == 'success') 
								responseElem.innerHTML = responseContent.replace('<!--response-->','Thank you, your message has been sent.');
							else
								responseElem.innerHTML = responseContent.replace('<!--response-->','Sorry there was a problem with your request. Please try again later.');
							Element.show(responseElem);
						}
					}
				}
			);
		}
	};
	function sendmailSubmit(fObj) {
		if (checkForm(fObj)) {
			fObj.submit();
		}
	};
	function open_ReminderPopup(showtitle, episode, time, scheduleid) {
		newWindow('/reminder.html?showtitle='+showtitle+'&episode='+episode+'&time='+time, scheduleid+'', 315,400,false,false,true);
	};
	function submit_ReminderPopup(formObj,hideDivObj,showDivObj){
		if (checkForm(formObj)){
			var params = formObj.serialize();
			new Ajax.Request(
				'/ajax/showReminderSave.jsp', 
				{
					method:'POST',
					parameters:'&nC'+noCache()+'&'+params+'&scheduleid='+window.name,
					onSuccess: function(xml) 
					{
						var response 		= xml.responseXML.getElementsByTagName(get_firstchild(xml.responseXML.documentElement).nodeName);
						var responseContent = showDivObj.innerHTML;
						if (getNodeValue(response[0]) == 'success') 
							showDivObj.innerHTML = responseContent.replace('<!--response-->','Thank you, your reminder will be sent.');
						else
							showDivObj.innerHTML = responseContent.replace('<!--response-->','Sorry there was a problem with your request. Please try again later.');
						Element.hide(hideDivObj);
						Element.show(showDivObj);
					}
				}
			);
		}
	};
		   	
	function ajaxRequest_Error(){alert("An error occurred during the process");};
	function search_Submit(sObj){
		if($F(sObj)!=''){
			if(document.getElementById('page_id')) 
				document.location.href='/search.jsp?kword='+$F(sObj)+'&page_id='+$F('page_id');
			else 
				document.location.href='/search.jsp?kword='+$F(sObj);
		}
		else{
			alert('Please enter a keyword');
		}
	};
	
	function search_Page(pNum,sObj){$('page_id').value=pNum;search_Submit(sObj);};							

	function search_tvSchedule(fObj){
		if(checkForm(fObj)){
			new Ajax.Request
			(
				'/ajax/tvScheduleProcess.jsp',
				{
					method:'POST',
					parameters:'&nC'+noCache()+'&keyword='+$F(fObj.id + '_keyword'),
					onSuccess:function (xml)
					{
						display_tvScheduleResults(xml);
					}
				}
			);
		}
	};
	
	function signIn_success(userId, userName, userEmail, userFname, userLname){createCookie('olio', userEmail+"|"+userId+"|"+userName+"|"+userFname+"|"+userLname, 30);};
	function signOut(){eraseCookie('olio');window.location.reload();};
	
	function registerUser(){
		if(checkForm($('registration_form'))){
			if($F('password')!=$F('re_password')){
				alert('Passwords do not match');
			}
			else{
				if(!$('confirm').checked){
					alert('Please agree to terms and conditions');
				}
				else{
					new Ajax.Request
					(
						'/ajax/registerProcess.jsp',
						{
							method:'POST',
							parameters: $('registration_form').serialize(),
							onFailure:ajaxRequest_Error,
							onSuccess:function (xml)
							{
								var insertStat 	= xml.responseXML.getElementsByTagName('insert')[0].firstChild ? xml.responseXML.getElementsByTagName('insert')[0].firstChild.data : '';
								var error 		= xml.responseXML.getElementsByTagName('error')[0].firstChild ? xml.responseXML.getElementsByTagName('error')[0].firstChild.data : 'Unknown error';
								if(insertStat==' Success '){
									var url			= document.location.href;
									var aryCurLoc 	= url.split('/');
									aryCurLoc[aryCurLoc.length - 1] = 'registerthankyou.jsp';
									window.location = aryCurLoc.join('/');
								}
								else{
									alert('The following error occured while trying to create your user account:\n' + error);
								}
							}
						}
					);
				}
			}
		}
	};
	
	function signIn(){
		var siteUrl = getMetaValue('siteUrl');
		var loc = '';
		if (siteUrl) {
			loc = 'http://'+siteUrl;
		}
		var loginHTML = ''
			+	'<div style="clear:both">'
			+	'</div>'
			+	'<form id="loginForm">'
			+	'<table width="320px">'
			+		'<tr>'
			+			'<td colspan="3">'
			+				'<table>'
			+					'<tr>'
			+						'<td align="right" class="grey 11px" width="130px">'
			+							'Email Address:'
			+						'</td>'
			+						'<td align="left">'
			+							'<input type="text" required alert="Please enter an email address." id="login_email">'
			+						'</td>'
			+					'</tr>'
			+					'<tr>'
			+						'<td colspan="2">'
			+							'<div style="clear:both">'
			+							'</div>'
			+						'</td>'
			+					'</tr>'
			+					'<tr>'
			+						'<td align="right" class="grey 11px">'
			+							'Password:'
			+						'</td>'
			+						'<td align="left">'
			+							'<input type="password" required alert="Please enter password." id="login_password">'
			+						'</td>'
			+					'</tr>'
			+				'</table>'
			+			'</td>'
			+		'</tr>'
			+		'<tr>'
			+			'<td colspan="3">'
			+				'<div style="clear:both">'
			+				'</div>'
			+			'</td>'
			+		'</tr>'
			+		'<tr>'
			+			'<td width="70px">&nbsp;</td>'
			+			'<td align="left">'
			+				'<a href="#" onclick="Dialog.closeInfo();forgotPassDialog(); return false;" class="red 11px">Forgot your password?</a>'
			+			'</td>'
			+			'<td align="right">'
			+				'<a href="'+loc+'/registration.html" class="red 11px">Register</a>'
			+			'</td>'
			+		'</tr>'
			+	'</table>'
			+	'</form>'
			+	'<div style="clear:both">'
			+	'</div>';

		Dialog.confirm
		(
			loginHTML,
			{
				className:"alphacube",
				width:400, 
				okLabel: "Login", cancelLabel: "Cancel",
	    		onOk:function(win)
				{
					var login_email = $('login_email').value;
					var login_password = $('login_password').value;
					if(checkForm($('loginForm'))) {						
						new Ajax.Request
						(
							'/ajax/loginProcess.jsp',
							{
								method:'POST',
								parameters:'&email=' + login_email + '&password=' + login_password,
								onFailure:ajaxRequest_Error,
								onSuccess:function (xml){
									var response 	= '';
									var userId 		= '';
									var userEmail	= '';
									var userFname	= '';
									var userLname	= '';
									var reasonText	= '';

									if(xml){
										response = xml.responseXML.getElementsByTagName('response')[0].firstChild ? xml.responseXML.getElementsByTagName('response')[0].firstChild.data : 'error';
										if(response == 'success'){
											userId 		= xml.responseXML.getElementsByTagName('identifier')[0].firstChild ? xml.responseXML.getElementsByTagName('identifier')[0].firstChild.data : 'Unknown';
											userName	= xml.responseXML.getElementsByTagName('username')[0].firstChild ? xml.responseXML.getElementsByTagName('username')[0].firstChild.data : 'Unknown';
											userEmail 	= login_email;
											userFname	= xml.responseXML.getElementsByTagName('firstname')[0].firstChild ? xml.responseXML.getElementsByTagName('firstname')[0].firstChild.data : 'Unknown';
											userLname 	= xml.responseXML.getElementsByTagName('lastname')[0].firstChild ? xml.responseXML.getElementsByTagName('lastname')[0].firstChild.data : 'Unknown';
										}
										else{
											reasonText = xml.responseXML.getElementsByTagName('cause')[0].firstChild ? xml.responseXML.getElementsByTagName('cause')[0].firstChild.data : 'Unknown';
										}
									}
									else{
										alert('An error occurred while trying to log in.\nSorry for the inconvenience.');
										return false;
									}

									if(response != 'success'){
										alert(reasonText);
										return false;
									}
									signIn_success(userId, userName, userEmail, userFname, userLname); 
									Dialog.closeInfo();
									window.location.reload();
									return true;
								}
							}
						);
					}
					else{
						return false;
					}
				}
			}
		);
	};

	function forgotPassDialog()	
	{
		var loginHTML = ''
			+	'<div style="clear:both">'
			+	'</div>'
			+	'<form id="forgotPassForm">'
			+	'<table width="400">'
			+		'<tr>'
			+			'<td class="grey 11px" align="right">'
			+				'Email Address:'
			+			'</td>'
			+			'<td align="left">'
			+				'<input required alert="Please enter your email address" type="text" id="forgotPass_email">'
			+			'</td>'
			+		'</tr>'
			+	'</table>'
			+	'</form>'
			+	'<div style="clear:both">'
			+	'</div>';

		Dialog.confirm
		(
			loginHTML,
			{
				className:"alphacube",
				width:400, 
				okLabel: "Reset", cancelLabel: "Cancel",
	    		onOk:function(win)
				{
					var email = $F('forgotPass_email');

					if(checkForm($('forgotPassForm'))) 
					{
						var site_id = getMetaValue('siteIdentifier');
						new Ajax.Request
						(
							'/ajax/resetPasswordProcess.jsp',
							{
								method:'POST',
								parameters:'&email=' + email + '&site_id=' + site_id,
								onFailure:ajaxRequest_Error,
								onSuccess:function (xml){
									var response = '';

									if (xml){
										response = xml.responseXML.getElementsByTagName('response')[0].firstChild ? xml.responseXML.getElementsByTagName('response')[0].firstChild.data : 'Error';
										if (response != 'success'){
											reasonText = xml.responseXML.getElementsByTagName('cause')[0].firstChild ? xml.responseXML.getElementsByTagName('cause')[0].firstChild.data : 'Unknown';
											alert(reasonText);
											return false;
										}
									}
									else{
										alert('An error occurred while trying to reset the password.\nSorry for the inconvenience.');
										Dialog.closeInfo();
										return false;
									}

									alert('The password for this account has been reset and the new password has been sent to the email address.');
									Dialog.closeInfo();
									return true;
								}
							}
						);
					}
					else{
						return false;
					}
				}
			}
		);
	};

	function loadProfilePassword(){profilePassword=Math.floor(Math.random()*999999999999)+'';$('password').value=profilePassword;$('re_password').value=profilePassword;};

	function saveProfile(){
		if(checkForm($('profile_form'))) 
		{
			if($F('password')!=$F('re_password')){
				alert('Passwords do not match');
			}
			else{
				if(profilePassword == $('password').value){
					$('password').disabled 		= true;
					$('re_password').disabled 	= true;
				}

				new Ajax.Request
				(
					'/ajax/registerProcess.jsp',
					{
						method:'POST',
						parameters: $('profile_form').serialize(),
						onFailure:ajaxRequest_Error,
						onSuccess:function (xml){
							$('password').disabled 				= false;
							$('re_password').disabled 			= false;
							$('saveSuccess').style.visibility	= 'visible';
						}
					}
				);
			}
		}
	};
	
	function submit_sendUsYourComment(formObj){
		if(checkForm(formObj)){
			new Ajax.Request('/ajax/sendEmail.jsp',{
							parameters: formObj.serialize(true),
							onComplete:function(xml){ 
								Element.hide('feedback-form');
								Element.show('feedback-response');
							}
						}
					);
		}
	};
	
	function render_timeZoneList(dObj){
		removeAllOptions(dObj);
		new Ajax.Request
		(
			'/ajax/data/timeZoneList.xml',
			{
				method:'POST',
				parameters:'&nC'+noCache(),
				onFailure:function(err){
					addOption(dObj,'No Timezones Found','',false);
				},
				onSuccess:function(xml){ 
					xml.responseXML.getElementsByTagName(firstNode.nodeName).each(function(xmlNode)
					{
						var category_id 		= getNodeValue(xmlNode,getNodeAttribute(xmlNode,'pk'));
						var program_title 		= getNodeValue(xmlNode,'program_title');
						var program_date_time 	= getNodeValue(xmlNode,'program_date_time');
						addOption(dObj,program_title,category_id,false);
					});
				}
			}
		);
	};

	function render_programList(dObj){
		removeAllOptions(dObj);
		new Ajax.Request
		(
			'/ajax/data/programList.xml',
			{
				method:'POST',
				parameters:'&nC'+noCache(),
				onFailure:function(err)
				{
					addOption(dObj,'No Programs Found','',false);
				},
				onSuccess:function(xml){ 
					var firstNode 	= get_firstchild(xml.responseXML.documentElement);
					var x 			= xml.responseXML.getElementsByTagName(firstNode.nodeName);
					for (var i=0;i<x.length;i++){
						var category_id 		= getNodeValue(x[i],'category_id');
						var program_title 		= getNodeValue(x[i],'display_name');
						addOption(dObj,program_title,category_id,false);
					};
				}
			}
		);
	};	

	function render_CountryList(dObj){
		removeAllOptions(dObj);
		new Ajax.Request
		(
			'/ajax/data/countryList.xml',
			{
				method:'POST',
				asynchronous:false,
				parameters:'&nC'+noCache(),
				onFailure:function(err)
				{
					addOption(dObj,'No Countries Found','',false);
				},
				onSuccess:function(xml){ 
					var x = xml.responseXML.getElementsByTagName('country');
					for (var i=0;i<x.length;i++){
						var country = getNodeValueByChildName(x[i],'name');
						addOption(dObj,country,country,false);
					};
				}
			}
		);
	};	

	function renderMainNavigation(req,parent_id){
		var tmp			= '';
		var subTmp		= '';
		var subNodes	= '';
		var k			= req.responseXML.getElementsByTagName('nav');
		var navLen		= k.length;
		var topLevelCnt	= 0;
		for(var j=0;j<k.length;j++){
			tmp					= '';
			subNodes			= '';
			var nLabel			= getNodeAttribute(k[j],'label');
			var nUrl			= getNodeAttribute(k[j],'url');
			var popup			= getNodeAttribute(k[j],'popup');
			var popupWidth		= getNodeAttribute(k[j],'width');
			var popupHeight		= getNodeAttribute(k[j],'height');
			var popupScroll		= getNodeAttribute(k[j],'scroll');
			var popupToolbar	= getNodeAttribute(k[j],'toolbar');
			var popupResize		= getNodeAttribute(k[j],'resize');
			var nParent			= getNodeAttribute(k[j],'parent_id');
			var nOrder			= getNodeAttribute(k[j],'order');
			var nId				= getNodeAttribute(k[j],'nav_id');
			var topImg			= 'top_'+nId;
			if(nParent==parent_id){
				if(parent_id==0){
					topLevelCnt++;
					if(popup=='1') {
						tmp += '<a class="item'+ topLevelCnt + '" href="' + nUrl + '" target="_blank">';
					} else {
						if (/seating/i.test(nLabel)) {
							tmp += '<a id="seating-menu" class="item' + topLevelCnt + '" href="'+nUrl+'">';
						} else { 
							tmp += '<a class="item'+ topLevelCnt + '" href="' + nUrl + '">';
						}
					}
					tmp += '<span>' + nLabel + '</span></a>';
					subNodes = renderMainNavigation_sub1(req,nId,topImg);
					if(subNodes!='')
						tmp+='<ul>'+subNodes+'</ul>';
				}
			}
			if(tmp!='')
				subTmp += '<li class="item'+ topLevelCnt + '">'+tmp+'</li>';
		}
		return '<ul id="nav" class="nav">'+subTmp+'</ul>';
	};
	
	function renderMainNavigation_sub1(req,parent_id,mainImage){
		var tmp			= '';
		var subTmp		= '';
		var subNodes	= '';
		var k			= req.responseXML.getElementsByTagName('nav');
		for(var j=0;j<k.length;j++){
			tmp	='';
			subNodes='';
			var nLabel			= getNodeAttribute(k[j],'label');
			var nUrl			= getNodeAttribute(k[j],'url');
			var popup			= getNodeAttribute(k[j],'popup');
			var popupWidth		= getNodeAttribute(k[j],'width');
			var popupHeight		= getNodeAttribute(k[j],'height');
			var popupScroll		= getNodeAttribute(k[j],'scroll');
			var popupToolbar	= getNodeAttribute(k[j],'toolbar');
			var popupResize		= getNodeAttribute(k[j],'resize');
			var nParent			= getNodeAttribute(k[j],'parent_id');
			var nOrder			= getNodeAttribute(k[j],'order');
			var nId				= getNodeAttribute(k[j],'nav_id');
			if(nParent==parent_id){
				tmp+='<li>';
				if(popup=='1')
					tmp+='<a href="'+nUrl+'" target="_blank">' + nLabel + '</a>';
				else
					tmp+='<a href="'+nUrl+'">' + nLabel + '</a>';
					
				subNodes=renderMainNavigation_sub2(req,nId);
				if(subNodes!='')
					tmp+='<ul>'+subNodes+'</ul>\n';
			}
			if(tmp!='')
				subTmp+=tmp+'</li>\n';
		}
		return subTmp;
	};
	
	function renderMainNavigation_sub2(req,parent_id){
		var tmp='';
		var subTmp='';
		var k=req.responseXML.getElementsByTagName('nav');
		for (var j=0;j<k.length;j++){
			tmp='';
			var nLabel=getNodeAttribute(k[j],'label');
			var nUrl=getNodeAttribute(k[j],'url');
			var popup=getNodeAttribute(k[j],'popup');
			var popupWidth=getNodeAttribute(k[j],'width');
			var popupHeight=getNodeAttribute(k[j],'height');
			var popupScroll=getNodeAttribute(k[j],'scroll');
			var popupToolbar=getNodeAttribute(k[j],'toolbar');
			var popupResize=getNodeAttribute(k[j],'resize');
			var nParent=getNodeAttribute(k[j],'parent_id');
			var nOrder=getNodeAttribute(k[j],'order');
			var nId=getNodeAttribute(k[j],'nav_id');
			if(nParent==parent_id){
				tmp+='<li>';
				if(popup=='1'){
					tmp+='<a href="'+nUrl+'" target="_blank">' + nLabel + '</a>';
				}
				else{
					tmp+='<a href="'+nUrl+'">' + nLabel + '</a>';
				}
				if(tmp!=''){
					tmp+='</li>\n';
				}
			}
			if(tmp!=''){
				subTmp+=tmp;
			}
		}
		return subTmp;
	};
	
	//ip_common.js
	function newWindow(wURL,wName,wWidth,wHeight,wScroll,wResizable,wCentered){
		var settings = 'height='+wHeight+',width='+wWidth+'scrollbars='+wScroll+',resizable='+wResizable;
		if(wCentered==true){
			lPosition	= (screen.width) ? (screen.width-wWidth)/2 : 0;
			tPosition	= (screen.height) ? (screen.height-wHeight)/2 : 0;	
			settings	+= ',left=' + lPosition + ',top=' + tPosition;
		}
		var nWindow	= window.open(wURL,wName,settings);
		nWindow.focus();
	};
	
	function open_win(link, win_name, params) {
		window.open(link,win_name.replace("'",""),params);
	};
	
	function disableContextMenu(event) {
		Event.stop(event); 
    	event.oncontextmenu = function(){return false;}
	};
		
	function truncateText_Append(txtString,len,append){
		  var trunc = txtString;
		  if (trunc.length > len){
		    trunc = trunc.substring(0, len);
		    trunc = trunc.replace(/\w+$/, '');
		    trunc += append;
		  }
		  return trunc;
	};

	function getPage(url){return url.substring(url.lastIndexOf('/') + 1);};
	
	function hasZero(value){
		if(value+0<10)
			return '0' + value;
		else
			return '' + value;
	};
	
	function noCache(){return Math.random(0, 1000)+'='+Math.random(0,1000);};
	function uniqueId(){var rndID = Math.random(0, 1000) + '';return rndID.replace('.','')};
	function addDays(myDate,days){return new Date(myDate.getTime() + days*24*60*60*1000);};	

	function getMetaValue(metaName){
		var metaArray = document.getElementsByTagName('meta');
		for(m=0;m<metaArray.length;m++){
			if(metaArray[m].name==metaName) {
				return metaArray[m].content;
				break;
			}	
		}
		return false;
	};
					
	function getFileExtension(fileName){
		if( fileName.length == 0 ) return ''; 
		var dot = fileName.lastIndexOf('.'); 
		if( dot == -1 ) return ''; 
		return fileName.substr(dot,fileName.length); 
	};

	function SearchAndReplace(Content, SearchFor, ReplaceWith){
	   var tmpContent = Content;
	   var tmpBefore = new String();   
	   var tmpAfter = new String();
	   var tmpOutput = new String();
	   var intBefore = 0;
	   var intAfter = 0;
	   if (SearchFor.length == 0) return;
	   while (tmpContent.toUpperCase().indexOf(SearchFor.toUpperCase()) > -1) {
	      intBefore = tmpContent.toUpperCase().indexOf(SearchFor.toUpperCase());
	      tmpBefore = tmpContent.substring(0, intBefore);
	      tmpOutput = tmpOutput + tmpBefore;
	      tmpOutput = tmpOutput + ReplaceWith;
	      intAfter = tmpContent.length - SearchFor.length + 1;
	      tmpContent = tmpContent.substring(intBefore + SearchFor.length);
	   }
	   return tmpOutput + tmpContent;
	};
	
	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);};
	
	function parseCookie() {
		var x = new Object();
		var y = readCookie('olio');
		if (y) {
			var tmp = y.split("|");
			if (tmp.length == 5) {
				x['userid'] = tmp[0]; 
				x['username'] = tmp[1];
				x['email'] = tmp[2];
				x['fname'] = tmp[3];
				x['lname'] = tmp[4];
			}
		}
		return x;
	};
	
	function loadScript(url, callback) {
		var f = arguments.callee;
		if (!f.queue) f.queue = {};
		var queue = f.queue;
		if (url in queue) {
			if (callback) {
				if (queue[url])
					queue[url].push(callback);
				else
					callback();
			}
			return;
		}
		queue[url] = callback ? [callback] : [];
		var script = document.createElement("script");
		script.type = "text/javascript";
		if (/WebKit/i.test(navigator.userAgent)) {
			var _timer = setInterval(function() {
				if (/loaded|complete/.test(document.readyState)) {
					clearInterval(_timer);
					while (queue[url].length) {
						queue[url].shift()();
					}
					queue[url] = null;
				}
			}, 1000);
		} else {
			script.onload = script.onreadystatechange = function() {
				if (script.readyState && script.readyState != "loaded" && script.readyState != "complete")
					return;
				script.onreadystatechange = script.onload = null;
				while (queue[url].length) {
					queue[url].shift()();
				}
				queue[url] = null;
			};
		}
		script.src = url;
		document.getElementsByTagName("head")[0].appendChild(script);
	};
	
	// ip_xml.js
	function getPropertyNodeByName(object,name){try{var propertyNode=object.getElementsByTagName(get_firstchild(object).nodeName);var propertyLen=propertyNode.length;for(var j=0;j<propertyLen;j++){switch(getNodeAttribute(propertyNode[j],'name')){case name:return getNodeValue(propertyNode[j]);break;}}}catch(err){return '';}};
	function getNodeValueByChildName(node,childname){var tmpString='';try{if(node.getElementsByTagName(childname)[0].firstChild.nodeValue=='null'){return '';}else{for(var i=0;i<node.getElementsByTagName(childname)[0].childNodes.length;i++){tmpString+=node.getElementsByTagName(childname)[0].childNodes[i].nodeValue;}return tmpString;}}catch(err){return '';}};
	function getNodeValue(node){var tmpString='';try{for(var i=0;i<node.childNodes.length;i++){tmpString+=node.childNodes[i].nodeValue;}return tmpString;}catch(err){return '';}};
	function getNodeChildObj(obj,tag){var tmpString='';try{if(obj.getElementsByTagName(tag)[0].firstChild.nodeValue=='null')return '';else{return obj.getElementsByTagName(tag);}}catch(err){return '';}};
	function getNodeName(obj){return obj.firstChild.nodeName;};
	function getNodeAttribute(obj,attr){try{return obj.getAttribute(attr);}catch(err){return '';}};
	function get_firstchild(n){try{var x=n.firstChild;while(x.nodeType!=1){x=x.nextSibling;}return x;}catch(err){return '';}};
	function hasChildElements(rootNode){try{for(var i=0;i<rootNode.childNodes.length;i++){if(rootNode.childNodes[i].nodeType == 1){return true;}}return false;}catch(err){return '';}};

	//ip_select.js
	function hasOptions(obj) 
	{
		if(obj!=null&&obj.options!=null)
			return true;
		else
			return false;
	};
	
	
	function selectMatchingOptions(obj,regex){selectUnselectMatchingOptions(obj,regex,'select',false);};
	function selectOnlyMatchingOptions(obj,regex){selectUnselectMatchingOptions(obj,regex,'select',true);};
	function unSelectMatchingOptions(obj,regex){selectUnselectMatchingOptions(obj,regex,'unselect',false);};
	
	function removeSelectedOptions(from){
		if(!hasOptions(from))
			return;
		if(from.type=="select-one")
			from.options[from.selectedIndex]=null;
		else
			for(var i=(from.options.length-1);i>=0;i--){
				var o=from.options[i];
				if(o.selected)
					from.options[i]=null;
			}
		from.selectedIndex=-1;
	};
	
	function removeAllOptions(from){
		if(!hasOptions(from))
			return;
		for(var i=(from.options.length-1);i>=0;i--)
			from.options[i]=null;
		from.selectedIndex=-1;
	};
	
	function addOption(obj,text,value,selected){if(obj!=null&&obj.options!=null)obj.options[obj.options.length]=new Option(text,value,selected);};
	
	function removeOption(fOBJ,value){
		for(i=0;i<fOBJ.options.length;i++){
			if(fOBJ.options[i].value==value)
				fOBJ.options[i]=null;
		}
	};
	
	function getSelectList(fOBJ){
		var pars='';
		for(i=0;i<fOBJ.length;i++){
			if(i>0)
				pars=pars+',';
			pars=pars+fOBJ.options[i].value;
		}
		return pars;
	};
	
	function getSelectListSelected(fOBJ){
		var pars='';
		var count=0;
		for(i=0;i<fOBJ.length;i++){
			if(fOBJ.options[i].selected==true){
				if(count>0)
					pars=pars+',';
				count++;
				pars=pars+fOBJ.options[i].value;
			}
		}
		return pars;
	};
	
	function display_Select(sOptions,sSelected){
		var tmpData='';
		var x=sOptions.split(',');
		for(var i=0;i<x.length;i++){
			var sltcd='';
			var items=x[i].split('|');
			if(items[0]==sSelected)
				sltcd='selected="selected"';
			tmpData+='<option value="'+items[0]+'" '+sltcd+'>'+items[1]+'</option>';
		}
		return tmpData;
	};
		
	// ip_form.xml
	var dfltValue   = '**NO VALUE**';
	var dfltChars   = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.?-()[]+=_-;:/#@$%&!,*<>\"\'\n\r ';
	var dfltMethod  = 'POST';
	
	function checkForm(object){
		errFlag = false;
	    for(var i=0;i<object.elements.length;i++){
	    	if(object.elements[i].attributes['id']){
				theO		= $(object.elements[i]);
				oType		= theO.type;
		        oName  		= theO.attributes['id'].value;
				theO.name 	= oName;
		        oValue 		= $F(theO);
			    (theO.attributes["required"]) ? oReqd=true : oReqd=false;
			   	(theO.attributes["alert"]) ? oAlert=theO.attributes['alert'].value : oAlert ='';
		       	(theO.attributes["chars"]) ? oChars=theO.attributes['chars'].value : oChars=dfltChars;
		        (theO.attributes["editor"]) ? oEditor=true : oEditor=false;
		        (theO.attributes["parent"]) ? oParent=theO.attributes['parent'].value : oParent='';
				(theO.attributes["minLen"]) ? oMin=theO.attributes['minLen'].value : oMin=1;
		        (theO.attributes["maxLen"]) ? oMax=theO.attributes['maxLen'].value : oMax=100;
				if(oReqd==true||(document.getElementById(oParent)&&oParent!=''&&$(oParent).checked==true)){
		        	if(oEditor==true){
						var tmpValue = getEditor(oName);
						if(tmpValue.length<oMin || tmpValue.length>oMax){
							errFlag=true;
							if(oAlert!='') alert(oAlert);
							break;
						}
		        	}
		        	else {
			            if(oName.toLowerCase().indexOf('email')>-1){ 
			                if(isValidEmail(oValue)==false) {
			                	errFlag = true;
								if(oAlert!='') alert(oAlert);
								break;
			                }
			             } 
			             else if(validate(oValue,oChars)==false||oValue.length<oMin||oValue.length>oMax){
			             	errFlag = true;
							if(oAlert!='') alert(oAlert);
							break;
			             }
			     	}
		        }
			}
	    }
		if(errFlag==false) 
			return true;
		else 
			return false;
	};
	function isValidEmail(string){if(string.length<1)return false;if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1){return true;}else{return false;}};
	function validate(strVl,strChrs){if(!strVl) return false;if(strVl==dfltValue)return false;if(strVl.length<1)return false;for(i=0;i<strVl.length;i++){if(strChrs.indexOf(strVl.charAt(i))==-1)return false;}return true;};	

	// ip_demandlet
	var demandletManager = {
		  loadJS: function(demandlet){
		  		var path = '/ipui/demandlets/';
				loadScript(path+demandlet+'.js',function(){demandletManager.start(demandlet);});		
		  },
		  loadDemandlet: function(demandlet){
		   		$$('div .'+demandlet).each(function(item){eval('initiate_' + demandlet + '(item);');});
		  }, 
		  load: function(demandlets){
		      	demandlets.split(',').each(function(demandlet){if($$('.'+demandlet).length>0) demandletManager.loadJS(demandlet);});
		  },
		  start: function(demandlet){
				if($$('div .'+demandlet).length>0) demandletManager.loadDemandlet(demandlet); 
		  },
		  setup: function(demandletObject,options){
		  	(options && (options.empty==false)) ? n='' : demandletObject.innerHTML 	= ''; //Updated to allow the retention of innerHTML content if empty:false is passed
			(demandletObject.getAttribute('id')) ? itemId=demandletObject.attributes['id'].value : itemId ='_'+uniqueId();
			demandletObject.setAttribute('id',itemId);
			return itemId;
		  }
	};
	//ip_date.js
	function isDate(p_Expression){return !isNaN(new Date(p_Expression));};

	function dateAdd(p_Interval, p_Number, p_Date){
		if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
		if(isNaN(p_Number)){return "invalid number: '" + p_Number + "'";}	
		p_Number = new Number(p_Number);
		var dt = new Date(p_Date);
		switch(p_Interval.toLowerCase()){
			case "yyyy": {
				dt.setFullYear(dt.getFullYear() + p_Number);
				break;
			}
			case "q": {
				dt.setMonth(dt.getMonth() + (p_Number*3));
				break;
			}
			case "m": {
				dt.setMonth(dt.getMonth() + p_Number);
				break;
			}
			case "y":
			case "d":
			case "w": {
				dt.setDate(dt.getDate() + p_Number);
				break;
			}
			case "ww": {
				dt.setDate(dt.getDate() + (p_Number*7));
				break;
			}
			case "h": {
				dt.setHours(dt.getHours() + p_Number);
				break;
			}
			case "n": {
				dt.setMinutes(dt.getMinutes() + p_Number);
				break;
			}
			case "s": {
				dt.setSeconds(dt.getSeconds() + p_Number);
				break;
			}
			case "ms": {
				dt.setMilliseconds(dt.getMilliseconds() + p_Number);
				break;
			}
			default: {
				return "invalid interval: '" + p_Interval + "'";
			}
		}
		return dt;
	};
	
	function dateDiff(p_Interval, p_Date1, p_Date2, p_firstdayofweek, p_firstweekofyear){
		if(!isDate(p_Date1)){return "invalid date: '" + p_Date1 + "'";}
		if(!isDate(p_Date2)){return "invalid date: '" + p_Date2 + "'";}
		var dt1 = new Date(p_Date1);
		var dt2 = new Date(p_Date2);
		var iDiffMS = dt2.valueOf() - dt1.valueOf();
		var dtDiff = new Date(iDiffMS);
		var nYears  = dt2.getUTCFullYear() - dt1.getUTCFullYear();
		var nMonths = dt2.getUTCMonth() - dt1.getUTCMonth() + (nYears!=0 ? nYears*12 : 0);
		var nQuarters = parseInt(nMonths/3);	
		var nMilliseconds = iDiffMS;
		var nSeconds = parseInt(iDiffMS/1000);
		var nMinutes = parseInt(nSeconds/60);
		var nHours = parseInt(nMinutes/60);
		var nDays  = parseInt(nHours/24);
		var nWeeks = parseInt(nDays/7);
		var iDiff = 0;		
		switch(p_Interval.toLowerCase()){
			case "yyyy": return nYears;
			case "q": return nQuarters;
			case "m": return nMonths;
			case "y": 
			case "d": return nDays;
			case "w": return nDays;
			case "ww":return nWeeks;	
			case "h": return nHours;
			case "n": return nMinutes;
			case "s": return nSeconds;
			case "ms":return nMilliseconds;
			default: return "invalid interval: '" + p_Interval + "'";
		}
	};

	function datePart(p_Interval, p_Date, p_firstdayofweek, p_firstweekofyear){
		if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
		var dtPart = new Date(p_Date);
		switch(p_Interval.toLowerCase()){
			case "yyyy": return dtPart.getFullYear();
			case "q": return parseInt(dtPart.getMonth()/3)+1;
			case "m": return dtPart.getMonth()+1;
			case "y": return dateDiff("y", "1/1/" + dtPart.getFullYear(), dtPart);			// day of year
			case "d": return dtPart.getDate();
			case "w": return dtPart.getDay();	// weekday
			case "ww":return dateDiff("ww", "1/1/" + dtPart.getFullYear(), dtPart);		// week of year
			case "h": return dtPart.getHours();
			case "n": return dtPart.getMinutes();
			case "s": return dtPart.getSeconds();
			case "ms":return dtPart.getMilliseconds();	// millisecond	// <-- extension for JS, NOT available in VBScript
			default: return "invalid interval: '" + p_Interval + "'";
		}
	};
	// REQUIRES: isDate()
	// NOT SUPPORTED: firstdayofweek (does system default)
	function weekdayName(p_Date, p_abbreviate){
		if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
		var dt = new Date(p_Date);
		var retVal = dt.toString().split(' ')[0];
		var retVal = Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[dt.getDay()];
		if(p_abbreviate==true){retVal = retVal.substring(0, 3)}	// abbr to 1st 3 chars
		return retVal;
	};
	// REQUIRES: isDate()
	function monthName(p_Date, p_abbreviate){
		if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
		var dt = new Date(p_Date);	
		var retVal = Array('January','February','March','April','May','June','July','August','September','October','November','December')[dt.getMonth()];
		if(p_abbreviate==true){retVal = retVal.substring(0, 3)}	// abbr to 1st 3 chars
		return retVal;
	};
	
	function DateAdd(p_Interval, p_Number, p_Date){return dateAdd(p_Interval, p_Number, p_Date);};
	function DateDiff(p_interval, p_date1, p_date2, p_firstdayofweek, p_firstweekofyear){return dateDiff(p_interval, p_date1, p_date2, p_firstdayofweek, p_firstweekofyear);};
	function DatePart(p_Interval, p_Date, p_firstdayofweek, p_firstweekofyear){return datePart(p_Interval, p_Date, p_firstdayofweek, p_firstweekofyear);};
	function getTimeFromDate(date_time){return hasZero(datePart('h', date_time)) + ":" + hasZero(datePart('n', date_time));};
	
	function parseDateObj(dateobj){
		var x = new Object();
		x['month'] = hasZero(dateobj.getMonth()-1);
		x['day'] = hasZero(dateobj.getDate());
		x['year'] = dateobj.getYear();
		x['hour'] = hasZero(dateobj.getHours());
		x['minute'] = hasZero(dateobj.getMinutes());
		x['second'] = hasZero(dateobj.getSeconds());
		return x;
	};
	
	function createDateObj(date_time){return new Date(Date.parse(date_time));};
	
	function convertTimeZone(dateObj, diff){
		var tmp = "";
		var plusminus = 1;
		if (diff.split("-").length > 1){
			tmp = diff.split("-")[1];
			plusminus = -1;
		} else if (diff.split("+").length > 1){
			tmp = diff.split("+")[1];
			plusminus = 1;
		}
		if (tmp.length){
			dateObj = dateAdd('n', plusminus * tmp.split(":")[1], dateObj);
			dateObj = dateAdd('h', plusminus * tmp.split(":")[0], dateObj);
		}
		return dateObj;
	};
	
	function convertToGMT(dateObj, diff){
		var tmp = "";
		var plusminus = 1;
		if (diff.split("-").length > 1){
			tmp = diff.split("-")[1];
			plusminus = 1;
		} else if (diff.split("+").length > 1){
			tmp = diff.split("+")[1];
			plusminus = -1;
		}
		if (tmp.length){
			dateObj = dateAdd('n', plusminus * tmp.split(":")[1], dateObj);
			dateObj = dateAdd('h', plusminus * tmp.split(":")[0], dateObj);
		}
		return dateObj;
	};
	function getServerTime() {
		var url = '/ajax/date.shtml';
		new Ajax.Request( url,
			{
				method:'get',
				asynchronous:false,
				parameters:'nC='+noCache(),
				onSuccess:function(dt){
					server_time = dt.responseText;
				}
			}
		);
	};
	function convertHours(p_Date) {
	    if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
	    var regHr = p_Date.getHours();
	    if (regHr == 0) regHr = 12;
	    else if (regHr > 12) regHr -= 12;
	    return regHr;
	};
	function showAMPM(p_Date) {
		if(!isDate(p_Date)){return "invalid date: '" + p_Date + "'";}
	    var amPM;
	    if (p_Date.getHours() < 12) amPM = 'AM';
	    else amPM = 'PM';
	    return amPM;
	};
	function dateInRange(dx, begin, end) {
	    if (!isDate(dx) || !isDate(begin) || !isDate(end)) { return false; }
	    return (dateDiff('n', begin, dx) >= 0 && dateDiff('n', dx, end) >= 0)?true:false;
	};
	/**
	 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
	 *
	 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
	 * http://www.opensource.org/licenses/mit-license.php
	 *
	 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
	 *   legal reasons.
	 */
	if(typeof deconcept=="undefined"){var deconcept=new Object();}
	if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
	if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
	deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
	this.DETECT_KEY=_b?_b:"detectflash";
	this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params=new Object();
	this.variables=new Object();
	this.attributes=new Array();
	if(_1){this.setAttribute("swf",_1);}
	if(id){this.setAttribute("id",id);}
	if(w){this.setAttribute("width",w);}
	if(h){this.setAttribute("height",h);}
	if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
	this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
	if(c){this.addParam("bgcolor",c);}
	var q=_8?_8:"high";
	this.addParam("quality",q);
	this.setAttribute("useExpressInstall",_7);
	this.setAttribute("doExpressInstall",false);
	var _d=(_9)?_9:window.location;
	this.setAttribute("xiRedirectUrl",_d);
	this.setAttribute("redirectUrl","");
	if(_a){this.setAttribute("redirectUrl",_a);}};
	deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
	this.attributes[_e]=_f;
	},getAttribute:function(_10){
	return this.attributes[_10];
	},addParam:function(_11,_12){
	this.params[_11]=_12;
	},getParams:function(){
	return this.params;
	},addVariable:function(_13,_14){
	this.variables[_13]=_14;
	},getVariable:function(_15){
	return this.variables[_15];
	},getVariables:function(){
	return this.variables;
	},getVariablePairs:function(){
	var _16=new Array();
	var key;
	var _18=this.getVariables();
	for(key in _18){_16.push(key+"="+_18[key]);}
	return _16;},getSWFHTML:function(){var _19="";
	if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
	if(this.getAttribute("doExpressInstall")){
	this.addVariable("MMplayerType","PlugIn");}
	_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
	_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
	var _1a=this.getParams();
	for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
	var _1c=this.getVariablePairs().join("&");
	if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
	}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
	_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
	_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
	var _1d=this.getParams();
	for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
	var _1f=this.getVariablePairs().join("&");
	if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
	return _19;
	},write:function(_20){
	if(this.getAttribute("useExpressInstall")){
	var _21=new deconcept.PlayerVersion([6,0,65]);
	if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
	this.setAttribute("doExpressInstall",true);
	this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
	document.title=document.title.slice(0,47)+" - Flash Player Installation";
	this.addVariable("MMdoctitle",document.title);}}
	if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
	var n=(typeof _20=="string")?document.getElementById(_20):_20;
	n.innerHTML=this.getSWFHTML();return true;
	}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
	return false;}};
	deconcept.SWFObjectUtil.getPlayerVersion=function(){
	var _23=new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins&&navigator.mimeTypes.length){
	var x=navigator.plugins["Shockwave Flash"];
	if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
	}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
	catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
	_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
	catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
	catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
	return _23;};
	deconcept.PlayerVersion=function(_27){
	this.major=_27[0]!=null?parseInt(_27[0]):0;
	this.minor=_27[1]!=null?parseInt(_27[1]):0;
	this.rev=_27[2]!=null?parseInt(_27[2]):0;
	};
	deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
	if(this.major<fv.major){return false;}
	if(this.major>fv.major){return true;}
	if(this.minor<fv.minor){return false;}
	if(this.minor>fv.minor){return true;}
	if(this.rev<fv.rev){
	return false;
	}return true;};
	deconcept.util={getRequestParameter:function(_29){
	var q=document.location.search||document.location.hash;
	if(q){var _2b=q.substring(1).split("&");
	for(var i=0;i<_2b.length;i++){
	if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
	return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
	return "";}};
	deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
	var _2d=document.getElementsByTagName("OBJECT");
	for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
	if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
	deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
	__flash_savedUnloadHandler=function(){};
	if(typeof window.onunload=="function"){
	var _30=window.onunload;
	window.onunload=function(){
	deconcept.SWFObjectUtil.cleanupSWFs();_30();};
	}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
	if(typeof window.onbeforeunload=="function"){
	var oldBeforeUnload=window.onbeforeunload;
	window.onbeforeunload=function(){
	deconcept.SWFObjectUtil.prepUnload();
	oldBeforeUnload();};
	}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
	if(Array.prototype.push==null){
	Array.prototype.push=function(_31){
	this[this.length]=_31;
	return this.length;};}
	var getQueryParamValue=deconcept.util.getRequestParameter;
	var FlashObject=deconcept.SWFObject;
	var SWFObject=deconcept.SWFObject;

 /**
 * @author Ryan Johnson <ryan@livepipe.net>
 * @copyright 2007 LivePipe LLC
 * @package Control.Tabs
 * @license MIT
 * @url http://livepipe.net/projects/control_tabs/
 * @version 2.1.1
 */

if(typeof(Control) == 'undefined')
	var Control = {};
Control.Tabs = Class.create();
Object.extend(Control.Tabs,{
	instances: [],
	findByTabId: function(id){
		return Control.Tabs.instances.find(function(tab){
			return tab.links.find(function(link){
				return link.key == id;
			});
		});
	}
});
Object.extend(Control.Tabs.prototype,{
	initialize: function(tab_list_container,options){
		this.activeContainer = false;
		this.activeLink = false;
		this.containers = $H({});
		this.links = [];
		Control.Tabs.instances.push(this);
		this.options = {
			beforeChange: Prototype.emptyFunction,
			afterChange: Prototype.emptyFunction,
			hover: false,
			linkSelector: 'li a',
			setClassOnContainer: false,
			activeClassName: 'active',
			defaultTab: 'first',
			autoLinkExternal: true,
			targetRegExp: /#(.+)$/,
			showFunction: Element.show,
			hideFunction: Element.hide
		};
		Object.extend(this.options,options || {});
		(typeof(this.options.linkSelector == 'string')
			? $(tab_list_container).getElementsBySelector(this.options.linkSelector)
			: this.options.linkSelector($(tab_list_container))
		).findAll(function(link){
			return (/^#/).exec(link.href.replace(window.location.href.split('#')[0],''));
		}).each(function(link){
			this.addTab(link);
		}.bind(this));
		this.containers.values().each(this.options.hideFunction);
		if(this.options.defaultTab == 'first')
			this.setActiveTab(this.links.first());
		else if(this.options.defaultTab == 'last')
			this.setActiveTab(this.links.last());
		else
			this.setActiveTab(this.options.defaultTab);
		var targets = this.options.targetRegExp.exec(window.location);
		if(targets && targets[1]){
			targets[1].split(',').each(function(target){
				this.links.each(function(target,link){
					if(link.key == target){
						this.setActiveTab(link);
						throw $break;
					}
				}.bind(this,target));
			}.bind(this));
		}
		if(this.options.autoLinkExternal){
			$A(document.getElementsByTagName('a')).each(function(a){
				if(!this.links.include(a)){
					var clean_href = a.href.replace(window.location.href.split('#')[0],'');
					if(clean_href.substring(0,1) == '#'){
						if(this.containers.keys().include(clean_href.substring(1))){
							$(a).observe('click',function(event,clean_href){
								this.setActiveTab(clean_href.substring(1));
							}.bindAsEventListener(this,clean_href));
						}
					}
				}
			}.bind(this));
		}
	},
	addTab: function(link){
		this.links.push(link);
		link.key = link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('/').last().replace(/#/,'');
		this.containers[link.key] = $(link.key);
		link[this.options.hover ? 'onmouseover' : 'onclick'] = function(link){
			if(window.event)
				Event.stop(window.event);
			this.setActiveTab(link);
			return false;
		}.bind(this,link);
	},
	setActiveTab: function(link){
		if(!link)
			return;
		if(typeof(link) == 'string'){
			this.links.each(function(_link){
				if(_link.key == link){
					this.setActiveTab(_link);
					throw $break;
				}
			}.bind(this));
		}else{
			this.notify('beforeChange',this.activeContainer);
			if(this.activeContainer)
				this.options.hideFunction(this.activeContainer);
			this.links.each(function(item){
				(this.options.setClassOnContainer ? $(item.parentNode) : item).removeClassName(this.options.activeClassName);
			}.bind(this));
			(this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName(this.options.activeClassName);
			this.activeContainer = this.containers[link.key];
			this.activeLink = link;
			this.options.showFunction(this.containers[link.key]);
			this.notify('afterChange',this.containers[link.key]);
		}
	},
	next: function(){
		this.links.each(function(link,i){
			if(this.activeLink == link && this.links[i + 1]){
				this.setActiveTab(this.links[i + 1]);
				throw $break;
			}
		}.bind(this));
		return false;
	},
	previous: function(){
		this.links.each(function(link,i){
			if(this.activeLink == link && this.links[i - 1]){
				this.setActiveTab(this.links[i - 1]);
				throw $break;
			}
		}.bind(this));
		return false;
	},
	first: function(){
		this.setActiveTab(this.links.first());
		return false;
	},
	last: function(){
		this.setActiveTab(this.links.last());
		return false;
	},
	notify: function(event_name){
		try{
			if(this.options[event_name])
				return [this.options[event_name].apply(this.options[event_name],$A(arguments).slice(1))];
		}catch(e){
			if(e != $break)
				throw e;
			else
				return false;
		}
	}
});
if(typeof(Object.Event) != 'undefined')
	Object.Event.extend(Control.Tabs);
	
	/*
	 * modalBox.js
	 */
	function addOverlay() {
	        var overlay = Builder.node('div', {id: 'ue_overlay', style:'display: none;'});
	        document.body.appendChild(overlay);
	        overlay.onclick = function() {
	        	if ($('ue_popup')) {
	        		var pos = getStyle($('ue_popup'), 'position');
	        		closeEvPopup();
	        		closeOverlay();
                	if (pos != 'fixed') {
                		$('filter_controls').style.visibility = 'visible';
                	}
	        	}
	        }
	};
	function addEventPopup() {
	        var ue_popup = Builder.node('div', {id: 'ue_popup', style:'display:none'});
	        var close_button = Builder.node('a', {id:'close_popup', href:'#'}, ['Close X']);
	        ue_popup.innerHTML = popupDefaultElems();
	        var innerContainer = ue_popup.firstChild;
	        innerContainer.insertBefore(close_button, innerContainer.firstChild);
	        close_button.onclick = function() {
	        		var pos = getStyle($('ue_popup'), 'position');
	                closeEvPopup();
	                closeOverlay();
                	if (pos != 'fixed') {
                		$('filter_controls').style.visibility = 'visible';
                	}
	                return false;
	        }
	        return document.body.appendChild(ue_popup);
	};
	function showOverlay() {
	        if ($('ue_overlay')) {
	                var overlay = $('ue_overlay');
	                overlay.style.height = pageHeight() + 'px';
	                overlay.style.width = pageWidth() + 'px';
	                Element.show(overlay);
	                Event.observe(window, 'resize', adjustOverlay);
	        }
	};
	function showEvPopup() {
	        if ($('ue_popup')) {
	                var ue_popup = $('ue_popup');
	                //Effect.Appear(ue_popup);
	                Element.show(ue_popup);
	                adjustEvPopup();
	                Event.observe(window, 'resize', adjustEvPopup);
	        }
	};
	function closeEvPopup() {
	        var ue_popup = $('ue_popup');
	        ue_popup.parentNode.removeChild(ue_popup);
	        return false;
	};
	function closeOverlay() {
	        var overlay = $('ue_overlay');
	        overlay.parentNode.removeChild(overlay);
	};
	function adjustOverlay() {
	        if (!$('ue_overlay')) return false;
	        var overlay = $('ue_overlay');
	        overlay.style.height = pageHeight() + 'px';
	        overlay.style.width = pageWidth() + 'px';
	};
	function adjustEvPopup() {
	        if (!$('ue_popup')) return false;
	        var w = getWidth($('ue_popup'));
	        var h = getHeight($('ue_popup'));
	        var position = getStyle($('ue_popup'), 'position');
	        if (position && position == 'fixed') {
	        	var t = (windowHeight() /2) - (h/2);
	       		var l = (windowWidth() / 2) - (w/2);
	        } else {
		        var t = scrollY() +(windowHeight() /2) - (h/2);
		        var l = scrollX() + (windowWidth() / 2) - (w/2);
	        }
	        if (t < 0) t = 0;
	        if (l < 0) l = 0;
	        $('ue_popup').style.top = t + "px";
	        $('ue_popup').style.left = l + "px";
	};
	function getStyle(elem, name) {
	        if (elem.style[name]) return elem.style[name];
	        else if (elem.currentStyle) return elem.currentStyle[name];
	        else if (document.defaultView && document.defaultView.getComputedStyle) {
	                name = name.replace(/([A-Z])/g,"-1$");
	                name = name.toLowerCase();
	                var s = document.defaultView.getComputedStyle(elem,"");
	                return s && s.getPropertyValue(name);
	        } else return null;
	};
	function popupDefaultElems() {
	        return '<div id="ue_popup_box"><h2 id="popup_evname"></h2>' +
                    '<p id="popup_evinfo"><span id="popup_evdate"></span>&nbsp;at <span id="popup_venue"></span></p>' +
                    '<p><span id="popup_evtour"></span></p></div><div id="ue_popup_bottom"></div>';
	};
	function pageHeight() {
		return document.body.scrollHeight;
	};
	function pageWidth() {
		return document.body.scrollWidth;
	};
	function scrollX() {
        var de = document.documentElement;
        return self.pageXOffset || (de && de.scrollLeft) || document.body.scrollLeft;
	};
	function scrollY() {
	        var de = document.documentElement;
	        return self.pageYOffset || ( de && de.scrollTop) || document.body.scrollTop;
	};
	function getHeight(elem) {
	        if (getStyle(elem, 'display') != 'none')
	                return elem.offsetHeight || parseInt(getStyle(elem, 'height'));
	        var old = resetCSS(elem, {display:'', visibility:'hidden', position:'absolute'});
	        var h = elem.clientHeight || parseInt(getStyle(elem, 'height'));
	        restoreCSS(elem, old);
	        return h;
	};
	function getWidth(elem) {
	        if (getStyle(elem, 'display') != 'none')
	                return elem.offsetWidth || parseInt(getStyle(elem, 'width'));
	        var old = resetCSS(elem, {display:'', visibility:'hidden', position:'absolute'});
	        var w = elem.clientWidth || parseInt(getStyle(elem, 'width'));
	        restoreCSS(elem, old);
	        return w;
	};
	function resetCSS(elem, prop) {
	        var old = {};
	        for (var i in prop) {
	                old[i] = elem.style[i];
	                elem.style[i] = prop[i];
	        }
	        return old;
	};
	function restoreCSS(elem, prop) {
	        for (var i in prop)
	                elem.style[i] = prop[i];
	};
	function windowHeight() {
	        var de = document.documentElement;
	        return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
	};
	function windowWidth() {
	        var de = document.documentElement;
	        return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
	};
	function setSearchField(sField) {
		if (sField) {
			sField.onfocus = function() {
				this.value = '';
			}
			sField.onkeydown = function (e) {
				if (e) {
					if (e.keyCode == 13 && this.value.length) {
						window.location.href='/search-results.html?query='+this.value;
					}
				}
			}
		}
	};
	function setSearchGo(sField, sButton) {
		if (sButton) {
			sButton.onclick = function() {
				if (sField) {
					if (sField.value.length == 0) return false;
					else if (sField.value == 'SEARCH...') {
						window.location.href='/search-results.html';
					}
					else {
						window.location.href='/search-results.html?query='+sField.value;
					}
				} else {
					return false;
				}
			}
		}
	};
	
	function Site( loc ) {
		this.name = (loc)?loc.split('://')[1].split('/')[0]:window.location.href.split('://')[1].split('/')[0];
	}
	Site.sitesList = { 	
		garden: { live: /(cma.thegarden|preview.thegarden|thegarden|madisonsquaregarden).com/i },
		radio: { live: /(preview.radiocity|radiocity).com/i },
		beacon: { live: /(preview.beacontheatre|beacontheatre|beacontheater|beacontheaternyc|beacontheatrenyc).com/i },
		wamu: { live: /(preview.wamuatmsg|wamuatmsg|wamutheateratmsg).com/i },
		chicago: { live: /(preview.thechicagotheatre|thechicagotheatre|thechicagotheater).com/i },
		msg: { live: /(preview.msg|msg).com/i }
	 };
	Site.prototype.getSiteUrl = function() {
		var siteUrl;
		if (this.name.match(Site.sitesList.beacon.live)) {
			siteUrl = 'http://www.beacontheatre.com/';
		} else if (this.name.match(Site.sitesList.garden.live)) {
			siteUrl = 'http://www.thegarden.com/';
		} else if (this.name.match(Site.sitesList.radio.live)) {
			siteUrl = 'http://www.radiocity.com/';
		} else if (this.name.match(Site.sitesList.wamu.live)) {
			siteUrl = 'http://www.wamuatmsg.com/';
		} else if (this.name.match(Site.sitesList.chicago.live)) {
			siteUrl = (/^prod/i.test(this.name))?'http://prod.thechicagotheatre.com/':'http://www.thechicagotheatre.com/';
		} else if (this.name.match(Site.sitesList.msg.live)) {
			siteUrl = (/^prod/i.test(this.name)) ? 'http://prod.msg.com/' : 'http://www.msg.com/';
		}
		return siteUrl;
	};
	Site.prototype.getSiteFolder = function() {
		var siteFolder;
		if (this.name.match(Site.sitesList.beacon.live)) {
			siteFolder = 'beacontheatre';
		} else if (this.name.match(Site.sitesList.garden.live) || /msg/i.test(this.name)) {
			siteFolder = 'thegarden';
		} else if (this.name.match(Site.sitesList.radio.live)) {
			siteFolder = 'radiocity';
		} else if (this.name.match(Site.sitesList.wamu.live)) {
			siteFolder = 'wamuatmsg';
		} else if (this.name.match(Site.sitesList.chicago.live) || /chicago/i.test(this.name)) {
			siteFolder = 'chicagotheatre';
		} else if (this.name.match(Site.sitesList.msg.live)) {
			siteFolder = 'msg';
		}
		return siteFolder;
	};
	Site.prototype.getSiteId = function() {
		var siteId;
		if (this.name.match(Site.sitesList.beacon.live)) {
			siteId = 3;
		} else if (this.name.match(Site.sitesList.garden.live)) {
			siteId = 1;
		} else if (this.name.match(Site.sitesList.radio.live)) {
			siteId = 2;
		} else if (this.name.match(Site.sitesList.wamu.live)) {
			siteId = 4;
		} else if (this.name.match(Site.sitesList.chicago.live)) {
			siteId = 5;
		} else if (this.name.match(Site.sitesList.msg.live)) {
			siteId = 6;
		}
		return siteId;
	};
     Site.prototype.getTmPostfix = function(venue_or_location) 
      {
            var tmPostfix;
            var brand;    
            if ((venue_or_location == '1') || (venue_or_location == 'Madison Square Garden'))
            {
                  tmPostfix = '?camefrom=CFC_MSG_';
                  brand = '&brand=msg';
            }
            else if ((venue_or_location == '2') || (venue_or_location == 'Radio City Music Hall'))
            {
                  tmPostfix = '?camefrom=CFC_RADIOCITY_';
                  brand = '&brand=radiocity';
            }
            else if ((venue_or_location == '3') || (venue_or_location == 'Beacon Theatre'))
            {
                  tmPostfix = '?camefrom=CFC_BEACONTHEATRE_';
                  brand = '&brand=beacontheatre';
            }
            else if ((venue_or_location == '4') || (venue_or_location == 'WaMu Theater at MSG'))
            {
                  tmPostfix = '?camefrom=CFC_WAMUTHEATER_';
                  brand = '&brand=wamumsg';
            }
            else if ((venue_or_location == '7') || (venue_or_location == 'The Chicago Theatre'))
            {
                  tmPostfix = '?camefrom=CFC_CHICAGOTHEATRE_';
                  brand = '&brand=chicagotheatre';
            }
            else
            {
                  tmPostfix = '?camefrom=CFC_MSG_';
				  brand = '&brand=msg';
            }
            if (this.name.match(Site.sitesList.beacon.live)) 
            {
                  tmPostfix = tmPostfix + 'BEACONTHEATRE' + brand;            
	    } 
            else if (this.name.match(Site.sitesList.garden.live)) 
            {
                  tmPostfix = tmPostfix + 'MSG' + brand;
            } 
            else if (this.name.match(Site.sitesList.radio.live)) 
            {
                  tmPostfix = tmPostfix + 'RADIOCITY' + brand;
            } 
            else if (this.name.match(Site.sitesList.wamu.live)) 
            {
                  tmPostfix = tmPostfix + 'WAMUMSG' + brand;
            } 
            else if (this.name.match(Site.sitesList.chicago.live)) 
            {
                  tmPostfix = tmPostfix + 'CHICAGOTHEATRE' + brand;
            } 
            else if (this.name.match(Site.sitesList.msg.live)) 
            {
                  tmPostfix = tmPostfix + 'MSG' + brand;
            }
            return tmPostfix;
      };     
	function getTxt(elem) {
		if (elem.constructor == String) {
			elem = elem.replace('&lt;', '<').replace('&gt;', '>');
			var tmp = document.createElement('div');
			tmp.innerHTML = elem;
			elem = tmp;
		}
		var str = '';
		for (var i = 0; i < elem.childNodes.length; i++) {
			str += (elem.childNodes[i].nodeType==3)?elem.childNodes[i].nodeValue:getTxt(elem.childNodes[i]);
		}
		return str;
	};
	function getFolderName() {
		var x = window.location.href.split('://')[1].split('/');
		var f = x[1];
		if(f=="") {
			var g = getPageName();
			if(g=="index.html"){
				f="homepage";
			}
		}
		return f;
	};
		
	function getPageName() {
		var x = window.location.href.lastIndexOf('/')+1;
		var y = window.location.href.length;
		var z = "index.html"
		if(x<y) {
			z = window.location.href.substring(x,y);
		}
		z = z.replace("#","-");
		z = z.replace("?name=","?;name=");
		return z;
	};
	
	//writeEmbedTag("mms://167.206.2.140/wmtencoder/msg_nes.wmv","320","286","0","MediaPlayer");
	function writeEmbedTag(myVideoPath,myWidth,myHeight,myAutoPlay,myID) {
		if(myAutoPlay=="1") {
			myObjAutoPlay = "true";
			myEmbAutoPlay = "1";
		}
		else {
			myObjAutoPlay = "false";
			myEmbAutoPlay = "0";
		}
		if(myID=="") {
			myID = "myMediaPlayer";
		}
		if(myVideoPath!="") {
			document.write("<OBJECT ID=\"" + myID + "\" WIDTH=\"" + myWidth + "\" HEIGHT=\"" + myHeight + "\" STANDBY=\"Loading Windows Media Player components...\" TYPE=\"application/x-oleobject\"><PARAM NAME=\"Streaming Video\" VALUE=\"" + myVideoPath + "\"><PARAM name=\"autostart\" VALUE=\"" + myObjAutoPlay + "\"><PARAM name=\"ShowControls\" VALUE=\"true\"><param name=\"ShowStatusBar\" value=\"true\"><PARAM name=\"ShowDisplay\" VALUE=\"false\"><EMBED TYPE=\"application/x-mplayer2\" SRC=\"" + myVideoPath + "\" NAME=\"" + myID + "\" WIDTH=\"" + myWidth + "\" HEIGHT=\"" + myHeight + "\" ShowControls=\"1\" ShowStatusBar=\"1\" ShowDisplay=\"0\" autostart=\"" + myEmbAutoPlay + "\"> </EMBED></OBJECT>");
		}
	};
	
	
	//breaking news ticket
	function getXMLbreakingNews(){
		var url = '/ajax/data/breakingNews.xml';
		new Ajax.Request(
			url,
			{
				method:'get',
				onComplete:getBreakingNews
			}
		);
	};
	
	function getBreakingNews(xml){
		var headLineLength = xml.responseXML.getElementsByTagName('headline').length;
		var count = 0;
		var today = new Date();
		
		for(var i=0;i<headLineLength;i++){
			startDate = getNodeValueByChildName(xml.responseXML.getElementsByTagName('headline')[i],'start_date').split(',');
			endDate = getNodeValueByChildName(xml.responseXML.getElementsByTagName('headline')[i],'end_date').split(',');
			sd = new Date();
			ed = new Date();
			for(var s=0;s<5;s++){
				switch(s){
					case 0:
						sd.setYear(startDate[0]);
						ed.setYear(endDate[0]);
						break;
					case 1:
						sd.setMonth(startDate[1]-1);
						ed.setMonth(endDate[1]-1);
						break;
					case 2:
						sd.setDate(startDate[2]);
						ed.setDate(endDate[2]);
						break;
					case 3:
						sd.setHours(startDate[3]);
						ed.setHours(endDate[3]);
						break;
					case 4:
						sd.setMinutes(startDate[4]);
						ed.setMinutes(endDate[4]);
						break;
				}
			}
			if (dateInRange(today, sd, ed))count++;
		}
		displayBreakingNews(count)
	};
	
	function displayBreakingNews(breakingNewsSize){
		if (breakingNewsSize > 0) {
			$('flashcontent-breakingnews').style.display = 'block';	
			var soTwo = new SWFObject("/media/home/breaking_news.swf", "newsticker", "352", "129", "9", "#FFFFFF");
			soTwo.addVariable("xmlUrl", "/ajax/data/breakingNews.xml");
			soTwo.write("flashcontent-breakingnews");
		}else{
			$('flashcontent-breakingnews').style.display = 'none';
		}
	};
	
	
	function countdownResize(changeVar){
	  if (changeVar == 'close') {
	  		$('flash-countdown').style.height = '43px';
			$('flash-countdown').style.overflow = 'hidden';
			$('googlesearch-wrapper').style.display = 'block';	
		
	  } else if (changeVar == 'open'){
		$('flash-countdown').style.height = 'auto'; 
		$('googlesearch-wrapper').style.display = 'none';
		$('googlesearch-wrapper').style.visibility = 'none'; 
	  }
	}
	
	
	var doubleClickKeyword = "";
	if (document.location.href.indexOf("preview.msg.com")>-1){
		doubleClickKeyword = "test";
	}
 
	
		/*
	Created By: Chris Campbell
	Website: http://particletree.com
	Date: 2/1/2006
	Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
	*/	
	//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/
	
	function getBrowserInfo() {
		if (checkIt('konqueror')) {
			browser = "Konqueror";
			OS = "Linux";
		}
		else if (checkIt('safari')) browser 	= "Safari";
		else if (checkIt('omniweb')) browser 	= "OmniWeb";
		else if (checkIt('opera')) browser 		= "Opera";
		else if (checkIt('webtv')) browser 		= "WebTV";
		else if (checkIt('icab')) browser 		= "iCab";
		else if (checkIt('msie')) browser 		= "Internet Explorer";
		else if (!checkIt('compatible')) { 
			browser = "Netscape Navigator";
			version = detect.charAt(8);
		}
		else browser = "An unknown browser";
	
		if (!version) version = detect.charAt(place + thestring.length);
	
		if (!OS) {
			if (checkIt('linux')) OS 		= "Linux";
			else if (checkIt('x11')) OS 	= "Unix";
			else if (checkIt('mac')) OS 	= "Mac";
			else if (checkIt('win')) OS 	= "Windows";
			else OS 						= "an unknown operating system";
		}
	};
	
	function checkIt(string) {
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	};
	
	/*-----------------------------------------------------------------------------------------------*/
	Event.unloadCache = Prototype.emptyFunction 
	Event.observe(window, 'load', initialize, false);
	Event.observe(window, 'load', getBrowserInfo, false);
	Event.observe(window, 'unload', Event.unloadCache, false);
	
	var lightbox = Class.create();
	
	lightbox.prototype = {
		yPos : 0,
		xPos : 0,
		
		
		initialize: function(ctrl, params) {
		
			if (ctrl) {			
				
				
				this.content = ctrl.href;
				this.params = {};
				this.elem = ctrl;
			
				// this.activateRef = this.activate.bindAsEventListener(this);
				this.activateRef = this.activate.bind(this);
			
				if (ctrl.lbEvtQueue == undefined) {
					ctrl.lbEvtQueue = [this.activateRef];
				} else {
					ctrl.lbEvtQueue.push(this.activateRef);
				}
				if (ctrl.onclick) {	this.oldonclick = ctrl.onclick;	}
				Object.extend(this.params, params || {});
				
				
				this.activateRef()
				// Event.observe(ctrl, 'click', this.activateRef, false);
				// ctrl.onclick = function(){return false;};
			}
			// Inert code
			//else function(){return false;}
	},
		
		// Turn everything on - mainly the IE fixes
		activate: function(event) {
			if (browser == 'Internet Explorer'&& navigator.appVersion.substr(22,3) == "6.0") {
				this.getScroll();
				this.prepareIE('100%', 'hidden');
				this.prepareIE('100%', 'hidden');
				this.setScroll(0,0);
				this.hideSelects('hidden');
			}
			this.displayLightbox("block");
		},
		
		// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
		prepareIE: function(height, overflow) {
			bod = document.getElementsByTagName('body')[0];
			bod.style.height = height;
			bod.style.overflow = overflow;
			htm = document.getElementsByTagName('html')[0];
			htm.style.height = height;
			htm.style.overflow = overflow; 
		},
		
		// In IE, select elements hover on top of the lightbox
		hideSelects: function(visibility) {
			selects = document.getElementsByTagName('select');
			for(i = 0; i < selects.length; i++) {
				selects[i].style.visibility = visibility;
			}
		},
		
		// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
		getScroll: function() {
			if (self.pageYOffset) {
				this.yPos = self.pageYOffset;
			} else if (document.documentElement && document.documentElement.scrollTop){
				this.yPos = document.documentElement.scrollTop; 
			} else if (document.body) {
				this.yPos = document.body.scrollTop;
			}
		},
		
		setScroll: function(x, y) {
			window.scrollTo(x, y); 
		},
		
		displayLightbox: function(display) {
			
			$('overlay').style.display = display;
			if (!this.params.nodisplay || display == 'none') {
				if (display == 'none') {
					$('lightbox').style.top = null;
					$('lightbox').style.left = null;
					$('lightbox').style.width = null;
					$('lightbox').style.height = null;
				}
				$('lightbox').style.display = display;
			}
			if (this.params.nodisplay && display == 'block') {
				centerElem($('lightbox'));
				$('lightbox').style.display = 'block'; 
			}
			if (!this.params.noOverlayClick && display != 'none') {
				$('overlay').className = 'lbAction';
				$('overlay').rel = 'deactivate';
			}
			if (this.params.noOverlayClick) {
				$('overlay').className = '';
				$('overlay').rel = null;
				$('overlay').onclick = null;
			}
			if (display != 'none' && !this.params.noAjax) {
				this.loadInfo();
			}		
		},
		
		// Begin Ajax request based off of the href of the clicked linked
		loadInfo: function() {
			var myAjax = new Ajax.Request( this.content,
	        	{method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)});
	        	 
		},
		
		// Display Ajax response and Close Button
		processInfo: function(response) {
			if (this.params.nodisplay) $('lightbox').style.display = 'none';
			if ($('lbContent')) Element.remove($('lbContent'));
			info = "<div id='lbContent'>"+response.responseText+"</div>";
			if (screen.height <= 600) {
				var tmp = document.createElement('div');
				tmp.innerHTML = info;
				var close = $(tmp).getElementsByClassName('close')[0];
				close.next().addClassName('win800x600');
				
				//DEV HERE
				$('lightbox').style.left = '50%';
				info = tmp.innerHTML;
			}
			new Insertion.Before($('lbLoadMessage'), info);
			$('lightbox').className = "done";
			if (this.params.oncomplete) { this.params.oncomplete(); }
			this.actions();			
		},
		
		// Search through new links within the lightbox, and attach click event
		actions: function() {
			lbActions = $$('.lbAction');
			for(i = 0; i < lbActions.length; i++) {
				if (lbActions[i].id == 'overlay') {
					lbActions[i].onclick = this[lbActions[i].rel].bindAsEventListener(this);
				} else {
					Event.observe(lbActions[i], 'mousedown', this[lbActions[i].rel].bindAsEventListener(this), false);
					lbActions[i].onclick = function(){return false;};
					//alert('hit');
				}
			}
	
		},
		
		// Example of creating your own functionality once lightbox is initiated
		insert: function(e) {
		   var link = Event.element(e).parentNode;
		   Element.remove($('lbContent'));
		 
		   var myAjax = new Ajax.Request(
				  link.href,
				  {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)}
		   );
		 
		},
		
		// Example of creating your own functionality once lightbox is initiated
		deactivate: function(e) {
			//alert('deactivate hit');
			if ($('lbContent')) Element.remove($('lbContent'));
			if (browser == "Internet Explorer" && navigator.appVersion.substr(22,3) == "6.0"){
				this.setScroll(0,this.yPos);
				this.prepareIE("auto", "auto");
				this.hideSelects("visible");
			}
			this.displayLightbox("none");
			$('lightbox').className = 'loading';
		},
		
		removeListener: function (restoreOld) {
			Event.stopObserving(this.elem, 'click', this.activateRef, false);
			if (restoreOld && this.oldonclick) {
				this.elem.onclick = this.oldonclick;
			}
		},
		
		flush: function () {
			while (this.elem.lbEvtQueue.length) {
				Event.stopObserving(this.elem, 'click', this.elem.lbEvtQueue.shift(), false);
			}
		}
	};
	/*-----------------------------------------------------------------------------------------------*/
	//kill lightbox
	function closeLightBox() {
		if(lightBox) lightBox.deactivate();
	};
	
	// Onload, make all links that need to trigger a lightbox active
	function initialize(){
		addLightboxMarkup(); 
		lbox = document.getElementsByClassName('lbOn');
		for(i = 0; i < lbox.length; i++) {
			valid = new lightbox(lbox[i]);
		}
	};
	
	// Add in markup necessary to make this work. Basically two divs:
	// Overlay holds the shadow
	// Lightbox is the centered square that the content is put into.
	function addLightboxMarkup() {
		bod 				= document.getElementsByTagName('body')[0];
		overlay 			= document.createElement('div');
		overlay.id		= 'overlay';	
		lb					= document.createElement('div');
		lb.id				= 'lightbox';
		lb.className 	= 'loading';
		lb.innerHTML	= '<div id="lbLoadMessage">' +
							  '<p>Loading</p>' +
							  '</div>';
		bod.appendChild(overlay);
		bod.appendChild(lb);
	};
	// ************** end of lightbox ************** //
	

	
	