var sRepeat=null
function doScroller(dir, src, amount) {
	// 3 arguments, dir: scroll "up" or "down",
	// src is the string id of positioned element
	// amount (optional) is number of pixels to scroll
	//if (window.document.readyState=="loading") alert("Please wait until the page is finished loading.")
	if (amount==null) amount=10;
	if (dir=="down") {
		document.getElementById(src).style.top = parseInt(document.getElementById(src).style.top) - amount;
		if (-parseInt(document.getElementById(src).style.top)>=document.getElementById(src).offsetHeight-document.getElementById(src).offsetParent.offsetHeight) {
			document.getElementById(src).style.top=-document.getElementById(src).offsetHeight+document.getElementById(src).offsetParent.offsetHeight;
		}
	}
	else {
			document.getElementById(src).style.top = parseInt(document.getElementById(src).style.top) + amount;
		if (parseInt(document.getElementById(src).style.top)>0)
			document.getElementById(src).style.top = 0;
	}
	if (sRepeat==null)
		sRepeat = setInterval("doScroller('" + dir + "','" + src + "'," + amount + ")",100);
	return false;
}
window.document.onmouseup = new Function("clearInterval(sRepeat);sRepeat=null")
window.document.ondragstart = new Function("return false")

var menuArray = ['dessertsMenu','cakesMenu'];
function hideAllMenus(){
	for (i=0; i<menuArray.length; i++) {
		hideMe = menuArray[i];
		document.getElementById(hideMe).style.top = '-1000px';
	}
}
function hideMenu(menuId) {
	document.getElementById(menuId).style.top = '-1000px';
}
function clearCallIn(menuId) {
	var codeString = 'window.clearTimeout(timeoutId' + menuId + ')';
	eval(codeString);
}
function showMenu(menuId,topValue) {
	hideAllMenus();
	document.getElementById(menuId).style.top = topValue;
	timeOutName = eval('window.timeoutId'+menuId);
	if (timeOutName) {
		clearCallIn(menuId);
	}
}
function callIn(menuId) {
	var codeString = 'window.timeoutId' +menuId + ' = setTimeout("hideMenu(\''+menuId+'\')",1000)';
	eval(codeString);
}
function navSwap(which,state) {
	elementId = 'navImg_'+which;
	e = eval('document.getElementById(\''+elementId+'\')');
	if (state == 'Over') {
		imgRef = '\'images/navOver_'+which+'.jpg\'';
		eval ('e.src = '+imgRef);
	}
	else {
		imgRef = '\'images/nav_'+which+'_san_francisco_cakes.jpg\'';
		eval ('e.src = '+imgRef);
	}
}
var b_version=navigator.appVersion;
	function safariScrollCorrection() {
		if (b_version.indexOf('Safari')!= -1) {
			document.getElementById('faqText').style.overflow = 'auto';
			document.getElementById('faqText').style.overflowX = 'hidden';
			document.getElementById('scrollButtons').style.display = 'none';
		}
	}
function scroll(direction) {
	textWindow = document.getElementById('menuText');
	currentScrollValue = textWindow.scrollTop;
	if (direction == 'up') {
		textWindow.scrollTop=currentScrollValue-15;
		}
	if (direction == 'down') {
		textWindow.scrollTop=currentScrollValue+15;
		}
}
function swapImage(imgNum) {
	var imgName =cakeImages[imgNum];
	newImg = '<img src="' + imgName + '"/>';
	newCaption = document.getElementById('img' + imgNum).title;
	document.getElementById('centralImage').innerHTML = newImg;
	document.getElementById('imageCaption').innerHTML = newCaption;
}
function cakePrices() {
	document.getElementById('imageCaption').innerHTML = '';
	document.getElementById('centralImage').innerHTML = '<strong>Cake Price Ranges</strong><br/>6&quot; cakes (serves 6-8) $24 - $30<br/>8&quot; cakes (serves 8-10) $30 - $38<br/>10&quot; cakes (serves 10-12) $40 - $45<br/>&frac14; sheet cakes (serves 15-20) $50 - $58<br/>&frac12; sheet cakes (serves 30-35) $100 - $120<br/>Full sheet cakes (serves 60-70) $200 - $230<br/><br/><strong>To order cakes:</strong><br/>You may call or visit any of our retail stores.  48 hours is needed for most cakes.  You may order a cake the day before but we may not be able to provide you with your first choice.  We require prepayment on all special order cakes.  Phone-in cake orders may be paid by credit card.  Full refunds are given on most cake orders if cancelled within 48 hours of pick-up date.';
}