var navImgCount = 6;

var homeProdCount = 4;

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/menu/menu_' + (i + 1) + '_on.gif';
	}
}

function nav_in(id) {

    document.getElementById('nav_' + id).src = 'img/menu/menu_' + id + '_on.gif';
}

function nav_out(id) {

    document.getElementById('nav_' + id).src = 'img/menu/menu_' + id + '_off.gif';
}

function writeHeader(navOn) {
	
	writeHeader1();
	writeHeader2(navOn);
}

function writeHeader1() {
	
	document.write(
			
		'<div id="com_title">' +
		'	<span style="float:left;height:18px;"><a class="title">Visit our other sites:&nbsp;&nbsp;</a><a class="lk_title" href="http://www.natrataste.com" target="_blank">NatraTaste</a><a class="title_sep">&nbsp;&nbsp;|&nbsp;&nbsp;</a><a class="lk_title" href="http://www.brooklynpremium.com/brand.html?b=8&p=1" target="blank">Sweet&#39;N Low Brands General Store</a></span>' +
    	'	<span style="float:right;height:18px;"><a class="lk_title" href="contact_us.php">Contact Us</a></span>' +
		'</div>');
}

function writeHeader2(navOn) {
	
	document.write(
			
    	'<div id="com_header">' +
    	'	<img src="img/common_top.jpg" width="720" height="205" alt="NatraTaste Gold" style="margin:0px;padding:0px;"/>' +
		'	<script type="text/javascript">' +
		'		writeNav(' + navOn + ')' +
		'	</script>' +
		'</div>');
}

function writeNav(navOn) {
	
	document.write(
	
/* 		'<div style="position:absolute;left:279px;top:33px;width:431px;height:30px;">' + */
		'<div style="position:absolute;left:203px;top:60px;width:510px;height:30px;">' +
			(navOn != '1' ? '<a href="index.html"><img onmouseover="nav_in(\'1\')" onmouseout="nav_out(\'1\')" id="nav_1" src="img/menu/menu_1_off.gif" alt="Home" border="0" style="display:inline"></a>' : '<a href="index.html"><img src="img/menu/menu_1_on.gif" alt="Home" border="0" style="display:inline"></a>') +
			(navOn != '2' ? '<a href="products.html"><img onmouseover="nav_in(\'2\')" onmouseout="nav_out(\'2\')" id="nav_2" src="img/menu/menu_2_off.gif" alt="Products/Coupons" border="0" style="display:inline"></a>' : '<a href="products.html"><img src="img/menu/menu_2_on.gif" alt="Products/Coupons" border="0" style="display:inline"></a>') +
			(navOn != '3' ? '<a href="recipes_1.html"><img onmouseover="nav_in(\'3\')" onmouseout="nav_out(\'3\')" id="nav_3" src="img/menu/menu_3_off.gif" alt="Recipes" border="0" style="display:inline"></a>' : '<a href="recipes_1.html"	><img src="img/menu/menu_3_on.gif" alt="Recipes" border="0" style="display:inline"></a>') +
			(navOn != '4' ? '<a href="faq.html"><img onmouseover="nav_in(\'4\')" onmouseout="nav_out(\'4\')" id="nav_4" src="img/menu/menu_4_off.gif" alt="FAQs" border="0" style="display:inline"></a>' : '<a href="faq.html"><img src="img/menu/menu_4_on.gif" alt="FAQs" border="0" style="display:inline"></a>') +
			(navOn != '5' ? '<a href="stores.html"><img onmouseover="nav_in(\'5\')" onmouseout="nav_out(\'5\')" id="nav_5" src="img/menu/menu_5_off.gif" alt="Store Locator" border="0" style="display:inline"></a>' : '<a href="stores.html"><img src="img/menu/menu_5_on.gif" alt="Store Locator" border="0" style="display:inline"></a>') +
			(navOn != '6' ? '<a href="http://www.brooklynpremium.com/brand.html?b=8&p=1" target="blank"	><img onmouseover="nav_in(\'6\')" onmouseout="nav_out(\'6\')" id="nav_6" src="img/menu/menu_6_off.gif" alt="Buy Online" border="0" style="display:inline"></a>' : '<a href="#"><img src="img/menu/menu_6_on.gif" alt="Buy Online" border="0" style="display:inline"></a>') +
		'</div>');
}

function writeFooter() {
	
	document.write(
			
		'<div id="com_footer1">' +
		'	<a class="normal">*Splenda and <nobr>NatraTaste Gold</nobr> contain the sweetener sucralose. Splenda is a registered trademark of McNeil Nutritionals, LLC.</a>' +
		'</div>' +
		'<div id="com_footer2">' +
		'	<a class="footer">&copy; 2008 Stadt Holdings Corporation, Brooklyn, NY 11205. All rights reserved.</a><a class="footer_sep">&nbsp;&nbsp;|&nbsp;&nbsp;</a><a class="lk_footer" href="contact_us.php">Contact Us</a>' +
		'</div>' +
		'<div id="com_footerpad">' +
		'	<!-- empty -->' +
		'</div>');
}

function writeHomeProd() {
	
	var prodIndex = Math.floor(Math.random() * homeProdCount) + 1;
	
	document.write(
			
			'<img src="img/home_food/home_food_' + prodIndex + '.gif" width="343" height="231" alt=""/>');
}

function writeRecipeNav(navOn) {

    document.write(
    		
    	'<div style="position:relative;width:258px;">' +
	    '	<a class="' + (navOn != '1' ? 'lk_normal' : 'lk_header') + '" href="recipes_1.html">Chocolate Chip Biscotti</a>' +
		'	<br/>' +
		'	<a class="' + (navOn != '2' ? 'lk_normal' : 'lk_header') + '" href="recipes_2.html">Golden Carrot Cake</a>' +
		'	<br/>' +
		'	<a class="' + (navOn != '3' ? 'lk_normal' : 'lk_header') + '" href="recipes_3.html">Chocolicious Chocolate Cupcakes</a>' +
		'	<br/>' +
		'	<a class="' + (navOn != '4' ? 'lk_normal' : 'lk_header') + '" href="recipes_4.html">Golden Cupcakes</a>' +
	    '	<br/>' +
		'	<a class="' + (navOn != '5' ? 'lk_normal' : 'lk_header') + '" href="recipes_5.html">Berry Good Breakfast Smoothie</a>' +
	    '	<br/>' +
	    '	<a class="' + (navOn != '6' ? 'lk_normal' : 'lk_header') + '" href="recipes_6.html">Peach and Blueberry Crisp</a>' +
	    '	<br/>' +
		'	<a class="' + (navOn != '7' ? 'lk_normal' : 'lk_header') + '" href="recipes_7.html">Golden Apple Pie</a>' +
	    '</div>');
}

function decryptEmail() {

	/***********************************************
	* Easy Email Scrambler script- © Dynamic Drive (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit http://www.dynamicdrive.com/ for full source code
	***********************************************/
	
	var maildivider="[decrypt]" //enter divider you use to divide your email address strings
	
	for (i=0; i<=(document.links.length-1); i++){
	if (document.links[i].href.indexOf(maildivider)!=-1)
	document.links[i].href=document.links[i].href.split(maildivider)[0]+"@"+document.links[i].href.split(maildivider)[1]
	}
}