// keeps track of the current sectionvar currentSection;function trace( msg ){  if( typeof( jsTrace ) != 'undefined' ){    jsTrace.send( msg );  }}function getSection(buttonName){	return buttonName.substring(0, buttonName.lastIndexOf("_"));}/****/var Site ={	/*	**	** TODO:	**	**	*/	init:function() {		if($('poster-frame')) {			$('poster-frame').addEvent('click', function(e) {				e = new Event(e);				$('poster-frame').setStyle('display', 'none');				$('video').setStyle('display', 'block');				$('featured-content').setStyle('height', '460px');				e.stop();			});		}	},	setLocation:function(storeID, locationID) {		var location = this.getLocationByStoreId(storeID);		if(location){			setCookie('myStore',storeID);						new ajax('/ext/get_my_pizza_html_manual?rnd='+Math.random(),'',function(response){				$('store_info').setHTML(response.responseText);								// INIT "Change Location" LINK				$('my_store_module').getElements('.change_location').setStyle('display','none');			}).sendGetData();		}	},		getLocationByStoreId:function(store_id){		if(typeof storeLocations!='undefined'){			for(var i=0;i<storeLocations.length;i++){				if(storeLocations[i][0]==store_id) return storeLocations[i];			}		}	}};/****/var Menu ={	/*	**	** TODO:	**	**	*/	init:function() {		currentSection =  $(document.body).id;		currentPage = $(document.body).getProperty('class');		var mainNav = $$('#main li a');		// loop through the main nav elements		mainNav.each(function(element) { 			// make sure the button isn't the current section 			if(getSection(element.id) == currentSection) { 				return; 			} else {				element.setStyle('opacity', .01);				// new fx transitions for the over/out state				var fi = new Fx.Style(element, 'opacity', {duration:333, wait: true });				var fo = new Fx.Style(element, 'opacity', {duration:666, wait: true });				// the mouse over event				element.addEvent('mouseenter', function(){					fo.stop();					fi.start(.99);				});				// the mouse out event				element.addEvent('mouseleave', function(){					fi.stop();					fo.start(.01);				});			}		});		/*		var subNav = $$('#subnav li a');		// loop through the main nav elements		subNav.each(function(element) { 			// make sure the button isn't the current section 			if(getSection(element.id) == currentPage) { 				return; 			} else {				element.setStyle('opacity', .01);				// new fx transitions for the over/out state				var fi = new Fx.Style(element, 'opacity', {duration:333, wait: true });				var fo = new Fx.Style(element, 'opacity', {duration:666, wait: true });				// the mouse over event				element.addEvent('mouseenter', function(){					fo.stop();					fi.start(.01, .99);				});				// the mouse out event				element.addEvent('mouseleave', function(){					fi.stop();					fo.start(.99, .01);				});			}		});		*/	}}function ajax(theURL, sendString, callbackFunction) {	var thisRequestObject;	thisRequestObject = initiateRequest();	thisRequestObject.onreadystatechange = processRequest;	function initiateRequest() {		if (window.XMLHttpRequest) return new XMLHttpRequest();		elseif(window.ActiveXObject)		return new ActiveXObject("Microsoft.XMLHTTP");	}	function processRequest() {		if (thisRequestObject.readyState == 4) {			if (thisRequestObject.status == 200) {				if (callbackFunction) callbackFunction(thisRequestObject, sendString);			} else alert("There was an error: (" + thisRequestObject.status + ") " + thisRequestObject.statusText);		}	}	this.sendGetData = function () {		if (theURL) {			thisRequestObject.open("GET", theURL, true);			thisRequestObject.send(sendString);		}	}	this.sendPostData = function () {		if (theURL) {			thisRequestObject.open("POST", theURL, true);			thisRequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");			thisRequestObject.send(sendString);		}	}}window.addEvent('load', Menu.init);window.addEvent('load', Site.init);window.addEvent('load', function(){	$$('.futura').setStyle('opacity','1');	});if(navigator.userAgent.indexOf('MSIE')>-1){	window.addEvent('beforeunload', function(){		// PREVENT IE JS onunload ERRORS RELATED TO YOUTUBE VIDEOS		var youtube_videos = $$('embed[src^="http://www.youtube.com"]');		for(var i=0;i<youtube_videos.length;i++){			youtube_videos[i].outerHTML = '';		}	});}function defer_navigate(url){	window.setTimeout(function(){		window.location.href = url;	},500);}function orderLinkClicked(anchor,evt){	var store_name = jQuery(anchor).parents('.location-listing').attr('location_name');			var is_map_bubble = jQuery(anchor).parents('#map').length;	var event_action = is_map_bubble?'Locator Map | Order Online':'Locator Link | Order Online';	_gaq.push(['_trackEvent','Order Link (External)',event_action,store_name]);	if(anchor.getAttribute('target')!='_blank'){		evt.preventDefault();		defer_navigate(anchor.getAttribute('href'));	}}function blogLinkClicked(anchor,evt){	var store_name = jQuery(anchor).parents('.location-listing').attr('location_name');			var is_map_bubble = jQuery(anchor).parents('#map').length;	var event_action = is_map_bubble?'Locator Map | Visit Blog':'Locator Link | Visit Blog';	_gaq.push(['_trackEvent','Store Info',event_action,store_name]);	if(anchor.getAttribute('target')!='_blank'){		evt.preventDefault();		defer_navigate(anchor.getAttribute('href'));	}}function getDirectionsLinkClicked(anchor,evt){	var store_name = jQuery(anchor).parents('.location-listing').attr('location_name');			var is_map_bubble = jQuery(anchor).parents('#map').length;	var event_action = is_map_bubble?'Locator Map | Get Directions':'Locator Link | Get Directions';	_gaq.push(['_trackEvent','Store Info',event_action,store_name]);	if(anchor.getAttribute('target')!='_blank'){		evt.preventDefault();		defer_navigate(anchor.getAttribute('href'));	}}function myZpizzaLinkClicked(anchor,evt){	var store_name = jQuery(anchor).parents('.location-listing').attr('location_name');			var is_map_bubble = jQuery(anchor).parents('#map').length;	var event_action = is_map_bubble?'Locator Map | Make my zpizza':'Locator Link | Make my zpizza';	_gaq.push(['_trackEvent','Store Info',event_action,store_name]);}function logMapMarkerClick(){	// FIRES GA EVENT ONLY ONCE PER SESSION	if(!readCookie('trackedFirstMapInteraction')){		setCookie('trackedFirstMapInteraction','1');		_gaq.push(['_trackEvent','Store Info','Locator Map','Interaction']);	}	}function setCookie(name,value){	var date = new Date();	date.setTime(date.getTime()+(365*24*60*60*1000));	var expires = "; expires="+date.toGMTString();	var domain = (window.location.host.toLowerCase().indexOf('zpizza.com')>-1)?'zpizza.com':'';	if(!domain&&navigator.appVersion.indexOf('MSIE')>-1) domain = window.location.host;	document.cookie = name + "=" + value + ";expires=" + expires + ";path=/;domain="+domain;}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;}jQuery(document).ready(function(){	// GOOGLE ANALYTICS EVENT TRACKING	var anchors = jQuery('a[google_event_tag]');	anchors.live('click',function(evt){		// FOR target=_blank ANCHORS, LET GOOGLE ANALYTICS TRACK NORMALLY. 		// FOR ALL OTHER ANCHORS, TRACK, DEFER, THEN PROGRAMMATICALLY CLICK		var anchor = this;		if(anchor.clicked) return;		anchor.clicked = true;		var google_event_tags = anchor.getAttribute('google_event_tag').split(';');		_gaq.push(['_trackEvent',google_event_tags[0],google_event_tags[1],google_event_tags[2]||null]);		if(anchor.getAttribute('target')!='_blank'){			evt.preventDefault();			defer_navigate(anchor.getAttribute('href'));		}	});});
