maxL=1000;
var bName = navigator.appName;
function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
	if (objCnt) {
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}

function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}


function openRules() {
    rulesPopup = window.open('OfficialRules.html','rulesPopup','width=564,height=421,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200');
	if (window.focus) {rulesPopup.focus()}
}


function openWhy() {
    whyPopup = window.open('dob_why.html','whyPopup','width=385,height=302,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200');
	if (window.focus) {whyPopup.focus()}
}


// Recipe popup functions
function openRecipe(recipeName) {
    recipePopup = window.open('recipes/' + recipeName + '.html','recipePopup','width=564,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200');
	if (window.focus) {recipePopup.focus()}
}

var currentTab = "ingredients";

function showTab(tab) {
	//hide all tabbed content
	document.getElementById("ingredients").style.display = "none";
	document.getElementById("directions").style.display = "none";
	document.getElementById("story").style.display = "none";
	
	//show selected tab's nav
	document.getElementById("nav").style.backgroundImage = "url(images/nav_" + tab + ".gif)";

	//show selected tab's content
	document.getElementById(tab).style.display = "block";
	
	//set current tab for rollovers
	currentTab = tab;
}

function Glow(tab) {
	document.getElementById("nav").style.backgroundImage = "url(images/nav_" + tab + ".gif)";
}

function DeGlow(tab) {
	document.getElementById("nav").style.backgroundImage = "url(images/nav_" + currentTab + ".gif)";
}
