//GLOBAL VARIABLES
var menuTimer;
var map = null;
var geocoder = null;
var urlAddress = "";
var xmlHttp;
var cssResponseID;
var displayType = "block";
var ss;
var arrPOBoxRE = new Array();
	arrPOBoxRE[0] = /<%=Application("POBoxExpressions")(0)%>/i;
	arrPOBoxRE[1] = /<%=Application("POBoxExpressions")(1)%>/i;
	arrPOBoxRE[2] = /<%=Application("POBoxExpressions")(2)%>/i;
	arrPOBoxRE[3] = /<%=Application("POBoxExpressions")(3)%>/i;
	arrPOBoxRE[4] = /<%=Application("POBoxExpressions")(4)%>/i;
	arrPOBoxRE[5] = /<%=Application("POBoxExpressions")(5)%>/i;
	arrPOBoxRE[6] = /<%=Application("POBoxExpressions")(6)%>/i;
	arrPOBoxRE[7] = /<%=Application("POBoxExpressions")(7)%>/i;
var arrProduct = new Array();
//JSCRIPT CLASS (sort of - no methods)
function theProduct(prodName, prodDesc, imgURL) {
	arrProduct[0] = prodName;
	arrProduct[1] = prodDesc;
	arrProduct[2] = imgURL;
	}
//Add Any site wide onload events to this function:
var arrHideSelects = new Array();
var slideTimer;
var tapeTimer;
var tapeReset;
var strOldHTML = ""; //this is a holder for menus that change after the item is clicked.
				//It keeps the old HTML so that when the menu
				//when the menu is destroyed, it can successfuly be reopened again
window.addEvent('load', function(){
	$$('a[rel="external"]').each(function(el){
		el.addEvent('click', function(event) {
			window.open(this.get('href'));
			event.stopPropagation();
			return false;
			});
		});
	$$('.validate-phone').addEvent('keyup',function(){$(this).value = this.value.formatPhone();});
	$$('.validate-ssn').addEvent('keyup',function(){$(this).value = this.value.formatSSN();});
	$$('.validate-ein').addEvent('keyup',function(){$(this).value = this.value.formatEIN();});
	$$("#co-brand div img").each(function(el){ scaleImage(el, 258, 50); });
	if ($("smallMap") && urlAddress) { initialize(); showAddress(urlAddress); }
	if (document.location.protocol == "https:") { $$("a").each(function(el) { el.href = el.href.replace("https:", "http:"); }); }
	if (Browser.firefox) { $$('input[type=button]').setStyles({'padding-top':'2px','padding-bottom':'2px'}); }
	});

function loader() {
	return;
	}

function couponMenu(parentID, strVisibility, e) {
	var cpnmen = $("cpnMenu");
	var curVis = cpnmen.style.visibility;
	if (curVis != strVisibility) cpnmen.style.visibility = strVisibility;
	else e = new Event(e).stopPropagation();
	}

function subCatMenu(parentID, strVisibility) {
	var submen = $(parentID).childNodes[2];
	if (submen) {
		var curVis = submen.style.visibility;
		if (curVis != strVisibility) {
			submen.lastChild.style.borderBottom = "none";
			submen.style.visibility = strVisibility;
			}
		else e = new Event(window.event).stopPropagation();
		}
	}

function fixBrokenImage(objImage, strType, maxWidth, maxHeight) {
	objImage.src = "/images/spacer.gif";
	if (maxHeight) objImage.style.height = maxHeight + "px";
	if (maxWidth) objImage.style.width = maxWidth + "px";
	if (strType == 'member') objImage.style.background = "url(/images/_memberimages/nomemberimage.jpg) no-repeat center center";
	else objImage.style.background = "url('/images/product_noimage.png') repeat center center";
	}

function scaleImage(objImage, maxWidth, maxHeight) {
	if (objImage) {
		if (objImage.naturalWidth) {
			var imgWidth = objImage.naturalWidth;
			var imgHeight = objImage.naturalHeight;
			}
		else {
			var imgWidth = objImage.offsetWidth;
			var imgHeight = objImage.offsetHeight;
			}
		if (imgWidth > maxWidth || imgHeight > maxHeight) {
			objImage.width = maxWidth;
			objImage.height = Math.round(imgHeight * (maxWidth / imgWidth));
			if (maxHeight - objImage.height < 0) {
				objImage.height = maxHeight
				objImage.width = Math.round(imgWidth * (maxHeight / imgHeight));
				}
			if (maxHeight - objImage.height > 2) objImage.vspace = objImage.vspace + Math.round((maxHeight - objImage.height) / 2);
			if (maxWidth - objImage.width > 2) objImage.hspace = objImage.hspace + Math.round((maxWidth - objImage.width) / 2);
			}
		}
	}

function fixRedX() {
	var arrImgs = $$("img");
	for (i = 0; i < arrImgs.length; i++) {
		if (arrImgs[i].parentNode.parentNode.className != "gmnoprint") {
			if (arrImgs[i].complete == false) {
				if (arrImgs[i].width != "" && arrImgs[i].height != "") {
					arrImgs[i].style.width = arrImgs[i].width + "px";
					arrImgs[i].style.height = arrImgs[i].height + "px";
					arrImgs[i].style.background = "url('/images/product_noimage.png') center center no-repeat";
					arrImgs[i].src = "/images/spacer.gif";
					}
				else arrImgs[i].src = "/images/product_noimage.png";
				}
			else {
				if (arrImgs[i].offsetWidth > 100 && arrImgs[i].className == "prodImage") { arrImgs[i].style.width = 100; }
				}
			}
		}
	}
function moveLeft() {
	currLeft = parseInt($("tape").style.left, 10);
	if (currLeft < tapeReset) currLeft = 240;
	$("tape").style.left = (currLeft - 3) + "px";
	}
function fixShadow(imgID, parentID) {
	parentHeight = $(parentID).offsetHeight;
	imageHeight = $(imgID).offsetHeight;
	$(imgID).style.top = (parentHeight - imageHeight) + "px";
	}
function formatNumber(num, dec, thou, pnt, curr1, curr2, n1, n2) {
	var x = Math.round(num * Math.pow(10, dec));
	if (x >= 0) n1 = n2 = "";
	var y = ("" + Math.abs(x)).split("");
	var z = y.length - dec;
	if (z < 0) z--;
	for (var i = z; i < 0; i++) y.unshift("0");
	y.splice(z, 0, pnt);
	if (y[0] == pnt) y.unshift("0");
	while (z > 3) {
		z -= 3;
		y.splice(z, 0, thou);
		}
	var r = curr1 + n1 + y.join('') + n2 + curr2;
	return r;
	}
function stateChanged() { 
	if (xmlHttp.readyState) {
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
			$(cssResponseID).innerHTML = xmlHttp.responseText;
			$(cssResponseID).style.display = displayType;
			xmlHttp = null;
			}
		}
	}
function getXmlHttpObject(handler) { 
	var objXMLHttp = null;
	try { objXMLHttp = new XMLHttpRequest() }
	catch(e) { objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP") }
	return objXMLHttp;
	}
function recordTraffic(lngVendorID, lngLocalLocationID, lngPromotionID, lngSiteLocation, lngTrafficType) {
	//qstring = "site=" + window.location.hostname;
	//qstring += "&pg=" + window.location.pathname + window.location.search;
	//qstring += "&vid=" + lngVendorID;
	//qstring += "&pid=" + lngPromotionID;
	//qstring += "&siteloc=" + lngSiteLocation;
	//qstring += "&traffic=" + lngTrafficType;
	//var xmlHttp = getXmlHttpObject();
	//xmlHttp.open("GET", "/_scripts/insertTraffic.asp?" + qstring, true);
	//xmlHttp.send(null);
	//xmlHttp = null;
	//Begin using Google Analytics for Event Tracking - run parallel for May 2011
	//once ensured that tracking is working as expected, disable above.
	switch (lngTrafficType) {
		case 350:
			strAction = "Click";
			break;
		case 357:
			strAction = "Print";
			break;
		case 353:
			strAction = "Regular Impression";
			break;
		case 352:
			strAction = "Search Impression";
			break;
		default:
			strAction = "View";
			break;
		}
	switch (lngSiteLocation) {
		case 355:
			strLocation = "Games In-Between Plays";
			break;
		case 356:
			strLocation = "Games Right Column";
			break;
		case 358:
			strLocation = "Homepage Deals and Coupons";
			break;
		case 247:
			strLocation = "Homepage Favorites Box";
			break;
		case 246:
			strLocation = "Homepage GBS Local";
			break;
		case 354:
			strLocation = "Homepage National";
			break;
		default:
			strLocation = "";
			break;
		}
	if (typeOf(_gaq) != 'null') {
		strLabel = '';
		if (lngVendorID) strLabel = 'Merchant('+lngVendorID+')';
		if (lngLocalLocationID != '') strLabel += ',Location('+lngLocalLocationID+')';
		if (lngPromotionID != '') strLabel += ',Promotion('+lngPromotionID+')';
		_gaq.push(['_trackEvent', strLocation, strAction, strLabel]);
		}
	}
function hideSaving() {
	new Fx.Elements($("saving"), {
		onComplete:function(){
			$("saving").setStyles({"visibility":"hidden"})
			}
		}).start({
			'0':{'opacity':[1,0]}
			});
	}
var geocoder, map;
function initialize() {
	geocoder = new google.maps.Geocoder();
	var latlng = new google.maps.LatLng(-34.397, 150.644);
	var myOptions = {
		zoom: 13,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		}
	map = new google.maps.Map($('smallMap'), myOptions);
	}
function showAddress(address) {
	geocoder.geocode({'address':address}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			map.setCenter(results[0].geometry.location);
			var marker = new google.maps.Marker({map: map, position: results[0].geometry.location});
			new google.maps.InfoWindow({content:address}).open(map, marker);
			}
		else {
			alert("Geocode was not successful for the following reason: " + status);
			}
		});
	}
function cleanString(strIn) {
	if (strIn == null) outString = "";
	else {
		outString = strIn.clean();
		outString = outString.replace("@@", "@");
		outString = outString.replace("&&", "&");
		outString = outString.replace("--", "-");
		outString = outString.replace("..", ".");
		outString = outString.replace(/cast\(/i, "");
		outString = outString.replace(/ declare /i, "");
		outString = outString.replace(/ exec /i, "");
		outString = outString.replace(/xp_/i, "");
		outString = outString.replace(/WAITFOR/i, "");
		outString = outString.replace(/SP_PASSWORD/i, "");
		outString = outString.replace("=", "");
		outString = outString.replace("[", "");
		outString = outString.replace("]", "");
		outString = outString.replace("{", "");
		outString = outString.replace("}", "");
		outString = outString.replace("|", "");
		outString = outString.replace("(", "");
		outString = outString.replace(")", "");
		outString = outString.replace("%", "");
		outString = outString.replace("$", "");
		outString = outString.replace("~", "");
		outString = outString.replace("+", "");
		outString = outString.replace("\"", "");
		outString = outString.replace("/", "");
		outString = outString.replace("?", "");
		outString = outString.replace("<", "");
		outString = outString.replace(">", "");
		outString = outString.replace("*", "");
		outString = outString.replace("#", "");
		outString = outString.replace("^", "");
		}
	return outString;
	}
function centerElement(elemID) {
	h = window.getSize().y;
	y = window.getScroll().y;
	var elem = $(elemID).getSize();
	$(elemID).setStyles({'top' : (h / 2) + y - (elem.y / 2), 'left' : (950 - elem.x) / 2});
	}
function restoreElement(boxID, elemID) {
	var elem = $(elemID);
	if (strOldHTML != "") {
		elem.innerHTML = strOldHTML;
		strOldHTML = "";
		}
	else {
		var box = $(boxID);
		elem.innerHTML = box.innerHTML;
		}
	if (arrHideSelects.length > 0 && navigator.appVersion.indexOf("MSIE 6") > -1) { for (sel = 0; sel < arrHideSelects.length; sel++) { arrHideSelects[sel].style.visibility = 'visible'; } }
	}
function destroyElement(elemID) {
	if ($(elemID)) {
		var elem = $(elemID);
		var par = elem.parentNode;
		par.removeChild(elem);
		}
	if (arrHideSelects.length > 0 && navigator.appVersion.indexOf("MSIE 6") > -1) { for (sel = 0; sel < arrHideSelects.length; sel++) { arrHideSelects[sel].style.visibility = 'visible'; } }
	}
function fitDisplayBox() {
	objDisplayBox = $("newBox");
	if (objDisplayBox.offsetWidth > parseInt(objDisplayBox.style.width)) objDisplayBox.style.width = objDisplayBox.offsetWidth + "px";
	if (objDisplayBox.offsetHeight > parseInt(objDisplayBox.style.height)) objDisplayBox.style.height = objDisplayBox.offsetHeight + "px";
	centerElement("newBox");
	}
function displayBox(strPage, intWidth, intHeight, bClose) {
	var strResponse = "";
	if ($("newBox")) {
		var nb = $("newBox");
		if (typeof(strPage) != "object") restoreElement("newBox", nb.className);
		if ($("closeButton")) destroyElement("closeButton");
		destroyElement("newBox");
		}
	if (typeof(strPage) == "object") {
		elemID = strPage.name;
		strResponse = strPage.HTML;
		bExternal = true;
		}
	else if (strPage == '#') {
		//create an empty element to be filled separately
		elemID = 'nothing'
		strResponse = '';
		bExternal = false;
		}
	else if (strPage.charAt(0) == '#') {
		//pull content from specified page element
		elemID = strPage.replace("#", "");
		sourceElement = $(elemID);
		strResponse = sourceElement.innerHTML.trim();
		sourceElement.innerHTML = "";
		bExternal = false;
		}
	else if (strPage.right(3) == 'jpg' || strPage.right(3) == 'gif' || strPage.right(3) == 'png') {
		//write img tag to display image
		elemID = "";
		strResponse = '<img src="' + strPage + '">';
		bExternal = true;
		}
	else {
		//grab content from specified page
		elemID = "";
		if (window.location.protocol == "https:") strPage = "https://" + window.location.hostname + strPage;
		var xmlHttp = getXmlHttpObject();
		xmlHttp.open("GET", strPage, false);
		xmlHttp.send(null);
		strResponse = xmlHttp.responseText;
		bExternal = true;
		}
	var box = new Element("div", {"id":"newBox","class":elemID,"styles":{"width":intWidth,"height":intHeight}});
	box.set('html', strResponse);
	$$("body").adopt(box);
	var blnCenter = false;
	if (bClose == null) {
		box.addEvent("mouseleave", function() {
			if (bExternal) menuTimer = setTimeout("destroyElement('" + box.id + "')", 50);
			else menuTimer = setTimeout("restoreElement('" + box.id + "', '" + box.className + "'); destroyElement('" + box.id + "')", 50);
			});
		}
	else {
		blnCenter = true;
		var cls = new Element("img", {"id":"clsButton", "name":elemID, "src":"/images/spacer.gif", "styles":{"position":"absolute", "z-index":101}})
		if (bClose == true) { cls.addClass("icon_close").setStyles({width:20,height:20}); }
		else { cls.addClass("icon_restore").setStyles({width:21,height:21}); }
		if (bExternal) cls.setStyles({top:21,right:21});
		else cls.setStyles({top:5,right:5});
		if (bExternal) {
			if (cls.outerHTML) box.set('html', cls.outerHTML + box.innerHTML);
			else cls.inject(box, 'bottom');
			var cls = $("clsButton");
			cls.addEvent("click", function(){
				this.dispose();
				$("newBox").dispose();
				});
			}
		else {
			cls.addEvent("click", function(){
				this.dispose();
				if (this.name != 'nothing') restoreElement("newBox", this.name);
				$("newBox").dispose();
				});
			cls.inject(box, 'bottom');
			}
		}
	if (blnCenter) centerElement("newBox");
	}
function popup(file, w, h) {
	if (!file) return;
	if (!w) w = 480;
	if (!h) h = 440;
	var t = (screen.height - h) / 2;
	var l = (screen.width - w) / 2;
	var options = "width=" + w + ",height=" + h + ",location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + l + ",screeny=" + t + ",left=" + l + ",top=" + t;
	var qm = file.indexOf("?");
	(qm == -1) ? qm = "?" : qm = "&";
	file = file + qm + "popup=true&pop=1";
	window.open(file, "greenbackstreet", options);
	}
function sendToMenu(strType, clickedOn) {
	var clickSource = $(clickedOn).getCoordinates();
	var intLeft = clickSource.left;
	var intTop = clickSource.top;
	var intHeight = clickSource.height;
	switch (strType) {
		case "store":
			storeID = clickedOn.replace("sendStoreTo", "");
			displayBox("#storeSendMenu", 270, 180, true);
			var newBox = $("newBox");
			break;
		case "broken":
			storeID = clickedOn.replace("sendStoreBroken", "");
			displayBox("#storeSendBrokenLinkMenu", 350, 180, true);
			var newBox = $("newBox");
			break;
		case "product":
			displayBox("#prodSendMenu", 270, 180, true);
			var newBox = $("newBox");
			strOldHTML = newBox.innerHTML;
			break;
		}
	newBox.style.height = newBox.scrollHeight + "px";
	centerElement("newBox");
	}
function addToMenu(strType, clickedOn) {
	var clickSource = $(clickedOn).getCoordinates();
	var intLeft = clickSource.left;
	var intTop = clickSource.top;
	var intHeight = clickSource.height;
	switch (strType) {
		case "fav":
			arrData = clickedOn.split("|");
			if (arrData[1] == "") {
				displayBox("#storeAddFavMenu", 150, 85, true);
				centerElement("newBox");
				}
			else {
				displayBox("#divAddFavConfirmation", 300, 100, null);
				centerElement("newBox");
				addFavorites(arrData[0]);
				}
			break;
		case "wm":
			storeID = clickedOn.replace("addStoreTo", "");
			displayBox("#storeAddWMMenu", 165, 110, null);
			var newBox = $("newBox");
			newBox.style.top = (intTop + intHeight) + "px";
			newBox.style.left = (intLeft + 25) + "px";
			$$("#newBox span.existingWM").each(function(sp){;
				sp.addEvent("click", function() {
					strOldHTML = this.parentNode.innerHTML;
					addToWikiMall(this.id, "store", storeID);
					});
				});
			var addToNew = $("storeAddToNewWikiMall2");
			if (addToNew != null) addToNew.href += "?store=" + storeID;
			break;
		case "store":
			storeID = clickedOn.replace("addStoreTo", "");
			displayBox("#storeAddMenu", 165, 110, null);
			var newBox = $("newBox");
			newBox.setStyles({'top':intTop + intHeight,'left':intLeft + 25});
			newBox.getFirst().addEvent("click", function() { strOldHTML = this.parentNode.innerHTML;addFavorites(storeID);});
			$$("#newBox span.existingWM").each(function(sp){;
				sp.addEvent("click", function() {
					strOldHTML = this.parentNode.innerHTML;
					addToWikiMall(this.id, "store", storeID);
					});
				});
			var addToNew = $("storeAddToNewWikiMall");
			if (addToNew != null) addToNew.href += "?store=" + storeID;
			break;
		case "product":
			//update product add to menu in case they just made one on this same page
			xmlHttp = getXmlHttpObject();
			xmlHttp.open("GET", strBase + "_scripts/buildAddToMenu.asp", false);
			xmlHttp.send(null);
			$("prodAddMenu").innerHTML = xmlHttp.responseText;
			displayBox("#prodAddMenu", 180, 150, null);
			var newBox = $("newBox");
			strOldHTML = newBox.innerHTML;
			newBox.style.top = (intTop + intHeight) + "px";
			newBox.style.left = (intLeft + 25) + "px";
			break;
		}
	if (newBox) newBox.setStyles({'height':newBox.getScrollSize().y,'width':newBox.getScrollSize().x});
	}
function addToWishList(wlid) {
	xmlHttp = getXmlHttpObject();
	displayType = "inline";
	cssResponseID = "newBox";
	xmlHttp.onreadystatechange = stateChanged;
	if (wlid == "new") {
		xmlHttp.open("POST", "/_scripts/addWL.asp", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send("action=add&wlname=" + escape($("wlName").value) + "&prod=" + escape(arrProduct.join('|')));
		}
	else {
		xmlHttp.open("POST", "/_scripts/addWLitem.asp", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send("action=add&wlid=" + wlid + "&prod=" + escape(arrProduct.join('|')));
		}
	}
function addToWikiMall(wmid, strType, obj) {
	xmlHttp = getXmlHttpObject();
	var d = new Date();
	displayType = "inline";
	cssResponseID = "newBox";
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
			if (!isNaN(xmlHttp.responseText)) $("newBox").innerHTML = "Added to wikiMALL&trade;.";
			else $("newBox").innerHTML = "Error adding to wikiMALL&trade;." + "<br>" + xmlHttp.responseText;
			}
		}
	if (strType == "store") {
		xmlHttp.open("POST", strBase + "_scripts/addWMstore.asp", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send("action=add&wmid=" + wmid.replace("wmid", "") + "&store=" + obj + "&" + d.getTime());
		}
	else {
		xmlHttp.open("POST", strBase + "_scripts/addWMitem.asp", true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send("action=add&wmid=" + wmid + "&prod=" + escape(obj.join('|')) + "&" + d.getTime());
		}
	}
function addFavorites(id) {
	xmlHttp = getXmlHttpObject();
	displayType = "inline";
	cssResponseID = "newBox";
	if (lngLocationID == null) lngLocationID = -1;
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("POST", strBase + "_scripts/myfavorites.asp", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send("action=add&vid=" + id + "&loc=" + lngLocationID + "&" + Math.random());
	}
function focusParentWindow() {var parentWindow = window.opener;parentWindow.focus();}
function checkZip(strField, strZip) {if (strZip != stripper(strZip)) $(strField).value = stripper(strZip);}
function checkPhone(strField, strPhone) {if (strPhone != formatPhone(strPhone)) $(strField).value = formatPhone(strPhone);}
function checkSSN(strField, strSSN) {if (strSSN != formatSSN(strSSN)) $(strField).value = formatSSN(strSSN);}
function checkEIN(strField, strEIN) {if (strEIN != formatEIN(strEIN)) $(strField).value = formatEIN(strEIN);}
function formatPhone(strNum) {
	strNum = stripper(strNum);
	arrNums = strNum.split("");
	strResult = "";
	for (i = 0; i < arrNums.length; i++) {
		if (i == 0) strResult += "(";
		if (i == 3) strResult += ") ";
		if (i == 6) strResult += "-";
		strResult += arrNums[i];
		}
	return strResult.toString().substr(0, 14);
	}
function formatSSN(strSSN) {
	ssnStr = stripper(strSSN);
	arrNums = ssnStr.split("");
	ssnResult = "";
	for (i = 0; i < arrNums.length; i++) {
		if (i == 3 || i == 5) ssnResult += "-";
		ssnResult += arrNums[i];
		}
	return ssnResult.toString();
	}
function formatEIN(strEIN) {
	var retVal = "";
	strEIN = stripper(strEIN);
	switch (strEIN.length) {
		case 2:
			retVal = strEIN + "-";
			break;
		case 9:
			retVal = strEIN.substr(0, 2) + "-" + strEIN.substr(2);
			break;
		default:
			retVal = strEIN;
			break;
		}
	return retVal;
	}
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,"");
	if (isNaN(num)) num = "0";
	cents = Math.floor((num * 100 + 0.5) % 100);
	num = Math.floor((num * 100 + 0.5) / 100).toString();
	if (cents < 10) cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) num = num.substring(0, num.length - (4 * i + 3)) + "," + num.substring(num.length - (4 * i + 3));
	return ("$" + num + "." + cents);
	}
function stripper(num) {
	str = num.toString().split("");
	for (i = 0; i < str.length; i++) {
		//str[i] = parseInt(str[i]);
		if (isNaN(str[i])) str[i] = "";
		}
	return str.join("");
	}
function unstripper(str) {
	str = str.toString();
	str = str.split("");
	for (i = 0; i < str.length; i++) {
		if (!isNaN(str[i])) str[i] = "";
		}
	return str.join("");
	}
function domainStripper(charString) {
	var validString = "_-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	var charArray = charString.split("");
	var strResult = "";
	for (i = 0; i < charArray.length; i++) if (validString.indexOf(charArray[i]) > -1) strResult += charArray[i];
	strResult = strResult.replace("--", "-");
	return strResult;
	}

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var Base64 = {
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
