// NETSCAPE 4 BROWSER DETECTION - CURRENTLY NOT IN USE
var isNS4 = navigator.appName.toLowerCase() == "netscape" && parseInt(navigator.appVersion) <= 4 ? true : false;

/////////////////////////////////// FLASH DETECTION ///////////////////////////////////
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i]))) continue;
		var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function show_flash(name, src, width, height, params){
	src = params == "" ? src : src + "?" + params;
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write(' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"');
	document.write(' id="' + name + '" name="' + name + '" width="' + width + '" height="' + height + '">');
	document.write('<param name="movie" value="' + src + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	if (params != "") {
		document.write('<param name="FlashVars" value="loc=' + params + '">');
	}
	document.write('<embed src="' + src + '"');
	if (params != "") {
		document.write(' FLASHVARS="loc=<%= path_translated %>"');
	}
	document.write(' quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash"');
	document.write(' id="' + name + '" name="' + name + '" width="' + width + '" height="' + height + '">');
	document.write('</embed>');
	document.write('</object>');
}
///////////////////////////////////////////////////////////////////////////////////////

// User must have cookies enabled to add products!
function cookiesEnabled(){
	// Ignore test if cookie was created
	if (readCookie("cookieTest") != null){
		return true;
	} else {
		createCookie("cookieTest", "test", 1);
		if (readCookie("cookieTest") == null) {
			alert("This site uses cookies to store information about your cart.\n\nYou must have cookies enabled to make online orders.\n\nTo place an order by phone, please call us toll-free at 1.800.860.9583.");
			return false;
		} else {
			return true;
		}
	}
}
function createCookie(strCookieName, strCookieValue, iDaysToExpire){
	iDaysToExpire = iDaysToExpire == null ? 30 : iDaysToExpire;
	var expires = "";
	
	// Set the amount of days to expire
	var oDate = new Date();
	oDate.setTime(oDate.getTime() + (iDaysToExpire * 24 * 60 * 60 * 1000));
	expires = "; expires=" + oDate.toGMTString();

	// Write the cookie
	document.cookie = strCookieName + "=" + strCookieValue + expires + "; path=/";
}
function readCookie(strCookieName){
	var nameEQ = strCookieName + "=";
	var ca = document.cookie.split(';');
	
	for(var i=0; i <ca.length; i++){
		var c = ca[i];
		while (c.charAt(0) == ' ') {
			c = c.substring(1,c.length);
		}
		if (c.indexOf(nameEQ) == 0) {
			// Match Found!
			return unescape(c.substring(nameEQ.length, c.length));
		}
	}
	// No matches found!
	return null;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	popup()
//	PARAMS		url:		NUMBER - The url to go to
//				varName:	STRING - Name of the variable referencing the popup window
//	PURPOSE		This will popup the specified url.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
var descPop;
var discountPop;
var adminPop;
var autoshipPop;
var charityPop;
var passwordPop;
var saveCartPop;
var noAccount;
var couponPop;
function popup(url, varName){
	if (varName == "descPop"){
		descPop = open(url, 'desc','width=420,height=505,scrollbars=1');
		if (typeof(descPop) == "object" && !descPop.closed) descPop.focus();
	} else if (varName == "discountPop"){
		discountPop = open(url, 'discount','width=420,height=505,scrollbars=1');
		if (typeof(discountPop) == "object" && !discountPop.closed) discountPop.focus();
	} else if (varName == "adminPop"){
		adminPop = open(url, 'admin','width=420,height=505,scrollbars=1');
		if (typeof(adminPop) == "object" && !adminPop.closed) adminPop.focus();
	} else if (varName == "autoshipPop"){
		autoshipPop = open(url, 'autoship','width=420,height=505,scrollbars=1');
		if (typeof(autoshipPop) == "object" && !autoshipPop.closed) autoshipPop.focus();
	} else if (varName == "charityPop"){
		charityPop = open(url, 'charity','width=420,height=505,scrollbars=1');
		if (typeof(charityPop) == "object" && !charityPop.closed) charityPop.focus();
	} else if (varName == "passwordPop"){
		passwordPop = open(url, 'password','width=420,height=505,scrollbars=1');
		if (typeof(passwordPop) == "object" && !passwordPop.closed) passwordPop.focus();
	} else if (varName == "saveCartPop"){
		saveCartPop = open( url, 'saveCart','width=420,height=505,scrollbars=1');
		if (typeof(saveCartPop) == "object" && !saveCartPop.closed) saveCartPop.focus();
	} else if (varName == "noAccount"){
		autoshipPop = open(url, 'noaccount','width=420,height=350,scrollbars=1');
		if (typeof(autoshipPop) == "object" && !autoshipPop.closed) autoshipPop.focus();
	} else if (varName == "couponPop"){
		couponPop = open(url, 'coupon','width=485,height=505,scrollbars=1');
		if (typeof(couponPop) == "object" && !couponPop.closed) couponPop.focus();
	}
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	trim()
//	PARAMS		val: STRING - Value to strip whitespace from
//
//	PURPOSE		This will strip out the leading and trailing whitespace from the value 
//				entered.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function trim(val){
	val = val.replace(/^\s+|\s+$/g, ""); 
	return val;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	gotoPage()
//	PARAMS		frameName: STRING - Name of the frame to update
//				url: STRING - The location to jump to in that frame
//	PURPOSE		This will swap out the image with a new one.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function gotoPage(frameName, url){
	//if (frameName != "left") top.frames["orders_left"].location = "tools.asp";
	top.frames["orders_" + frameName].location = url;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	swapImage()
//	PARAMS		imgName: STRING - Name of the image to update
//				imgSource: STRING - Source of the image to display
//	PURPOSE		This will update the selected image by changing its image src.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function swapImage(imgName, imgSource){
	$("[name=" +imgName+ "]").attr("src", imgSource);
}

//Swap out by Object Name
function swapSrc(imgName, imgSource){
	$("[name=" + imgName +"]").attr("src", imgSource);
}

//pass in Object as e and sSrc as the ImageString
function cSrc(e, sSrc)
{
	$(e).attr("src", sSrc);	
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	writeToLayer()
//	PARAMS		strName: STRING - name of the layer/span to update
//				val: STRING - Value to place in the layer/span
//	PURPOSE		This will update the value is the layer/span
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function writeToLayer(strName, val){
	if (document.all) {
		document.all[strName].innerHTML = val;
	} else if (document.layers){
		//document.layers[strName].document.open();
		//document.layers[strName].document.write(val);
		//document.layers[strName].document.close();
	} else if (document.getElementById){
		document.getElementById(strName).innerHTML =  val;
	}
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	getNumber()
//	PARAMS		num: INTEGER - Number embedded in form element name
//	PURPOSE		This will alert the user if they do not enter a valid number.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function getNumber(oField){
	var qty = Number(oField.value);
	//var pattern = /[^[0-9]]*/g;
	//qty = (qty.replace(pattern, ''));

	if (isNaN(qty) || qty < 0 || qty > 999 || qty == "") {
		alert("You must enter in a valid quantity.");
		oField.value = 1;
	} else {
		if (qty.toString().indexOf(".") != -1) oField.value = Math.floor(qty);
	}
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	getCurrency()
//	PARAMS		val:	NUMBER - Number to format into currency
//	PURPOSE		This will return the number in currency format and return an empty
//				string if no number is passed in.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function getCurrency(val){
	var cents;
	val = val.toString();
	if (val != "" && !isNaN(val)){
		if (val.indexOf(".") == -1){
			val += ".00";
		} else {
			cents = val.substring(val.indexOf(".")+1, val.length);
			if (cents.length == 1) val += "0";
		}
		return "$" + val;
	} else {
		return "";
	}
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	getIndex()
//	PARAMS		field: OBJECT - Select box to search
//				value: STRING - Value to search for within the select box
//	PURPOSE		This will return the selected index of the select box if the value
//				is found so we can select it.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function getIndex(field, value){
	for (var i=0; i<field.options.length; i++){
		if (field.options[i].value == value || field.options[i].text == value) {
			return i;
			break;
		}
	}
	return 0;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	checkPhone()
//	PARAMS		strValue: STRING - Phone to validate
//	PURPOSE		This will validate the customer's phone by stripping out the non-numeric
//				characters and checking if at least 7 numbers are supplied.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function checkPhone(strValue){
	var pattern = /[^[0-9]]*/g;
	var sTempVal = strValue;
	sTempVal = (strValue.replace(pattern, ''));
	if (sTempVal.length < 7) {
		return false;
	} else{ 
		return true;
	}
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	checkEmail()
//	PARAMS		strValue: STRING - Email to validate
//	PURPOSE		This will validate the customer's email addres
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function checkEmail(strValue) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(strValue)){
		return true;
	}
	return false;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	isValidCreditCard()
//	PARAMS		type: STRING - Type of Credit Card to validate
//				ccnum: STRING - Credit Card Number to validate
//	PURPOSE		This will validate the customers credit card by making sure that the
//				numbers fit the credit cards companies pattern.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function isValidCreditCard(type, ccnum) {
	// Used for demo purposes
	if (type == "Visa" && ccnum == "999966661111") return true;
	if (type == "Visa") {
		// Visa: length 16, prefix 4, dashes optional.
		var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
	} else if (type == "MC") {
		// Mastercard: length 16, prefix 51-55, dashes optional.
		var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
	} else if (type == "Disc") {
		// Discover: length 16, prefix 6011, dashes optional.
		var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
	} else if (type == "AmEx") {
		// American Express: length 15, prefix 34 or 37.
		var re = /^3[4,7]\d{13}$/;
	} else if (type == "Diners") {
		// Diners: length 14, prefix 30, 36, or 38.
		var re = /^3[0,6,8]\d{12}$/;
	}
	if (!re.test(ccnum)) return false;
	// Checksum ("Mod 10")
	// Add even digits in even length strings or odd digits in odd length strings.
	var checksum = 0;
	for (var i=(2-(ccnum.length % 2)); i<=ccnum.length; i+=2) {
		checksum += parseInt(ccnum.charAt(i-1));
	}
	// Analyze odd digits in even length strings or even digits in odd length strings.
	for (var i=(ccnum.length % 2) + 1; i<ccnum.length; i+=2) {
		var digit = parseInt(ccnum.charAt(i-1)) * 2;
		if (digit < 10) checksum += digit;
		else checksum += (digit-9);
	}
	if ((checksum % 10) == 0) return true;
	else return false;
}

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	isValidCreditCard()
//	PARAMS		type: STRING - Type of Credit Card to validate
//				ccnum: STRING - Credit Card Number to validate
//	PURPOSE		This will validate the customers credit card by making sure that the
//				numbers fit the credit cards companies pattern.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function isValidCreditCardCheckout(ccnum) {
    // Used for demo purposes
    var ccType = "";
    var isCC = false;
    var i = 0;

    if (ccnum == "999966661111") { $("#CreditCardType").val("Visa"); return true; }

    for (i = 0; i < 5; i++) {
        switch (i) {
            case 0: if (/^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/.test(ccnum)) { isCC = true; ccType = "Visa"; } break;
            case 1: if (/^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/.test(ccnum)) { isCC = true; ccType = "MC"; } break;
            case 2: if (/^6011-?\d{4}-?\d{4}-?\d{4}$/.test(ccnum)) { isCC = true; ccType = "Disc"; } break;
            case 3: if (/^3[4,7]\d{13}$/.test(ccnum)) { isCC = true; ccType = "AmEx"; } break;
            case 4: if (/^3[0,6,8]\d{12}$/.test(ccnum)) { isCC = true; ccType = "Diners"; } break;
        }
    }
    if (!isCC) { $("#CreditCardType").val(""); return false; }
	
    
    // Checksum ("Mod 10")
    // Add even digits in even length strings or odd digits in odd length strings.
    var checksum = 0;
    for (var i = (2 - (ccnum.length % 2)); i <= ccnum.length; i += 2) {
        checksum += parseInt(ccnum.charAt(i - 1));
    }
    // Analyze odd digits in even length strings or even digits in odd length strings.
    for (var i = (ccnum.length % 2) + 1; i < ccnum.length; i += 2) {
        var digit = parseInt(ccnum.charAt(i - 1)) * 2;
        if (digit < 10) checksum += digit;
        else checksum += (digit - 9);
    }
    if ((checksum % 10) == 0) { $("#CreditCardType").val(ccType); return true; }
    else return false;
}


// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	pageResults_html()
//	PARAMS		iPage:			INTEGER - Current page
//				iPageCount:		INTEGER - Total records displayed per page
//				iTotalRecords:	INTEGER - Total records returned from results
//				strQueryString	STRING	- Querystring to use on links
//	PURPOSE		This will display the paging for search results
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function pageResults_html(iPage, iPageCount, iTotalRecords, strQueryString) {
	//alert(iPage + " : " + iPageCount + " : " + iTotalRecords);
	var iCounter = 0;
	var iStart = 0
	var iEnd = 0
	var iTotalPages = Math.round((iTotalRecords / iPageCount) + 0.49999999999999);
	var strText = "";
	var url = "site_map";

	strQueryString = strQueryString == "" ? "" : strQueryString + "&";

	iPage = iPage <= 0 ? 1 : iPage;
	
	iCounter = Math.round((iPage / iTotalPages * (iTotalPages/iPageCount)) + 0.49999999999999)
	iCounter = iCounter - 1

	iStart = iPageCount * iCounter
	iEnd = iStart + iPageCount > iTotalPages ? iTotalPages : iStart + iPageCount;
	
	strText = "<span class='blu11'>|</span> ";

	for (var i=iStart+1; i<=iEnd; i++){
		if (i == iPage) strText += "<b class='bodyTextLg'>" + i + "</b> <span class='blu11'>|</span> ";
		else strText += "<a href='" + url + i + ".html' class='bodyLink'>" + i + "</a> <span class='blu11'>|</span> ";
	}

	strText = iCounter == 0 ? strText : "<a href='" + url + "?" + strQueryString + "Page=" + iStart + "' class='bodyLink'><<</a> " + strText;
	strText = Math.abs(iStart - iEnd) < iPageCount  || iEnd == iTotalPages ? strText : strText + " <a href='" + url + "?" + strQueryString + "Page=" + (iEnd+1) + "' class='bodyLink'>>></a>";
	document.write(strText);
}
//pageResults_html(1, 5, 133);




// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	pageResults()
//	PARAMS		iPage:			INTEGER - Current page
//				iPageCount:		INTEGER - Total records displayed per page
//				iTotalRecords:	INTEGER - Total records returned from results
//				strQueryString	STRING	- Querystring to use on links
//	PURPOSE		This will display the paging for search results
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function pageResults(iPage, iPageCount, iTotalRecords, strQueryString) {
	//alert(iPage + " : " + iPageCount + " : " + iTotalRecords);
	var iCounter = 0;
	var iStart = 0
	var iEnd = 0
	var iTotalPages = Math.round((iTotalRecords / iPageCount) + 0.49999999999999);
	var strText = "";
	var url = self.location.toString().substring(0, self.location.toString().indexOf("?"));

	strQueryString = strQueryString == "" ? "" : strQueryString + "&";

	iPage = iPage <= 0 ? 1 : iPage;
	
	iCounter = Math.round((iPage / iTotalPages * (iTotalPages/iPageCount)) + 0.49999999999999)
	iCounter = iCounter - 1

	iStart = iPageCount * iCounter
	iEnd = iStart + iPageCount > iTotalPages ? iTotalPages : iStart + iPageCount;
	
	strText = "<span class='blu11'>|</span>";

	for (var i=iStart+1; i<=iEnd; i++){
		if (i == iPage) strText += "<b style='padding:5px'>" + i + "</b><span class='blu11'>|</span>";
		else strText += "<a href='" + url + "?" + strQueryString + "Page=" + i + "' style='padding:5px'>" + i + "</a><span class='blu11'>|</span>";
	}

	strText = iCounter == 0 ? strText : "<a href='" + url + "?" + strQueryString + "Page=" + iStart + "' class='bodyLink'><<</a> " + strText;
	strText = Math.abs(iStart - iEnd) < iPageCount  || iEnd == iTotalPages ? strText : strText + " <a href='" + url + "?" + strQueryString + "Page=" + (iEnd+1) + "' class='bodyLink'>>></a>";
	document.write(strText);
}
//pageResults(1, 5, 133);

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//	FUNCTION	atYourService()
//	PARAMS		strOptions:		STRING - String array of options and order to be placed.
//	PURPOSE		This will create the right side menu and place them in the order specified.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function atYourService(blnShowTopDivider, strOptions, blnShowBottomDivider){
	var arrOptions = strOptions.split(",");
	var returnText = "";
	var arrFeatures =	[
							// layout, width, hieght, title, image graphic, header graphic, text displayed, URL
							[0,	"",	"",		"Vitamin Advisor",	"service_vitamin_advisor_gfx.gif",		"service_vitamin_advisor_txt.gif",		"Free online tool to help you find the right product.",																						"/expert_opinion/wellness_advisor.asp"],
							[0,	"",	"",		"Catalog Request",	"auto-delivery-graphic.gif",				"autodelivery.gif",				"The worry-free discount program to make sure you never run out of your favorite vitamins.",																										"/company/auto_delivery.asp"],
							[0,	"",	"",		"Free Shipping",	"service_free_shipping_gfx.gif",		"service_free_shipping_txt.gif",		"Take advantage of free shipping on select products.",																						"/products/free_shipping.asp"],
							[0,	"",	"",		"On Sale!",			"service_on_sale_gfx.gif",				"service_on_sale_txt.gif",				"40-75% OFF on already low prices. Limited time only, based on in-stock inventory.",														"/products/on_sale.asp"],
							[0,	"",	"",		"New AHCC",			"service_new_ahcc_gfx.gif",				"service_new_ahcc_txt.gif",				"Pure Prescriptions brand AHCC. Now in 180 count or 3 month supply.<br><b>Starting at $30.00</b>",											"/products/product_details.asp?ProductsID=100"],
							[0,	"",	"",		"$5.00 Off",		"service_5off_gfx.gif",					"",										"Get $5.00 Off your first purchase when you sign up for my account or refer a friend to our site.<br><b>Coupon: 5OFF</b>",					""],
							//[1,	"",	"164",	"Fall Sale",		"service_fall_sale_gfx.gif",			"service_fall_sale_txt.gif",			"Great savings<br>on customer<br>favorites.",																							"/products/on_sale.asp"],
							[1,	"",	"184",	"Great Savings!",		"service_onsale_gfx.gif",			"service_onsale_txt.gif",			"On most customer<br>favorites. Start<br>saving today.",																				"/products/on_sale.asp"],
							//[1,	"",	"184",	"Holiday Sale",		"service_holiday_sale_gfx.jpg",			"service_holiday_sale_txt.jpg",			"",																																		"/products/on_sale.asp"],
							[0,	"",	"",		"Express Shop",		"service_express_shop_gfx.gif",			"service_express_shop_txt.gif",			"Designed for our frequent online customer, express shop offers the ability to breeze through our entire catalog.",							"/products/express_shop.asp"],
							[0,	"",	"",		"Nattokinase",		"service_cardiokinase_gfx.gif",			"service_cardiokinase_txt.gif",			"Professional Grade Nattokinase from Iagen Biologics Now Available!<br>Free Shipping<br><b>Starting at $39.50</b>",							"/products/product_view.asp?ProductsID=112&ProductsCategoryID=104"],
							//[0,	"",	"",		"C-Glutamine",		"service_cglutamine_gfx.gif",			"service_cglutamine_txt.gif",			"Multi-Purpose Super Nutrient from Iagen Biologics<br>Free Shipping<br><b>Starting at $26.50</b>",											"/products/product_view.asp?ProductsID=107&ProductsCategoryID=100"],
							[0,	"",	"",		"New Greens",		"service_newgreens_gfx.gif",			"service_newgreens_txt.gif",			"A Great Tasting Superfruit Drink<br>10+ servings of fruits & vegetables<br><br>Tastes Great! Satisfaction Guaranteed!<br><b>Starting at $44.00</b>",											"/newgreens_berry.asp"],
							[0,	"",	"",		"Same",				"service_same_gfx.gif",					"service_same_txt.gif",					"Extra Strength SAMe Supports joint comfort, function and mobility.<br>Free Shipping<br><b>Starting at $29.95</b>",							"/products/product_view.asp?ProductsID=197&ProductsCategoryID=106"],
							[0,	"",	"",		"Inflacain",		"service_Inflacain_gfx.gif",			"service_Inflacain_txt.gif",			"Provides natural, fast-acting, and long-lasting joint relief.<br>Free Shipping<br><b>Starting at $49.50</b>",								"/products/product_view.asp?ProductsID=425&ProductsCategoryID=104"],
							[0,	"",	"",		"Joint Renew",		"service_jointrenew_gfx.gif",			"service_jointrenew_txt.gif",			"Comprehensive Glucosamine Formula.<br>Promotes Healthy Joint Function and Comfort*.<br>One Month Supply<br><b>Starting at $29.95</b>",		"/products/product_view.asp?ProductsID=445&ProductsCategoryID=106"]
						];

	if (blnShowTopDivider){
		returnText += '<tr>\n';
		returnText += '	<td colspan="2"><div class="dottedborder vmargin" ></div></td>\n';
		returnText += '</tr>\n';
	}
	
	for (var i=0; i<arrOptions.length; i++){
		if (arrOptions[i] < arrFeatures.length && arrOptions[i] != ""){
			returnText += '<tr>\n';
			returnText += '	<td colspan="2"><img src="/images/spacer.gif" width="1" height="10"></td>\n';
			returnText += '</tr>\n';
			returnText += '<tr valign="top">\n';

			if (arrFeatures[arrOptions[i]][0] == 1) {
				returnText += '	<td colspan="2" height="' + arrFeatures[arrOptions[i]][2] + '" class="bodyTextSm" background="/images/' + arrFeatures[arrOptions[i]][4] + '">\n';
				//returnText += '		<img src="/images/spacer.gif" width="1" height="' + arrFeatures[arrOptions[i]][2] + '" align="left">\n';
				returnText += '		<img src="/images/' + arrFeatures[arrOptions[i]][5] + '"><br>\n';
				returnText += '		<img src="/images/spacer.gif" width="1" height="4"><br>\n';
				returnText += 		arrFeatures[arrOptions[i]][6] + '<br>\n';
				returnText += '		<img src="/images/spacer.gif" width="1" height="5"><br>\n';
				if (arrFeatures[arrOptions[i]][7] != "") returnText += '		<a href="http://www.purecapspro.com/' + arrFeatures[arrOptions[i]][7] + '"><img src="/images/arrow_red.gif" width="15" height="13" border="0"></a>\n';
			} else {
				returnText += '	<td><img src="/images/' + arrFeatures[arrOptions[i]][4] + '"></td>\n';
				returnText += '	<td>\n';
				if (arrFeatures[arrOptions[i]][5] != "") returnText += '		<img src="/images/' + arrFeatures[arrOptions[i]][5] + '"><br>\n';
				returnText += '		<img src="/images/spacer.gif" width="1" height="4"><br>\n';
				returnText += '		<span class="bodyTextSm">' + arrFeatures[arrOptions[i]][6] + '</span><br>\n';
				returnText += '		<img src="/images/spacer.gif" width="1" height="5"><br>\n';
				if (arrFeatures[arrOptions[i]][7] != "") returnText += '		<a href="' + arrFeatures[arrOptions[i]][7] + '"><img src="/images/arrow_red.gif" width="15" height="13" border="0"></a>\n';
			}

			returnText += '	</td>\n';
			returnText += '</tr>\n';

			if (i < arrOptions.length - 1 || blnShowBottomDivider){
				returnText += '<tr>\n';
				returnText += '	<td colspan="2"><div class="dottedborder  vmargin"></div></td>\n';
				returnText += '</tr>\n';
			}
		}
	}
	
	//document.write('<table border="0" cellpadding="0" cellspacing="0" width="223" bgcolor="#EAF2F1">' + returnText + '</table>');
	document.write(returnText);
}
//atYourService(true, "0,1,2,3", true);

// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//verisign logo pop up
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function popUpverisign(URL) {
	eval("win3 = window.open(URL, 'win3', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=510,left = 50,top = 50');");
	win3.focus();
}
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//verisign logo pop up
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function popUpprivacy(URL) {
	eval("win4 = window.open(URL, 'win4', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=450,left = 1,top = 1');");
	win4.focus();
}
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//free shippingpopup
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function popUpfreeship(URL) {
	eval("win5 = window.open(URL, 'win5', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=282,left = 1,top = 1');");
	win5.focus();
}


///******   Add jquery if doesn't exist             ***********////////////////
if (typeof jQuery == 'undefined') {
document.write('<script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script>');
}

