// IE6
	var blank = new Image();
	blank.src = '/_assets/img/misc/slug.gif';
	function fixIE6() {
		var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
		if (badBrowser) {
			// png fix
			$('img[src$=.png]').each(function() {
				if (!this.complete) {
					this.onload = function() { fixPng(this) };
				} else {
					fixPng(this);
				}
			});
		}
	}
	function fixPng(png) {
		var src = png.src;
		if (!png.style.width) { png.style.width = $(png).width(); }
		if (!png.style.height) { png.style.height = $(png).height(); }
		png.onload = function() { };
		png.src = blank.src;
		png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}


// EClub
	var eclubFormSent = false;
	function initEclub() {
		if ($('#eclub_form').length) {
			// Form Inputs
				setFormInput('#M_email', 'EMAIL');
				setFormInput('#M_firstname', 'FIRST');
				setFormInput('#M_lastname', 'LAST');
			// Submit
				$('#eclub_form').submit(function() {
					if (eclubFormSent == false) {
						$('#eclub_form button').attr('disabled', 'disabled');
						$('label span').html('');
						clearFormInput('#M_email', 'EMAIL');
						clearFormInput('#M_firstname', 'FIRST');
						clearFormInput('#M_lastname', 'LAST');
						// vars
						var url = $('#eclub_form').attr('action');
						var data = $("#eclub_form").serialize();
						var invalid = 0;
						// validate
						if ($('#M_email').val() == '') {
							$('#error_email').html('<br />Your email is required');
							invalid ++;
						} else if (!isValidEmail($('#M_email').val())) {
							$('#error_email').html('<br />Please enter a valid email');
							invalid ++;
						}
						if ($('#M_location').val() == '') {
							$('#error_location').html('<br />Your favorite BO is required');
							invalid ++;
						}
						if ($('#M_menu_item').val() == '') {
							$('#error_menu_item').html('<br />Your favorite item is required');
							invalid ++;
						}
						// reset inputs
						$('#M_email').blur();
						$('#M_firstname').blur();
						$('#M_lastname').blur();
						// is valid?
						if (invalid > 0) {
							$('#eclub_form button').removeAttr('disabled');
							return false;
						} else {
							eclubFormSent = true;
							return true;
						}
					}
					return false;
				});
				
			// Focus & Blur: Email
				$('#M_email').focus(function() {
					$(this).addClass('focus');
				});
				$('#M_email').blur(function() {
					if ($(this).val() == "EMAIL") {
						$(this).removeClass('focus');
					}
				});
			// Focus & Blur: First Name
				$('#M_firstname').focus(function() {
					$(this).addClass('focus');
				});
				$('#M_firstname').blur(function() {
					if ($(this).val() == "FIRST") {
						$(this).removeClass('focus');
					}
				});
			// Focus & Blur: Last Name
				$('#M_lastname').focus(function() {
					$(this).addClass('focus');
				});
				$('#M_lastname').blur(function() {
					if ($(this).val() == "LAST") {
						$(this).removeClass('focus');
					}
				});
			// Changed: Birthday Month
				$('#M_birthday_month').change(function() {
					if ($(this).val() != "") {
						$(this).parent().find('span').addClass('focus');
					}
				});
			// Change: Birthday Day
				$('#M_birthday_day').change(function() {
					if ($(this).val() != "") {
						$(this).parent().find('span').addClass('focus');
					}
				});
			// Change: Favorite Bojangles
				$('#M_location').change(function() {
					if ($(this).val() != "") {
						$(this).parent().find('span').addClass('focus');
					}
				});
			// Change: Favorite Menu Item
				$('#M_menu_item').change(function() {
					if ($(this).val() != "") {
						$(this).parent().find('span').addClass('focus');
					}
				});
		}
	}
	function setFormInput(input, label) {
		$(input).val(label);
		$(input).focus(function() {
			if ($(this).val() == label) { $(this).val(''); }
		});
		$(input).blur(function() {
			if ($(this).val() == '') { $(this).val(label); }
		});
	}
	function clearFormInput(input, label) {
		if ($(input).val() == label) {
			$(input).val('');
		}
	}
	function isValidEmail(email) {
		var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		return regex.test(email);
	}


// History
	var historyItem = -1;
	function initHistory() {
		var total = $('#history .items div').size();
		if (total > 1) {
			// set nav
				$('#history .nav ul li').each(function(i) {
					$(this).click(function() { changeHistoryItem(i) });
				});
				$('#history .nav .arrow_left').click(function() {
					if (historyItem > 0) {
						changeHistoryItem(historyItem-1);
					} else {
						changeHistoryItem(total-1);
					}
				});
				$('#history .nav .arrow_right').click(function() {
					if (historyItem+1 < total) {
						changeHistoryItem(historyItem+1);
					} else {
						changeHistoryItem(0);
					}
				});
			// init & show
				$('#history .nav').fadeIn('slow');
				changeHistoryItem(0);
		}
	}
	function changeHistoryItem(key) {
		if (historyItem != key) {
			$('#history .nav ul li.on').removeClass('on');
			$('#history .nav ul li:eq(' + key + ')').each(function() {
				$(this).addClass('on');
			});
			$('#history .items div').hide();
			$('#history .items div:eq(' + key + ')').each(function() {
				if (historyItem == -1) {
					$(this).show();
				} else {
					$(this).fadeIn('slow');
				}
			});
			historyItem = key;
		}
	}


// Promotions
	function initPromotions() {
		$('#promotions .nav .tab').click(function() {
			var key = $('#promotions .nav .tab').index(this);
			$('#promotions .nav .tab').removeClass('selected');
			$('#promotions .list').hide();
			$('#promotions .nav .tab:eq('+key+')').addClass('selected');
			$('#promotions .list:eq('+key+')').show();
		});
	}


// Menu
	function disableMenuButtons() {
		$('#menu_options .menu_button').remove();
		$('#menu_options .menu_saving').show();
	}
	function showUpdateButton() {
		$('#m_update_cart').slideDown();
	}
	function addMenuItem(url) {
		disableMenuButtons();
		// build out data
		var data = "meal_id=" + m_meal_id;
		data += "&item_id=" + m_item_id;
		data += "&size_id=" + m_size_id;
		data += "&sides=" + m_sides_string;
		data += "&extras=" + m_extras_string;
		data += "&name=" + m_name;
		data += "&entree_name=" + m_entree_name;
		data += "&calories=" + m_total_calories;
		data += "&active=1";
		// submit
		$.ajax({
			type: "POST", 
			url: url, 
			data: data,
			dataType: "text", 
			success: function (data) {
				window.location.href = data;
			}
		});
	}
	function updateMenuItem(url) {
		disableMenuButtons();
		// build out data
		var data = "meal_id=" + m_meal_id;
		data += "&item_id=" + m_item_id;
		data += "&size_id=" + m_size_id;
		data += "&sides=" + m_sides_string;
		data += "&extras=" + m_extras_string;
		data += "&name=" + m_name;
		data += "&entree_name=" + m_entree_name;
		data += "&calories=" + m_total_calories;
		data += "&active=1";
		// submit
		$.ajax({
			type: "POST", 
			url: url, 
			data: data,
			dataType: "text", 
			success: function (data) {
				window.location.href = data;
			}
		});
	}
	function removeMenuItem(url) {
		disableMenuButtons();
		// build out data
		var data = "action=delete";
		// submit
		$.ajax({
			type: "POST", 
			url: url, 
			data: data,
			dataType: "text", 
			success: function (data) {
				window.location.href = data;
			}
		});
	}
	function roundNumber(value) {
		var offset_for_decimals = 1;
		return Math.round(value * offset_for_decimals) / offset_for_decimals;
	}
	function changeFixin($size_key, $option_key, $size_id, $type_id, $key) {
		// next key
			if ($key == undefined) {
				m_current_fixins[$size_key][$option_key]['key'] ++;
				if (m_current_fixins[$size_key][$option_key]['key'] >= m_sizes[$size_id][$type_id].length) {
					m_current_fixins[$size_key][$option_key]['key'] = 0;
				}
				$key = m_current_fixins[$size_key][$option_key]['key'];
			}
		// update image
			$('#f'+$size_key+'_image_'+$option_key).attr('src', m_fixin_image_path_header + m_sizes[$size_id][$type_id][$key]['image_id'] + '.png');
		// update fixin link
			var link_html = "";
			link_html += '<div class="fixin_type">';
			link_html += ($type_id == 2) ? 'Drink' : 'Fixin&rsquo;';
			link_html += '</div>';
			link_html += '<div class="fixin_image"><img src="' + m_fixin_image_path_nav + m_sizes[$size_id][$type_id][$key]['image_id'] + '.png" alt="" /></div>';
			link_html += '<div class="fixin_title">' + m_sizes[$size_id][$type_id][$key]['name'] + ' <br /><span>(' + m_sizes[$size_id][$type_id][$key]['size_name'] + ')</span></div>';
			$('#f'+$size_key+'_option_'+$option_key).html(link_html);
		// update selected dropdown
			$('#f'+$size_key+'_option_'+$option_key+'_subs .fixin_option').removeClass('selected');
			$('#f'+$size_key+'_option_'+$option_key+'_subs .fixin_option:eq('+$key+')').addClass('selected');
			$('#f'+$size_key+'_option_'+$option_key+'_subs').hide();
		// update nutritional info
			m_menu_options[$size_key][$option_key] = m_sizes[$size_id][$type_id][$key]['info'];
			m_current_fixins[$size_key][$option_key]['ids'] = m_sizes[$size_id][$type_id][$key]['ids'];
			updateNutrition();
		// show add button
			showUpdateButton();
	}
	function updateNutrition() {
		var totals = new Array();
		totals['calories'] = 0;
		totals['calories_from_fat'] = 0;
		totals['fat'] = 0;
		totals['saturated_fat'] = 0;
		totals['trans_fat'] = 0;
		totals['cholesterol'] = 0;
		totals['sodium'] = 0;
		totals['carbohydrates'] = 0;
		totals['dietary_fiber'] = 0;
		totals['sugar'] = 0;
		totals['protein'] = 0;
		totals['vitamin_a'] = 0;
		totals['vitamin_c'] = 0;
		totals['calcium'] = 0;
		totals['iron'] = 0;
		var allergens = new Array();
		var sensitivities = new Array();
		if (m_menu_options != undefined && m_menu_options[m_current_size] != undefined) {
			for (var itm in m_menu_options[m_current_size]) {
				
				// allergens
				for (var key in m_menu_options[m_current_size][itm]['allergens']) {
					if (jQuery.inArray(m_menu_options[m_current_size][itm]['allergens'][key], allergens) == -1) {
						allergens.push(m_menu_options[m_current_size][itm]['allergens'][key]);
					}
				}
				
				// sensitivities
				for (var key in m_menu_options[m_current_size][itm]['sensitivities']) {
					if (jQuery.inArray(m_menu_options[m_current_size][itm]['sensitivities'][key], sensitivities) == -1) {
						sensitivities.push(m_menu_options[m_current_size][itm]['sensitivities'][key]);
					}
				}
				
				// nutrition
				for (var key in m_menu_options[m_current_size][itm]['nutrition']) {
					if (totals[key] == undefined) {
						totals[key] = m_menu_options[m_current_size][itm]['nutrition'][key];
					} else {
						totals[key] += m_menu_options[m_current_size][itm]['nutrition'][key];
					}
				}
				
			}
		}
		
		m_size_id = m_sizes_id[m_current_size];
		m_total_calories = totals['calories'];
		m_sides_string = "";
		if (m_current_fixins != undefined && m_current_fixins[m_current_size] != undefined) {
			for (var itm in m_current_fixins[m_current_size]) {
				m_sides_string += m_current_fixins[m_current_size][itm]['ids'] + ";";
			}
		}
		
		m_extras_string = "";
		if (m_extras_info != undefined) {
			for (var itm in m_extras_info) {
				if (m_extras_set[itm] == true) {
					
					// allergens
					for (var key in m_extras_info[itm]['allergens']) {
						if (jQuery.inArray(m_extras_info[itm]['allergens'][key], allergens) == -1) {
							allergens.push(m_extras_info[itm]['allergens'][key]);
						}
					}
					
					// sensitivities
					for (var key in m_extras_info[itm]['sensitivities']) {
						if (jQuery.inArray(m_extras_info[itm]['sensitivities'][key], sensitivities) == -1) {
							sensitivities.push(m_extras_info[itm]['sensitivities'][key]);
						}
					}
					
					// nutrition
					m_extras_string += m_extras_id[itm] + ',' + m_extras_name[itm] + ',' + m_extras_info[itm]['nutrition'].calories + ';';
					for (var key in m_extras_info[itm]['nutrition']) {
						if (totals[key] == undefined) {
							totals[key] = m_extras_info[itm]['nutrition'][key];
						} else {
							totals[key] += m_extras_info[itm]['nutrition'][key];
						}
					}
				}
			}
		}
		
		// display nutritional totals
		for (key in totals) {
			$('#n_'+key).html(roundNumber(totals[key]));
		}
		
		// display allergens
		allergens.sort();
		var allergens_text = "";
		for (key in allergens) {
			if (allergens_text != "") {
				allergens_text += ", ";
			}
			allergens_text += allergens[key];
		}
		allergens_text = (allergens_text == "") ? "None" : allergens_text;
		$('#n_allergens').html(allergens_text);
		
		// display sensitivities
		sensitivities.sort();
		var sensitivities_text = "";
		for (key in sensitivities) {
			if (sensitivities_text != "") {
				sensitivities_text += ", ";
			}
			sensitivities_text += sensitivities[key];
		}
		sensitivities_text = (sensitivities_text == "") ? "None" : sensitivities_text;
		$('#n_sensitivities').html(sensitivities_text);
		
	}
	function addMenuExtra(extra_id) {
		var obj = "#m_extra_" + extra_id;
		if ($(obj).hasClass('added')) {
			$(obj).removeClass('added');
			m_extras_set[extra_id] = false;
		} else {
			$(obj).addClass('added');
			m_extras_set[extra_id] = true;
		}
		updateNutrition();
		showUpdateButton();
	}
	function initMenu() {
		if ($('#menu_list').length) {
			// smooth anchors
			$(".sidebar a[href*=#]").click(function(event) {
				event.preventDefault();
				var hash = this.href.split("#")[1];
				var destination = $('a[name="' + hash + '"]').offset().top;
				$('html, body').animate({scrollTop:destination}, 750, 'easeInOutQuad', function() {
					window.location.hash = hash;
				});
				return false;
			});
			// position sidebar
			if ($(window).height() >= 700) {
				if ($(window).height() <= 800) {
					$('.sidebar .feature_small').fadeOut();
				}
				$(window).scroll(updateSidebarPosition);
				updateSidebarPosition();
			}
		}
		// sizes
		$('.combo_size span').click(function() {
			m_current_size = $('.combo_size span').index(this);
			$('.header').hide();
			$('.header:eq('+m_current_size+')').show();
			$('.combo_size span').removeClass('selected');
			$('.combo_size span:eq('+m_current_size+')').addClass('selected');
			$('.fixins').hide();
			$('.fixins:eq('+m_current_size+')').show();
			updateNutrition();
			showUpdateButton();
		});
		// nutritation table
		$('.nutrition_header').click(function() {
			if ($('.nutrition_header').hasClass('hide')) {
				$('.nutrition_header').removeClass('hide');
				$('.nutrition_info').slideDown();
			} else {
				$('.nutrition_header').addClass('hide');
				$('.nutrition_info').slideUp();
			}
		});
		// fixins
		$('.fixin_options').mousedown(function() {
			$(this).children('.fixin_option_subs').show();
			$(this).css("z-index", "5");
		});
		$('.fixin_options').mouseleave(function() {
			$(this).children('.fixin_option_subs').hide();
			$(this).css("z-index", "0");
		});
		// sidebar
		//$('#menu_options').fadeIn();
		// update nutrition
		if ($('#menu_item').length) {
			updateNutrition();
		}
	}
	function updateSidebarPosition() {
		var y = $(window).scrollTop();
		var headerPadding = parseInt($('#header').css('padding-top'));
		var headerHeight = parseInt($('#header').css('height'));
		if (y >= headerPadding + headerHeight) {
			$('.sidebar').animate({marginTop:y-headerPadding}, {duration:250, queue:false}, 'easeInOutQuad');
		} else {
			$('.sidebar').animate({marginTop:80}, {duration:250, queue:false}, 'easeInOutQuad');
		}
	}


// Cookie Helpers
	function setCookie($name, $value, $daysUntilExpired) {
		var date = new Date();
		date.setDate(date.getDate() + $daysUntilExpired);
		document.cookie = $name + "=" + escape($value) + "; expires=" + date.toUTCString();
	}
	function getCookie($name) {
		var i, x, y, ARRcookies=document.cookie.split(";");
		for (i=0; i<ARRcookies.length; ++i) {
			x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
			y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
			x = x.replace(/^\s+|\s+$/g,"");
			if (x == $name) {
				return unescape(y);
			}
		}
	}


// Flash Overlays
	function initFlashOverlays() {
		if ($('body').hasClass('search') && !$('body').hasClass('mobile') && !$('body').hasClass('facebook')) {
			// intro
				var cookieValue = getCookie('bojanglesIntro');
				if (cookieValue != 'false') {
					showIntro();
				}
			// its bo time
				$('.its_bo_time').click(showBoTime);
		}
		
	}
	function addOverlayHtml() {
		var html = '';
		html += '<div id="its_bo_time">';
		html += '<div id="its_bo_time_flash"></div>';
		html += '<\/div>';
		$('body').prepend(html);
	}
	function showIntro() {
		addOverlayHtml();
		swfobject.embedSWF("/_assets/swf/intro.swf", "its_bo_time_flash", "100%", "100%", "10.0.0", "/_assets/swf/expressInstall.swf", false, {menu:"false", wmode:"transparent"}, {id:"bo_time", name:"bo_time"});
		setCookie('bojanglesIntro', 'false', 1);
	}
	function showBoTime() {
		addOverlayHtml();
		swfobject.embedSWF("/_assets/swf/bo-time.swf", "its_bo_time_flash", "100%", "100%", "10.0.0", "/_assets/swf/expressInstall.swf", false, {menu:"false", wmode:"transparent"}, {id:"bo_time", name:"bo_time"});
		return false;
	}
	function hideFlashOverlay() {
		$("#its_bo_time").remove();
	}


// Geolocation
	var geocoded = false; // need this or setLocation will run twice
	var location_default = "City, State or Zip";
	function setLocation(location) {
		var geocoder = new google.maps.Geocoder();
		var coords = new google.maps.LatLng(location.coords.latitude, location.coords.longitude);
		geocoder.geocode({'latLng': coords}, function(results, status) {
			if (status == google.maps.GeocoderStatus.OK && geocoded == false) {
				var cityState = results[0].address_components[2].long_name+', '+results[0].address_components[5].short_name;
				location_default = cityState;
				$.ajax({
					url:'/geolocation/set_location',
					type:'POST',
					dataType:'json',
					data:{
						'cityState': cityState
					},
					success:function(response) {
						$('#find_a_bo input[name="geo_lat"]').val(location.coords.latitude);
						$('#find_a_bo input[name="geo_lng"]').val(location.coords.longitude);
						$('#find_a_bo input[name="geo_address"]').val(response);
						$('#find_a_bo input[name="address"]').val(response);
					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						//alert(XMLHttpRequest.responseText);
						alert(errorThrown);
					}
				});
				//alert('Geocoding worked.');
			} else {
				//alert('Geocoding failed.');
			}
			//returned OK, set to true
			geocoded = true;
		});
	}
	function handleNoGeolocation() {
		$.ajax({
			url:'/geolocation/unset_location'
		});
		//alert('No geolocation.');
		//location failed, set to true
		geocoded = true;	
	}
	function findLocation() {
		if ($('#find_a_bo input[name="address"]').length > 0) {
			if (navigator.geolocation) {
				navigator.geolocation.getCurrentPosition(
					function(position) {
						setLocation(position);
					},
					function() {
						handleNoGeolocation();
					}
				);
			} else if (google.gears) {
				var geo = google.gears.factory.create('beta.geolocation');
				geo.getCurrentPosition(
					function(position) {
						setLocation(position);
					},
					function() {
						handleNoGeolocation();
					}
				);
			} else {
				handleNoGeolocation();
			}
		}
	}


// Find a BO
	function initFindABo() {
		$('#find_a_bo .form input').focus(function() {
			if ($(this).val() == 'City, State or Zip') {
				$(this).val('');
			}
		});
		$('#find_a_bo .form input').blur(function() {
			if ($(this).val() == '') {
				$(this).val(location_default);
			}
		});
		$('#find_a_bo .form input').keyup(function(e) {
			if (e.which == "13") {
				var address = $('#find_a_bo input[name="address"]').val();
				mapLookup(address);
			}
		});
		$('#find_a_bo .form a').click(function() {
			var address = $('#find_a_bo input[name="address"]').val();
			mapLookup(address);
		});
	}
	function mapLookup(address) {
		var geocoder = new google.maps.Geocoder();
		geocoder.geocode({address: address}, function(results, status) {
			if (status == google.maps.GeocoderStatus.OK) {
				$('#find_a_bo input[name="geo_lat"]').val(results[0].geometry.location.lat());
				$('#find_a_bo input[name="geo_lng"]').val(results[0].geometry.location.lng());
				$('#find_a_bo input[name="geo_address"]').val(address);
				$('#find_a_bo form').submit();
			} else {
				alert("Error: " + status);
			}
		});
	}


// Locations & Directory
	var directory_city_scrollpane;
	var directory_location_scrollpane;
	var showState;
	var showCity;
	function preload(images) {
		$(images).each(function() {
			var img = new Image();
			img.src = this;
		});
	}
	function selectState(obj) {
		$('#directory .state li a').each(function() {
			if ($(this).attr("id") != obj.attr("id")) {
				$(this).removeClass("active");
			}
		});
	}
	function selectCity(obj) {
		$('#directory .city li a').each(function() {
			if ($(this).attr("id") != obj.attr("id")) {
				$(this).removeClass("active");
			}
		});
	}
	function initLocations() {
		// Locations, Image Map
			if ($('#directory_map').length > 0) {
				if (/\bMSIE 6/.test(navigator.userAgent) && !window.opera) {
					$('#directory_map .border').supersleight({shim: '/_assets/img/directory/spacer.gif'});
					preload([
						'/_assets/img/directory/map_background_al.gif',
						'/_assets/img/directory/map_background_dc.gif',
						'/_assets/img/directory/map_background_fl.gif',
						'/_assets/img/directory/map_background_ga.gif',
						'/_assets/img/directory/map_background_md.gif',
						'/_assets/img/directory/map_background_ms.gif',
						'/_assets/img/directory/map_background_nc.gif',
						'/_assets/img/directory/map_background_pa.gif',
						'/_assets/img/directory/map_background_sc.gif',
						'/_assets/img/directory/map_background_tn.gif',
						'/_assets/img/directory/map_background_va.gif',
						'/_assets/img/directory/map_background.gif'
					]);
				} else {
					preload([
						'/_assets/img/directory/map_background_al.png',
						'/_assets/img/directory/map_background_dc.png',
						'/_assets/img/directory/map_background_fl.png',
						'/_assets/img/directory/map_background_ga.png',
						'/_assets/img/directory/map_background_md.png',
						'/_assets/img/directory/map_background_ms.png',
						'/_assets/img/directory/map_background_nc.png',
						'/_assets/img/directory/map_background_pa.png',
						'/_assets/img/directory/map_background_sc.png',
						'/_assets/img/directory/map_background_tn.png',
						'/_assets/img/directory/map_background_va.png',
						'/_assets/img/directory/map_background.png'
					]);		
				}
			}
			$('#directory_map .usa a').hover(
				function() {
					var target = $(this).attr("class");
					$('#directory_map .map .background').addClass(target);
				},
				function () {
					$('#directory_map .map .background').attr("class", "background");
				}
			);
			$('map area').hover(
				function() {
					var target = $(this).attr("class");
					$('#directory_map .map .background').addClass(target);
				},
				function () {
					$('#directory_map .map .background').attr("class", "background");
				}
			);
		// Locations / Directory
			if ($('#directory').length > 0) {
				// IE6 & IE 7 CONDITION IS TO AVOID SCROLLPANE ISSUE
				if (!/\bMSIE 6/.test(navigator.userAgent) && !/\bMSIE 7/.test(navigator.userAgent)) {
					directory_city_scrollpane = $('#directory .city .listing').jScrollPane({
						maintainPosition: false,
						autoReinitialise: true
					});
				}	
				
				directory_location_scrollpane = $('#directory .location .listing').jScrollPane({
					maintainPosition: false,
					autoReinitialise: true
				});
			}
			$('#directory .state li a').live('click', function() {
				$(this).addClass("active");
				selectState($(this));
			});
			$('#directory .city li a').live('click', function() {
				$(this).addClass("active");
				selectCity($(this));
			});
			showState = function(state) {
				//alert('showState('+state+')');
				$('#directory .city .listing ul')
				.html('<div class="loading"></div>')
				.load('/locations/cities/' + encodeURIComponent(state));
				$('#directory .location .listing .items').html('');
			}
			showCity = function(state, city) {
				//alert('showCity('+state+', ' + city + ')');
				$('#directory .location .listing .items')
				.html('<div class="loading"></div>')
				.load('/locations/stores/' + encodeURIComponent(state) + '/' + encodeURIComponent(city));
			}
			showCityInt = function(state, city) {
				//alert('showCityInt('+state+', ' + city + ')');
				$('#directory .location .listing .items')
				.html('<div class="loading"></div>')
				.load('/locations/stores_int/' + encodeURIComponent(state) + '/' + encodeURIComponent(city));
			}
			showCityIntAll = function(state, city) {
				//alert('showCityIntAll('+state+', ' + city + ')');
				$('#directory .location .listing .items')
				.html('<div class="loading"></div>')
				.load('/locations/stores_int_all');
			}
		// Apply
			showApplyState = function(state) {
				//alert('showApplyState('+state+')');
				$('#directory .city .listing ul')
				.html('<div class="loading"></div>')
				.load('/apply/cities/' + encodeURIComponent(state));
				$('#directory .location .listing .items').html('');
			}
			showApplyCity = function(state, city) {
				//alert('showApplyCity('+state+', ' + city + ')');
				$('#directory .location .listing .items')
				.html('<div class="loading"></div>')
				.load('/apply/stores/' + encodeURIComponent(state) + '/' + encodeURIComponent(city));
			}
	}


// Newsroom
	function initNewsroom() {
		if ($('body.newsroom').length) {
			if (/\bMSIE 6/.test(navigator.userAgent) && !window.opera) {
				$('#header h1').supersleight({shim: '/_assets/img/directory/spacer.gif'});
			}
		}
		if ($('#more_press_button').length) {
			$('#more_press_button').live('click', function() {
				$(this).html('<img src="/_assets/img/newsroom/loader.gif" />');
				$.ajax({
					url: $(this).attr('href').replace('filter', 'fetch'),
					success: function(data) {
						$('#more_press_button').replaceWith(data);
					}
				});
				return false;	
			});
		}	
		if ($('#more_media_button').length) {
			$('#more_media_button').live('click', function() {
				$(this).html('<img src="/_assets/img/newsroom/loader.gif" />');
				$.ajax({
					url: $(this).attr('href').replace('filter', 'fetch'),
					success: function(data) {
						$('#more_media_button').replaceWith(data);
					}
				});
				return false;
			});
		}
	}


// Document is Ready
	$(document).ready(function() {
		fixIE6();
		initEclub();
		initHistory();
		initMenu();
		initPromotions();
		$("select").uniform();
		initFlashOverlays();
		initFindABo();
		initLocations();
		initNewsroom();
	});

