$(document).ready(function() {						/***************************************	Utility functions	***************************************/		// Remove a specific string from the editor window	removeTextFromProductText = function(textToRemove, id) {		var productText = tinyMCE.get("productText").getContent();				if (id != "") {			tinyMCE.get("productText").dom.remove(id);			productText = tinyMCE.get("productText").getContent();		}				tinyMCE.get("productText").setContent(productText);		$("#productText").val(productText);				designDetails[v].text = $("#productText").val();				if (tinyMCE.get('productText').getContent().length == 0) {			zoomOut();			$('#zoom a').addClass('disabled');		}	}		// Take in an array of <p> tags and build a clean paragraph for the editor window	getLyricBlock = function(paragraphs) {		var lyricBlock = "";		for (x = 0; x < paragraphs.length; x++) {			lyricBlock = lyricBlock + paragraphs[x].innerHTML;			if (x < (paragraphs.length - 1)){				lyricBlock = lyricBlock + "<br />"; // "\n" // Only add line breaks in between paragraphs, addTextToProductText takes care of ending line breaks			}		}		return lyricBlock;	}		// Add text to the editor window - put a line break after each addition	addTextToProductText = function(textToAdd, id, lid){		if (id != "") {			textToAdd = "<span " +					"id=\"" + id + "\">" +					textToAdd + "<br /></span>";		} 				$("#update_lid").val(lid);				$("#productText").val($("#productText").val() + textToAdd);		tinyMCE.get("productText").setContent($("#productText").val());				designDetails[v].text = $("#productText").val();				$('#zoom a').removeClass('disabled');	}		// Update the preview background based on selected product, color, and view	updateProductBackground = function() {		var backgroundImage = '/images/productImages/' +				$('#productList li.currentProduct a').attr('rel');		if ($('#colorList li.currentColor a').attr('rel') != undefined) {			backgroundImage = backgroundImage + $('#colorList li.currentColor a').attr('rel');		}		backgroundImage = backgroundImage + $('#viewList li.currentView a').attr('rel') + '.jpg';		$("#product").css("background","url(" + backgroundImage + ") no-repeat top center");				var productId = $("#update_pid").val();				if (productId == 69 &&!zoom && $('li.currentView a').attr('rel') == "Back") {			if($('#colorList li.currentColor a').attr('rel') == "White"){				$('#productOverlay').removeClass();				$('#productOverlay').addClass('whiteHood');			} else {				$('#productOverlay').removeClass();				$('#productOverlay').addClass('ashHood');			}		} else {			$('#productOverlay').removeClass();		}				$("#size").html($("#sizeList li.currentSize").html());		$('#size:empty').parents('#productSize').hide();		$('#size:parent').parents('#productSize').show();		$("#color").css("background", $("#colorList li.currentColor").css("background"));		$("#color").html($("#colorList li.currentColor").html());		$('#color:empty').parents('#productColor').hide();		$('#color:parent').parents('#productColor').show();	}		setLyricClasses = function() {		$(".blockContainer").removeClass('onProduct').addClass('notOnProduct'); // reset all lyric block arrows to default state		$(".blockContainer").parent().next().removeClass("onProduct").addClass('notOnProduct');		for (var x = 0; x < designDetails[v].lyricBlocksOnLocation.length; x++) { // for any lyric blocks on view, switch arrow back to the remove image			$("#" + designDetails[v].lyricBlocksOnLocation[x]).removeClass('notOnProduct').addClass('onProduct');			//$("#" + designDetails[v].lyricBlocksOnLocation[x]).removeClass(notOnProduct).parent().next().addClass("onProduct");		}				if ($(".blockContainer p span.line").hasClass('onProduct')){			$(".blockContainer p span.line").removeClass('onProduct').addClass('notOnProduct'); // reset all lines to default state		}		// for any selected lines on view, switch classes back to onProduct		for (var x = 0; x < designDetails[v].lyricLinesOnLocation.length; x++) { // for any lyric blocks on view, switch arrow back to the remove image			$("#" + designDetails[v].lyricLinesOnLocation[x]).removeClass('notOnProduct').addClass('onProduct');		}	}});/* ------------------------------------------------------------------------------ *//*	Show and hide pop-up divs	To include: <div class="popUpDiv" id="uniqueId"></div>	To show: displayPopUp('uniqueId',x offset,y offset,true or false relative toggle)	To hide:hidePopUp('uniqueId')*/var IE = document.all?true:false;var lxPos;var lyPos;function displayPopUp(element, x, y, relative) {	var elem = document.getElementById(element);	$(elem).fadeIn(250);		$('<div id="opaque"></div>').insertAfter(elem);		// Position relative to cursor position	if (relative){		elem.style.left = lxPos + x + "px";		elem.style.top = lyPos + y + "px";	} else {		// Position relative to upper left corner of website		elem.style.left = "50%";		elem.style.marginLeft = x - 420 + "px";		elem.style.top = y + "px";	}								$('#opaque').click(function() {		hidePopUp(element);		if ($('body').attr('id') == 'home'){			dropMovie();		};	});}		function hidePopUp(element) {	var elem = document.getElementById(element);	$(elem).fadeOut(250);	$('#opaque').remove();	if (typeof tinyMCE != 'undefined') {		tinyMCE.get('productText').execCommand('mceCleanup');	}}function spliceArray(myArray, myId) {	if ($.browser.msie) {		for (var x = 0; x < myArray.length; x++) {			if (myArray[x] == myId) {				myArray.splice(x, 1);			}		}	} else {		myArray.splice(myArray.indexOf(myId), 1);	}}