//////////////////////////////// INIT SCREEN DETERMINATIONfunction getCSSRule(ruleName, deleteFlag) {               // Return requested style obejct   ruleName=ruleName.toLowerCase();                       // Convert test string to lower case.   if (document.styleSheets) {                            // If browser can play with stylesheets      for (var i=0; i<document.styleSheets.length; i++) { // For each stylesheet         var styleSheet=document.styleSheets[i];          // Get the current Stylesheet         var ii=0;                                        // Initialize subCounter.         var cssRule=false;                               // Initialize cssRule.          do {                                             // For each rule in stylesheet            if (styleSheet.cssRules) {                    // Browser uses cssRules?               cssRule = styleSheet.cssRules[ii];         // Yes --Mozilla Style            } else {                                      // Browser usses rules?               cssRule = styleSheet.rules[ii];            // Yes IE style.             }                                             // End IE check.            if (cssRule)  {                               // If we found a rule...               if (cssRule.selectorText.toLowerCase()==ruleName) { //  match ruleName?                  if (deleteFlag=='delete') {             // Yes.  Are we deleteing?                     if (styleSheet.cssRules) {           // Yes, deleting...                        styleSheet.deleteRule(ii);        // Delete rule, Moz Style                     } else {                             // Still deleting.                        styleSheet.removeRule(ii);        // Delete rule IE style.                     }                                    // End IE check.                     return true;                         // return true, class deleted.                  } else {                                // found and not deleting.                     return cssRule;                      // return the style object.                  }                                       // End delete Check               }                                          // End found rule name            }                                             // end found cssRule            ii++;                                         // Increment sub-counter         } while (cssRule)                                // end While loop      }                                                   // end For loop   }                                                      // end styleSheet ability check   return false;                                          // we found NOTHING!}                                                         // end getCSSRule function killCSSRule(ruleName) {                          // Delete a CSS rule      return getCSSRule(ruleName,'delete');                  // just call getCSSRule w/delete flag.}                                                         // end killCSSRulefunction addCSSRule(ruleName) {                           // Create a new css rule   if (document.styleSheets) {                            // Can browser do styleSheets?      if (!getCSSRule(ruleName)) {                        // if rule doesn't exist...         if (document.styleSheets[0].addRule) {           // Browser is IE?            document.styleSheets[0].addRule(ruleName, null,0);      // Yes, add IE style         } else {                                         // Browser is IE?            document.styleSheets[0].insertRule(ruleName+' { }', 0); // Yes, add Moz style.         }                                                // End browser check      }                                                   // End already exist check.   }                                                      // End browser ability check.   return getCSSRule(ruleName);                           // return rule we just created.} var browserHeight;var browserHeightFlip = 660; // CHANGED FROM 640 ON 1/25/10var global;function adjustFixed() {	if (self.innerHeight) {		browserHeight = self.innerHeight;	} else if (document.documentElement && document.documentElement.clientHeight) {		browserHeight = document.documentElement.clientHeight;	} else if (document.body) {		browserHeight = document.body.clientHeight;	}	if (browserHeight < browserHeightFlip) {		global = getCSSRule('.dropShadow');		global.style.position = "absolute";		global = getCSSRule('#topContentWrapper');		global.style.position = "relative";		global = getCSSRule('#mainContent');		global.style.paddingTop = "0";		global = getCSSRule('#widgetsDiv');		global.style.padding = "0 0 35px 0";		global = getCSSRule('#searchDiv');		global.style.position = "relative";//		global = getCSSRule('.holidayQuickOrder');//		global.style.display = "none";	} else {		global = getCSSRule('.dropShadow');		global.style.position = "fixed";		global = getCSSRule('#topContentWrapper');		global.style.position = "fixed";		global = getCSSRule('#mainContent');		global.style.paddingTop = "165px";		global = getCSSRule('#widgetsDiv');		global.style.padding = "35px 0 35px 0";		global = getCSSRule('#searchDiv');		global.style.position = "fixed";//		global = getCSSRule('.holidayQuickOrder');//		global.style.display = "block";	}	}adjustFixed();////////////////////////////////////////////////////////////////////////////////////// PAGE TRANSITIONvar fibernocciOne = 2;var fibernocciTwo = 3;var subscribeStatus = "stopped";var subscribeHeight = 0;var teaTemp;function newPage(page) {	document.getElementById("productPhoto").style.backgroundImage = "url(http://www.adagio.com/images/blank.gif)";	teaTemp = page;	updateContent();//	if (subscribeStatus != "in transit") {//		teaTemp = page;//		fibernocciOne = 2;//		fibernocciTwo = 3;//		if (document.getElementById("productPhoto").style.height == "1px") {//			subscribeStatus = "in transit";//			subscribeHeight = 1;//			openSubscribeLoop=setInterval("showImage()",50);//		} else {//			subscribeStatus = "in transit";//			subscribeHeight = 1;//			closeSubscribeLoop=setInterval("hideImage()",50);//		}//	}}function hideImage() {	subscribeHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = subscribeHeight;		if (subscribeHeight >= 330) {		document.getElementById("productPhoto").style.height = "1px";		clearInterval(closeSubscribeLoop);		subscribeStatus = "stopped";//		document.getElementById("productPhoto").style.backgroundImage = "url(http://www.adagio.com/images3/products/"+teaTemp+".jpg)";		updateContent();//		newPage(teaTemp);	} else {		document.getElementById("productPhoto").style.height = (330 - subscribeHeight) + "px";	}}function showImage() {	subscribeHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = subscribeHeight;	if (subscribeHeight >= 330) {		document.getElementById("productPhoto").style.height = "330px";		clearInterval(openSubscribeLoop);		subscribeStatus = "stopped";	} else {		document.getElementById("productPhoto").style.height = subscribeHeight + "px";	}}////////////////////////////////////////////////////////////////////////////////////// UPDATE CONTENTfunction updateContent() {	if (!isWorking && http) {		http.open("GET", "/ajax/updateMainCopy.html?teaName=" + teaTemp, true);		http.onreadystatechange = handleHttpResponseCopy;		isWorking = true;		http.send(null);	}}function handleHttpResponseCopy() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('mainCopy').innerHTML = results[0];			document.getElementById("productPhoto").style.backgroundImage = "url(http://www.adagio.com/images3/products/"+results[1]+")";			isWorking = false;//			newPage(teaTemp);		}	}}////////////////////////////////////////////////////////////////////////////////////// UPDATE REVIEWSfunction updateReviews(teaId, type) {	if (!isWorking && http) {		document.getElementById('reviews').style.height = "350px";		document.getElementById('reviews').innerHTML = "<center><br><br><br><br><br><br><br><img width='32' height='32' border='0' src='/images4/wait_icon.gif'><br>loading reviews<br></center>";		document.getElementById('reviewsButton').innerHTML = "";		http.open("GET", "/ajax/updateReviews.html?teaId=" + teaId + "&type=" + type, true);		http.onreadystatechange = handleHttpResponseReviews;		isWorking = true;		http.send(null);	}}function handleHttpResponseReviews() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('reviews').innerHTML = results[0];			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// VOTEfunction reviewVote(reviewId, voteType) {	if (!isWorking && http) {		http.open("GET", "/ajax/reviewVote.html?reviewId=" + reviewId + "&voteType=" + voteType, true);		http.onreadystatechange = handleHttpResponseReviewVote;		isWorking = true;		http.send(null);	}}function handleHttpResponseReviewVote() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			if (results[0]) {				document.getElementById('vote_'+results[1]).innerHTML = results[0];			}			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// GENERIC OPEN/CLOSE CONTENTvar openCloseStatus = "stopped";var openCloseHeight = 0;function openClose(divName, heightTotal) {	if (openCloseStatus != "in transit") {		fibernocciOne = 2;		fibernocciTwo = 3;		if (document.getElementById(divName).style.height == "1px") {			openCloseStatus = "in transit";			openCloseHeight = 1;			openDivLoop = setInterval("openDiv('"+divName+"', "+heightTotal+")",100);		} else {			openCloseStatus = "in transit";			openCloseHeight = 1;			closeDivLoop = setInterval("closeDiv('"+divName+"', "+heightTotal+")",100);		}	}}function openDiv(divName, heightTotal) {	openCloseHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = openCloseHeight;	if (openCloseHeight >= heightTotal) {		document.getElementById(divName).style.height = heightTotal+"px";		clearInterval(openDivLoop);		openCloseStatus = "stopped";	} else {		document.getElementById(divName).style.height = openCloseHeight + "px";	}}function closeDiv(divName, heightTotal) {	openCloseHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = openCloseHeight;		if (openCloseHeight >= heightTotal) {		document.getElementById(divName).style.height = "1px";		clearInterval(closeDivLoop);		openCloseStatus = "stopped";	} else {		document.getElementById(divName).style.height = (heightTotal - openCloseHeight) + "px";	}}////////////////////////////////////////////////////////////////////////////////////// EMAIL A FRIEND DIV// document.getElementById('share').style.top='-353px';// document.getElementById('shareDiv').style.display='block'var shareStatus = "stopped";var shareHeight = 0;function shareDiv() {	if (shareStatus != "in transit") {		fibernocciOne = 2;		fibernocciTwo = 3;		if (document.getElementById('share').style.top == "1px") {			shareStatus = "in transit";			shareHeight = 1;			document.getElementById('shareDiv').style.display = 'block';			openDivLoop = setInterval("openShareDiv()",75);		} else {			shareStatus = "in transit";			shareHeight = 353;			closeDivLoop = setInterval("closeShareDiv()",75);		}	}}function openShareDiv() {	shareHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = shareHeight;	if (shareHeight >= 353) {		document.getElementById('share').style.top = "-353px";		clearInterval(openDivLoop);		shareStatus = "stopped";	} else {		document.getElementById('share').style.top = "-" + shareHeight + "px";	}}function closeShareDiv() {	shareHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = shareHeight;		if (shareHeight >= 353) {		document.getElementById('share').style.top = "1px";		clearInterval(closeDivLoop);		shareStatus = "stopped";		document.getElementById('shareDiv').style.display = 'none';	} else {		document.getElementById('share').style.top = "-" + (353 - shareHeight) + "px";	}}////////////////////////////////////////////////////////////////////////////////////// EMAIL FRIEND SENDfunction emailFriend(receiver, subject, message, senderName, senderEmail, currentPage, blend) {	if (!isWorking && http) {		http.open("GET", "/ajax/emailFriend.html?receiver=" + receiver + "&subject=" + subject + "&message=" + message + "&senderName=" + senderName + "&senderEmail=" + senderEmail + "&currentPage=" + currentPage + "&blend=" + blend, true);		http.onreadystatechange = handleHttpResponseEmailFriend;		isWorking = true;		http.send(null);	}}function handleHttpResponseEmailFriend() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('shareDivConfirm').innerHTML = "<div style='padding:100px 12px 0;'>Thank you for sharing this page. We hope your friend enjoys it as well.</div>";			document.getElementById('shareDivConfirm').style.display = "inline";			document.getElementById('shareDivForm').style.display = "none";			isWorking = false;			setTimeout("emailFriendClose()",3000);		}	}}function emailFriendClose() {	shareDiv();	document.getElementById('shareDivConfirm').style.display = "none";	document.getElementById('shareDivForm').style.display = "inline";	document.forms['emailFriendForm'].receiver.value = "";}////////////////////////////////////////////////////////////////////////////////////// ADD A FRIEND VIA GMAILfunction addGmailFriend(id, friendId) {	if (!isWorking && http) {		http.open("GET", "/ajax/addGmailFriend.html?id=" + id + "&friendId=" + friendId, true);		http.onreadystatechange = handleHttpResponseAddGmailFriend;		isWorking = true;		http.send(null);	}}function handleHttpResponseAddGmailFriend() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('contact_'+results[0]).innerHTML = "friend added";			document.getElementById('contact_'+results[0]).style.fontSize = "8pt";			document.getElementById('contact_'+results[0]).style.color = "#666666";			document.getElementById('contact_'+results[0]).style.paddingTop = "5px";			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// NOTE REMOVEvar noteOpacity;var noteHeight;function removeNote(id) {	if (openCloseStatus != "in transit") {				noteOpacity = 1;		closeDivLoop = setInterval("dimNote("+id+")",50);		openCloseStatus = "in transit";				document.getElementById("note_"+id).style.overflow = "hidden";				// REMOVE NOTE		if (!isWorking && http) {			http.open("GET", "/ajax/note_remove.html?id=" + id, true);			http.send(null);		}			}}function dimNote(id) {	noteOpacity -= .1;	document.getElementById("note_"+id).style.opacity = noteOpacity;	if (noteOpacity <= 0) {		clearInterval(closeDivLoop);		fibernocciOne = 2;		fibernocciTwo = 3;		openCloseHeight = 1;		noteHeight = document.getElementById("note_"+id).scrollHeight;		closeDivLoop = setInterval("closeNote("+id+")",100);	}	}function closeNote(id) {	openCloseHeight = fibernocciOne + fibernocciTwo;	fibernocciOne = fibernocciTwo;	fibernocciTwo = openCloseHeight;		noteHeight = noteHeight - openCloseHeight;		if (noteHeight <= 0) {		document.getElementById("note_"+id).style.height = "0";		clearInterval(closeDivLoop);		openCloseStatus = "stopped";	} else {		document.getElementById("note_"+id).style.height = noteHeight + "px";	}	}////////////////////////////////////////////////////////////////////////////////////// TOGGLE WISHLISTfunction toggleWishlist() {	if (document.getElementById('wishlist').style.display == "none") {		document.getElementById('wishlistButton').innerHTML = "<span style='font-size:8pt;font-style:normal;'>disable wishlist</span>";		document.getElementById('wishlistButton').className = "buttonWish";		document.getElementById('wishlist').style.display = "block";		document.getElementById('purchase').style.display = "none";	} else {		document.getElementById('wishlistButton').innerHTML = "<span style='font-size:8pt;font-style:normal;'>enable wishlist</span>";		document.getElementById('wishlistButton').className = "buttonCart";		document.getElementById('wishlist').style.display = "none";		document.getElementById('purchase').style.display = "block";	}}////////////////////////////////////////////////////////////////////////////////////// UPDATE FAVORITESfunction updateFavorites(pid) {	if (!isWorking && http) {		http.open("GET", "/ajax/updateFavorites.html?pid=" + pid, true);		http.onreadystatechange = handleHttpResponseFavorites;		isWorking = true;		http.send(null);	}}function handleHttpResponseFavorites() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('favoritesButton').innerHTML = results[0];			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// NOTIFY MEfunction notifyMe(teaId, email) {	if (!isWorking && http) {		http.open("GET", "/ajax/notify_me.html?item=" + teaId + "&email=" + email, true);		http.onreadystatechange = handleHttpResponseNotifyMe;		isWorking = true;		http.send(null);	}}function handleHttpResponseNotifyMe() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('notifyMe').innerHTML = "Thank you for choosing to be notified when this product is back in stock.<br><br>";			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// TWITTER UPDATEfunction twitterUpdate(twitter) {	if (!isWorking && http) {		if (twitter) {			http.open("GET", "/ajax/updateTwitter.html?twitter=" + twitter, true);			http.onreadystatechange = handleHttpResponseTwitter;			isWorking = true;			http.send(null);		}	}}function handleHttpResponseTwitter() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");//			document.getElementById('twitterCopy').style.paddingTop = "15px";			document.getElementById('twitterCopy').innerHTML = "Thanks. We use direct messages for updates, so make sure to <A HREF='http://twitter.com/AdagioTeas' TARGET='_new'>follow us</A> to be notified each time your package moves more than 6 inches :)";			document.getElementById('twitterForm').style.display = "none";//			document.getElementById('twitterDiv').style.height = "100px";			isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// RURAL LISTfunction ruralZipCheck(zipcode) {	if (!isWorking && http) {		if (zipcode) {			http.open("GET", "/ajax/rural_check.html?zipcode=" + zipcode, true);			http.onreadystatechange = handleHttpResponseRuralCheck;			isWorking = true;			http.send(null);		}	}}function handleHttpResponseRuralCheck() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			document.getElementById('ruralCheckResult').innerHTML = results[0];			isWorking = false;		}	}}										////////////////////////////////////////////////////////////////////////////////////// STEAMsteamLocation = 0;steamOpacity = 0;function steam() {	document.getElementById("steam").style.backgroundImage = "url('/images4/steam.png')";	steamAnimateLoop = setInterval("steamAnimate()",50);}function steamRestart() {	steamAnimateLoop = setInterval("steamAnimate()",50);}function steamAnimate() {	document.getElementById("steamDiv").style.top = "0";	steamLocation = steamLocation - 1;	document.getElementById("steam").style.backgroundPosition = "0 " + steamLocation + "px";	steamOpacity += .02;	document.getElementById('steam').style.opacity = steamOpacity;}function steamStop() {	document.getElementById("steamDiv").style.top = "-500px";	clearInterval(steamAnimateLoop);}function steamStart() {	setTimeout("steamRestart()",3000);}////////////////////////////////////////////////////////////////////////////////////// SIGNATURE BLEND SEARCHfunction signatureBlendSearch(term, type) {	if (!isWorking && http) {		if (term) {			http.open("GET", "/ajax/signature_blend_search.html?term=" + term + "&type=" + type, true);			http.onreadystatechange = handleHttpResponseSignatureBlend;			isWorking = true;			http.send(null);		}	}}function handleHttpResponseSignatureBlend() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split('***SPLIT***');			document.getElementById('tealist').innerHTML = "<table width='164' cellpadding='0' cellspacing='0' border='0' style='font-family:arial;font-size:10pt;'>" + results[0] + "</table>";			isWorking = false;		}	}}function updateWishlistTotal() {		var wishlist_subtotal = 0;	var wishlist_shipping = 0;		for (i=0;i<document.wishlistForm.length;i++) {		if (document.wishlistForm[i].type=="checkbox") {			if (document.wishlistForm[i].checked) {				wishlist_subtotal += parseFloat(document.wishlistForm[i].value);			}		}	}		wishlist_subtotal = Math.round(wishlist_subtotal*100)/100;		if (wishlist_subtotal >= 50) {		wishlist_shipping = "free shipping";	} else {		wishlist_shipping = "+$3.75 shipping";	}		document.getElementById("wishlist_subtotal").innerHTML = "\$"+wishlist_subtotal;	document.getElementById("wishlist_shipping").innerHTML = wishlist_shipping;		if (wishlist_subtotal > 0) {		document.getElementById("wishlist_summary").style.display = "inline";	} else {		document.getElementById("wishlist_summary").style.display = "none";	}	}function toggleTabs(turnOn) {	document.getElementById("favoritesDiv").style.display = "none";	document.getElementById("customBlendsDiv").style.display = "none";	document.getElementById("friendsDiv").style.display = "none";	document.getElementById("teamapDiv").style.display = "none";	document.getElementById("teachefDiv").style.display = "none";	document.getElementById("teachatDiv").style.display = "none";	document.getElementById("favoritesHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById("customBlendsHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById("friendsHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById("teamapHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById("teachefHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById("teachatHeaderDiv").style.backgroundColor = "#98ac5e";	document.getElementById(turnOn + "Div").style.display = "inline";	document.getElementById(turnOn + "HeaderDiv").style.backgroundColor = "#e27a16";}function InsertMovie() {	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'");	document.write("width='751' height='342'");	document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'>");	document.write("<param name='movie' value='/swf/front_page/valentines.swf' /><param name='loop' value='false' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' />");	document.write("<embed src='/swf/front_page/valentines.swf' loop='false' quality='high' bgcolor='#ffffff'");	document.write("width='751' height='342' name='valentines' align='middle'");	document.write("play='true'");	document.write("loop='false'");	document.write("quality='high'");	document.write("allowScriptAccess='sameDomain'");	document.write("type='application/x-shockwave-flash'");	document.write("pluginspage='http://www.macromedia.com/go/getflashplayer'>");	document.write("<\/embed>");	document.write("<\/object>");}function InsertAllInThisTea() {	document.write("<div style='float:right;'>");	document.write("<div style='background:url('/movies/all_in_this_tea_bg.gif') top left no-repeat;'>");	document.write("<div style='padding:20px;'>");	document.write("<object width='320' height='256' classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>");	document.write("<param name='src' value='/movies/all_in_this_tea.jpg' />");	document.write("<param name='href' value='/movies/all_in_this_tea.mov' />");	document.write("<param name='target' value='myself' />");	document.write("<param name='controller' value='false' />");	document.write("<param name='autoplay' value='false' />");	document.write("<param name='scale' value='aspect' />");	document.write("<embed width='320' height='256' type='video/quicktime' pluginspage='http://www.apple.com/quicktime/download/' src='/movies/all_in_this_tea.jpg' href='/movies/all_in_this_tea.mov' target='myself' controller='false' autoplay='false' scale='aspect'></embed>");	document.write("</object>");	document.write("</div>");	document.write("</div>");	document.write("</div>");}function InsertHolidayPage(version, height) {	document.write("<embed src='/swf/front_page/"+version+"' loop='false' quality='high' bgcolor='#ffffff'");	document.write("width='749' height='"+height+"' name='"+version+"' align='middle'");	document.write("play='true'");	document.write("loop='true'");	document.write("quality='high'");	document.write("allowScriptAccess='sameDomain'");	document.write("type='application/x-shockwave-flash'");	document.write("pluginspage='http://www.macromedia.com/go/getflashplayer'>");	document.write("<\/embed>");}function productVideo(status, movieId) {	if (status == "on") {		if (document.getElementById("ratingScore")) {			document.getElementById('ratingScore').style.display='none';		}		if (document.getElementById("reviewsScore")) {			document.getElementById('reviewsScore').style.display='none';		}		document.getElementById('videoButton').style.display='none';		document.getElementById('priceOptions').style.display='none';		document.getElementById('productPhoto').style.display='none';		document.getElementById('movieLayer').innerHTML = "<embed src='http://blip.tv/play/"+movieId+"' type='application/x-shockwave-flash' width='575' height='360' allowscriptaccess='always' allowfullscreen='true'></embed><br><center><table><tr><td><a href='#' class='button' onclick='productVideo(\"off\",\"\");return false;'><span>close video</span></a></td></tr></table></center>";	}	if (status == "off") {		if (document.getElementById("ratingScore")) {			document.getElementById('ratingScore').style.display='block';		}		if (document.getElementById("reviewsScore")) {			document.getElementById('reviewsScore').style.display='block';		}		document.getElementById('videoButton').style.display='block';		document.getElementById('priceOptions').style.display='block';		document.getElementById('productPhoto').style.display='block';		document.getElementById('movieLayer').innerHTML = "";		document.getElementById('videoButton').blur();	}}function getUpdate(type, arg1, arg2) {	if ((type == "state") && (arg1 == "3")) {		productVideo("off","");	}}////////////////////////////////////////////////////////////////////////////////////// COLLAPSEvar rand_no;function expandCollapse (window) {	if (!isWorking && http) {		if (window) {					rand_no = Math.random() * 1000000;			http.open("GET", "/ajax/expand_collapse.html?random="+rand_no+"&window=" + window, true);			http.onreadystatechange = handleHttpResponseExpandCollapse;			isWorking = true;			http.send(null);		}	}}function handleHttpResponseExpandCollapse() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split('---'); //the fields are seperated by ---						if (results[0] == 1) {				document.getElementById('nav_'+results[1]).style.display = "inline";				document.getElementById('arrow_'+results[1]).src = "/images4/header_arrow_open.png";			} else {				document.getElementById('nav_'+results[1]).style.display = "none";				document.getElementById('arrow_'+results[1]).src = "/images4/header_arrow_closed.png";			}						isWorking = false;		}	}}////////////////////////////////////////////////////////////////////////////////////// SEARCH SUGGESTIONvar counter = 0;var counterByTwo = 0;var copy;var searchCounter = -1;function suggest(searchValue) {	if (!isWorking && http && searchValue) {		http.open("GET", "/ajax/search_suggestions.html?searchValue=" + searchValue , true);		http.onreadystatechange = handleHttpResponseSearch;		isWorking = true;		http.send(null);	}}function handleHttpResponseSearch() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("---");						counter = 0;			counterByTwo = 0;			copy = "";						while (counterByTwo < (results.length-1)) {    			    			// close button				if (counter == 1) {					copy += "<div style='position:relative;top:0;left:0;'><div style='position:absolute;top:-16px;left:182px;'><a href='#' onclick='document.getElementById(\"search_suggestion\").innerHTML = \"\";return false;'><img width='9' height='9' border='0' src='/images4/icon_close_note.png'></a></div></div>";				}				    			copy += "<div id='counter_"+counter+"' style='background:url(\"/images4/search_suggestions_middle.png\") top left no-repeat;width:203px;height:18px;'><div style='padding:2px 8px 0;'>" + results[counterByTwo] + "</div></div>";				copy += "<input type='hidden' name='content_"+counter+"' value='"+results[counterByTwo+1]+"'>";								counterByTwo = counterByTwo + 2;				counter = counter + 1;				    		}						if (copy) {				document.getElementById("search_suggestion").innerHTML = "<img width='203' height='4' border='0' src='/images4/search_suggestions_top.png'><br>" + copy + "<img width='203' height='10' border='0' src='/images4/search_suggestions_bottom.png'><br>";			} else {				document.getElementById("search_suggestion").innerHTML = "";			}			isWorking = false;		}	}}function displayunicode(e,content) {	var unicode=e.keyCode? e.keyCode : e.charCode	if (unicode == 38) {		searchCounter = searchCounter - 1;		if (searchCounter <= 0) {searchCounter = 0;}		resetAll();		document.getElementById('counter_'+searchCounter).style.backgroundImage = "url('/images4/search_suggestions_middle2.png')";	} else if (unicode == 40) {		searchCounter = searchCounter + 1;		if (searchCounter >= counter-1) {searchCounter = counter-1;}		resetAll();		document.getElementById('counter_'+searchCounter).style.backgroundImage = "url('/images4/search_suggestions_middle2.png')";	} else if (unicode == 13) {		if (searchCounter > -1) {			location = "http://www.adagio.com/search/index.html?query=" + document.formSearch.elements[searchCounter+1].value;		}	} else {		suggest(content);	}}function rolloverSearch(number) {	searchCounter = number;	resetAll();	document.getElementById('counter_'+searchCounter).style.backgroundImage = "url('/images4/search_suggestions_middle2.png')";}function resetAll() {	for(var i=0; i<counter; i++) {		document.getElementById('counter_'+i).style.backgroundImage = "url('/images4/search_suggestions_middle.png')";	}}////////////////////////////////////////////////////////////////////////////////////// ADDITIONAL VIEWSfunction additionalView (current, total, image) {		for (i=1;i<total+1;i++) {		document.getElementById('giftview_'+i).src='/images3/giftview_dot_empty.gif';	}	document.getElementById('giftview_'+current).src='/images3/giftview_dot_filled.gif';	document.getElementById('backgroundPhoto').style.backgroundImage='url(/images3/products/'+image+'_'+current+'.jpg)';	}////////////////////////////////////////////////////////////////////////////////////// PODCASTvar opacityPerc = 0;function openLogin(podCastFile) {	document.getElementById('adagioTeavPromo').style.display = "none";	document.getElementById('adagioTeavVideo').style.opacity = 0;	if (podCastFile <= 4500000) {		document.getElementById('adagioTeavVideoContents').innerHTML = "<div ONCLICK='closeLogin();'><img width='535' height='24' border='0' src='/images3/video_top.gif'></div><embed src='http://blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/rss/flash/"+podCastFile+"&showplayerpath=http://blip.tv/scripts/flash/showplayer.swf&feedurl=http%3A//adagio.blip.tv/rss/flash&brandname=Adagio%20TeaV&enablejs=true&smokeduration=0&tabType2=guide&tabType1=details&tabTitle1=About&tabTitle2=Episodes&tabUrl2=http%3A//adagio.blip.tv/rss/flash/%3Fsort%3D%7Edate&showguidebutton=false&brandlink=http%3A//www.adagio.com/blends/&lightcolor=0xFFFFFF&backcolor=0x000000&autostart=true' type='application/x-shockwave-flash' width='535' height='330' allowscriptaccess='always' allowfullscreen='true'></embed>";	} else {		document.getElementById('adagioTeavVideoContents').innerHTML = "<div ONCLICK='closeLogin();'><img width='535' height='24' border='0' src='/images3/video_top.gif'></div><object width='535' height='308'><param name='allowfullscreen' value='true' /><param name='allowscriptaccess' value='always' /><param name='movie' value='http://vimeo.com/moogaloop.swf?clip_id="+podCastFile+"&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=DA7310&amp;fullscreen=1' /><embed src='http://vimeo.com/moogaloop.swf?clip_id="+podCastFile+"&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=DA7310&amp;fullscreen=1' type='application/x-shockwave-flash' allowfullscreen='true' allowscriptaccess='always' width='535' height='308'></embed></object>";	}	document.getElementById('adagioTeavVideo').style.display = "inline";	fadeOn();}function fadeOn() {	opacityPerc += .05;	document.getElementById('adagioTeavVideo').style.opacity = opacityPerc;	if (opacityPerc <= 1) {		setTimeout('fadeOn()',25);	}}function closeLogin() {	opacityPerc -= .05;	document.getElementById('adagioTeavVideo').style.opacity = opacityPerc;	if (opacityPerc >= 0) {		setTimeout('closeLogin()',25);	} else {		document.getElementById('adagioTeavVideo').style.display = "none";		document.getElementById('adagioTeavVideoContents').innerHTML = "";		document.getElementById('adagioTeavPromo').style.display = "inline";	}}////////////////////////////////////////////////////////////////////////////////////// SOCIAL BAR DESCRIPTIONfunction socialBarDescOn(bgPosition, copyPosition, copy) {	document.getElementById('socialBarDesc').style.display = "block";	document.getElementById('socialBarDescBg').style.backgroundPosition = bgPosition + "px 0";	document.getElementById('socialBarDescCopy').style.paddingLeft = copyPosition + "px";	document.getElementById('socialBarDescCopy').innerHTML = copy;}function socialBarDescOff() {	document.getElementById('socialBarDesc').style.display = "none";	document.getElementById('socialBarDescBg').style.backgroundPosition = "0 0";	document.getElementById('socialBarDescCopy').style.paddingLeft = 0;	document.getElementById('socialBarDescCopy').innerHTML = "";}////////////////////////////////////////////////////////////////////////////////////// KONAMI CODEvar keysEntered = new Array();var i;for(i=0;i<10;i++) {	keysEntered[i] = 0;}function DetectKonamiCode(ev) {    var keyCode = null;    if(window.event) {        keyCode = window.event.keyCode;    } else if(ev) {        keyCode = ev.which;    } else {        return true;    }	AddKeyToList(keyCode);	return true;}function AddKeyToList(keyCode) {    var i;    var up = 38;    var down = 40;    var left = 37;    var right = 39;    var b = 66;    var a = 65;    for(i=0;i<9;i++) {        keysEntered[i] = keysEntered[i + 1];    }    keysEntered[9] = keyCode;        if((keysEntered[0]==up) && (keysEntered[1]==up) && (keysEntered[2]==down) && (keysEntered[3]==down) && (keysEntered[4]==left) && (keysEntered[5]==right) && (keysEntered[6]==left) && (keysEntered[7]==right) && (keysEntered[8]==b) &&  (keysEntered[9]==a)) {		konami();    }        var str = '';    for(i=0;i<10;i++){        str += keysEntered[i] + ' | ';    }    }function konami() {	if (!isWorking && http) {		http.open("GET", "/ajax/konami.html", true);		http.onreadystatechange = handleHttpResponseKonami;		isWorking = true;		http.send(null);	}}function handleHttpResponseKonami() {	if (http.readyState == 4) {		if (http.responseText.indexOf('invalid') == -1) {			results = http.responseText.split("***SPLIT***");			location = results[0];			isWorking = false;		}	}}