var brandNames = new Array(
	'Sweet\'N Low',
	'Sugar In The Raw',
	'Butter Buds',
	'Sweet One',
	'Nu-Salt',
	'Sweet Magic',
	'NeuroCoat',
	'NatraTaste');

var brandSects = new Array(
	new Array(
		'Sweeteners & Other Products',
		'Candy',
		'Tableware',
		'Accessories & Clothing'),
	new Array(
		'Premium Turbinado Sugar',
		'Tableware',
		'Accessories & Clothing'),
	new Array(
		'Butter-flavored Granules',
		'Tableware',
		'Accessories & Clothing',
		'Books'),
	new Array(
		'Sweeteners',
		'Tableware',
		'Accessories'),
	new Array(
		'Sodium-Free Salt Substitute',
		'Accessories'),
	new Array(
		'Sweeteners'),
	new Array(
		'All-Natural Carbohydrates'),
	new Array(
		'Sweeteners',
		'Tableware',
		'Accessories'));

var prodCodes = new Array(
	// brand 1
	new Array(
		new Array(
				'sweetlowpac', 
				'swlowkoforpa', 
				'caofswlowkof',
				'sweetnlowbulk',
				'swlowbuca',
				'sweetlowbrow',
				'caofswlowbr',
				'swlowli',
				'swlowlica',
				'swlowsy',
				'caofswnlowsy',
				'swlowta',
				'swlowtaca'),
		new Array(
				'caofswlobuha', 
				'caofswlofrfl',
				'caofswlopeha',
				//'caofswlosufr',
				'swloincoflha'
				//'caofspchwaba',
				//'caofsppebuwa'
				),
		new Array(
				'swlowcemug3i',
				'sweetlowcerm',
				//'sweetlowtrav',
				//'swlowcomug2i',
				'sweetnlowcry',
				'swlowcrho3it',
				'sweetnlowbowl2',
				'sweetnlowlov',
				'swlowthtipah',
				//'sweetnlowthr',
				'suinrastnoce'),
		new Array(
				'swnlowappoov',
				'inpinspeclim',
				'swlowsoscpib',
				'sweetnlowtsh',
				'swlowt',
				'sweetnlowbar',
				'sweetnlowbra',
				'swlowbrca2',
				'dinedoodle',
				'dinedoodle1',
				'swlowfl',
				'swlowfl3',
				//'sweetnlowpoc1',
				//'swlowpoca',
				'mebrfl',
				'mebrflgo',
				'mebrlich')),
	// brand 2
	new Array(
		new Array(
				'stinrawbubag',
				'stexinrawcao',
				'suginrawpac1',
				'suginrawpacc',
				'suginrawbul11',
				'suginrawbulc',
				'suinraw6lbbu',
				'suinraw6lbbu1',
				'st502bo',
				'st502bo12it'),
		new Array(
				'suinrawcomug',
				'suinrawcomug1',
				'sugarbowl',
				'suinrawstnoc',
				'suinramithpi'),
		new Array(
				'appoovmi',
				'suginrawpocc',
				'suinrawpoca1',
				'suginrawpols',
				'suinraposhby',
				'dinedoodle_sir',
				'dinedoodle1_sir')),
	// brand 3
	new Array(
		new Array(
				'butbudmix1bo',
				'butbudmixcas',
				'butbudpac1bo',
				'bububoxof502',
				//'caofbubu2gpa',
				'butbudsprin11',
				'butbudsprinc',
				'butbudnoncoo2',
				'butbudnoncoo1',
				'caofbusp',
				'caofgabu'),
		new Array(
				'butbudthrein'),
		new Array(
				'butbudpoccar',
				'bubupoca12it'),		
		
		new Array(
				'fatfrelivwit')),
	// brand 4
	new Array(
		new Array(
				'sweetonepac11',
				'sweetonecase',
				'swone5lbbuba'),
		new Array(
				'swonecemug',
				'swonecemugit',
				'swonecrho',
				'swonecrho3it',
				'swonmithpise',
				'swonelopaho'),
		new Array(
				'sweetonepocc',
				'swonepoca12i',
				'swonebabag')),
	// brand 5
	new Array(
		new Array(
				'nusshak3oz',
				'nush3it',
				'nush12it',
				'nuspac1boxco',
				'nusaltpackets'),
		new Array(
				'nuspoccar1',
				'nupoca12it')),
	// brand 6
	new Array(
		new Array(
				'noname1',
				'swma5lbbubag')),
	// brand 7
	new Array(
		new Array(
				'neurocoat1',
				'neurocoat-by-the-month',
				'nemosuse')),
	// brand 8
	new Array(
		new Array(
				'natpac',
				//'natspoonfors1',
				//'naspforsp1ja',
				//'naspforsp1ja1',
				'ntg100ct2boxes',
				'nago1012it',
				'nago202bo',
				'nago208',
				'nago97ozbag',
				'nago98it'),
		new Array(
				'nattravmug',
				'nacomug2it',
				'natcryshol',
				'nacrho3it',
				'nacrbo1',
				'natlovseatho',
				'namithpiset',
				'nastnoceba'),
		new Array(
				'comcomnatrec',
				'natbrascas',
				'nabrca3it',
				'natpoccar1',
				'napoca12it')));

function preloadImages() {
	
	// Preload nav images.

    var navImgCount = 8;

	var preloadedNavImgs = new Array();

    for (var i = 0; i < navImgCount; i++) {

        preloadedNavImgs[(i * 3) + 0] = new Image();
        preloadedNavImgs[(i * 3) + 0].src = 'img/prod_' + (i + 1) + '/menu_w.png';
		preloadedNavImgs[(i * 3) + 1] = new Image();
		preloadedNavImgs[(i * 3) + 1].src = 'img/prod_' + (i + 1) + '/menu_g.png';
		preloadedNavImgs[(i * 3) + 2] = new Image();
		preloadedNavImgs[(i * 3) + 2].src = 'img/prod_' + (i + 1) + '/menu_h.png';
	}
    
    // Preload brand images.
    
    var preloadedBrandImgs = new Array();
    
    var brandSectCount = 0;
    
    for (var j = 0; j < brandSects.length; j++) {
    	
    	for (var k = 0; k < brandSects[j].length; k++) {
    	
    		preloadedBrandImgs[brandSectCount] = new Image();
    		preloadedBrandImgs[brandSectCount].src = 'img/prod_' + (j + 1) + '/prod_' + (k + 1) + '_on.png';
    		
    		brandSectCount++;
    	}
    }
}

function writeBorder(brandOn, navOnTop) {
	
	var brandImgDir1 = '';
	var brandImgDir2 = '';
	
	
	if (brandOn == -1) {
		brandImgDir1 = 'home/';
		brandImgDir2 = 'home/';
		
	} else if (brandOn == 0) {
		brandImgDir1 = 'prod_none/';
		brandImgDir2 = 'prod_none/';
	} else {
		brandImgDir1 = 'prod_' + brandOn + '/';
		brandImgDir2 = '';
	}

	document.write(
	
		'<img src="img/' + brandImgDir1 + 'frame_l.png" style="left:0px;top:0px;z-index:2;" width="100" height="606" alt="">' +
		//'<img src="img/' + brandImgDir2 + 'frame_r.png" style="left:900px;top:0px;z-index:2;" width="135" height="606" alt="" border="0">' +
		'<img src="img/' + brandImgDir2 + 'frame_r_top.png" style="left:900px;top:0px;z-index:2;" border="0" vspace="0">' +
		'<a href="../brand.html?b=8&p=1" target="_self"><img src="img/' + brandImgDir2 + 'frame_r_middle.png" style="left:900px;top:383px;z-index:2;" border="0" vspace="0"></a>' +
		'<a href="../brand.html?b=2&p=1" target="_self"><img src="img/' + brandImgDir2 + 'frame_r_end.png" style="left:900px;top:452px;z-index:2;" border="0" vspace="0"></a>' +
		'<img src="img/' + brandImgDir1 + 'frame_t1.png" style="left:100px;top:0px;z-index:2;" width="150" height="105" alt="">' +
    	'<img src="img/' + brandImgDir2 + 'frame_t2.png" style="left:250px;top:0px;z-index:2;" width="650" height="105" alt="">' 

+
		'<img src="img/' + brandImgDir2 + 'frame_b.png" style="left:100px;top:535px;z-index:2;" width="800" height="71" alt="">' +
		'<img src="img/' + brandImgDir2 + 'sign.png" style="left:860px;top:15px;z-index:2;" width="175" height="135" alt="Come in. We\'re OPEN">' +
		'<img src="img/' + brandImgDir1 + 'welcome.png" style="left:0px;top:420px;z-index:2;" width="225" height="155" alt="Welcome to the Sweet\'N Low Brands General Store.">' +
		'<img src="img/reflect.png" style="left:0px;top:606px;z-index:2;" width="1035" height="114" alt="">' +
		'<div style="left:15px;top:14px;z-index:2">' +
		'	<a class="' + (navOnTop != '1' ? 'lk_menu_off' : 'lk_menu_on') + '" href="index.html">Home</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '2' ? 'lk_menu_off' : 'lk_menu_on') + '" href="aboutus.html">About Us</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '3' ? 'lk_menu_off' : 'lk_menu_on') + '" href="history.html">History</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '4' ? 'lk_menu_off' : 'lk_menu_on') + '" href="news_1.html">News Room</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '5' ? 'lk_menu_off' : 'lk_menu_on') + '" href="privacy.html">Privacy Policy</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '6' ? 'lk_menu_off' : 'lk_menu_on') + '" href="mailto:info[decrypt]brooklynpremium.com">Send Email</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '7' ? 'lk_menu_off' : 'lk_menu_on') + '" href="https://order.store.yahoo.net/cgi-bin/wg-order?brooklynpremium" target="_blank">View Cart</a>' +
		'</div>'
		
	);	
}

// farme only brand.html
function writeBorder2(brandOn, navOnTop) {
	
	var brandImgDir1 = '';
	var brandImgDir2 = '';
	
	
	if (brandOn == -1) {
		brandImgDir1 = 'home/';
		brandImgDir2 = 'home/';
		
	} else if (brandOn == 0) {
		brandImgDir1 = 'prod_none/';
		brandImgDir2 = 'prod_none/';
	} else {
		brandImgDir1 = 'prod_' + brandOn + '/';
		brandImgDir2 = '';
	}

	document.write(
	
		'<img src="img/' + brandImgDir1 + 'frame_l.png" style="left:0px;top:0px;z-index:2;" width="100" height="606" alt="">' +
		//'<img src="img/' + brandImgDir2 + 'frame_r.png" style="left:900px;top:0px;z-index:2;" width="135" height="606" alt="" border="0">' +
		'<img src="img/' + brandImgDir2 + 'frame_r_top.png" style="left:900px;top:0px;z-index:2;" border="0" vspace="0">' +
		'<a href="../brand.html?b=8&p=1" target="_self"><img src="img/' + brandImgDir2 + 'frame_r_middle.png" style="left:900px;top:383px;z-index:2;" border="0" vspace="0"></a>' +
		'<a href="../brand.html?b=2&p=1" target="_self"><img src="img/' + brandImgDir2 + 'frame_r_end.png" style="left:900px;top:452px;z-index:2;" border="0" vspace="0"></a>' +
		'<img src="img/' + brandImgDir1 + 'frame_t1.png" style="left:100px;top:0px;z-index:2;" width="150" height="105" alt="">' +
    	'<img src="img/' + brandImgDir2 + 'frame_t2_brand.png" style="left:250px;top:0px;z-index:2;" width="650" height="105" alt="">' 

+
		'<img src="img/' + brandImgDir2 + 'frame_b.png" style="left:100px;top:535px;z-index:2;" width="800" height="71" alt="">' +
		'<img src="img/' + brandImgDir2 + 'sign.png" style="left:860px;top:15px;z-index:2;" width="175" height="135" alt="Come in. We\'re OPEN">' +
		'<img src="img/' + brandImgDir1 + 'welcome.png" style="left:0px;top:420px;z-index:2;" width="225" height="155" alt="Welcome to the Sweet\'N Low Brands General Store.">' +
		'<img src="img/reflect.png" style="left:0px;top:606px;z-index:2;" width="1035" height="114" alt="">' +
		'<div style="left:15px;top:14px;z-index:2">' +
		'	<a class="' + (navOnTop != '1' ? 'lk_menu_off' : 'lk_menu_on') + '" href="index.html">Home</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '2' ? 'lk_menu_off' : 'lk_menu_on') + '" href="aboutus.html">About Us</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '3' ? 'lk_menu_off' : 'lk_menu_on') + '" href="history.html">History</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '4' ? 'lk_menu_off' : 'lk_menu_on') + '" href="news_1.html">News Room</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '5' ? 'lk_menu_off' : 'lk_menu_on') + '" href="privacy.html">Privacy Policy</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '6' ? 'lk_menu_off' : 'lk_menu_on') + '" href="mailto:info[decrypt]brooklynpremium.com">Send Email</a>' +
		'	<a class="menu_sep">&nbsp;|&nbsp;</a>' +
		'	<a class="' + (navOnTop != '7' ? 'lk_menu_off' : 'lk_menu_on') + '" href="https://order.store.yahoo.net/cgi-bin/wg-order?brooklynpremium" target="_blank">View Cart</a>' +
		'</div>'
		
	);	
}


function writeNav(brandOn, bgWhite) {
	
	document.write(
		
    	(brandOn != '1' ? '<a onmouseover="menu_in_local(1, ' + bgWhite + ')" onmouseout="menu_out_local(1)" href="brand.html?b=1&p=1"><img id="menu_1" style="left:52px;top:560px;z-index:2;"  src="img/transp.png" width="123" height="38" alt="' + brandNames[0] + '" border="0"/></a>' : '<a href="brand.html?b=1&p=1"><img id="menu_1" style="left:52px;top:560px;z-index:2;"  src="img/prod_1/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="123" height="38" alt="' + brandNames[0] + '" border="0"/></a>') +
    	(brandOn != '2' ? '<a onmouseover="menu_in_local(2, ' + bgWhite + ')" onmouseout="menu_out_local(2)" href="brand.html?b=2&p=1"><img id="menu_2" style="left:175px;top:556px;z-index:2;" src="img/transp.png" width="169" height="40" alt="' + brandNames[1] + '" border="0"/></a>' : '<a href="brand.html?b=2&p=1"><img id="menu_2" style="left:175px;top:556px;z-index:2;" src="img/prod_2/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="169" height="40" alt="' + brandNames[1] + '" border="0"/></a>') +
    	(brandOn != '3' ? '<a onmouseover="menu_in_local(3, ' + bgWhite + ')" onmouseout="menu_out_local(3)" href="brand.html?b=3&p=1"><img id="menu_3" style="left:344px;top:551px;z-index:2;" src="img/transp.png" width="122" height="41" alt="' + brandNames[2] + '" border="0"/></a>' : '<a href="brand.html?b=3&p=1"><img id="menu_3" style="left:344px;top:551px;z-index:2;" src="img/prod_3/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="122" height="41" alt="' + brandNames[2] + '" border="0"/></a>') +
    	(brandOn != '4' ? '<a onmouseover="menu_in_local(4, ' + bgWhite + ')" onmouseout="menu_out_local(4)" href="brand.html?b=4&p=1"><img id="menu_4" style="left:466px;top:547px;z-index:2;" src="img/transp.png" width="105" height="43" alt="' + brandNames[3] + '" border="0"/></a>' : '<a href="brand.html?b=4&p=1"><img id="menu_4" style="left:466px;top:547px;z-index:2;" src="img/prod_4/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="105" height="43" alt="' + brandNames[3] + '" border="0"/></a>') +
    	(brandOn != '5' ? '<a onmouseover="menu_in_local(5, ' + bgWhite + ')" onmouseout="menu_out_local(5)" href="brand.html?b=5&p=1"><img id="menu_5" style="left:571px;top:544px;z-index:2;" src="img/transp.png" width="90"  height="44" alt="' + brandNames[4] + '" border="0"/></a>' : '<a href="brand.html?b=5&p=1"><img id="menu_5" style="left:571px;top:544px;z-index:2;" src="img/prod_5/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="90"  height="44" alt="' + brandNames[4] + '" border="0"/></a>') +
    	(brandOn != '6' ? '<a onmouseover="menu_in_local(6, ' + bgWhite + ')" onmouseout="menu_out_local(6)" href="brand.html?b=6&p=1"><img id="menu_6" style="left:661px;top:540px;z-index:2;" src="img/transp.png" width="120" height="46" alt="' + brandNames[5] + '" border="0"/></a>' : '<a href="brand.html?b=6&p=1"><img id="menu_6" style="left:661px;top:540px;z-index:2;" src="img/prod_6/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="120" height="46" alt="' + brandNames[5] + '" border="0"/></a>') +
    	(brandOn != '7' ? '<a onmouseover="menu_in_local(7, ' + bgWhite + ')" onmouseout="menu_out_local(7)" href="brand.html?b=7&p=1"><img id="menu_7" style="left:781px;top:536px;z-index:2;" src="img/transp.png" width="104" height="48" alt="' + brandNames[6] + '" border="0"/></a>' : '<a href="brand.html?b=7&p=1"><img id="menu_7" style="left:781px;top:536px;z-index:2;" src="img/prod_7/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="104" height="48" alt="' + brandNames[6] + '" border="0"/></a>') +
    	(brandOn != '8' ? '<a onmouseover="menu_in_local(8, ' + bgWhite + ')" onmouseout="menu_out_local(8)" href="brand.html?b=8&p=1"><img id="menu_8" style="left:885px;top:532px;z-index:2;" src="img/transp.png" width="118" height="49" alt="' + brandNames[7] + '" border="0"/></a>' : '<a href="brand.html?b=8&p=1"><img id="menu_8" style="left:885px;top:532px;z-index:2;" src="img/prod_8/menu_' + (bgWhite ? 'w' : 'g') + '.png" width="118" height="49" alt="' + brandNames[7] + '" border="0"/></a>')
	);
}

var mapFlashBrandId = new Array(
	new Array(1, 1),
	new Array(2, 2),
	new Array(3, 3),
	new Array(4, 4),
	new Array(5, 5),
	new Array(6, 1),
	new Array(7, 7),
	new Array(8, 8),
	new Array(9, 1),
	new Array(10, 6));

var mapBrandFlashId = new Array(
	new Array(1, 1),
	new Array(2, 8),
	new Array(3, 7),
	new Array(4, 3),
	new Array(5, 2),
	new Array(6, 10),
	new Array(7, 4),
	new Array(8, 5));

/**
 * Get the brand ID from the Flash ID 
 */
function getIdBrand(idFlash) {
			
	for (var i = 0; i < mapFlashBrandId.length; i++) {
		
		if (mapFlashBrandId[i][0] == idFlash) {
		
			var idBrand = mapFlashBrandId[i][1];
			break;
		}
	}
	
	return idBrand;
}

/**
 *  Get the Flash ID from the brand ID 
 */
function getIdFlash(idBrand) {
			
	for (var i = 0; i < mapBrandFlashId.length; i++) {
		
		if (mapBrandFlashId[i][0] == idBrand) {
		
			var idFlash = mapBrandFlashId[i][1];
			break;
		}
	}
	
	return idFlash;
}

function roll_over(idBrand, bgWhite) {
	
	var bg;
	
	if (brandOn == -1) {
		bg = 'h';
	} else if (brandOn == 0) {
		bg = 'g';
	} else {
		bg = 'w';
	}
	
	document.getElementById('menu_' + idBrand).src = 'img/prod_' + idBrand + '/menu_' + bg + '.png';
}

function roll_out(idBrand) {

	document.getElementById('menu_' + idBrand).src = 'img/transp.png';	
}

/* Called by Flash */
function menu_in(idFlash, bgWhite) {
	
	var idBrand = getIdBrand(idFlash);
	
	roll_over(idBrand, bgWhite);
}

/* Called by Flash */
function menu_out(idBrand) {
	
	roll_out(idBrand);
}

function menu_in_local(idBrand, bgWhite) {
	
	// ensure roll over occurs locally.
	roll_over(idBrand, bgWhite);
	
	if (brandOn == -1) {
		
		var idFlash = getIdFlash(idBrand);
		
		
		
		// document.getElementById('shop').mouseIn(brand + '');
		document['shop'].mouseIn(idFlash + '');
	    
		
	}
	
	
}

function menu_out_local(idBrand) {
	
	// ensure roll out occurs locally.
	roll_out(idBrand);
	
	if (brandOn == -1) {
	
		var idFlash = getIdFlash(idBrand);
		
		
		
		// document.getElementById('shop').mouseOut(brand + '');
		document['shop'].mouseOut(idFlash + '');
    	
		
	}
}

function writeNewsMenu(newsOn) {
	
	document.write(
	
		'<div style="left:72px;top:155px;line-spacing:30px;line-height:25px;">' +		
		'	<a class="lk_frame_' + (newsOn != '1' ? 'off' : 'on') + '" href="news_1.html">' + brandNames[0] + '</a><br/>' +
		'	<a class="lk_frame_' + (newsOn != '2' ? 'off' : 'on') + '" href="news_2.html">' + brandNames[1] + '</a><br/>' +
		'	<a class="lk_frame_' + (newsOn != '3' ? 'off' : 'on') + '" href="news_3.html">' + brandNames[2] + '</a>' +
		'</div>'
	);
}

function writeBrandMenu(brandOn, sectOn) {
	
	if (brandOn == '1') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(1, 1)" onmouseout="prod_out(1, 1)" href="brand.html?b=1&p=1"><img id="prod_1" style="left:70px;top:258px" src="img/prod_1/prod_1_off.png" width="210" height="26" alt="' + brandSects[0][0] + '" border="0"/></a>' : '<a href="brand.html?b=1&p=1"><img id="prod_1" style="left:70px;top:258px" src="img/prod_1/prod_1_on.png" width="210" height="26" alt="' + brandSects[0][0] + '" border="0"/></a>') +
		    (sectOn != '2' ? '<a onmouseover="prod_in(1, 2)" onmouseout="prod_out(1, 2)" href="brand.html?b=1&p=2"><img id="prod_2" style="left:69px;top:284px" src="img/prod_1/prod_2_off.png" width="210" height="32" alt="' + brandSects[0][1] + '" border="0"/></a>' : '<a href="brand.html?b=1&p=2"><img id="prod_2" style="left:69px;top:284px" src="img/prod_1/prod_2_on.png" width="210" height="32" alt="' + brandSects[0][1] + '" border="0"/></a>') +
		    (sectOn != '3' ? '<a onmouseover="prod_in(1, 3)" onmouseout="prod_out(1, 3)" href="brand.html?b=1&p=3"><img id="prod_3" style="left:69px;top:308px" src="img/prod_1/prod_3_off.png" width="210" height="23" alt="' + brandSects[0][2] + '" border="0"/></a>' : '<a href="brand.html?b=1&p=3"><img id="prod_3" style="left:69px;top:308px" src="img/prod_1/prod_3_on.png" width="210" height="23" alt="' + brandSects[0][2] + '" border="0"/></a>') +
		    (sectOn != '4' ? '<a onmouseover="prod_in(1, 4)" onmouseout="prod_out(1, 4)" href="brand.html?b=1&p=4"><img id="prod_4" style="left:69px;top:331px" src="img/prod_1/prod_4_off.png" width="210" height="33" alt="' + brandSects[0][3] + '" border="0"/></a>' : '<a href="brand.html?b=1&p=4"><img id="prod_4" style="left:69px;top:331px" src="img/prod_1/prod_4_on.png" width="210" height="33" alt="' + brandSects[0][3] + ' and Clothing" border="0"/></a>')
		);
	} else if (brandOn == '2') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(2, 1)" onmouseout="prod_out(2, 1)" href="brand.html?b=2&p=1"><img id="prod_1" style="left:69px;top:257px" src="img/prod_2/prod_1_off.png" width="210" height="36" alt="' + brandSects[1][0] + '" border="0"/></a>' : '<a href="brand.html?b=2&p=1"><img id="prod_1" style="left:69px;top:257px" src="img/prod_2/prod_1_on.png" width="210" height="36" alt="' + brandSects[1][0] + '" border="0"/></a>') +
		    (sectOn != '2' ? '<a onmouseover="prod_in(2, 2)" onmouseout="prod_out(2, 2)" href="brand.html?b=2&p=2"><img id="prod_2" style="left:69px;top:283px" src="img/prod_2/prod_2_off.png" width="210" height="24" alt="' + brandSects[1][1] + '" border="0"/></a>' : '<a href="brand.html?b=2&p=2"><img id="prod_2" style="left:69px;top:283px" src="img/prod_2/prod_2_on.png" width="210" height="24" alt="' + brandSects[1][1] + '" border="0"/></a>') +
		    (sectOn != '3' ? '<a onmouseover="prod_in(2, 3)" onmouseout="prod_out(2, 3)" href="brand.html?b=2&p=3"><img id="prod_3" style="left:69px;top:307px" src="img/prod_2/prod_3_off.png" width="210" height="34" alt="' + brandSects[1][2] + '" border="0"/></a>' : '<a href="brand.html?b=2&p=3"><img id="prod_3" style="left:69px;top:307px" src="img/prod_2/prod_3_on.png" width="210" height="34" alt="' + brandSects[1][2] + '" border="0"/></a>')
		);
	} else if (brandOn == '3') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(3, 1)" onmouseout="prod_out(3, 1)" href="brand.html?b=3&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_3/prod_1_off.png" width="210" height="36" alt="' + brandSects[2][0] + '" border="0"/></a>' : '<a href="brand.html?b=3&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_3/prod_1_on.png" width="210" height="36" alt="' + brandSects[2][0] + '" border="0"/></a>') +
		    (sectOn != '2' ? '<a onmouseover="prod_in(3, 2)" onmouseout="prod_out(3, 2)" href="brand.html?b=3&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_3/prod_2_off.png" width="210" height="24" alt="' + brandSects[2][1] + '" border="0"/></a>' : '<a href="brand.html?b=3&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_3/prod_2_on.png" width="210" height="24" alt="' + brandSects[2][1] + '" border="0"/></a>') +
		    (sectOn != '3' ? '<a onmouseover="prod_in(3, 3)" onmouseout="prod_out(3, 3)" href="brand.html?b=3&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_3/prod_3_off.png" width="210" height="34" alt="' + brandSects[2][2] + '" border="0"/></a>' : '<a href="brand.html?b=3&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_3/prod_3_on.png" width="210" height="34" alt="' + brandSects[2][2] + '" border="0"/></a>') +
		    (sectOn != '4' ? '<a onmouseover="prod_in(3, 4)" onmouseout="prod_out(3, 4)" href="brand.html?b=3&p=4"><img id="prod_4" style="left:68px;top:331px" src="img/prod_3/prod_4_off.png" width="210" height="25" alt="' + brandSects[2][3] + '" border="0"/></a>' : '<a href="brand.html?b=3&p=4"><img id="prod_4" style="left:68px;top:331px" src="img/prod_3/prod_4_on.png" width="210" height="25" alt="' + brandSects[2][3] + '" border="0"/></a>')
		);
	} else if (brandOn == '4') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(4, 1)" onmouseout="prod_out(4, 1)" href="brand.html?b=4&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_4/prod_1_off.png" width="210" height="26" alt="' + brandSects[3][0] + '" border="0"/></a>' : '<a href="brand.html?b=4&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_4/prod_1_on.png" width="210" height="26" alt="' + brandSects[3][0] + '" border="0"/></a>') +
		    (sectOn != '2' ? '<a onmouseover="prod_in(4, 2)" onmouseout="prod_out(4, 2)" href="brand.html?b=4&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_4/prod_2_off.png" width="210" height="24" alt="' + brandSects[3][1] + '" border="0"/></a>' : '<a href="brand.html?b=4&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_4/prod_2_on.png" width="210" height="24" alt="' + brandSects[3][1] + '" border="0"/></a>') +
		    (sectOn != '3' ? '<a onmouseover="prod_in(4, 3)" onmouseout="prod_out(4, 3)" href="brand.html?b=4&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_4/prod_3_off.png" width="210" height="25" alt="' + brandSects[3][2] + '" border="0"/></a>' : '<a href="brand.html?b=4&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_4/prod_3_on.png" width="210" height="25" alt="' + brandSects[3][2] + '" border="0"/></a>')
		);
	} else if (brandOn == '5') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(5, 1)" onmouseout="prod_out(5, 1)" href="brand.html?b=5&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_5/prod_1_off.png" width="210" height="26" alt="' + brandSects[4][0] + '" border="0"/></a>' : '<a href="brand.html?b=5&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_5/prod_1_on.png" width="210" height="26" alt="' + brandSects[4][0] + '" border="0"/></a>') +
		    (sectOn != '2' ? '<a onmouseover="prod_in(5, 2)" onmouseout="prod_out(5, 2)" href="brand.html?b=5&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_5/prod_2_off.png" width="210" height="25" alt="' + brandSects[4][1] + '" border="0"/></a>' : '<a href="brand.html?b=5&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_5/prod_2_on.png" width="210" height="25" alt="' + brandSects[4][1] + '" border="0"/></a>')
		);
	} else if (brandOn == '6') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(6, 1)" onmouseout="prod_out(6, 1)" href="brand.html?b=6&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_6/prod_1_off.png" width="210" height="26" alt="' + brandSects[5][0] + '" border="0"/></a>' : '<a href="brand.html?b=6&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_6/prod_1_on.png" width="210" height="26" alt="' + brandSects[5][0] + '" border="0"/></a>')
		);
	} else if (brandOn == '7') {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(7, 1)" onmouseout="prod_out(7, 1)" href="brand.html?b=7&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_7/prod_1_off.png" width="210" height="36" alt="' + brandSects[6][0] + '" border="0"/></a>' : '<a href="brand.html?b=7&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_7/prod_1_on.png" width="210" height="36" alt="' + brandSects[6][0] + '" border="0"/></a>')
		);
	} else {
		document.write(
			(sectOn != '1' ? '<a onmouseover="prod_in(8, 1)" onmouseout="prod_out(8, 1)" href="brand.html?b=8&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_8/prod_1_off.png" width="210" height="26" alt="' + brandSects[7][0] + '" border="0"/></a>' : '<a href="brand.html?b=8&p=1"><img id="prod_1" style="left:68px;top:257px" src="img/prod_8/prod_1_on.png" width="210" height="26" alt="' + brandSects[7][0] + '" border="0"/></a>') +
			(sectOn != '2' ? '<a onmouseover="prod_in(8, 2)" onmouseout="prod_out(8, 2)" href="brand.html?b=8&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_8/prod_2_off.png" width="210" height="24" alt="' + brandSects[7][1] + '" border="0"/></a>' : '<a href="brand.html?b=8&p=2"><img id="prod_2" style="left:68px;top:283px" src="img/prod_8/prod_2_on.png" width="210" height="24" alt="' + brandSects[7][1] + '" border="0"/></a>') +			
			(sectOn != '3' ? '<a onmouseover="prod_in(8, 3)" onmouseout="prod_out(8, 3)" href="brand.html?b=8&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_8/prod_3_off.png" width="210" height="26" alt="' + brandSects[7][2] + '" border="0"/></a>' : '<a href="brand.html?b=8&p=3"><img id="prod_3" style="left:68px;top:307px" src="img/prod_8/prod_3_on.png" width="210" height="26" alt="' + brandSects[7][2] + '" border="0"/></a>')
		);
	}	
}

function prod_in(brand, prod) {
	
	document.getElementById('prod_' + prod).src = 'img/prod_' + brand + '/prod_' + prod + '_on.png';
}

function prod_out(brand, prod) {

	document.getElementById('prod_' + prod).src = 'img/prod_' + brand + '/prod_' + prod + '_off.png';
}

function writeLeftBG(brandOn) {
	
	document.write(
		'<img src="img/prod_' + brandOn + '/bg_left.png" style="left:40px;top:80px;" width="244" height="479" alt="' + brandNames[brandOn - 1] + '"/>'
	);
}

function writeProductFrame(brandOn, sectOn) {
	
	document.write(
		'<div id="main_right">' +
		'	<iframe frameborder="0" src="brand_' + brandOn + "_" + sectOn + '.html"></iframe>' +
		'</div>'
	);
}

function writeItemFrame(brandOn, sectOn, prodCode) {
	
	document.write(
		'<div id="main_right">' +
		'	<iframe frameborder="0" src="item_' + prodCode +  '.html?b=' + brandOn + '&p=' + sectOn + '"></iframe>' +
		'</div>'
	);
}

function writeBrandBack(brandOn, sectOn) {

	document.write(
		'<a class="lk_item_1_back" href="brand.html?b=' + brandOn + '&p=' + sectOn + '" target="_top">&lt; back</a>'	
	);
}

function getBrandOn() {

	var brandOn = gup('b');
	
	if (brandNames[brandOn - 1] == null) {
		brandOn = 1;
	}
	
	return brandOn;
}

function getSectOn(brandOn) {
	
	var sectOn = gup('p');
	
	if (brandSects[brandOn - 1][sectOn - 1] == null) {
		sectOn = 1;
	}
	
	return sectOn;
}

function getProdCode(brandOn, sectOn) {
	
	var prodCode = gup('i');
	
	var arrayToString = prodCodes[brandOn - 1][sectOn - 1].toString(); 
	if (arrayToString.search(prodCode) == -1) {
		prodCode = prodCodes[0][0][0];
	}
	
	return prodCode;
}

function gup(name) {

	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp(regexS);
	var tmpURL = window.location.href;
	var results = regex.exec(tmpURL);

    if(results == null) {

        return "-1";

    } else {

        return results[1];
    }
}

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 (var 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]
	}
}