// JavaScript Document
$(document).ready(function(){
	var currentProtocol = (("https:" == document.location.protocol) ? "https:" : "http:");
	
	/* 2010-02-19
	* sometimes this pagetracker causes an error in IE, probably IE6 but unsure
	* error is "pagetracker is null or not an object"
	* so use a try/catch just in case */
	try { _gaq.push(['_trackEvent', 'Products', 'Product Viewed', prodID ]); } catch (error) {}
	
	// test item 5364
	// large images
	if ( $("#prodImage").length ) {
		// there is an enlarged image available
		$("#prodImage").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'Large Image Viewed', prodID ]); } catch (error) {}
			
			if ( dialogCreated( $("#largeImage") ) ) {
				$("#largeImage").dialog( "destroy" );
			}
			$("#largeImage").attr( "title", "Enlarged Image" ).dialog({
				bgiframe: true,
				height: 545,
				width: 675,
				modal: true
			}).load( $(this).attr("href") );
			
			return false;
		});
	}
	
	// flash 360 images
	if ( $("#flash360").length ) {
		// there is a flash image available
		$("#flash360").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', '360 Flash Viewed', prodID ]); } catch (error) {}
			
			if ( dialogCreated( $("#largeImage") ) ) {
				$("#largeImage").dialog( "destroy" );
			}
			$("#largeImage").attr( "title", "360 Degree View" ).dialog({
				bgiframe: true,
				height: 545,
				width: 675,
				modal: true
			}).load( $(this).attr("href") );
			
			return false;
		});
	}

	if ( $(".reviewImage").length ) {
		// someone has submitted a review with an image
		// use .live instead of .click to make sure the action is attached to
		// new elements as well
		$(".reviewImage").live( "click", function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'Review Image Viewed', prodID ]); } catch (error) {}
			if ( dialogCreated( $("#reviewImages") ) ) {
				$("#reviewImages").dialog( "destroy" );
			}
			$("#reviewImages").dialog({
				bgiframe: true,
				height: 500,
				width: 600,
				modal: true
			}).load( $(this).attr("href") );
			return false;
		});
	}

	if ( $("#viewAllReviews").length ) {
		$("#viewAllReviews").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'All Reviews Viewed', prodID ]); } catch (error) {}
			if ( !dialogCreated( $("#allReviewsDialog") ) ) {
				$("#allReviewsDialog").dialog({
					bgiframe: true,
					height: 545,
					width: 675,
					modal: true
				}).html("<p style=\"text-align: center;\"><img src=\"/images/misc/loadingAnimation.gif\"></p>").load( $(this).attr("href"), function(){
					$(document).ready(function(){
						$("head").append("<link rel=\"stylesheet\" href=\"/jquery/css/datatables/demos.css\" type=\"text/css\" />");
						$("#allReviewsTable").dataTable({
							"bPaginate": false,
							"bFilter": false,
							"aaSorting": [[1,'desc']],
							"aoColumns": [
								null,
								{ "iDataSort": 2 },
								{ "bVisible": false },
								{ "bSortable": false }
							]
						});
						if ( testSetAttributeIgnoresNameAttribute() ) {
							// IE <= 7 looks like garbage, so we need to apply the fixes below
							//$("body").append("<br>this is IE7 or less");
							$("#allReviewsTable_wrapper").css( "height", "95%" );
							$("#allReviewsTable_wrapper").css( "overflow", "scroll" );
							$("#allReviewsDialog").css( "overflow", "hidden" );
						}
					});
				});
			} else {
				$("#allReviewsDialog").dialog( "open" );
			}
			return false;
		});
	}
	
	
	
	// additional images
	if ( $(".thickbox").length ) {
		// there are extra images available
		$("head").append("<link rel=\"stylesheet\" href=\"/includes/thickbox.css\" type=\"text/css\">");
		$.getScript( "/jquery/thickbox.js" );
	}
	
	// additional images (using greybox)
	if ( $(".greybox").length ) {
		// there are extra images available
		$("head").append("<link rel=\"stylesheet\" href=\"/includes/greybox/greybox.css\" type=\"text/css\">");
		var GB_ROOT_DIR = "/includes/greybox/";
		
		$.getScript( "/includes/greybox/AJS.js" );
		$.getScript( "/includes/greybox/greybox.js" );
		
		
		/*var GB_ANIMATION = true;
		$(document).ready(function(){
			$("a.greybox").click(function(){
				event.preventDefault();
				var t = this.title;
				if ( !t ) { t = this.href; }
				GB_show(t,this.href,470,600);
				return false;
			});
		});*/
	}
	
	//transit time
	if ( $("#transitTimeShow").length ) {
		// there is a transit time calculator available
		$("#transitTimeShow").click(function(event){
			event.preventDefault();
			jqSlideLayer( "transitTimePop", "fast", 0 );
			try { _gaq.push(['_trackEvent', 'Products', 'Transit Estimator Form Viewed', prodID ]); } catch (error) {}
		});
		
		$("#transitTimePopClose").click(function(event){
			jqSlideLayer( "transitTimePop", "fast", 0 );
		});
		
		$("#to").keypress(function(event){
			if ( ( event.which && event.which == 13 ) || ( event.keyCode && event.keyCode == 13 ) ) {
				// they hit enter, which won't trigger a click in IE for some reason
				document.getElementById("transitTimeButton").click();
				event.preventDefault();
				return false;
			} else {
				return true;
			}
		});
		
		$("#transitTimeButton").click(function(event){
			event.preventDefault();
			jqToggleLayer( "transitTimeLoading", "fast", 0 );
			//try { _gaq.push(['_trackEvent', 'Products', 'Transit Time Calculator Used', prodID ]); } catch (error) {}
			var theShipZip = $("#to").val();
			//get manufacturer and availability from href query string
			var theIncURL = $("#transitTimeShow").attr("href");
			var theAvailability = $.getQueryString({id:"availability",theURL: theIncURL});
			var manufacturer = $.getQueryString({id:"from",theURL: theIncURL});
			var isGlasswareVal = $.getQueryString({id:"isGlassware",theURL: theIncURL});
			var weightVal = $.getQueryString({id:"weight",theURL: theIncURL});
			var pTags = document.getElementById("tags").checked;
			// now use manufacturer to determine the from zip
			switch ( manufacturer ) {
			case "Designing Ducks":
				var theFromZip = "19484";
				break;
			case "Designing%20Ducks":
				var theFromZip = "19484";
				break;
			case "Fashioncraft":
				var theFromZip = "11791";
				break;
			case "JBS":
				var theFromZip = "55340";
				break;
			case "JDS":
				var theFromZip = "55340";
				break;
			case "Chandler Candle":
				var theFromZip = "95623";
				break;
			case "Chandler%20Candle":
				var theFromZip = "95623";
				break;
			case "Elsies Daughter":
				var theFromZip = "05462";
				break;
			case "Elsies%20Daughter":
				var theFromZip = "05462";
				break;
			case "Event Blossom":
				var theFromZip = "92780";
				break;
			case "Event%20Blossom":
				var theFromZip = "92780";
				break;
			case "Impressions by Brianna":
				var theFromZip = "13760";
				break;
			case "Impressions%20by%20Brianna":
				var theFromZip = "13760";
				break;
			case "Kate Aspen":
				var theFromZip = "30097";
				break;
			case "Kate%20Aspen":
				var theFromZip = "30097";
				break;
			case "Levie":
				var theFromZip = "10001";
				break;
			case "Pixior":
				var theFromZip = "92780";
				break;
			case "The Mint Box":
				var theFromZip = "21784";
				break;
			case "The%20Mint%20Box":
				var theFromZip = "21784";
				break;
			case "The Wedding Pen Company":
				var theFromZip = "37064";
				break;
			case "The%20Wedding%20Pen%20Company":
				var theFromZip = "37064";
				break;
			case "Wedding Ship":
				var theFromZip = "92780";
				break;
			case "Wedding%20Ship":
				var theFromZip = "92780";
				break;
			default:
				var theFromZip = "11791";
			}
			var thePostURL = currentProtocol + "//www.favorfavorbaby.com/pscripts/UPS/timeInTransit.php";
			$.post( thePostURL, {
			   to: theShipZip,
			   from: theFromZip,
			   availability: theAvailability,
			   tags: pTags,
			   isGlassware: isGlasswareVal,
			   weight: weightVal,
			   jQSubmit: "1"
			   },
			   function(returnData){
					$("#transitTimeResults").html( returnData );
					jqToggleLayer( "transitTimeLoading", "fast", 0 );
			   }
			);
			try { _gaq.push(['_trackEvent', 'Products', 'Transit Estimator Used', prodID ]); } catch (error) {}
			/*theURL += "?Screen=CALCSHIPPING&Store_Code=FFB&calcship=1&ShipZip=" + theShipZip + "&shipcountry=" + theShipCountry;
			$.post( theURL, {
				   nothing: "nothing"
				   },
				   function(returnData){
					   $("#calcShipResults").html( returnData );
				   });*/
			//jqSlideLayer ( "transitTimePop", "medium", 0 );
		});
		
		
	} // if ( $("#transitTimeShow").length ) {
	
	//ups maps
	if ( $("#mapShow").length ) {
		// there should always be a map, but you never know
		$("#mapShow").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'UPS Map Viewed', prodID ]); } catch (error) {}
			if ( !dialogCreated( $("#MapPop") ) ) {
				$("#MapPop").dialog({
					bgiframe: true,
					height: 500,
					width: 575,
					modal: true
				}).load( $(this).attr("href") );
			} else {
				$("#MapPop").dialog( "open" );
			}
			
			return false;
		});
	}
	
	//wish list
	if ( $("#wishListButton").length ) {
		// it should also always be there
		$("#wishListButton").click(function(event){
			event.preventDefault();
			$("#wishListDescription").load( "/includes/ajax/whatIsThisProd2.php", function(){
				$(document).ready(function(){
					if ( !dialogCreated( $("#wishListDescription") ) ) {
						$("#wishListDescription").dialog({
							bgiframe: true,
							height: 250,
							width: 350,
							modal: true
						});
					} else {
						$("#wishListDescription").dialog( "open" );
					}
				});
			});
			return false;
		});
	}
	
	//glass date format
	if ( $("#glassDateButton").length ) {
		// it should also always be there
		$("#glassDateButton").mouseover(function(event){
			jqToggleLayer( "glassDatePop", null, 0 );
		});
		$("#glassDateButton").mouseout(function(event){
			jqToggleLayer( "glassDatePop", null, 0 );
		});
	}
	
	// personalization designs 
	if ( $("#showDesigns").length ) {
		$("#showDesigns").click(function(event){
			jqToggleLayer( 'coffee-favors', null, 1 );
			//jqSlideLayer( "coffee-favors", "slow", 1 );
			
			/*** personalized tags by FC ***/
			/* do not load on fly (non-ajax) method */
			if ( $(".popLink").length ) {
				// bind the links in coffee-favors with their behaviors below
				$(".popLink").click( function(event) {
					event.preventDefault();
					var theURL = $(this).attr("href");
					$("#personalitypopimage").load(theURL);
					//jqSlideLayer( 'personalitypop', 'slow', 0 );
					jqToggleLayer( 'personalitypop', null, 0, "show" );
				});
			}
			/* end do not load on fly (non-ajax) method */

			/****** LOAD ON THE FLY USING .LOAD ********/
			/*
			if ( $(".popLink").length == 0 ) { // only load it the first time (popLink will be > 0 after first load )
				$("#coffee-favors").load("//www.favorfavor.com/includes/attributes/FC/personalized-tags/allTags.php", function() {
					// rebind the links
					$(".popLink").click( function(event) {
						event.preventDefault();
						var theURL = event.target.href; // text within <a>
						if ( !theURL ) {
							theURL = event.target.parentNode.href; // <img> within <a>
						}
						$("#personalitypopimage").load(theURL);
						//jqSlideLayer( 'personalitypop', 'slow', 0 );
						jqToggleLayer( 'personalitypop', null, 0 );
					});
																															   
				});
			}
			jqSlideLayer( "coffee-favors", "slow", 1 );
			*/
			/****** END LOAD ON THE FLY USING .LOAD ********/
			
			
			/********* LOAD ON THE FLY USING .AJAX *********/
			// below is another way to do it using .ajax. this doesn't do the slide till the data is loaded
			/*
			if ( $(".popLink").length == 0 ) { // only load it the first time (popLink will be > 0 after first load )
				$.ajax({
					type: "GET",
					url: "//www.favorfavor.com/includes/attributes/FC/personalized-tags/allTags.php",
					success: function(data){
						$("#coffee-favors").html(data);
						jqSlideLayer( "coffee-favors", "slow", 1 );
						//jqToggleLayer( "coffee-favors", null, 0 );
						// rebind the links
						$(".popLink").click( function(event) {
							event.preventDefault();
							var theURL = event.target.href; // text within <a>
							if ( !theURL ) {
								theURL = event.target.parentNode.href; // <img> within <a>
							}
							$("#personalitypopimage").load(theURL);
							//jqSlideLayer( 'personalitypop', 'slow', 0 );
							jqToggleLayer( 'personalitypop', null, 0 );
						});
					}
				});
			} else {
				jqSlideLayer( "coffee-favors", "slow", 1 );
				//jqToggleLayer( "coffee-favors", null, 0 );
			}
			*/
			/********* LOAD ON THE FLY USING .AJAX *********/
		});
	}
	
	// personalization designs JQUI
	if ( $("#showDesignsJQUI").length || $(".showDesignsJQUI").length ) {
		$("#showDesignsJQUI,.showDesignsJQUI").click(function(event) {
			if ( !dialogCreated( $("#JQUIDialog") ) ) {
				//var HW = getHW( $(this).attr("href") );
				var dialogWidth = $("#JQUIDialog").css("width") != "auto" && $("#JQUIDialog").css("width") != "" ? $("#JQUIDialog").css("width").replace( "px", "" ) : "620";
				var dialogHeight = $("#JQUIDialog").css("height") != "auto" && $("#JQUIDialog").css("height") != "" ? $("#JQUIDialog").css("height").replace( "px", "" ) : "500";
				// above is buggy, just hardcode it
				dialogWidth = "620";
				dialogHeight = "500";
				$("#JQUIDialog").dialog({
					bgiframe: true,
					width: parseInt(dialogWidth),
					height: parseInt(dialogHeight),
					modal: true
				});
				if ( $("#JQUIDialog.personalizedTags").length ) {
					$("#JQUIDialog").load("/fashioncraft-jars/tags-showDesigns.htm");
				}
			} else {
				$("#JQUIDialog").dialog( "open" );
			}
		});
	} // if ( $("#showDesignsJQUI").length ) {
		
	/* FC Personalized Tags */
	if ( $(".popLink").length ) {
		// bind the links in coffee-favors with their behaviors below
		$(".popLink").click( function(event) {
			event.preventDefault();
			if ( !dialogCreated( $("#attInfo") ) ) {
				$("#attInfo").load( $(this).attr("href"), function(){
					$("#attInfo").dialog({
						bgiframe: true,
						width: 525,
						height: 440,
						modal: true
					});
				});
			} else {
				$("#attInfo").load( $(this).attr("href"), function(){
					$("#attInfo").dialog( "open" );
				});
			}
		});
	} // if ( $(".popLink").length ) {

	// personalization designs JQUI - VERSION 2
	if ( $(".showDesignsJQUIv2").length ) {
		$(".showDesignsJQUIv2").click(function(event) {
			event.preventDefault();
			/*new version, differences are:
			* popup Div will never be present by default, it must be added
			* data is always loaded from href of clicked link
			* this enables multiple links to share the same dialog container,
			* as opposed to one unique container for each link
			*/
			if ( $("#JQUIDialogv2").length ) {
				// if it has been created, we just load the new data and show it
				$("#ui-dialog-title-JQUIDialogv2").text( $(this).attr("title") );
				$("#JQUIDialogv2").attr({ title: $(this).attr("title") }).dialog("open");
				if ( $("#JQUIDialogv2").data( "currentURL" ) != $(this).attr("href") ) {
					$("#JQUIDialogv2").load( $(this).attr("href") ).data( "currentURL", $(this).attr("href") );
				}
			} else {
				$("body").append("<div id=\"JQUIDialogv2\"></div>");
				$("#JQUIDialogv2").attr({ title: $(this).attr("title") }).dialog({
					bgiframe: true,
					width: 620,
					height: 500,
					modal: true
				}).load( $(this).attr("href") ).data( "currentURL", $(this).attr("href") );
			}
		});
	} // if ( $("#showDesignsJQUI").length ) {

	// personalization designs JQUI
	
	if ( $("#showDesignsJQUI2").length || $(".showDesignsJQUI2").length ) {
		$("#showDesignsJQUI2,.showDesignsJQUI2").click(function(event) {
			if ( !dialogCreated( $("#JQUIDialog2") ) ) {
				//var HW = getHW( $(this).attr("href") );
				$("#JQUIDialog2").dialog({
					bgiframe: true,
					width: 600,
					height: 500,
					modal: true
				});
			} else {
				$("#JQUIDialog2").dialog( "open" );
			}
		});
	} // if ( $("#showDesignsJQUI2").length ) {
	
	// similar to above but for the mint-tin div
	if ( $("#showDesignsMint").length ) {
		$("#showDesignsMint").click(function(event){
			jqToggleLayer( 'mint-tin-favors', null, 1 );
		});
	}
	
	
	//popup designs/tags/etc -- close window buttons
	if ( $("#closeWindowTop").length ) {
		$("#closeWindowTop").click(function(event){
			jqToggleLayer('coffee-favors', null, 1);
		});
		$("#closeWindowBottom").click(function(event){
			jqToggleLayer('coffee-favors', null, 1);
		});
	}
	
	//similar to above but for the mint-tin div
	if ( $("#closeWindowTopMint").length ) {
		$("#closeWindowTopMint").click(function(event){
			jqToggleLayer('mint-tin-favors', null, 1);
		});
		$("#closeWindowBottomMint").click(function(event){
			jqToggleLayer('mint-tin-favors', null, 1);
		});
	}
	if ( $("#openWindowDescripMint").length ) {
		$("#openWindowDescripMint").click(function(event){
			jqToggleLayer('mint-tin-favors', null, 1);
		});
	}
	
	//personalized tags - FC
	if ( $("#AddPersTags").length ) {
		// there are personalized tags from FC, or there are matching tags by KA
		/*$("#basketAdd").submit( function() {
			return checkTags();
		});*/
		// show tag details
		
		if ( 0 ) {
			$("#AddPersTags").click(function(event){
				clearTags();
				jqToggleLayer( "persTagsBox", null, 0 );
				//jqSlideLayer( "persTagsBox", "slow", 0 );
				try { _gaq.push(['_trackEvent', 'Products', 'Tag Details Viewed', prodID ]); } catch (error) {}
			});
		} else {
			//$("#selectPersTags,#selectShapeColor,#selectTagType,#Names,#Date").parents(".attributeLine").hide();
			$("#Line1,#Line2,#selecttextLines23Color,#selecttextLine1Color,#selectfontStyle,#selectDesign,#selectpatternColor,#selectPattern,#selectborderColor,#selectbackgroundColor,#selectLayout").parents(".attributeLine").hide();
			
			//var tagType = $.getQueryString({id:"dyoTags", defaultvalue:""}) != "" ? "dyo" : "default";
			var tagType = "dyo"; // or "default"
			
			if ( tagType == "dyo" ) {
				$(".fashioncraftLabelsLink").next(".attrC").remove();
			}
			
			$("#AddPersTags").data( "optionsVisible","0" );
			$("#AddPersTags").data( "tagType", tagType );
						
			$("#AddPersTags").click(function(event){
				event.preventDefault();
				clearTags();
				//jqToggleLayer( "persTagsBox", null, 0 );
				//jqSlideLayer( "persTagsBox", "slow", 0 );
				// unhide each option
				if ( $("#AddPersTags").data("optionsVisible") == "0" ) {
					if ( $("#AddPersTags").data("tagType") == "default" ) {
						$("#selectPersTags,#selectShapeColor,#selectTagType,#Names,#Date").addClass("required").parents(".attributeLine").show();
						$("input[src='/images/buttons/update2/add-to-cart.png']").show();
						$("#persTagsBox").show("blind", 200);
					} else {
						$("#selectLayout").parents(".attributeLine").show("blind", 200);
						$("#Line1,#Line2,#selecttextLines23Color,#selecttextLine1Color,#selectfontStyle,#selectdesign,#selectpatternColor,#selectPattern,#selectborderColor,#selectbackgroundColor,#selectLayout").addClass("required");
					}
					$("#AddPersTags").data("optionsVisible","1");
					
				} else {
					if ( $("#AddPersTags").data("tagType") == "default" ) {
						$("#persTagsBox").hide("blind", 200);
						$("#selectPersTags,#selectShapeColor,#selectTagType,#Names,#Date").removeClass("required");
					} else {
						$("#selectLayout").parents(".attributeLine").hide("blind", 200);
						$("#Line1,#Line2,#selecttextLines23Color,#selecttextLine1Color,#selectfontStyle,#selectdesign,#selectpatternColor,#selectPattern,#selectborderColor,#selectbackgroundColor,#selectLayout").removeClass("required");
					}
					$("#AddPersTags").data("optionsVisible","0");
				}
				try { _gaq.push(['_trackEvent', 'Products', 'Tag Details Viewed', prodID ]); } catch (error) {}
				return false;
			});
		}
	}
	
	if ( $("#ReviewBoxPop").length ) {
		// a review has been submitted
		$("#reviewReceived").click(function(event){
			jqToggleLayer( "ReviewBoxPop", null, 0 );
		});
	}
	
	if ( $("#coffeeRedBag").length ) {
		// these are coffee favors with bag colors
		$("#coffeeRedBag").click(function(event){
			jqSetSelection ( "bag", "8320", "bag", null );
		});
		$("#coffeeSilverBag").click(function(event){
			jqSetSelection ( "bag", "8290", "bag", null );
		});
		$("#coffeeWhiteBag").click(function(event){
			jqSetSelection ( "bag", "8310", "bag", null );
		});
		
		$("#coffeeRedBag").hover(
			function () {
				$("#coffeeRedBag").css({ 'cursor' : 'pointer' });
			}, 
			function () {
				$("#coffeeRedBag").css({ 'cursor' : 'default' });
			}
		);
		$("#coffeeSilverBag").hover(
			function () {
				$("#coffeeSilverBag").css({ 'cursor' : 'pointer' });
			}, 
			function () {
				$("#coffeeSilverBag").css({ 'cursor' : 'default' });
			}
		);
		$("#coffeeWhiteBag").hover(
			function () {
				$("#coffeeWhiteBag").css({ 'cursor' : 'pointer' });
			}, 
			function () {
				$("#coffeeWhiteBag").css({ 'cursor' : 'default' });
			}
		);
	}
	
	// reviews #6 - #20
	if ( $("#showMoreReviews").length ) {
		$("#showMoreReviews").click(function(event){
			$(".moreReviews").slideToggle("normal");
			if ( $("#showMoreReviews").html() == "<b>show more</b>" ) {
				try { _gaq.push(['_trackEvent', 'Products', 'More Reviews Viewed', prodID ]); } catch (error) {}
				$("#showMoreReviews").html( "<b>show less</b>" );
			} else {
				$("#showMoreReviews").html( "<b>show more</b>" );
			}
		});
	}
	
	// wait list signup
	if ( $(".waitListShow").length ) {
		$(".waitListShow").click(function(event){
			event.preventDefault();
			if ( !dialogCreated( $("#waitListPop") ) ) {
				//var HW = getHW( $(this).attr("href") );
				$("#waitListPop").dialog({
					bgiframe: true,
					width: 450,
					height: 250,
					modal: true
				});
			} else {
				$("#waitListPop").dialog( "open" );
			}
			try { _gaq.push(['_trackEvent', 'Products', 'Wait List Signup Viewed', prodID ]); } catch (error) {}
		});
		$("#Your_Email").keypress(function(event){
			if ( ( event.which && event.which == 13 ) || ( event.keyCode && event.keyCode == 13 ) ) {
				// they hit enter, which won't trigger a click in IE for some reason
				$("#waitListSubmit").click();
				event.preventDefault();
				return false;
			} else {
				return true;
			}
		});
		$("#waitListSubmit").click(function(event){
			event.preventDefault();
			$(".loading").slideToggle("fast");
			var theURL = "http://www.favorfavorbaby.com/pscripts/waitlist.php";
			/*theURL += "Your_Email=" + escape( $("#Your_Email").val() );
			theURL += "&Product_Code=" + escape( $("#Product_Code").val() );
			theURL += "&Screen=PROD";
			theURL += "&SubScreen=CTWLSEND";
			theURL += "&Store_Code=FFB";*/
			// we have to append a random # to the URL to prevent caching
			$.get( theURL, {
			   email: $("#Your_Email").val(),
			   code: $("#Product_Code").val(),
			   rand: Math.floor(Math.random()*99999999999)
			   },
			   function(returnData){
					$(".loading").slideToggle("fast");
					if ( returnData == "1" ) {
						$("#waitListResults").addClass("success").removeClass("alert").html("<br>Thank you, we will be glad to notify you as soon as this item is back in stock.");
						try { _gaq.push(['_trackEvent', 'Products', 'Wait List Signup Success', prodID ]); } catch (error) {}
					} else {
						$("#waitListResults").addClass("alert").removeClass("success").html("<br>There was an error submitting your request. Please <a href=\"http://www.favorfavorbaby.com/c-contact-us.htm\">contact us</a> to be added to the signup list.");
						try { _gaq.push(['_trackEvent', 'Products', 'Wait List Signup Failure', prodID ]); } catch (error) {}
					}
				   //$("#waitListResults").html(returnData);
				   $("#waitListResults").show("fast");
				   //alert( returnData );
			   });
		});

	} // wait list signup
	

	$("#basketAdd").submit(function(){
		enableFormElements( $("#basketAdd") );
		if ( $("#Quantity").val() == "1" && prodMin > 1 ) {
			$("#basketAdd input:text").each(function(i){
				if ( $(this).val() && isNaN($(this).val()) ) {
					$(this).val("SAMPLE");
				}
			});
		}
	});

	// validate quantity
	if ( $("#Quantity").length) {
		$("#basketAdd").validate({
			errorClass: "alert",
			errorElement: "p"/*,
			submitHandler: function(form){
				if ( $("#Quantity").val() == "1" ) {
					$("input").each( function( index, item ) {
						if ( $(this).attr("type") == "text" && $(this).val() && $(this).attr("id") != "Quantity" ) {
							$(this).val("sample");
						}
					});
				}
				$("#basketAdd").submit();
			}*/
		});
		if ( !blockSamples ) {
			$("#Quantity").rules("add", { negativeRange: [1,prodMin] });
			
			
			$("#orderSample").click(function(event){
				event.preventDefault();
				if ( !dialogCreated( $("#sampleConfirm") ) ) {
					$("body").append("<div title=\"Order a Sample\" id=\"sampleConfirm\" class=\"hideMe\"><p class=\"nomarg\" style=\"font-size: .8em;\">Please Note: we cannot personalize or honor specific color, imprint, or text selections for personalized items for samples. You will receive 1 item with random personalization.</p></div>");
					$("#sampleConfirm").dialog({
						height: 200,
						width: 500,
						modal: true,
						buttons: {
							'That\'s ok, send me a sample!': function() {
								$(this).dialog('close');
								$("#Quantity").val("1").change();
								//alert("item would now be added to cart");
								$("#basketAdd").submit();
							},
							Cancel: function() {
								$(this).dialog('close');
							}
						}
					});
				} else {
					$("#sampleConfirm").dialog( "open" );
				}
				return false;
			})/*.css("opacity",".6").hover(function(){
				$(this).css("opacity","1");
			},
			function(){
				$(this).css("opacity",".6");
			})*/;
			
			
		} else { // if ( !blockSamples ) {
			$("#Quantity").rules("add", { min: prodMin });
		} // if ( !blockSamples ) {
		
		// let's also hide all attributes if the quantity is changed to 1 (sample)
		// what if they're looking at an accessory item? have to deal with that also
		$("#Quantity").change(function(){
			
			if ( prodMin > 1 && $("#Quantity").val() == "1" && !blockSamples && $("input[name='Product_Attribute_Count']").val() >= "1" ) {
				
				if ( !$("#sampleMessage").length ) {
					$("#pAttributes").before("<div id=\"sampleMessage\" class=\"nomarg hideMe\" style=\"width:90%;\"><p class=\"ui-state-highlight ui-corner-all\"><span class=\"ui-icon ui-icon-info fLeft\"></span>Orders for 1 item are considered samples, and will ship with random personalization options.</p>");
					if ( $("#persTagsBox").length && $("#persTagsBox").css("display") != "none" ) {
						$("#sampleMessage p").append(" Sample personalized tags can be shipped with random personalization.");
					}
				}
				if ( !$("#persTagsBox").length || $("#persTagsBox").css("display") != "none" ) {
					// save the old values in case they change their mind										   
					var sampleText = "SAMPLE";
					$("#pAttributes input[type=text][id!=Quantity]").each(function(index){
						$(this).data( "oldValue", $(this).val() ).val(sampleText.substring(0,$(this).attr("maxlength")));
					});
					$("#pAttributes select").each(function(index){
						$(this).data( "oldValue", $(this).val() ).val("sample");
						//$("body").append("<br>" + $(this).attr("id") + " val = " + $(this).val() );
					});
				}
				
				//$("#pAttributes select").val("sample");
				$("#sampleMessage").show("blind", "slow");
				$("#pAttributes").hide("blind", "slow");
			} else if ( $("#sampleMessage").length && $("#pAttributes").css("display") == "none" ) {
				// check if there are old values (they filled out some data before changing quantity to 1)
				// if so, restore them
				$("#pAttributes input[type=text]").each(function(index){
					if ( $(this).data("oldValue") != "undefined" ) {
						$(this).val( $(this).data("oldValue") );
					} else {
						$(this).val("");
					}
				});
				
				$("#pAttributes select").each(function(index){
					if ( $(this).data("oldValue") != "undefined" && $(this).data("oldValue") != "" ) {
						$(this).val( $(this).data("oldValue") );
					} else {
						$(this).val("");
					}
				});
				$("#sampleMessage").hide("blind", "slow");
				$("#pAttributes").show("blind", "slow");
			}
		});
	}
	
	/* this works but is not in use. see http://www.favorfavorbaby.com/test/jq/9401.htm */
	if ( $(".pub").length) {
		$(".pub").click(function(event){
			event.preventDefault();
			var theContentURL = $(this).attr("href");
			var whatToRequest = jqMakePUBURL( currentProtocol, theContentURL );
			var theAnchor = $(this);
			$.get( whatToRequest, function(data){
				// use the query string to get the ID of the layer we're going to load
				// we'll also make that id visible
				//alert(data);
				//alert( theAnchor.attr("href") );
				theAnchor.after( data );
				jqSlideLayer( "largeImage", "slow", 0 );
			});
		});
	} // if ( $(".pub").length) {
	
	
	

	
	// exit surveys
	/*if ( prodID == "test" ) {
		var exit = true;
		$("a").bind("click", function(){ exit = false; });
		$("form").bind("submit", function(){ exit = false; });
		$(window).bind("unload", function(){
							if ( exit ) {
								var surveyURL = "http://www.favorfavorbaby.com/includes/surveys/supplies.php";
								var height = "550";
								var width = "450";
								var windowName = "FavorFavorExitSurvey";
								var settings = "toolbar=0,directories=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height;
								window.open( surveyURL, windowName, settings );
							}
		});
	}*/
	


	if ( $("#prodCreateAccount").length ) {
		$("#prodCreateAccount").click(function(event){
			event.preventDefault();
			$.getScript( '/jscripts/acad.js' );
			if ( !dialogCreated( $("#createAccountDialog") ) ) {
				$("#createAccountDialog").load( "/includes/ajax/acad.php", function(){
					$(document).ready(function(){
						try { _gaq.push(['_trackEvent', 'Products', 'Save Basket: Info Viewed', prodID ]); } catch (error) {}
						$("#accountCreate").validate({
							rules: {
								Customer_Login: "required",
								Customer_PasswordEmail: {
									required: true,
									email: true
								},
								Customer_Password: "required",
								Customer_VerifyPassword: "required",
								
								
								Customer_ShipFirstName: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipLastName: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipEmail: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipPhone: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									},
       								minlength: 7,
      								digits: true
								},
								Customer_ShipAddress: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipCity: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipStateSelect: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_ShipZip: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									},
       								minlength: 5,
      								digits: true
								},
								Customer_ShipCountry: {
									required: {
										depends: function(element) {
											return $("#addressInfo:checked").length;
										}
									}
								},
								Customer_BillFirstName: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								},
								Customer_BillLastName: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								},
								Customer_BillEmail: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									},
									email: true
								},
								Customer_BillPhone: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									},
       								minlength: 7,
      								digits: true
								},
								Customer_BillAddress: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								},
								Customer_BillCity: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								},
								Customer_BillStateSelect: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								},
								Customer_BillZip: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									},
       								minlength: 5,
      								digits: true
								},
								Customer_BillCountry: {
									required: {
										depends: function(element) {
											return $("#differentBilling:checked").length;
										}
									}
								}
							
							}
						});
						$("#createAccount").click(function(event){
							event.preventDefault();
							if ( $("#accountCreate").valid() ) {
								try { _gaq.push(['_trackEvent', 'Products', 'Save Basket: Account Created, Item Added', prodID ]); } catch (error) {}
								createAccount( sessionID, "prod" );
							}
							return false;
						});
						
						$("#accountLogin").validate({
							rules: {
								accountLoginCustomer_Login: "required",
								accountLoginCustomer_Password: "required"
							}
						});
						$("#loginAccount").click(function(event){
							event.preventDefault();
							if ( $("#accountLogin").valid() ) {
								try { _gaq.push(['_trackEvent', 'Products', 'Save Basket: Logged In, Item Added', prodID ]); } catch (error) {}
								loginAccount( sessionID, "prod" );
							}
							return false;
						});
						
						$("#whatIsThis").click(function(event){
							event.preventDefault();
							$("#whatIsThisInfo").load( "/includes/ajax/whatIsThisProd.php", function(){
								$(document).ready(function(){
									if ( !dialogCreated( $("#whatIsThisInfo") ) ) {
										$("#whatIsThisInfo").dialog({
											bgiframe: true,
											height: 250,
											width: 350
										});
									} else {
										$("#whatIsThisInfo").dialog( "open" );
									}
								});
							});
							return false;
						});
						
					});															
				}).dialog({
					bgiframe: true,
					height: 490,
					width: 700,
					modal: true
				});
			} else {
				$("#createAccountDialog").dialog( "open" );
			}
			return false;
	   });
	} // if ( $("#prodCreateAccount").length ) {

	if ( $("#prodAddWishList").length ) {
		$.getScript( '/jscripts/acad.js' );
		$("#prodAddWishList").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'Save Basket: Item Added', prodID ]); } catch (error) {}
			saveBasket( '', sessionID, "prod", "loggedIn" );
			return false;
		});
		
	}
	
	// show review submitted confirmation
	if ( $("#ReviewBoxPop").length ) {
		try { _gaq.push(['_trackEvent', 'Products', 'Product Review Submitted', prodID ]); } catch (error) {}
		if ( !dialogCreated( $("#ReviewBoxPop") ) ) {
			$("#ReviewBoxPop").dialog({
				bgiframe: true,
				height: 200,
				width: 200
			});
		} else {
			$("#ReviewBoxPop").dialog( "open" );
		}	
	} // if ( $("#ReviewBoxPop").length ) {

	// glassware artwork
	if ( $("#showGlassCustomArt").length ) {
		// there is an enlarged image available
		$("#showGlassCustomArt").click(function(event){
			event.preventDefault();
			try { _gaq.push(['_trackEvent', 'Products', 'Glassware Custom Art Info Viewed', prodID ]); } catch (error) {}
			
			if ( dialogCreated( $("#glassCustomArt") ) ) {
				$("#glassCustomArt").dialog( "open" );
			} else {
				$("#glassCustomArt").dialog({
					bgiframe: true,
					height: 300,
					width: 400
				});
			}
			
			return false;
		});
	}

	if ( $("#reviewTabs").length ) {
		// this should always be true as of 2009-06-18
		// tabify the reviews and images
		//$("#reviewTabs").tabs();
		$("#reviewTabs").tabs({ fx: { opacity: 'toggle', duration : 150 } });
		$("#reviewTabs").css({ "background-color" : "transparent", "background-image" : "none" });
		//$(".ui-tabs").css({ "background-color" : "transparent" });
		//$(".ui-widget-content").css({ "background-color" : "transparent" });
	}

	$.localScroll({ duration: '400' });
	
	
	// add a note about DD being out of office for a week
	/*if ( $("#DDOutOfOffice").length ) {
		$("#DDOutOfOffice").dialog({ show: 'scale' });
	}*/
	

	
	if ( $("#chocolateShippingNotes").length ) {
		var csnDate = new Date();
		if ( csnDate.getMonth() > 2 && csnDate.getMonth() < 10 ) { // between march and october
			var selectedTab = 0;
		} else {
			var selectedTab = 1;
		}
		$("#chocolateShippingNotes").tabs({ selected: selectedTab });
	}

	if ( $("#selectletterCount").length && $("#babyName").length ) {
		// this is a kara nessian diaper cake with option for wooden letters showing baby name
		// rather than make visitors count the letters and choose from menu, lets
		// count the letters and fill out the menu for them.
		$("#selectletterCount").parent().parent().parent().parent().hide();
		$("#babyName").keyup(function(){
			$("#selectletterCount").val( $(this).val().length );
			//$("body").append("<br>I set the value to '" + $(this).val().length + "'");
		});
	}

	if ( $("#shipsOnOrAbout").length ) {
		$("#shipsOnOrAbout").parent().parent().hide();
	}
	
	if ( isGlassware ) {
		if ( $("#shipsOnOrAbout").length  && !outOfStock ) {
			/* note: this CAN handle items that are out of stock, the code is available below.
			* but we don't want it enabled for them right now, because maybe they will ship sooner than
			* the usual production time, hence the "&& !outOfStock" above
			*/
			
			if ( 1 ) {
				// pull shipping date from Fashioncraft
				var futureURL = "http://www.fashioncraft.com/utilities/glassShipDate.php?a=1&jsoncallback=?";
				$.getJSON(futureURL, function(data){
					var date = String(data["shipDate"]).split( /\-/g );
					var year = date[0];
					var month = date[1];
					var day = date[2];
					switch( date[1] ) {
					case "01":
						month = "January";
						break;
					case "02":
						month = "February";
						break;
					case "03":
						month = "March";
						break;
					case "04":
						month = "April";
						break;
					case "05":
						month = "May";
						break;
					case "06":
						month = "June";
						break;
					case "07":
						month = "July";
						break;
					case "08":
						month = "August";
						break;
					case "09":
						month = "September";
						break;
					case "10":
						month = "October";
						break;
					case "11":
						month = "November";
						break;
					case "12":
						month = "December";
						break;
					}
					var newShipDate = month + " " + day + ", " + year;
					$("#shipsOnOrAbout").val( newShipDate );
					$(".prodAvailability").html("Ships<a title=\"This refers to the date the item will leave our warehouse. For a transit time estimate, click on the 'more shipping info' link to the right.\" class=\"shippingOnOrAboutDescription\" style=\"color: #00f\" href=\"javascript:void(0);\">*</a> on or about " + newShipDate);
					$(".shippingOnOrAboutDescription").tooltip({
						showURL: false,
						showBody: ":",
						extraClass: "pretty"
					}).click(function(event){
						event.preventDefault();
						return false;
					});
				});
			} else { // if ( 1 ) {
			
			
				var advanceDays = 14;
				var advanceWeeks = 0;
				var futureURL = "/pscripts/misc/futureDate.php?days=" + advanceDays + "&weeks=" + advanceWeeks;
				if ( outOfStock ) {
					futureURL += "&return=" + escape($(".prodAvailability").text().split(":")[0].split(" ")[1]);
				}
				$.get(futureURL, function(data){
					$("#shipsOnOrAbout").val(data);
					$(".prodAvailability").html("Ships<a title=\"This refers to the date the item will leave our warehouse. For a transit time estimate, click on the 'more shipping info' link to the right.\" class=\"shippingOnOrAboutDescription\" style=\"color: #00f\" href=\"javascript:void(0);\">*</a> on or about " + data);
					$(".shippingOnOrAboutDescription").tooltip({
						showURL: false,
						showBody: ":",
						extraClass: "pretty"
					}).click(function(event){
						event.preventDefault();
						return false;
					});
				});
			} // if ( 1 ) {
		} // if ( $("#shipsOnOrAbout").length  && !outOfStock ) {
		
		if ( $(".fashioncraftGlasswareLink").length ) {
			// add fashioncraft's glassware info to product descriptions
			//$("body").append("<br>working");
			$.get("/includes/ajax/glass/bullets.htm", function(data){
				//$("body").append("<br>working 2");
				data = data.split("|");
				if ( $("#prodInfoDescription ul").length ) {
					//$("body").append("<br>... appending");
					$("#prodInfoDescription ul").append(data[0]);
				} else {
					//$("body").append("<br>... prepending");
					$("#prodInfoDescription").prepend("<ul>" + data[0] + "</ul>");
				}
				$("#prodInfoDescription").append(data[1]);
		
				if ( $("#custArtLink").length ) {
					$("#custArtLink").click(function(event){
						event.preventDefault();
						try { _gaq.push(['_trackEvent', 'Products', 'Glassware Custom Art Info Viewed', prodID ]); } catch (error) {}
						if ( !dialogCreated( $("#custArtPop") ) ) {
							$("body").append("<div id=\"custArtPop\" class=\"hideMe\" title=\"Custom Artwork\" style=\"font-size: .8em;\">");
							$("#custArtPop").load( $(this).attr("href"), function(){
								$("#custArtPop").dialog({
									bgiframe: true,
									height: 260,
									width: 500,
									modal: true
								});
							});
						} else {
							$("#custArtPop").dialog( "open" );
						}
						return false;
					});
				} // if ( $("#custArtLink").length ) {
			});
		} // if ( $("#custArtLink").length ) {
		
		
		
		if ( $("#custArtLink").length ) {
			$("#custArtLink").click(function(event){
				event.preventDefault();
				if ( !dialogCreated( $("#custArtPop") ) ) {
					$("body").append("<div id=\"custArtPop\" class=\"hideMe\" title=\"Custom Artwork\">");
					$("#custArtPop").load( $(this).attr("href"), function(){
						$("#custArtPop").dialog({
							bgiframe: true,
							height: 260,
							width: 500,
							modal: true
						});
					});
				} else {
					$("#custArtPop").dialog( "open" );
				}
				return false;
			});
		} // if ( $("#custArtLink").length ) {
	} // if ( isGlassware ) {

	if ( $("#DDAssembly").length ) {
		$("#DDAssembly").click(function(event){
			event.preventDefault();
			if ( !dialogCreated( $("#DDAssemblyExpl") ) ) {
				$("body").append("<div id=\"DDAssemblyExpl\" class=\"hideMe\" title=\"Assembly Options\" style=\"font-size: .8em;\">");
				$("#DDAssemblyExpl").load( $(this).attr("href"), function(){
					$("#DDAssemblyExpl").dialog({
						bgiframe: true,
						height: 200,
						width: 400,
						modal: true
					});
				});
			} else {
				$("#DDAssemblyExpl").dialog( "open" );
			}			   
			return false;
		});
	} // if ( $("#DDAssembly").length ) {
	
	// prod page
	if ( $("b:contains(:)").length ) {
		$("b:contains(:)").each(function(){
			if ( $.trim($(this).text()) == ":" ) {
				$(this).hide();
			}
		});
	}
	// patr page
	if ( $("#missingProdAttributes").length ) {
		if ( $("#missingProdAttributes a img").parent().next().html() == ":" ) {
			$("#missingProdAttributes a img").parent().next().hide();
		}
	}
	
	$(".vLargePop").live("click",function(event){
		event.preventDefault();
		// create a very large popup window and display the href value
		if ( $("#vLargePop").length ) {
			$("#vLargePop").dialog( "option", "title", $(this).attr("title") ).dialog("open").load( $(this).attr("href") );
		} else {
			$("body").append("<div id=\"vLargePop\"></div>");
			$("#vLargePop").attr( "title", $(this).attr("title") ).dialog({
				bgiframe: true,
				height: 500,
				width: 600,
				modal: true
			}).load( $(this).attr("href") );
		}
		return false;
	});
	
	if ( $("a.thickbox[rel='gallery-extraImages'][href$='pdf']").length ) {
		// this is a link to a PDF that is embedded as an additional product image
		// disable the thickbox functionality so it can be viewed like a normal link
		$("a.thickbox[rel='gallery-extraImages'][href$='pdf']").attr("rel","").attr("class","").attr("target","_blank");
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	/**** button rollovers *****/
	//rolloverLink( el, off, over, clicked );
	rolloverLink( $("#orderSample img"), "/images/buttons/update2/orderSample-off.png", "/images/buttons/update2/orderSample-over.png", "/images/buttons/update2/orderSample-down.png" );
	
	
	/*********** PRODUCT SPECIFIC ************/
	switch( prodID ) {
	case "amwed115":
		$("#Text2").parents(".attributeLine").hide();
		$("#selectWidth").change(function(event){
			if ( $(this).val() == "Wide5-8" ) {
				if ( $("#Text2").parents(".attributeLine:hidden").length ) {
					$("#Text2").addClass("required").parents(".attributeLine").show("normal");
				}
			} else {
				if ( $("#Text2").parents(".attributeLine:visible").length ) {
					$("#Text2").removeClass("required").val("").parents(".attributeLine").hide();
				}
			}
		});
		break;
	case "4748":
	case "4747":
		// hide sticker option on certain items
		$("#selectTagType option").each(function(){
			if ( $(this).text() == "Stickers (+0.28)" ) {
				$(this).remove();
			}
		});
		break;
	case "EB2136":
		// remove latte and ivory options
		$(".attributeImages img[src*=classic-latte.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-ivory.jpg]").parent().parent().remove();
		$("#selectcolor option[value=Latte]").remove();
		$("#selectcolor option[value=Ivory]").remove();
		break;
	case "EB2138":
		// remove latte and ivory options
		$(".attributeImages img[src*=classic-aqua-blue.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-burgundy.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-chocolate-blue.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-chocolate-green.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-chocolate-pink.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-grey.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-ivory.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-ivory-chocolate.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-latte.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-lemon.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-strawberry-chocolate.jpg]").parent().parent().remove();
		$(".attributeImages img[src*=classic-white.jpg]").parent().parent().remove();
		
		
		$("#selectcolor option[value=AquaBlue]").remove();
		$("#selectcolor option[value=Burgundy]").remove();
		$("#selectcolor option[value=ChocolateBlue]").remove();
		$("#selectcolor option[value=ChocolateGreen]").remove();
		$("#selectcolor option[value=ChocolatePink]").remove();
		$("#selectcolor option[value=Grey]").remove();
		$("#selectcolor option[value=Ivory]").remove();
		$("#selectcolor option[value=IvoryChocolate]").remove();
		$("#selectcolor option[value=Latte]").remove();
		$("#selectcolor option[value=Lemon]").remove();
		$("#selectcolor option[value=StrawberryChocolate]").remove();
		$("#selectcolor option[value=White]").remove();
		break;
	case "EB1081":
		$(".attributeLine:contains('Text Line')").hide();
		$(".attributeLine label:contains('Add Matching Personalized Tags')").click(function(event){
			//event.preventDefault();
			if ( $("input:checked",this).length ) {
				$(".attributeLine:contains('Text Line')").show();
			} else {
				$(".attributeLine:contains('Text Line')").hide();
			}
			//alert("click detected");
			//return false;
		});
		break;
	/*case "":
		break;*/
	} // switch( prodID ) {
	/*********** END PRODUCT SPECIFIC ************/	
	
	
	if ( $.getQueryString({id:"ela"}) == "1" || 1 ) {
		// equal length attributes
		// first get the longest one
		var longest = 0;
		$(".attributeLine input,.attributeLine select").not(":hidden").each( function(){
			if ( $(this).width() > longest ) {
				longest = $(this).width();
			}
		});
		$(".attributeLine input[type='text'],.attributeLine select").not(":hidden").width( longest );
	}

});
