$(document).ready(function() {
	go_decoding();
	
	switch (strPageID.toLowerCase()) {
		case "homev2" :
			swfobject.embedSWF(	"/_flash/header_v2.swf", 
								"header_flash", 
								"1194", 
								"274", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									image: strPageImage, 
									imagename: strPageImageCaption, 
									caption: txtPageHeadline
								}, 
								{menu: "false", wmode: "window", base: ""});
			swfobject.embedSWF(	"/_flash/video.swf", 
								"homepage_video", 
								"366", 
								"245", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									imagefile: strHomeImage, 
									videofile: strHomeVideo
								}, 
								{menu: "false", wmode: "transparent", base: "_flash/"});
			break;
			
		case "home" :
		case "landing_detail" :
		case "landing_signup_refer" :
		case "landing_signup_paybymail" :
		case "landing_signup_extended" :
		case "signup_complete" :
			swfobject.embedSWF(	"/_flash/header_new.swf", 
								"header_flash", 
								"1194", 
								"274", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									image: strPageImage, 
									imagename: strPageImageCaption
								}, 
								{menu: "false", wmode: "window", base: ""});
			break;
			
		default :
			swfobject.embedSWF(	"/_flash/header.swf", 
								"header_flash", 
								"1194", 
								"274", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									image: strPageImage, 
									imagename: strPageImageCaption
								}, 
								{menu: "false", wmode: "window", base: ""});
			break;
	}
	
	// global city show function for special module type
	
	$("#cities_show_all").click(function() {
		$(".cities").css("height", "auto");
		$(".cities").css("overflow-y", "visible");
		
		$("#cities_show_all").hide();
		$("#cities_not_listed").show();
	});

	// global search button
	$("#search_button_link").click(function() {
		$("#frmSearch").submit();
	});

	switch (strPageID.toLowerCase()) {
		case "homev2" :
			sIFR.replace(eightTrack, {
			  selector: '.sifr_header h2', 
			  wmode: 'transparent', 
			  fitExactly: 'false', 
			  forceSingleLine: 'true',  
			  selectable: 'false', 
			  offsetLeft: 5, 
			  css: {
				'.sIFR-root': { 'color': '#474749', 'letter-spacing': '-0.5' }
			  }
			});
			break;
			
		case "champions" :
			var txtTooltip		= 	"<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">" + 
									"<tr>" +
									"<td class=\"c-tl\">&nbsp;</td>" + 
									"<td class=\"c-tr\">&nbsp;</td>" + 
									"</tr><tr>" + 
									"<td class=\"c-m-l\">" + 
									"<div class=\"c-m-l-t\">" + 
									"<img src=\"/_content/ttf.php?fsize=22&text=[NAME]&trans=true\" alt=\"\" />" + 
									"<div class=\"cms_content cms_content_xxsmall\" id=\"tooltip_data\"></div>" + 
									"</div>" + 
									"</td>" + 
									"<td class=\"c-m-r\">&nbsp;</td>" + 
									"</tr><tr>" + 
									"<td class=\"c-bl\">&nbsp;</td>" + 
									"<td class=\"c-br\">&nbsp;</td>" + 
									"</tr>" + 
									"</table>";
			$('.champion_rollover').simpletip({
				onShow: function() {
					this.update(generateTooltip(txtTooltip, this.getParent()[0].name, this.getParent()[0].rel));
				}, 
				showEffect: 'none', 
				content: generateTooltip(txtTooltip, $(this).attr('name'), $(this).attr('rel')), 
				fixed: false, 
				offset: [15, 0]
			});
			break;
			
		case "champions_detail" :
			sIFR.replace(eightTrack, {
			  selector: 'ul.athlete_header li h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 5, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.quicknav_left h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 20, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			break;

		case "calendar_athlete" :
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.quicknav_left h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 2, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			break;
			
		case "contact" :
			$("#btnSubmit").click(function() {
				$("#frmContact").submit();
			});
			break;
			
		case "slog" :
			sIFR.replace(eightTrack, {
			  selector: 'ul.athlete_header li h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 5, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			$("#slogger_quickjump_button").click(function() {
				if ($(".slogger_quickjump").css("display") == "block") {
					$(".slogger_quickjump").hide("slow");
					$("#slogger_quickjump_image").attr("src", "/_images/_elements/_headers/slogger_jump.jpg");
				} else {
					$(".slogger_quickjump").show("slow");
					$("#slogger_quickjump_image").attr("src", "/_images/_elements/_headers/slogger_jump_o.jpg");
				}
			});
			break;

		case "slog_athlete" :
			sIFR.replace(eightTrack, {
			  selector: 'ul.athlete_header li h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 5, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic_426 h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.quicknav_left h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 20, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			break;
			
		case "slog_category" :
			sIFR.replace(eightTrack, {
			  selector: 'ul.athlete_header li h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 5, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic_426 h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			$("#btnSubmit").click(function() {
				$("#frmComment").submit();
			});
			$("#strName").focus(function() {
				if ($("#strName").val() == 'Name') {
					$("#strName").val('');
					$("#strName").css("fontStyle", "normal");
					$("#strName").css("color", "#484848");
				}
			});
			$("#strName").blur(function() {
				if ($("#strName").val() == '') {
					$("#strName").val('Name');
					$("#strName").css("fontStyle", "italic");
					$("#strName").css("color", "#ccd0d1");
				}
			});
			$("#txtComments").focus(function() {
				if ($("#txtComments").val() == 'Comments') {
					$("#txtComments").val('');
					$("#txtComments").css("fontStyle", "normal");
					$("#txtComments").css("color", "#484848");
				}
			});
			$("#txtComments").blur(function() {
				if ($("#txtComments").val() == '') {
					$("#txtComments").val('Comments');
					$("#txtComments").css("fontStyle", "italic");
					$("#txtComments").css("color", "#ccd0d1");
				}
			});
			$("#topics_show_all").click(function() {
				$("ul.topics_left").css("height", "auto");
				$("ul.topics_left").css("overflow-y", "visible");
				
				$("#topics_show_all").hide();
			});
			break;

		case "slog_detail" :
			sIFR.replace(eightTrack, {
			  selector: 'ul.athlete_header li h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 5, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#ffffff', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.quicknav_left h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 20, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			$("#btnSubmit").click(function() {
				$("#frmComment").submit();
			});
			$("#strName").focus(function() {
				if ($("#strName").val() == 'Name') {
					$("#strName").val('');
					$("#strName").css("fontStyle", "normal");
					$("#strName").css("color", "#484848");
				}
			});
			$("#strName").blur(function() {
				if ($("#strName").val() == '') {
					$("#strName").val('Name');
					$("#strName").css("fontStyle", "italic");
					$("#strName").css("color", "#ccd0d1");
				}
			});
			$("#txtComments").focus(function() {
				if ($("#txtComments").val() == 'Comments') {
					$("#txtComments").val('');
					$("#txtComments").css("fontStyle", "normal");
					$("#txtComments").css("color", "#484848");
				}
			});
			$("#txtComments").blur(function() {
				if ($("#txtComments").val() == '') {
					$("#txtComments").val('Comments');
					$("#txtComments").css("fontStyle", "italic");
					$("#txtComments").css("color", "#ccd0d1");
				}
			});
			break;

		case "store_detail" :
			sIFR.replace(eightTrack, {
			  selector: '.header_dynamic h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 10, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			break;
			
		case "testimonials" : 
			$("#btnSubmit").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if (($("#strFirstName").val() == '') || ($("#strFirstName").val() == "First Name")) {
					strErrorMessage		+=	' - Please enter your first name.\n';
					boolErrorFound		= true;
				}
				if (($("#strLastName").val() == '') || ($("#strLastName").val() == "Last Name")) {
					strErrorMessage		+=	' - Please enter your last name.\n';
					boolErrorFound		= true;
				}
				if (($("#strCity").val() == '') || ($("#strCity").val() == "City")) {
					strErrorMessage		+=	' - Please enter your city.\n';
					boolErrorFound		= true;
				}
				if (($("#txtTestimonial").val() == '') || ($("#txtTestimonial").val() == "Testify!")) {
					strErrorMessage		+=	' - Please enter your testimonial.\n';
					boolErrorFound		= true;
				}
				
				if (boolErrorFound) {
					alert('Some errors were found while trying to process your order.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
					return false;
				} else {
					return true;
				}
			});
			// focus events
			$("#strFirstName").focus(function() { if ($(this).val() == "First Name") $(this).val(""); });
			$("#strLastName").focus(function() { if ($(this).val() == "Last Name") $(this).val(""); });
			$("#strCity").focus(function() { if ($(this).val() == "City") $(this).val(""); });
			$("#txtTestimonial").focus(function() { if ($(this).val() == "Testify!") $(this).val(""); });
			
			// blur events
			$("#strFirstName").blur(function() { if ($(this).val() == "") $(this).val("First Name"); });
			$("#strLastName").blur(function() { if ($(this).val() == "") $(this).val("Last Name"); });
			$("#strCity").blur(function() { if ($(this).val() == "") $(this).val("City"); });
			$("#txtTestimonial").blur(function() { if ($(this).val() == "") $(this).val("Testify!"); });
			break;
			
		case "gallery" :
			$('.gallery_tooltip').simpletip({
				onBeforeShow: function() {
					this.hide();
				}, 
				onShow: function() {
					this.update(this.getParent()[0].rel);
				}, 
				showEffect: 'none', 
				content: $(this).attr('rel'), 
				fixed: false, 
				offset: [15, 0]
			});
			$('.gallery_tooltip').click(function() {
				window.location		= $(this).attr('href');
			});
			break;
			
		case "gallery_detail" :
			sIFR.replace(eightTrack, {
			  selector: '#gallery h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			sIFR.replace(eightTrack, {
			  selector: '.quicknav_left h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetLeft: 25, 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1', 'background-color': '#ffffff' }
			  }
			});
			$('.gallery_photo_button').simpletip({
				onBeforeShow: function() {
					this.hide();
				}, 
				onShow: function() {
					if (this.getParent()[0].title != "") {
						this.update(this.getParent()[0].title);
					} else {
						this.update("");
						this.hide();
					}
				}, 
				showEffect: 'none', 
				content: $(this).attr('title'), 
				fixed: false, 
				offset: [15, 0]
			});
			$('.gallery_video_button').simpletip({
				onBeforeShow: function() {
					this.hide();
				}, 
				onShow: function() {
					if (this.getParent()[0].title != "") {
						this.update(this.getParent()[0].title);
					} else {
						this.update("");
						this.hide();
					}
				}, 
				showEffect: 'none', 
				content: $(this).attr('title'), 
				fixed: false, 
				offset: [15, 0]
			});
			$('.gallery_photo_button').click(function() {
				var strPhotoID			= this.id;
				var arrPhotoInfo		= strPhotoID.split('|');
				var strCaptionText		= this.title;
				
				if (arrPhotoInfo[1] != null) {
					var strPhotoType	= arrPhotoInfo[0];
					var intPhotoID		= arrPhotoInfo[1];

					$('#large_image').attr('src', '');
					
					$('#large_image').hide();
					$('#gallery_large_caption').hide();
					$('#loading_overlay').show();
					
					scrollTo(0, 345);
					
					window.location.hash		= "#" + intPhotoID;
					
					$('#large_image').attr('src', '/_content/_get-image.php?type=' + strPhotoType + '&id=' + intPhotoID);
					$('#caption_text').html(strCaptionText);
					
					$('#large_image').load(function() {
						$('#loading_overlay').hide();
						$('#large_image').show();
						
						if ($('#caption_text').html().length > 0) {
							$('#gallery_large_caption').show();
						}
					});
				}
			});
			$('.gallery_video_button').click(function() {
				var strVideoID			= this.id;
				var arrVideoInfo		= strVideoID.split('|');
				var strCaptionText		= this.title;
				
				if (arrVideoInfo[1] != null) {
					var strVideoType	= arrVideoInfo[0];
					var intVideoID		= arrVideoInfo[1];

					scrollTo(0, 345);

					window.location.hash		= "#" + intVideoID;
					window.fraVideoFrame.location.href = "/_content/_get-video.php?type=" + strVideoType + "&id=" + intVideoID;
					$('#caption_text').html(strCaptionText);
				}
			});
			
			var strLocationHash			= window.location.hash;
			
			if (strLocationHash.length > 0) {
				var intMediaID			= strLocationHash.replace('#', '');
						
				switch (strGalleryMedia) {
					case "photos" :
						$('#large_image').attr('src', '');
						
						$('#large_image').hide();
						$('#gallery_large_caption').hide();
						$('#loading_overlay').show();

						$('#large_image').attr('src', '/_content/_get-image.php?type=' + strGalleryType + '&id=' + intMediaID);
						$('#caption_text').html('');

						$('#large_image').load(function() {
							$('#loading_overlay').hide();
							$('#large_image').show();
							
							if ($('#caption_text').html().length > 0) {
								$('#gallery_large_caption').show();
							}
						});
						break;
						
					case "videos" :
						window.fraVideoFrame.location.href = "/_content/_get-video.php?type=" + strGalleryType + "&id=" + intMediaID;
						$('#caption_text').html('');
						break;
				}
			}
			
			if (strGalleryMedia == "videos") {
				window.fraVideoFrame.location.href = "/_content/_get-video.php?type=" + strGalleryType + "&id=" + intFirstVideoID;
			}
			break;
			
		case "landing_home" :
			isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
			if (!jQuery.support.opacity) {
				if (isIE6) {
					$("#upgrade").show();
				}
			}
			swfobject.embedSWF(	"/_flash/athlete_ticker.swf", 
								"athletes_flash", 
								"570", 
								"209", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
								}, 
								{menu: "false", wmode: "window", base: ""});
			break;

		case "landing_detail" :
			swfobject.embedSWF(	"/_flash/detail_header_new.swf", 
								"flash_header", 
								"815", 
								"56", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									name: strClinicName, 
									title: strClinicTitle
								}, 
								{menu: "false", wmode: "transparent", base: ""});
			swfobject.embedSWF(	"/_flash/ticker.swf", 
								"flash_ticker", 
								"360", 
								"70", 
								"9.0.0", 
								"/_js/_swfobject/expressInstall.swf", 
								{
									id: strPageKey
								}, 
								{menu: "false", wmode: "transparent", base: ""});

			$("#marquee_data").marquee("marquee_text");
			$(".marquee_text div").css("padding-right", "996px");
			$(".marquee_text div").css("position", "relative");
			$(".marquee_text div").css("left", "-696px");
			break;

		case "landing_signup_extended" :
			Shadowbox.init();
			
			$(".checkbox").click(function() {
				var strRelID		= $(this).attr("rel");
				var objImageObject	= $(this).children("img");
				var intCurVal		= parseInt($("#" + strRelID).val());
				
				if (intCurVal) {
					$("#" + strRelID).val("0");
					objImageObject.attr("src", "/_images/_buttons/input_check_off.png");
				} else {
					$("#" + strRelID).val("1");
					objImageObject.attr("src", "/_images/_buttons/input_check_on.png");
				}
			});
			$(".checkbox_label").click(function() {
				var strTitleID		= $(this).attr("title");
				var objAnchorObject	= $("a[rel=" + strTitleID + "]");
				var objImageObject	= $(objAnchorObject).children("img");
				var intCurVal		= parseInt($("#" + strTitleID).val());
				
				if (intCurVal) {
					$("#" + strTitleID).val("0");
					objImageObject.attr("src", "/_images/_buttons/input_check_off.png");
				} else {
					$("#" + strTitleID).val("1");
					objImageObject.attr("src", "/_images/_buttons/input_check_on.png");
				}
			});
			$("#intSessionID").change(function() {
				calculateTotalDue();
			});
			$("#strPromoCode").change(function() {
				obtainPromoDiscount($(this).val());
			});
			$("#btnSubmit").click(function() {
				if (!boolAJAXActive) {
					var strErrorMessage		= '';
					var boolErrorFound		= false;
					
					if ($("#strFirstName").val() == '') {
						strErrorMessage		+=	' - Please enter the first registrant\'s first name.\n';
						boolErrorFound		= true;
						errorClass("#strFirstName", true);
					} else {
						errorClass("#strFirstName", false);
					}
					if ($("#strLastName").val() == '') {
						strErrorMessage		+=	' - Please enter the first registrant\'s last name.\n';
						boolErrorFound		= true;
						errorClass("#strLastName", true);
					} else {
						errorClass("#strLastName", false);
					}
					if ($("#strEmail").val() == '') {
						strErrorMessage		+=	' - Please enter the first registrant\'s e-mail address.\n';
						boolErrorFound		= true;
						errorClass("#strEmail", true);
					} else {
						var strEmail		= $("#strEmail").val();
						var boolEmailValid	= false;
						
						if (strEmail.indexOf('@') > -1) {
							intAtPosition	= strEmail.indexOf('@');
							if (strEmail.indexOf('.', intAtPosition) > -1) {
								boolEmailValid	= true;
							}
						}
						
						if (!boolEmailValid) {
							strErrorMessage		+=	' - Please enter a valid e-mail address for the first registrant.\n';
							boolErrorFound		= true;
							errorClass("#strEmail", true);
						} else {
							errorClass("#strEmail", false);
						}
					}
					if ($("#strMailingAddress").val() == '') {
						strErrorMessage		+=	' - Please enter the first registrant\'s mailing address.\n';
						boolErrorFound		= true;
						errorClass("#strMailingAddress", true);
					} else {
						errorClass("#strMailingAddress", false);
					}
					if ($("#strPhone").val() == '') {
						strErrorMessage		+=	' - Please enter the first registrant\'s phone number.\n';
						boolErrorFound		= true;
						errorClass("#strPhone", true);
					} else {
						errorClass("#strPhone", false);
					}
					/*
					if ($("#strShirtSize").val() == '') {
						strErrorMessage		+=	' - Please select the first registrant\'s shirt size.\n';
						boolErrorFound		= true;
					}
					*/
					if ($("#intSessionID").val() == '0') {
						strErrorMessage		+=	' - Please select a session time.\n';
						boolErrorFound		= true;
						errorClass("#intSessionID", true);
					} else {
						errorClass("#intSessionID", false);
					}
					
					// payment
					if ($("#strCardholderName").val() == '') {
						strErrorMessage		+=	' - Please enter the cardholder\'s full name.\n';
						boolErrorFound		= true;
						errorClass("#strCardholderName", true);
					} else {
						errorClass("#strCardholderName", false);
					}
					if ($("#strCardNumber").val() == '') {
						strErrorMessage		+=	' - Please enter the credit card number you will be using.\n';
						boolErrorFound		= true;
						errorClass("#strCardNumber", true);
					} else {
						errorClass("#strCardNumber", false);
					}
					if ($("#strCVVCode").val() == '') {
						strErrorMessage		+=	' - Please enter the 3 or 4 digit verification code from your credit card.  This is usually found on the back of the card near the magnetic strip.\n';
						boolErrorFound		= true;
						errorClass("#strCVVCode", true);
					} else {
						errorClass("#strCVVCode", false);
					}
					if ($("#strBillingAddress").val() == '') {
						strErrorMessage		+=	' - Please enter the billing address for the credit card you are using.\n';
						boolErrorFound		= true;
						errorClass("#strBillingAddress", true);
					} else {
						errorClass("#strBillingAddress", false);
					}
					if ($("#strBillingCity").val() == '') {
						strErrorMessage		+=	' - Please enter the billing city for the credit card you are using.\n';
						boolErrorFound		= true;
						errorClass("#strBillingCity", true);
					} else {
						errorClass("#strBillingCity", false);
					}
					if ($("#strBillingZIP").val() == '') {
						strErrorMessage		+=	' - Please enter the billing ZIP for the credit card you are using.\n';
						boolErrorFound		= true;
						errorClass("#strBillingZIP", true);
					} else {
						errorClass("#strBillingZIP", false);
					}
					
					if (!boolErrorFound) {
						if (parseInt($("#intRegistrantCount").val()) > 1) {
							if (confirm('You are about to register and pay for ' + parseInt($("#intRegistrantCount").val()) + ' participants.  This is going to be a total of $' + (getTotal() - getDiscount()) + '.  Are you sure you want to proceed?\n\nPress [OK] to continue, or [CANCEL] to abort.')) {
								if (parseInt($("#intRegistrantCount").val()) < 10) {
									for (var intCounter = (parseInt($("#intRegistrantCount").val()) + 1); intCounter <= 10; intCounter++) { 
										$("#strRegFirstName_" + intCounter).val("");
										$("#strRegLastName_" + intCounter).val("");
										$("#strRegAge_" + intCounter).val("");
										$("#strRegEmail_" + intCounter).val("");
										$("#strRegAddress_" + intCounter).val("");
										$("#strRegPhone_" + intCounter).val("");
										$("#strRegTeam_" + intCounter).val("");
										//$("#strRegShirtSize_" + intCounter).val("");
									}
								}
	
								$("#lyrButton").hide();
								$("#lyrLoader").show();
								$("#frmSignup").submit();
							}
						} else {
							$("#lyrButton").hide();
							$("#lyrLoader").show();
							$("#frmSignup").submit();
						}
					} else {
						alert('Some errors were found while trying to process your order.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
					}
				} else {
					alert('Please wait for the promo code lookup to finish before attempting to process your order.');	
				}
			});
			
			$("#strFirstName").blur(function() {
				$("#strRegFirstName_1").val($("#strFirstName").val());
				calculateTotalDue();
			});
			$("#strLastName").blur(function() {
				$("#strRegLastName_1").val($("#strLastName").val());
			});
			$("#strAge").blur(function() {
				$("#strRegAge_1").val($("#strAge").val());
			});
			$("#strRegFirstName_1").blur(function() {
				$("#strFirstName").val($("#strRegFirstName_1").val());
			});
			$("#strRegLastName_1").blur(function() {
				$("#strLastName").val($("#strRegLastName_1").val());
			});
			$("#strRegAge_1").blur(function() {
				$("#strAge").val($("#strRegAge_1").val());
			});
			$("#intRegistrantCount").change(function() {
				var intRegCount		= parseInt($("#intRegistrantCount").val());
				
				// hide all
				for (var intCounter = 2; intCounter <= 10; intCounter++) {
					$("#lyrRegistrant_" + intCounter).hide();	
				}
				
				if (intRegCount <= 10) {
					for (var intCounter = 2; intCounter <= intRegCount; intCounter++) {
						$("#lyrRegistrant_" + intCounter).show();
					}
				}
				
				obtainPromoDiscount($("#strPromoCode").val());
			});
			$(".registrant_input").change(function() {
				calculateTotalDue();
			});
			
			// initially calculate total due on page load
			calculateTotalDue();
			if ($("#strPromoCode").val() != "") {
				obtainPromoDiscount($("#strPromoCode").val());
			}
			break;
			
		case "store_register" :
			$("#btnSubmit").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if ($("#strFirstName").val() == '') {
					strErrorMessage		+=	' - Please enter your first name.\n';
					boolErrorFound		= true;
				}
				if ($("#strLastName").val() == '') {
					strErrorMessage		+=	' - Please enter your last name.\n';
					boolErrorFound		= true;
				}
				if ($("#strDOB").val() == '') {
					strErrorMessage		+=	' - Please enter your date of birth.\n';
					boolErrorFound		= true;
				}
				if ($("#strAddress").val() == '') {
					strErrorMessage		+=	' - Please enter your mailing address.\n';
					boolErrorFound		= true;
				}
				if ($("#strCity").val() == '') {
					strErrorMessage		+=	' - Please enter your city.\n';
					boolErrorFound		= true;
				}
				if ($("#strState").val() == '') {
					strErrorMessage		+=	' - Please enter your state or province.\n';
					boolErrorFound		= true;
				}
				if ($("#strPostCode").val() == '') {
					strErrorMessage		+=	' - Please enter your postal code.\n';
					boolErrorFound		= true;
				}
				if ($("#strPhone").val() == '') {
					strErrorMessage		+=	' - Please enter your phone number.\n';
					boolErrorFound		= true;
				}
				if ($("#strEmail").val() == '') {
					strErrorMessage		+=	' - Please enter your e-mail address.\n';
					boolErrorFound		= true;
				} else {
					var strEmail		= $("#strEmail").val();
					var boolEmailValid	= false;
					
					if (strEmail.indexOf('@') > -1) {
						intAtPosition	= strEmail.indexOf('@');
						if (strEmail.indexOf('.', intAtPosition) > -1) {
							boolEmailValid	= true;
						}
					}
					
					if (!boolEmailValid) {
						strErrorMessage		+=	' - Please enter a valid e-mail address.\n';
						boolErrorFound		= true;
					}
				}
				if ($("#strPassword").val() == '') {
					strErrorMessage		+=	' - Please enter your password.\n';
					boolErrorFound		= true;
				} else {
					if ($("#strPasswordV").val() == '') {
						strErrorMessage		+=	' - Please enter your password again in the Confirm Password box.\n';
						boolErrorFound		= true;
					} else {
						if ($("#strPassword").val() != $("#strPasswordV").val()) {
							$("#strPassword").val("");
							$("#strPasswordV").val("");
							
							strErrorMessage		+=	' - Your passwords do not match.  Please enter them again.\n';
							boolErrorFound		= true;
						}
					}
				}
				
				if (!boolErrorFound) {
					$("#frmRegister").submit();
				} else {
					alert('Some errors were found while trying to process your registration.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
				}
			});
			break;

		case "store_guest" :
			$("#btnSubmit").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if ($("#strFirstName").val() == '') {
					strErrorMessage		+=	' - Please enter your first name.\n';
					boolErrorFound		= true;
				}
				if ($("#strLastName").val() == '') {
					strErrorMessage		+=	' - Please enter your last name.\n';
					boolErrorFound		= true;
				}
				if ($("#strAddress").val() == '') {
					strErrorMessage		+=	' - Please enter your mailing address.\n';
					boolErrorFound		= true;
				}
				if ($("#strCity").val() == '') {
					strErrorMessage		+=	' - Please enter your city.\n';
					boolErrorFound		= true;
				}
				if ($("#strState").val() == '') {
					strErrorMessage		+=	' - Please enter your state or province.\n';
					boolErrorFound		= true;
				}
				if ($("#strPostCode").val() == '') {
					strErrorMessage		+=	' - Please enter your postal code.\n';
					boolErrorFound		= true;
				}
				if ($("#strPhone").val() == '') {
					strErrorMessage		+=	' - Please enter your phone number.\n';
					boolErrorFound		= true;
				}
				if ($("#strEmail").val() == '') {
					strErrorMessage		+=	' - Please enter your e-mail address.\n';
					boolErrorFound		= true;
				} else {
					var strEmail		= $("#strEmail").val();
					var boolEmailValid	= false;
					
					if (strEmail.indexOf('@') > -1) {
						intAtPosition	= strEmail.indexOf('@');
						if (strEmail.indexOf('.', intAtPosition) > -1) {
							boolEmailValid	= true;
						}
					}
					
					if (!boolEmailValid) {
						strErrorMessage		+=	' - Please enter a valid e-mail address.\n';
						boolErrorFound		= true;
					}
				}
				
				if (!boolErrorFound) {
					$("#frmRegister").submit();
				} else {
					alert('Some errors were found while trying to save your shipping information.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
				}
			});
			break;

		case "store_account" :
			$("#btnSubmit").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if ($("#strFirstName").val() == '') {
					strErrorMessage		+=	' - Please enter your first name.\n';
					boolErrorFound		= true;
				}
				if ($("#strLastName").val() == '') {
					strErrorMessage		+=	' - Please enter your last name.\n';
					boolErrorFound		= true;
				}
				if ($("#strDOB").val() == '') {
					strErrorMessage		+=	' - Please enter your date of birth.\n';
					boolErrorFound		= true;
				}
				if ($("#strAddress").val() == '') {
					strErrorMessage		+=	' - Please enter your mailing address.\n';
					boolErrorFound		= true;
				}
				if ($("#strCity").val() == '') {
					strErrorMessage		+=	' - Please enter your city.\n';
					boolErrorFound		= true;
				}
				if ($("#strState").val() == '') {
					strErrorMessage		+=	' - Please enter your state or province.\n';
					boolErrorFound		= true;
				}
				if ($("#strPostCode").val() == '') {
					strErrorMessage		+=	' - Please enter your postal code.\n';
					boolErrorFound		= true;
				}
				if ($("#strPhone").val() == '') {
					strErrorMessage		+=	' - Please enter your phone number.\n';
					boolErrorFound		= true;
				}
				if ($("#strEmail").val() == '') {
					strErrorMessage		+=	' - Please enter your e-mail address.\n';
					boolErrorFound		= true;
				} else {
					var strEmail		= $("#strEmail").val();
					var boolEmailValid	= false;
					
					if (strEmail.indexOf('@') > -1) {
						intAtPosition	= strEmail.indexOf('@');
						if (strEmail.indexOf('.', intAtPosition) > -1) {
							boolEmailValid	= true;
						}
					}
					
					if (!boolEmailValid) {
						strErrorMessage		+=	' - Please enter a valid e-mail address.\n';
						boolErrorFound		= true;
					}
				}
				if ($("#strPassword").val() != '') {
					if ($("#strPasswordV").val() == '') {
						strErrorMessage		+=	' - Please enter your password again in the Confirm Password box.\n';
						boolErrorFound		= true;
					} else {
						if ($("#strPassword").val() != $("#strPasswordV").val()) {
							$("#strPassword").val("");
							$("#strPasswordV").val("");
							
							strErrorMessage		+=	' - Your passwords do not match.  Please enter them again.\n';
							boolErrorFound		= true;
						}
					}
				}
				
				if (!boolErrorFound) {
					$("#frmAccount").submit();
				} else {
					alert('Some errors were found while trying to update your account.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
				}
			});
			break;
			
		case "store_login" :
			$("#btnLogin").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if ($("#strEmail").val() == '') {
					strErrorMessage		+=	' - Please enter your e-mail address.\n';
					boolErrorFound		= true;
				} else {
					var strEmail		= $("#strEmail").val();
					var boolEmailValid	= false;
					
					if (strEmail.indexOf('@') > -1) {
						intAtPosition	= strEmail.indexOf('@');
						if (strEmail.indexOf('.', intAtPosition) > -1) {
							boolEmailValid	= true;
						}
					}
					
					if (!boolEmailValid) {
						strErrorMessage		+=	' - Please enter a valid e-mail address.\n';
						boolErrorFound		= true;
					}
				}
				if ($("#strPassword").val() == '') {
					strErrorMessage		+=	' - Please enter your password.\n';
					boolErrorFound		= true;
				}
				
				if (!boolErrorFound) {
					$("#frmLogin").submit();
				} else {
					alert('Some errors were found while trying to log you in.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
				}
			});
			break;

		case "store_checkout" :
			$("#btnAuthorize").click(function() {
				var strErrorMessage		= '';
				var boolErrorFound		= false;
				
				if ($("#strCardholderName").val() == '') {
					strErrorMessage		+=	' - Please enter the cardholder\'s name.\n';
					boolErrorFound		= true;
				}
				if ($("#strCardNumber").val() == '') {
					strErrorMessage		+=	' - Please enter your credit card number.\n';
					boolErrorFound		= true;
				}
				if ($("#strCardCVV").val() == '') {
					strErrorMessage		+=	' - Please enter your credit card\'s CVV (security) code.\n';
					boolErrorFound		= true;
				}
				
				if (!boolErrorFound) {
					$("#lyrButtons").hide();
					$("#lyrWait").show();
					$("#frmCheckout").submit();
				} else {
					alert('Some errors were found while trying to process this transaction.  Please correct the items listed below, and then try again.\n\n' + strErrorMessage);
				}
			});
			break;
			
		case "store_category" :
			sIFR.replace(eightTrack, {
			  selector: '.category_header h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1' }
			  }
			});
			break;
			
		case "store_search" :
			sIFR.replace(eightTrack, {
			  selector: '.category_header h1', 
			  wmode: 'transparent', 
			  fitExactly: 'true', 
			  forceSingleLine: 'true', 
			  selectable: 'false', 
			  offsetTop: 2, 
			  css: {
				'.sIFR-root': { 'color': '#484848', 'letter-spacing': '-1' }
			  }
			});
			break;
			
	}
});

function generateTooltip(txtRawHTML, strTitle, strCaption) {
	txtRawHTML		= txtRawHTML.replace("[NAME]", strTitle);
	txtRawHTML		= txtRawHTML.replace("id=\"tooltip_data\">", "id=\"tooltip_data\">" + strCaption);
	
	return txtRawHTML;
}

function calculateTotalDue() {
	var intRegCount		= parseInt($("#intRegistrantCount").val());
	var dblTotal		= 0.00;
	var intCurSession	= $("#intSessionID").val();
	var intRegCounter	= 1;
	var dblSessionPrice	= parseFloat(arrSessions[intCurSession]);

	// update price-per-person
	if (intCurSession != "") {
		$("#lyrPrice").html("$" + arrSessions[intCurSession]);
	} else {
		$("#lyrPrice").html("n/a");
	}

	// add default first registration
	dblTotal			+= dblSessionPrice;
	
	if (intRegCount > 1) {
		for (var intCounter = 2; intCounter <= intRegCount; intCounter++) {
			if (($("#strRegFirstName_" + intCounter).val().length >= 2) && ($("#strRegLastName_" + intCounter).val().length >= 2)) {
				dblTotal	+= dblSessionPrice;
				intRegCounter++;
			}
		}
	}
	
	if (intRegCounter > intRegCount) {
		intRegCounter	= intRegCount;	
	}
	
	if (dblDiscount > 0) {
		switch (intDiscountType) {
			case 1 :
			case 2 :
				dblTotal			-= dblDiscount;
				$("#lyrPromoCode").html("(including $" + $.currency(dblDiscount, {s: ",", d: ".", c: 2}) + " discount)");
				break;
				
			case 3 :
			case 4 :
				dblTotal			-= (dblDiscountEach * intRegCounter);
				$("#lyrPromoCode").html("(including $" + $.currency(dblDiscountEach, {s: ",", d: ".", c: 2}) + " off each registrant)");
				break;
		}
	} else {
		$("#lyrPromoCode").html("");
	}
	
	$("#lyrTotalDue").html("$" + $.currency(dblTotal, {s: ",", d: ".", c: 2}) + "  (" + intRegCounter + " registrants)");
}

function getActualNumRegistrants() {
	var intRegCount		= parseInt($("#intRegistrantCount").val());
	var intRegCounter	= 1;

	if (intRegCount > 1) {
		for (var intCounter = 2; intCounter <= intRegCount; intCounter++) {
			if (($("#strRegFirstName_" + intCounter).val().length >= 2) && ($("#strRegLastName_" + intCounter).val().length >= 2)) {
				intRegCounter++;
			}
		}
	}
	
	return intRegCounter;
}

function resetMarquee() {
	$(".marquee_text div").css("left", "-0px");
}

function getTotal() {
	var dblTotal		= 0.00;
	var intCurSession	= $("#intSessionID").val();
	var intRegCounter	= 1;
	var dblSessionPrice	= parseFloat(arrSessions[intCurSession]);

	dblTotal			+= dblSessionPrice;
	dblTotal			= (dblTotal * parseInt($("#intRegistrantCount").val()));
	
	return dblTotal;
}

function getDiscount() {
	var dblReturnAmount			= 0;
	
	if (intDiscountType > -1) {
		switch (intDiscountType) {
			case 1 :
			case 2 :
				dblReturnAmount		= dblDiscount;
				break;
				
			case 3 :
			case 4 :
				dblReturnAmount		= (dblDiscountEach * getActualNumRegistrants());
				break;
		}
	}
	
	return dblReturnAmount;
}

function obtainPromoDiscount(strCurPromoCode) {
	if (strCurPromoCode == "") {
		boolAJAXActive		= false;
		dblDiscount			= 0.00;
		dblDiscountEach		= 0.00;
		intDiscounType		= -1;
		calculateTotalDue();
		
		$("#strPromoCode").val("");
		$("#lyrPromoCode").html("");
	} else {
		boolAJAXActive		= true;
		dblDiscount			= 0.00;
		dblDiscountEach		= 0.00;
		intDiscountType		= -1;
		$("#lyrPromoCode").html("Looking up promo code, please wait...");
		
		$.get(	"/_content/_code-lookup.php", 
				{
					code: strCurPromoCode, 
					key: $("#key").val(), 
					total: getTotal(), 
					numreg: getActualNumRegistrants(), 
					sid: $("#intSessionID").val()
				}, 
				function(txtData) {
					boolAJAXActive	= false;
					var objJSON		= eval(txtData);
					
					if (objJSON.success) {
						dblDiscount			= parseFloat(objJSON.amount);
						dblDiscountEach		= parseFloat(objJSON.amounteach);
						intDiscountType		= parseInt(objJSON.type);
						calculateTotalDue();
					} else {
						dblDiscount			= 0.00;
						dblDiscountEach		= 0.00;
						intDiscountType		= -1;
						calculateTotalDue();
						
						$("#strPromoCode").val("");
						$("#lyrPromoCode").html("");
	
						alert("Sorry, but that promotional code is not valid.");
					}
				}, 
				"json");
	}
}

function errorClass(strElementID, boolAddClass) {
	var objElement		= $(strElementID).parent("div");
	var arrClasses		= $(objElement).attr("class").split(" ");
	var strClassSuffix	= "_red";
	var strCurClass		= "";
	
	if (arrClasses.length >= 1) {
		strCurClass			= arrClasses[0];
		
		switch (boolAddClass) {
			case true : 
				if (arrClasses.length > 1) {
					if (!$(objElement).hasClass(strCurClass + strClassSuffix)) {
						$(objElement).addClass(strCurClass + strClassSuffix);
					}
				} else {
					$(objElement).addClass(strCurClass + strClassSuffix);
				}
				break;
				
			case false : 
				if ($(objElement).hasClass(strCurClass + strClassSuffix)) {
					$(objElement).removeClass(strCurClass + strClassSuffix);
				}
				break;
		}
	}
}