
var navImgCount = 9;
var preloadedImgs = new Array()

function preloadImages(){
    var i = 0;
    // Preload nav images.
    for (i; i < navImgCount; i++){
        preloadedImgs[i] = new Image()
		preloadedImgs[i].src = '.../img/navi/nav_0' + (i + 1) + '_on.gif';
	}

}

function nav_ov(id) {
    document.getElementById('nav_' + id).src = '../img/navi/nav_0' + id + '_on.gif';
}


function nav_off(id) {
    document.getElementById('nav_' + id).src = '../img/navi/nav_0' + id + '_off.gif';
}


function writeNav(navOn) {
    document.write(
		'<div id="navi">' +
            (navOn != '1' ? '<a href="../home/index.php"><img onmouseover="nav_ov(\'1\')" onmouseout="nav_off(\'1\')" id="nav_1" src="../img/navi/nav_01_off.gif" alt="Home" border="0" width="32" height="13" style="margin: 14px 0px 13px 10px;"></a>' : '<img src="../img/navi/nav_01_on.gif" alt="Home" border="0" width="32" height="13" style="margin: 14px 0px 13px 10px;">') +

            (navOn != '2' ? '<a href="../oursugar/index.html"><img onmouseover="nav_ov(\'2\')" onmouseout="nav_off(\'2\')" id="nav_2" src="../img/navi/nav_02_off.gif" alt="Our Sugar"  border="0" width="71" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_02_on.gif" alt="Our Sugar" border="0" width="71" height="13" style="margin: 14px 0px 13px 13px;">') +

            (navOn != '3' ? '<a href="../recipes/index.php"><img onmouseover="nav_ov(\'3\')" onmouseout="nav_off(\'3\')" id="nav_3" src="../img/navi/nav_03_off.gif" alt="Recipes" border="0" width="51" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_03_on.gif" alt="Recipes" border="0" width="51" height="13" style="margin: 14px 0px 13px 13px;">') +

            (navOn != '4' ? '<a href="../faq/index.html"><img onmouseover="nav_ov(\'4\')" onmouseout="nav_off(\'4\')" id="nav_4" src="../img/navi/nav_04_off.gif" alt="FAQs" border="0" border="0" width="31" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_04_on.gif" alt="FAQs" border="0" width="31" height="13" style="margin: 14px 0px 13px 13px;">') +

            (navOn != '5' ? '<a href="../contact/index.php"><img onmouseover="nav_ov(\'5\')" onmouseout="nav_off(\'5\')" id="nav_5" src="../img/navi/nav_05_off.gif" alt="Contact us" border="0" width="74" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_05_on.gif" alt="Contact us" border="0" width="74" height="13" style="margin: 14px 0px 13px 13px;">') +

			(navOn != '6' ? '<a href="../buyonline/index.html"><img onmouseover="nav_ov(\'6\')" onmouseout="nav_off(\'6\')" id="nav_6" src="../img/navi/nav_06_off.gif" alt="Buy Online"  border="0" width="71" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_06_on.gif" alt="Buy Online" border="0" width="71" height="13" style="margin: 14px 0px 13px 13px;">') +

			(navOn != '7' ? '<a href="../storelocator/index.html"><img onmouseover="nav_ov(\'7\')" onmouseout="nav_off(\'7\')" id="nav_7" src="../img/navi/nav_07_off.gif" alt="Store Locator"  border="0" width="93" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_07_on.gif" alt="Store Locator" border="0" width="93" height="13" style="margin: 14px 0px 13px 13px;">') +

			(navOn != '8' ? '<a href="../coupons/index.html"><img onmouseover="nav_ov(\'8\')" onmouseout="nav_off(\'8\')" id="nav_8" src="../img/navi/nav_08_off.gif" alt="Coupons"  border="0" border="0" width="55" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_08_on.gif" alt="Coupons" border="0" width="55" height="13" style="margin: 14px 0px 13px 13px;">')  +

			(navOn != '9' ? '<a href="http://www.sweetnlow.com/careers.html" target="_blank"><img onmouseover="nav_ov(\'9\')" onmouseout="nav_off(\'9\')" id="nav_9" src="../img/navi/nav_09_off.gif" alt="Career Center" border="0" width="98" height="13" style="margin: 14px 0px 13px 13px;"></a>' : '<img src="../img/navi/nav_09_on.gif" alt="Career Center" border="0" width="98" height="13" style="margin: 14px 0px 13px 13px;">') +
		'</div>'
    );

}

function adjustSearchValue(fld){
  if(fld.value == ''){
   	fld.value = "recipe name or ingredient";
  }
  else if(fld.value == "recipe name or ingredient"){
   	fld.value = '';
  }
}

// Login and Search
function writeSubNavLogin(navOn) {
    document.write(
	'<!-- Navi Oben -->' +
	'<div id="links">' +
		(navOn != 'sl1' ? '<a href="../register/signin.php" target="_self">Sign in</a>' : (((document.location + "").indexOf("signin.php") != -1)?'<span class="alinksub">Sign in</span>':'<a href="../logout.php" target="_self">Logout</a>')) +
		'&nbsp;&nbsp;<span class="line">|</span>&nbsp;&nbsp;' +
		(navOn != 'sl2' ? '<a href="../register/index.php" target="_self">Register</a>' : '<span class="alinksub">Register</span>') +
	'</div>' +
	'<!-- Search -->' +
	'<div id="search">' +
		'<form action="../recipes/searchresults.php" method="GET" name="frmSearch">'+
		'<img src="../img/search.gif" alt="Recipe Search" width="96" height="12" border="0" hspace="6" vspace="6"><input name="Search" type="text" class="inpt" size="30" maxlength="40" value="recipe name or ingredient" onfocus="adjustSearchValue(this)" onblur="adjustSearchValue(this)">&nbsp;&nbsp;<input type="image" src="../img/go.gif" alt="GO!" width="20" height="12" vspace="6" border="0">' +
		'</form>' +
  '</div>'
	);
}


// Subnavi FAQ
function writeSubNavFAQ(navOn) {
    document.write(
	'<div id="subnavi">' +
		'<div class="subfaq">' +
			(navOn != 'sf1' ? '<a href="index.html" target="_self">What is it?</a><br>' : '<span class="alink">What is it?</span><br>') +
			(navOn != 'sf2' ? '<a href="cooking.html" target="_self">Cooking With It</a><br>' : '<span class="alink">Cooking With It</span><br>') +
			(navOn != 'sf3' ? '<a href="availability.html" target="_self">Availability</a><br>' : '<span class="alink">Availability</span><br>') +
			(navOn != 'sf4' ? '<a href="nutritionfacts.html" target="_self">Nutrition Facts</a><br>' : '<span class="alink">Nutrition Facts</span><br>') +
    	'</div>' +
	'</div>'
	);
}


// Subnavi Recipes
function writeSubNavRecipes(navOn) {
  /*
    document.write(
	'<div class="subrecipes">' +
			(navOn != 'sr1' ? '<a href="index.html" target="_self">Introduction</a><br>' : '<span class="alink">Introduction</span><br>') +
			(navOn != 'sr2' ? '<a href="desserts.html" target="_self">Desserts</a><br>' : '<span class="alink">Desserts</span><br>') +
			(navOn != 'sr3' ? '<a href="entrees.html" target="_self">Entrees</a><br>' : '<span class="alink">Entrees</span><br>') +
			(navOn != 'sr4' ? '<a href="sidedishes.html" target="_self">Side Dishes</a><br>' : '<span class="alink">Side Dishes</span><br>') +
			(navOn != 'sr5' ? '<a href="breads.html" target="_self">Breads/Muffins/Biscuits</a><br>' : '<span class="alink">Breads/Muffins/Biscuits</span><br>') +
			(navOn != 'sr6' ? '<a href="snacks.html" target="_self">Snacks</a><br>' : '<span class="alink">Snacks</span><br>') +
			(navOn != 'sr7' ? '<a href="beverages.html" target="_self">Beverages</a><br>' : '<span class="alink">Beverages</span><br>') +
			(navOn != 'sr8' ? '<a href="toppings.html" target="_self">Toppings/Sauces</a><br>' : '<span class="alink">Toppings/Sauces</span><br>') +
	'</div>'
	);
  */
}


// Subnavi My recipes Box
function writeSubNavMyBox(navOn) {
    document.write(
	'<!-- Sign in -->' +
	'<div class="signinbox">' +
			(navOn != 'sbox1' ? '<a href="../recipes/myfolder.php" target="_self">My Recipe Folder</a><br>' : '<span class="alink">My Recipe Folder</span><br>') +
			(navOn != 'sbox2' ? '<a href="../recipes/myreviews.php" target="_self">My Reviews</a><br>' : '<span class="alink">My Reviews</span><br>') +
			(navOn != 'sbox3' ? '<a href="../logout.php" target="_self">Logout</a><br>' : '<span class="alink">Logout</span><br>') +
		'</div>'
	);
}


// Subnavi My recipes Box oben
function writeSubNavMyBoxUp(navOn) {
    document.write(
		    (navOn != 'sboxup1' ? '<a href="../recipes/myfolder.php" target="_self" class="sub">My Recipe Folder</a>' : '<span class="alink">My Recipe Folder</span>') +
			'&nbsp;&nbsp;<span class="line">|</span>&nbsp;&nbsp;' +
			(navOn != 'sboxup2' ? '<a href="../recipes/myreviews.php" target="_self" class="sub">My Reviews</a>' : '<span class="alink">My Reviews</span>')
	);
}



//PopUp News
	var win = null;
	function openPopUp(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,'
	win = window.open(mypage,myname,settings)
	}
