window.initLiveChat = function() {

    if ( window.pu ) {
	pu('https://chat1.chatstat.com/chatframe.aspx?csuid=56621', 0)
    }

};

$(function() {
	//$(document).pngFix();


	if ($('body').hasClass('beta')) {
	$("body.home div#photo-bg").flash(
		{src:"flash/home-beta.swf",
		 width:818,
		 height:544,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"});
	} else {
	$("body.home div#photo-bg").flash(
		{src:"flash/home.swf",
		 width:818,
		 height:544,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"});
	}
	

	$("#spa-photos").flash(
		{src:"flash/photo-gallery.swf",
		 width:550,
		 height:420,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"});
	
	
	// Flash masthead JS below:
	
	var leftOffset = 303;

	//var offset = $("#inner-wrapper").offset();
	var innerWrapper = $('#inner-wrapper');
	if ( innerWrapper.length ) {
 		if ($.browser.msie) {
			var left = (innerWrapper.offset().left)/733 + leftOffset; //IE Fix
		} else {
			var left = innerWrapper.offset().left + leftOffset;
		};
	};
	
	var width = document.body.clientWidth - left;
		
	$(".masthead").css({marginLeft:left+"px",width:width+"px"});

	$("#title-wrapper").each(function() {
	    
		var maintitle = $("h1", this).text(); 
		var subtitle = $("h2", this).text();

		/* start of replacement flash code
		    var flashMastheads = [
			{
			    id:'philosophy-masthead',
			    xmlPath:'flash/philosophy.xml'
			},
			{
			    id:'another-masthead',
			    xmlPath:'flash/another.xml'
			},
			{
			    id:'another-masthead',
			    xmlPath:'flash/another.xml'
			}
		    ];

		    $( flashMastheads ).each( function( iter, obj ) {
			$('div#' + obj['id']).flash({
			    width:width,
			    height:423,
			    wmode:'transparent',
			    quality:'high'
			},
			{version:'8'},
			function( htmlOptions ) {
			    htmlOptions.flashvars.xmlfile = obj['xmlPath'];
			    htmlOptions.flashvars.maintitle = maintitle;
			    htmlOptions.flashvars.subtitle = subtitle;
			    $( this ).html( $.fn.flash.transform( htmlOptions ));
			});
		    });
		    
		    end of flash replacement code */

			$("div#philosophy-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/philosophy.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#wellness-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/wellness.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#salon-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/salon.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#experience-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/experience.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#services-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#welcome-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/welcome.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#waxing-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/waxing-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#touch-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/touch-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#factsheet-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/spa-factsheet.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#facilities-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/spa-facilities.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#treatments-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/signature-treatments.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#classes-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/signature-classes.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#prenatal-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/prenatal-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#ocean-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/ocean-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#nail-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/nail-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#staff-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/meet-the-staff.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#hair-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/hair-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#schedule-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/fitness-schedule.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#fitness-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/fitness-activities.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#faqs-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/FAQ.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#facial-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/facial-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#exclusive-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/exclusive-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#earth-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/earth-inspired.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#water-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/bath-and-water.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#specials-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/specials.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
		});

	$(window).resize(function(){ //when user re-sizes window, re-load flash with new width.
		//offset = $("#inner-wrapper").offset();
		var leftOffset = 303;
		if ($("#inner-wrapper")){
			if ($.browser.msie) {
				var left = ($("#inner-wrapper").offset().left)/733 + leftOffset; //IE fix
			} else {
				var left = $("#inner-wrapper").offset().left + leftOffset;
			}
		}
		width = document.body.clientWidth - left;
		$(".masthead").css({marginLeft:left+"px",width:width+"px"});
	$("#title-wrapper").each(function() {
		var maintitle = $("h1", this).text(); 
		var subtitle = $("h2", this).text();
			$("div#philosophy-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/philosophy.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#wellness-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/wellness.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#salon-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/salon.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#experience-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/experience.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#services-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#welcome-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/welcome.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#waxing-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/waxing-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#touch-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/touch-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#factsheet-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/spa-factsheet.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#facilities-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/spa-facilities.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#treatments-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/signature-treatments.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#classes-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/signature-classes.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#prenatal-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/prenatal-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#ocean-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/ocean-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#nail-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/nail-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#staff-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/meet-the-staff.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#hair-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/hair-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#schedule-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/fitness-schedule.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#fitness-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/fitness-activities.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#faqs-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/FAQ.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#facial-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/facial-therapies.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#exclusive-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/exclusive-services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#earth-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/earth-inspired.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#water-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/bath-and-water.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#specials-masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/specials.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
			$("div#masthead").flash(
			{src:"flash/masthead.swf",
	 			width:width,
				height:423,
		 		wmode:"transparent",
		 		quality:"high"},
		 		{version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.xmlfile = "flash/services.xml";
					htmlOptions.flashvars.maintitle = maintitle;
					htmlOptions.flashvars.subtitle = subtitle;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
		});
	});
	
	/* JS to find the last list item in the footer nav and decrease the width by 1px in order to height the border */
	
	$("ul#lagunabeach-footer").each( function () {
		var a = $(this);
		$("li:last-child a", a).css("height","28px");
		$("li:last-child", a).css("height","28px");
	});
});

function checkExposure() { 
	
	var exposed = $.cookie('exposed'); // reads cookie
	
	if (exposed != 'true')  { // If not exposed...
		$('#modal-wrapper').jqm({closeClass:'jqmClose'}).jqmShow();
		$.cookie('exposed', 'true'); // Mark this session as being exposed
	}
}


$(function(){
	if($('body').is('.home')) {
		checkExposure();
	}
});