

//dropdown JS (arn)
$(document).ready(function() {
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
		//Calculate width of all ul's
		//(function($) {
		//	jQuery.fn.calcSubWidth = function() {
		//		rowWidth = 0;
		//		//Calculate row
		//		$(this).find("ul").each(function() {
		//			rowWidth += $(this).width();
		//		});
		//	};
		//})(jQuery);
		//if ( $(this).find(".row").length > 0 ) { //If row exists...
		//	var biggestRow = 0;
			//Calculate each row
		//	$(this).find(".row").each(function() {
		//		$(this).calcSubWidth();
				//Find biggest row
		//		if(rowWidth > biggestRow) {
		//			biggestRow = rowWidth;
		//		}
		//	});
			//Set width
		//	$(this).find(".sub").css({'width' :biggestRow});
		//	$(this).find(".row:last").css({'margin':'0'});
		//} else { //If row does not exist...
		//	$(this).calcSubWidth();
			//Set Width
		//	$(this).find(".sub").css({'width' : rowWidth});
		//}
	}
	function megaHoverOut(){
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide();
	  });
	}
	var config = {
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		 interval: 100, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 100, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};
	if ($("ul#topNavigation li").length > 0) {
		$("ul#topNavigation li .sub").css({
			'opacity': '0'
		});
		$("ul#topNavigation li").hoverIntent(config);
	}
});
//stop dropdown JS



//cycle plugin (used globally for rotating-marketing div)
$(document).ready(function() {

    if ($('.marketing-list').length > 0) {
		$('.marketing-list').cycle({
			fx: 'fade'
		});
	}
});

//
function ShowHide(){
	$("#why-buy-extended").slideToggle({"height": "toggle"}, { duration: 1000 });
}


function ArrayDeleteAt(vArray, vPosition){
	var a2 = new Array();

	//copy all the indexes after the index we want to delete
	for (i=vPosition+1; i<vArray.length; i++){
		a2[a2.length] = vArray[i];
	}
	//shorten the original array to before the deleted Index
	vArray.length = vPosition;
	//add the temp array to the original and return it.
	vArray = vArray.concat(a2);
	return vArray;
}

function checkESMformat() {
	//checks the email format and returns false if incorrect format on the email exclusives sidebar.
	var email = document.getElementById('esignupfield');
	var filter = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
	if (!filter.test(email.value)) {
		document.getElementById("esmright").style.display="block";
		document.getElementById("esmright2").style.display="none";
	}else{
		document.getElementById("esmright").style.display="none";
		var outlink='/emailExclusives.cfm?emailsignupemail=' + document.getElementById("esignupfield").value + '&KeepThis=true&TB_iframe=true&height=580&width=600';
		document.getElementById("emailactivelink").setAttribute("href",outlink);
		document.getElementById("esmright2").style.display="block";
	}
}

function validateESMsignup() {
	// checks form validation for Email Exclusives signup
	var stopform=0;  // 0  means "form is ok"
	var emailmsg='';
	var fnamemsg='';
	var lnamemsg='';
	var catmsg='';
	var fname=document.getElementById("first-name");
	var lname=document.getElementById("last-name");
	//checks the email format and returns false if incorrect format on the email exclusives sidebar.
	var email = document.getElementById('email-address');
	var filter = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;

	if (!filter.test(email.value)) {
		stopform+=1;
		emailmsg='Email Address';
		document.getElementById("emailasterisk").style.color="#ff0000";
	}else{
		document.getElementById("emailasterisk").style.color="#000000";
	}
	if (fname.value.length==0) {
		stopform+=1;
		fnamemsg='First Name';
		document.getElementById("fnameasterisk").style.color="#ff0000";
	}else{
		document.getElementById("fnameasterisk").style.color="#000000";
	}
	if (lname.value.length==0) {
		stopform+=1;
		lnamemsg='Last Name';
		document.getElementById("lnameasterisk").style.color="#ff0000";
	}else{
		document.getElementById("lnameasterisk").style.color="#000000";
	}

	// check the checkboxes
	var numchecked=0
	for (i=0; i<document.frmemailexclusives.eeoptions.length; i++){
		if (document.frmemailexclusives.eeoptions[i].checked==true){
			numchecked+=1;
		}
	}
	if (numchecked==0){
		stopform+=1;
		catmsg='Category (choose at least one)';
		document.getElementById("categoryasterisk").style.color="#ff0000";
	}else{
		document.getElementById("categoryasterisk").style.color="#000000";
	}

	if (stopform !=0) {
		msg = "<p>The following fields are missing required information: ";

		if (emailmsg!=''){
			msg += emailmsg;
		}

		if (fnamemsg!=''){
			if (emailmsg!=''){
				msg+= ', ';
			}
		}
		if (fnamemsg!=''){
			msg+=fnamemsg;
		}

		if ((fnamemsg!='') || (emailmsg!='')){
			if (lnamemsg!=''){
				msg+= ', ';
			}
		}
		if (lnamemsg!=''){
			msg+=lnamemsg;
		}

		if ((fnamemsg!='') || (emailmsg!='') || (lnamemsg!='')){
			if (catmsg!=''){
				msg+= ', ';
			}
		}
		if (catmsg!=''){
			msg+=catmsg;
		}

		msg += ".&nbsp;&nbsp;Please fill in the missing information and try again.</p>";
		document.getElementById("eevalidationerrors").innerHTML=msg;
		document.getElementById("eevalidationerrors").style.display="block";
		return false;
	}else{
		if(document.getElementById("eevalidationerrors")){
			document.getElementById("eevalidationerrors").style.display="none";
		}
		return true;
	}

}



// --------------------------------------------------------------
// --------------------------------------------------------------
// \/\/\/\/\/\/\/\/ Site Specific \/\/\/\/\/\/\/\/

// Live Person JavaScript Option A  Added: JRG 110100 --->
function enterLivePerson(aname, gname, re, name) {
	window.name = "lp_parent";
	var url = "http://spinlife.client.liveperson.net/user.asp?aname=" + aname + "&gname=" + gname + "&RE=" + re + "&name=" + name;
	var hWnd = window.open(url,"live_person","width=300,height=350,resizable=yes,scrollbars=yes");
	if (hWnd != null) { if (hWnd.opener == null) { hWnd.opener = self; window.name = "home"; hWnd.location.href=url; } }
}

function clearSearch(object,focus_event){
	if (focus_event && object.value == 'Search Here'){
		object.value='';
	}else if (!focus_event && object.value == ''){
		object.value='Search Here';
	}
}

function MsgBox(win,w,h) {
	var vParameters, newWindow

	if (!w){ w = 250; }
	if (!h){ h = 400; }
	vParameters = "scrollbars=0,toolbar=0,status=0,menubar=0,resizable=0,location=0,directories=0,width=" + w +",height=" + h;
	newWindow=window.open(win,"Newwindow",vParameters);
	newWindow.focus();
}

function Certify(URL){
	var popupWin = window.open(URL, 'Participant', 'location,scrollbars,width=400,height=300');
	window.top.name = 'opener';
}

function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=550,height=450');
	self.name = "mainWin";
}

function showSpinRecommends(productID){
	var vURL = '/spinlifeRecommends.cfm?productID=' + productID;
	window.open(vURL,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=300');
}

function confirmModuleDelete(){
	var oTemp = event.srcElement;

	if (!confirm("Are you sure you want to delete this module?\n\nWARNING: This action can no be undone.")){
		return false;
	}

	document.location = oTemp.href;
}

function toggleDetails(i){
	var oTemp = document.getElementById('itemDetails'+i);
	if (oTemp.style.display == '' || oTemp.style.display == 'block') {

		oTemp.style.display = 'none';
		document.getElementById('details'+i).innerHTML = '<img src="/images/button/arrow_forShow.gif" border="0"  style="margin-right:8px;">View Product Details'
	}
	else {
		oTemp.style.display = 'block';
		document.getElementById('details'+i).innerHTML = '<img src="/images/button/arrow_forhide.gif" border="0"  style="margin-right:8px;">Hide Product Details'
	}
}

function showColorName(strIn){
	if (!strIn || strIn == '') { strIn = ' '; }
	document.getElementById('colorName').innerText = strIn;
}

function checkAllBrands(){
	var aBrands = document.getElementById('searchByBrand').brandID;

	for (i=1; i < aBrands.length; i++){
		aBrands[i].checked = aBrands[0].checked;
		aBrands[i].disabled = aBrands[0].checked;
	}
}

function popDesc(which, ID, ID2, width, height){
	var vFilename = '/popDesc.cfm?which=' + which + '&ID=' + ID + '&ID2=' + ID2;
	if (!width){ width = 400; }
	if (!height){ height = 250; }
	w_desc = window.open(vFilename, 'w_popup', 'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1');
}

function popEd(which){
	w_details = window.open('/pop_gogo.cfm?fileID=' + which , 'w_popup', 'width=620,height=450,resizable=1,scrollbars=1');
}

// match.cfm functions (Compare logic)
function checkForm_compare(){
	if (document.formCompare.comparelist.value != ''){ return true;	}
	alert("Please select two to eight products to compare in the checkboxes below.");
	return false;
}

function buildcomparelist(vObject, domain){
	var vList = document.formCompare.comparelist.value;
	if (vList == ''){
		var aList = new Array();
	}else{
		var aList = vList.split(',');
		vList = '';
	}

	if (!domain){ domain = 'spinlife.com'; }

	if (vObject.checked){
		//add
		if (aList.length == 0){
			//nothing in the array, so just add this one
			aList[aList.length] = vObject.value;
		}else if (aList.length >= 8){
			alert("Sorry, you can not compare more than eight products.");
			vObject.checked = false;
			return false;
		}else{
			for (i=0; i < aList.length; i++){
				if (vObject.value == aList[i]){
					//already in the list, so return
					return true;
				}
				//add it to the array and break the loop
				aList[aList.length] = vObject.value;
				break;
			}
		}
	}else{
		//remove
		for (i=0; i < aList.length; i++){
			if (vObject.value == aList[i]){
				//found it, so remove it.
				aList = ArrayDeleteAt(aList,i);
				break;
			}
		}
	}

	for (i=0; i<aList.length; i++){
		vList += aList[i] + ',';
	}
	if (vList.length > 0){ vList = vList.substring(0,vList.length-1); }

	applyCompareList(vList, domain);
}

function clearCompareList(domain){
	var aObjects = document.getElementsByName('compareProduct');

	for (i=0; i < aObjects.length; i++){
		aObjects[i].checked = false;
	}

	applyCompareList('', domain);
}

function applyCompareList(vList, domain){
	//fill in the form variable "comparelist" with our value.
	//document.formsort.comparelist.value = vList;
	document.formCompare.comparelist.value = vList;
	setCookie("COMPARE_LIST", vList, getExpirationDate(1), '/', domain);

	//take the "comparelist" variable out of the querystring, so we don't duplicate it and then put it back in.
	for (i=1; eval('document.all.pageLink'+i); i++){
		vObject = eval('document.all.pageLink'+i);

		aStrings = vObject.href.split('&');
		vObject.href = aStrings[0];
		for (x=1; x < aStrings.length; x++){
			if (aStrings[x].substring(0,13) != '&comparelist='){
				vObject.href += '&' + aStrings[x];
			}
		}

		vObject.href += '&comparelist=' + vList;
	}
}

function resortList(s){
	document.getElementById('formsort').sort.value = s;
	document.getElementById('formsort').submit();
}

function checkAllBrands(bAll){
	var aChecks = document.all.brandID;

	if (bAll && aChecks[0].checked){
		for (i=1; i < aChecks.length; i++)
			aChecks[i].checked = false;
	}else{
		var bAll = true;
		for (i=1; i < aChecks.length; i++){
			if (aChecks[i].checked){
				bAll = false;
				break;
			}
		}
		aChecks[0].checked = bAll;
	}
}

// spec.cfm function (calc pricing logic)
function formatNumber(num, decimalNum, bLeadingZero, bAddCommas){
	/*	IN - num:            the number to be formatted
			decimalNum:     the number of decimals after the digit
			bLeadingZero: true / false to use leading zero

		RETVAL - formatted number
	*/
	var tmpNum = num;
	var aTemp;

	// Return the right number of decimal places
	tmpNum *= Math.pow(1000,decimalNum);
	tmpNum = Math.floor(tmpNum);
	tmpNum /= Math.pow(1000,decimalNum);

	var tmpStr = new String(tmpNum);

	// See if we need to hack off a leading zero or not
	if (!bLeadingZero && num < 1 && num > -1 && num !=0)
		if (num > 0)
			tmpStr = tmpStr.substring(1,tmpStr.length);
		else
			// Take out the minus sign out (start at 2)
			tmpStr = "-" + tmpStr.substring(2,tmpStr.length);

	// See if we need to add zeros
	aTemp = tmpStr.split(".");
	if (aTemp.length == 1){ aTemp[1] = ''; }
	while (aTemp[1].length < decimalNum){ aTemp[1] += 0; }
	tmpStr = aTemp[0] + '.' + aTemp[1];

	// See if we need to add commas
	if (bAddCommas){
		aTemp = tmpStr.split('.');
		var nCommas = Math.floor((aTemp[0].length-1) / 3);
		for (i=nCommas;  i > 0; i--){
			p = aTemp[0].length - (3*i);
			aTemp[0] = aTemp[0].substring(0,p) + "," + aTemp[0].substring(p,aTemp[0].length);
		}
		tmpStr = aTemp[0] + '.' + aTemp[1];
	}

	return tmpStr;
}


function updatePrice(bOnLoad){
	if(typeof CFV_salePrice == 'undefined'){ return false; }

	var p1 = document.getElementById('price1');
	var p2 = document.getElementById('price2');
	var f = document.f_config;
	var m = 10000;
	var x = 0;
	var total = CFV_salePrice * m;
	var lstConfig = '';
	var selObj;

	for (i=0; i < aConfigOptions.length; i++){
		x = 0;
		if (document.getElementById(aConfigOptions[i][0]).checked || document.getElementById(aConfigOptions[i][0]).selected){
			x = Math.round(parseFloat(aConfigOptions[i][1]) * m);
		}
		total += x;
	}

	total /= m;

	total = formatNumber(total, 2, false, true);

	p1.innerHTML = '$' + total;
	if (p2)
		p2.innerHTML = '$' + total;

	if (!bOnLoad && !bIgnoreConfigCookies){
		setCookie("CONFIG_PRODUCTID", CFV_productID, getExpirationDate(1), '/', '<cfoutput>#Application.cookieDomain#</cfoutput>');
		setCookie("CONFIG_VALUES", lstConfig, getExpirationDate(1), '/', '<cfoutput>#Application.cookieDomain#</cfoutput>');
	}
}

function getExpirationDate(vDays){
	var tDate = new Date();
	fixDate(tDate);
	vDays *= 24 * 60 * 60 * 1000;
	tDate.setTime(tDate.getTime() + vDays);
}

function listAppend(lst, value){
	return lst + ((lst.length > 0)?',':'') + value;
}

function popDetails(which, fileID, linkLoc, productID){
	var vFilename;
	if (!productID)
	{
		var vQS = 'productID=' + CFV_productID;
	}
	else
	{
		var vQS = 'productID=' + productID;
	}

	if (which == 'file' || which == 'video'){
		vQS += '&fileID=' + fileID;
	}
	if (linkLoc){
		vQS += '&linkLoc=' + linkLoc;
	}

	switch(which){
		case 'specs':
			vFilename = 'pop_specs.cfm'; break;
		case 'image':
			vFilename = 'pop_image.cfm'; break;
		case 'warranty':
			vFilename = 'pop_warranty.cfm'; break;
		case 'photos':
			vFilename = 'pop_photos.cfm'; break;
		case 'reviews':
			vFilename = 'pop_reviews.cfm'; break;
		case 'file':
			vFilename = 'pop_files.cfm'; break;
		case 'colors':
			vFilename = 'pop_colors.cfm'; break;
		case 'video':
			vFilename = 'pop_video.cfm'; break;
		default:
			vFilename = 'specs';
	}

	w_details = window.open('/critpath/' + vFilename + '?' + vQS, 'w_popup', 'width=620,height=450,resizable=1,scrollbars=1');
}

function popSTAF(productID){
	window.open('/critpath/staf.cfm?productID=' + productID, 'staf_popup', 'scrollbars=1,resizable=1,width=500,height=430');
}

function popSpecs(specID, productID){
	window.open('/critpath/pop_configOption.cfm?productID=' + productID + '&specID=' + specID, 'spec_popup', 'scrollbars=0,resizable=1,width=555,height=280');
}

function swapAltImage(indexIn){
	document.getElementById('altLarge').src = aAltImages[indexIn]["src"];
	document.getElementById('altImageText').innerText = aAltImages[indexIn]["altText"];
}

// registration.cfm
function toggleShippingAddress(wipeShipping){
	if (!document.getElementById('ship_bill')){ return false; }
	var bChecked = document.getElementById('ship_bill').checked;
	var bgColor = 'ffffff';
	if (bChecked)
		bgColor = 'cccccc';

	document.getElementById('ship_company_name').disabled =
	document.getElementById('ship_first_name').disabled =
	document.getElementById('ship_middle_initial').disabled =
	document.getElementById('ship_last_name').disabled =
	document.getElementById('ship_street1').disabled =
	document.getElementById('ship_street2').disabled =
	document.getElementById('ship_city').disabled =
	document.getElementById('ship_state').disabled =
	document.getElementById('ship_postal').disabled =
	document.getElementById('ship_country').disabled =
	document.getElementById('ship_area_code').disabled =
	document.getElementById('ship_suffix').disabled = bChecked;

	document.getElementById('ship_company_name').style.backgroundColor =
	document.getElementById('ship_first_name').style.backgroundColor =
	document.getElementById('ship_middle_initial').style.backgroundColor =
	document.getElementById('ship_last_name').style.backgroundColor =
	document.getElementById('ship_street1').style.backgroundColor =
	document.getElementById('ship_street2').style.backgroundColor =
	document.getElementById('ship_city').style.backgroundColor =
	document.getElementById('ship_state').style.backgroundColor =
	document.getElementById('ship_postal').style.backgroundColor =
	document.getElementById('ship_country').style.backgroundColor =
	document.getElementById('ship_area_code').style.backgroundColor =
	document.getElementById('ship_suffix').style.backgroundColor = bgColor;

	if (bChecked)
	{
		document.getElementById('ship_company_name').value = document.getElementById('company_name').value;
		document.getElementById('ship_first_name').value = document.getElementById('user_first_name').value;
		document.getElementById('ship_middle_initial').value = document.getElementById('user_middle_initial').value;
		document.getElementById('ship_last_name').value = document.getElementById('user_last_name').value;
		document.getElementById('ship_street1').value = document.getElementById('bill_street1').value;
		document.getElementById('ship_street2').value = document.getElementById('bill_street2').value;
		document.getElementById('ship_city').value = document.getElementById('bill_city').value;
		document.getElementById('ship_state').value = document.getElementById('bill_state').value;
		document.getElementById('ship_postal').value = document.getElementById('bill_postal').value;
		document.getElementById('ship_country').value = document.getElementById('bill_country').value;
		document.getElementById('ship_area_code').value = document.getElementById('home_phone_area_code').value;
		document.getElementById('ship_suffix').value = document.getElementById('home_phone_suffix').value;

	}
	else
	{
		if (wipeShipping)
		{
			document.getElementById('ship_company_name').value =
			document.getElementById('ship_first_name').value =
			document.getElementById('ship_middle_initial').value =
			document.getElementById('ship_last_name').value =
			document.getElementById('ship_street1').value =
			document.getElementById('ship_street2').value =
			document.getElementById('ship_city').value =
			document.getElementById('ship_state').value =
			document.getElementById('ship_postal').value =
			document.getElementById('ship_area_code').value =
			document.getElementById('ship_suffix').value = "";
			document.getElementById('ship_country').selectedIndex = 0;
		}
	}
}

// checkout1.cfm
function UpdateTotal(){
	var oSelect;
	var oSpan_grandTotal = document.getElementById('grandTotal');
	var oSpan_shippingTotal = document.getElementById('shippingTotal');
	var m = 10000;
	var grandTotal = (CFV_ITEMGRANDTOTAL + CFV_OHIOTAX) * m;
	var shippingTotal = 0;
	var shippingTotal_ground = 0;
	var maxGroundShipping = 9.95 * m;

	if (CFV_bInternational && CFV_bFreight){
		return true;
	}

	if (aItems.length > 0) {
		for (x = 0; x < aItems.length; x++) {
			//if (oSelect = document.getElementById('shipping_flag' + aItems[x].itemID)) {
				oSelect = document.getElementById('shipping_flag' + aItems[x].itemID);
				if (oSelect.options && oSelect.options.length > 0) {
					if (oSelect.options[oSelect.selectedIndex].value == 1) {
						shippingTotal_ground += aItems[x].aPrices[oSelect.options[oSelect.selectedIndex].value - 1] * m;
					}
					else {
						shippingTotal += aItems[x].aPrices[oSelect.options[oSelect.selectedIndex].value - 1] * m;
					}
				}
			//}
		}
	}

	if (shippingTotal_ground > maxGroundShipping){
		shippingTotal_ground = maxGroundShipping;
	}

	shippingTotal += shippingTotal_ground;
	grandTotal = grandTotal + shippingTotal;

	oSpan_shippingTotal.innerHTML = formatNumber(shippingTotal/m, 2, false, true);
	oSpan_grandTotal.innerHTML = formatNumber(grandTotal/m, 2, false, true);
}

// --------------------------------------------------------------
// --------------------------------------------------------------
// \/\/\/\/\/\/\/\/ FROM maphome.htm \/\/\/\/\/\/\/\/

// advisor/spinmaster popup page
function smpage (sm){
	smwin = window.open(sm,"smpage","width=580,height=400,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
	smwin.focus();
	if (!smwin.opener){
    	smwin.opener = "self";
	}
}
// itemgroup help popup page
function ighelp (ig){
	igwin = window.open(ig,"igpage","width=390,height=400,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
	igwin.focus();
	if (!igwin.opener){
    	igwin.opener = "self";
	}
}
// product help popup page
function prodhelp (prod){
	prodwin = window.open(prod,"prodpage","width=390,height=400,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
	prodwin.focus();
	if (!prodwin.opener){
		prodwin.opener = "self";
	}
}

// logic help popup page
function loghelp (logic){
	logwin = window.open(logic,"logpage","width=580,height=400,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
	logwin.focus();
	if (!logwin.opener){
		logwin.opener = "self";
	}
}

// color charts popup page
function charts(chart){
	chartwin = window.open(chart,"chartpage","width=580,height=400,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
	chartwin.focus();
	if (!chartwin.opener){
		chartwin.opener = "self";
	}
}

function lImage(chart){
	chartwin = window.open(chart,"chartpage","width=375,height=375,toolbar=no,menubar=no,scrollbars=no,resizable=no,screenX=25,screenY=50,top=50,left=25");
	chartwin.focus();
	if (!chartwin.opener){
		chartwin.opener = "self";
	}
}

function certify(URL){
	popupWin = window.open(URL, 'Participant', 'location,scrollbars,width=400,height=300');
	window.top.name = 'opener';
}

function Uscribe(uwin){
	chartwin = window.open(uwin,"chartpage","width=375,height=175,toolbar=no,menubar=no,scrollbars=no,resizable=no,screenX=25,screenY=50,top=50,left=25");
	chartwin.focus();
	if (!chartwin.opener){
		chartwin.opener = "self";
	}
}
//This function was added on 12/19/00 by Allwyn Naik to open a popup from match page for Free Shipping Details.
function freeShipping_popup(){
	freeShipping_popup = window.open("../about/freeShipping_text.cfm","fShipWin","width=400,height=500,toolbar=no,menubar=no,scrollbars=no,resizable=no,screenX=30,screenY=50,left=30,top=50");
}

function medicare_popup(categoryID)
{
	medicarePopup = window.open("/shopping/medicare_agreement.htm#_" + categoryID, "wMedicare", "width=400,height=400,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function insurance_popup()
{
	insurancePopup = window.open("/shopping/insurance.htm", "wInsurance", "width=500,height=200,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function medicare_popup()
{
	insurancePopup = window.open("/shopping/medicare.htm", "wMedicare", "width=500,height=225,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function international_popup()
{
	insurancePopup = window.open("/shopping/international.htm", "wInternational", "width=500,height=250,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function inHomeService_popup()
{
	inHomeServicePopup = window.open("/shopping/inHomeService.htm", "wInHomeService", "width=550,height=200,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function WhiteGlove_popup()
{
	WhiteGlovePopup = window.open("/shopping/WhiteGloveDelivery.htm", "wWhiteGlove", "width=550,height=200,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function ADACompliant_popup()
{
	ADACompliantPopup = window.open("/shopping/ada-compliant.htm", "wADACompliant", "width=550,height=200,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}
function madeInAmerica_popup()
{
	MadeInUSAPopup = window.open("/shopping/made-in-america.htm", "wMadeInUSA", "width=550,height=200,toolbar=no,menubar=no,left=30,top=50,scrollbars=yes");
}

function email_validate(){
	var txt = new String(document.newsletter.email.value);

	if (txt.indexOf("@") == -1){
		alert("Email Address Must Contain A @");
		return false;
	}
	else if (txt.indexOf(".") == -1){
		alert("Email Address Must Contain A .");
		return false;
	}
	else if (txt.indexOf(".") == 0){
		alert(". Cannot Be The First Character Of An Email Address");
		return false;
	}
	else if (txt.indexOf("@") == 0){
		alert("@ Cannot Be The First Character Of An Email Address");
		return false;
	}else{
		alert("Thank You");
	}
	return true;
}

function email_onclick(){
	document.newsletter.email.select();
	document.newsletter.email.focus();
	return true;
}

