<!--
var fontImages = new Array();
var cardImages1 = new Array();
var cardImages2 = new Array();

function preloadFontImages(){
	for (i=0;i<fontList.length;i++){
		fontImages[i]=new Image()
		if (fontList[i]!='')
			fontImages[i].src=fontList[i];
	}
}
function preloadImages1(){	
	for (i=0;i<cardList1.length;i++){
		cardImages1[i]=new Image()		
		if (cardList1[i]!='')
			{
				cardImages1[i].src=cardList1[i];
			}
	}
}
function preloadImages2(){
	for (i=0;i<cardList2.length;i++){
		cardImages2[i]=new Image()
		if (cardList2[i]!='')
			{
				cardImages2[i].src=cardList2[i];
			}
	}
}
function hide(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "hidden";		
	else if (elm && elm.style)
		elm.style.visibility = "hidden";	
		
	
	if (elm && elm.style)
	    elm.style.display='none';
}
function show(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "visible";		
	else if (elm && elm.style)	    
		elm.style.visibility = "visible";	
		
	if (elm && elm.style)
	    elm.style.display='';
		
		
}

function setTextbox(ID, sText)
{
	var elm = getElement(ID);
	if (elm)
		{
			elm.value = sText;	
			hiLite(ID);
		}
}

function goBack()
{
	if (history)
		history.go(-1);
}

function changePage(URL)
{
	location.href=URL;
}

function openUpload(sParams, isDialog)
{
	var WWidth=440;
	var WHeight=280;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
	var url = 'upload.aspx?n='+sParams
	var dlgVal = "0";
	if (isDialog != undefined && null != isDialog)
	{
	    // Only 
	    dlgVal = (isDialog == false) ? "1" : "0";
	}
			
	oUpload=window.open(url,"ImageUpload","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable="+dlgVal+",scrollbars="+dlgVal+",menubar="+dlgVal+",dependent=1");					
	if (oUpload) {
	    oUpload.focus();	
	} else {
	    alert('Popup was blocked.  You must allow pop-ups for this site to upload images.');
	}
}

function closeUpload(fKeepOpen)
{
	if (window.opener)
        window.opener.document.frmProducts.submit();
	if (!fKeepOpen)
	{
	    window.close();
	}
}

function changeFontImage(FontCombo)
{	
	if (FontCombo)
	{
	    var img = getElement(FontCombo.id + 'Image');
	    var i = FontCombo.selectedIndex + 1;	
	    img.src = fontImages[i].src;
	}
}
function changeCardImage1(CardCombo)
{	
	if (CardCombo)
	{
	    var img = getElement(CardCombo.id + 'Image');
	    var i = CardCombo.selectedIndex;	
	    img.src = cardImages1[i].src;	
	}
}
function changeCardImage2(CardCombo)
{	
	if (CardCombo)
	{
	    var img = getElement(CardCombo.id + 'Image');
	    var i = CardCombo.selectedIndex;	
	    img.src = cardImages2[i].src;	
	}
}
function printWindow()
{
	window.print();
}

function showPage(url)
{
	location.href=url;
}

function openZipCode()
{
	var WWidth=500;
	var WHeight=250;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	zipWindow=window.open("ZipCode.aspx","ZipCode","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizeable=0,scrollbars=0,menubar=0,dependent=1");					
	if (zipWindow) zipWindow.focus();	
}

function openPopup(url)
{
	var WWidth=500;
	var WHeight=500;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	oWindow=window.open(url,"Popup","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizeable=0,scrollbars=1,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}

function showAdminReceipt(orderID, sType)
{
	oWindow=window.open("AdminReceipt.aspx?ID=" + orderID + "&RT=" + sType,"AdminReport");					
	if (oWindow) oWindow.focus();	
}

function showReceipt(orderID, sType)
{
	oWindow=window.open("Receipt.aspx?ID=" + orderID + "&RT=" + sType,"Receipt");					
	if (oWindow) oWindow.focus();	
}
function openPictureBox(ID)
{
	var WWidth=500;
	var WHeight=500;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	oWindow=window.open("picturebox.aspx?ID=" + ID,"Picture","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizeable=0,scrollbars=0,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}

function openHelpPopup(sPage)
{
	var WWidth=500;
	var WHeight=250;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	oWindow=window.open('help/' + sPage,"Popup","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizeable=0,scrollbars=0,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}

function closeZipCode()
{
	var elm = getElement('txtZipcode')
	
	if (elm)
		setCookie ('SKIPS_ZIPCODE', elm.value, 8760) ;
				
	if (window.opener && window.opener.document)
		window.opener.document.frmDefault.submit();
	
	window.close();
}

/* This will set focus to any element */
function setFocus(ID)
{
	var elm = getElement(ID);
	if (elm && !elm.disabled)
		elm.focus();
}

var currentField = "";
var startupFocusField = "";

/* This will hi-lite any element */
function hiLite(ID)
{
	var elm = getElement(ID);
	if (elm)
		{
			currentField = ID;
//			if (elm.select)
//				elm.select();
		}
}

/* This will hi-lite any element */
function clearValue(elm)
{
	if (elm)
		elm.value='';
}

/* This will submit any form */
function submitForm(ID)
{
	var elm = getElement(ID);
	if (elm)
		elm.submit();
}


/* This is called in the body onload event to set inital focus */
function initialFocus(ID)
{
	setTimeout("setFocus('" + ID + "')",1);
}

/* This returns the element for an ID passed */
function getElement(ID)
{
	if (ID=='')
		return null;
		
	if (document.images && document.images[ID])
	{	
		return document.images[ID];
	}
	else if (document.getElementById)
	{
		return document.getElementById(ID);
	}
	else if (document.all)
	{	
		return document.all[ID];
	}
	else if (document.layers)
	{	
		if (document.layers[ID])
			return document.layers[ID];
		else if (document.forms[0])
			return eval("document.forms[0]." + ID);		
	}
	else
	{	
		return null;
	}
}

function textFocus(textbox, originalClass)
{
	if (textbox && textbox.className)
		{			
			
			textbox.className = originalClass + 'FOCUS';
			hiLite(textbox.id);						
		}
	
}

function textBlur(textbox, originalClass)
{
	if (textbox && textbox.className)
			textbox.className = originalClass;
}
function hiLiteBtn(elm)
{	
	if (elm && elm.className)
		{
			elm.className = 'submit_focus'
		}
}

function blurBtn(elm)
{	
	if (elm && elm.className)
		{			
			elm.className = 'submit'
		}
}
function getValue(combo)
{
	var sText = "";
				
	if ((combo) && (combo.options) && (combo.selectedIndex>-1))
		sText = combo.options[combo.selectedIndex].text.toString().replace(/\$|\,/g,'');
	
	var value = 0;
	var pos1 =  sText.indexOf("[") + 1;		
    var pos2 = (sText.indexOf("]"));
    
    if (pos1>0)
		{
			value = sText.substring(pos1, pos2);	
			if (isNaN(value))			    
				value = 0;			
		}
	
	return parseFloat(value);
}

function formatMoney(num, addSign) { 
	var sign, cents; 
	num = num.toString().replace(/\$|\,/g,''); 
	if(isNaN(num)) 
		num = "0"; 
	sign = (num == (num = Math.abs(num))); 
	num = Math.floor(num*100+0.50000000001); 
	cents = num%100; 
	num = Math.floor(num/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)); 

	if (addSign)
		return (((sign)?'+':'-') + ' $' + num + '.' + cents); 
	else
		return (((sign)?'':'-') + ' $' + num + '.' + cents); 
}

var sTotalLabel=''; 
var sShippingLabel=''; 
var sOptionLabel=''; 
var sDiscountLabel=''; 

function adjustTotals()
{
		if (sTotalLabel=='') return;
			
		var theform;
		var sID = '';
		var total=0;
		var shipping=0;
		var totalPrice;
		var shippingPrice;
		var optionPrice;
		var discountPrice;
		
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			theform = document.forms["frmDefault"];
		}
		else {
			theform = document.frmDefault;
		}
		
		if (theform && theform.elements)
		{
			for (var i=0; i<=theform.length-1; ++i)
			{
				sID = theform.elements[i].id
				if (sID && sID.toLowerCase().indexOf("cbooption") > -1)
				{					
					total = total + getValue(theform.elements[i]);					
				}	
				else if	(sID && sID.toLowerCase().indexOf("cboshipping") > -1)
				{					
					shipping = getValue(theform.elements[i]);										
				}
			}
		}
		
		if (sShippingLabel!='')
			shippingPrice = getElement(sShippingLabel);
		if (sTotalLabel!='')
			totalPrice = getElement(sTotalLabel);
		if (sOptionLabel!='')
			optionPrice = getElement(sOptionLabel);
		if (sDiscountLabel!='')		
			discountPrice = getElement(sDiscountLabel);
				
		if (optionPrice)	
			optionPrice.innerHTML = formatMoney(total, true);
		
		if (shippingPrice)				
			shippingPrice.innerHTML = formatMoney(shipping, true);
				
		if (discountPrice)
			discountPrice.innerHTML = formatMoney(discount, true);
				
		total = total + basePrice + discount + shipping;
		
		if (totalPrice)
			totalPrice.innerHTML = formatMoney(total, false);		
			
			
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var acceptsCookies = false;
if(document.cookie == '') 
	{
    	document.cookie = 'acceptsCookies=yes'; 
    	if(document.cookie.indexOf('acceptsCookies=yes') != -1) 
		acceptsCookies = true; 
	} 
	else 
  		acceptsCookies = true;
  		

function setCookie (name, value, hours, path, domain, secure) 
	{
    		if (acceptsCookies) 
			{ 
	    			if ( (typeof(hours) == 'string') && Date.parse(hours) ) 
					var numHours = hours;
	     			else 
					if (typeof(hours) == 'number') 
						var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();	    		
				document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); 
    		}
	}

/*function preloadFontImages(){
	for (i=0;i<fontList.length;i++){
		fontImages[i]=new Image()
		fontImages[i].src="fonts/images/" + fontList[i];
	}
}*/

function changeOptionImage(Combo, ID)
{	
	var img = getElement('imgOption' + ID);
	var i = Combo.selectedIndex;	
	var s = eval("OptionImages" + ID + "[" + i + "].src");
	img.src = s;
}

function setComboValue(ID, setValue)
{
	var elm = getElement(ID);
	if (elm && elm.options) {
		for (var i=0; i<elm.options.length; i++) {
			if (elm.options[i].value == setValue) {
				elm.options[i].selected = true;
				break;
	        }
	    }
	}
}

function showImage(ID)
{	
	var img = getElement('imgOption' + ID);
	var i = 0;	
	var s = eval("OptionImages" + ID + "[" + i + "].src");
	img.src = s;
}

function openImagePopup(IMG, H, W)
{
	var WWidth=W + 100;
	if (WWidth > 425)
		WWidth = 425;
	var WHeight=H + 75;
	if (WHeight > 425)
		WHeight = 425;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	IMGwin=window.open("imagepreview.aspx?ID=" + IMG,"IMGView","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=0,scrollbars=0,menubar=0,dependent=1");					
	if (IMGwin) IMGwin.focus();	
}

function openImagePopupDetail(IMG, H, W)
{
	var WWidth=W + 100;
	if (WWidth > 800)
		WWidth = 800;
	var WHeight=H + 75;
	if (WHeight > 600)
		WHeight = 600;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	IMGwin=window.open("imagepreview.aspx?PIC=" + IMG,"IMGView","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (IMGwin) IMGwin.focus();	
}

function deleteImage(img)
{
	var answer = window.confirm('Are you sure you want to delete the image ' + img + '?');
	if (answer)
		location.href='myimages.aspx?delete=' + img;
}

function showReport(startDate, endDate, sType)
{	
	oWindow=window.open("Receipt.aspx?SD=" + startDate + "&ED=" + endDate + "&RT=" + sType,"","resizable=1,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}


//-->
