<!--
var cropX, cropY, cropHeight, cropWidth;

function errortrap(msg,url,line){
	return true;
}
onerror=errortrap;

function warning(sMsg, sURL)
{
	var answer = window.confirm(sMsg);
	if (answer)
		changePage(sURL);
}

function warning(sMsg)
{
	if (window.confirm(sMsg)==true)
		return true;
	else
		return false;
}

function warning(sMsg, sURL, trueOrFalse)
{
	var answer = window.confirm(sMsg);
	changePage(sURL);
}

function MM_findObj(n, d) { //v4.01
	if (!n) return;
  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];}
}

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_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 signIn()
{
	var win = window;
	if (window.opener)
		{
			win = window.opener;
			window.close();
		}
	if (win)
		win.changePage('login-retail.aspx?ReturnURL=editor.aspx');
}

function increaseValue(txt)
{
	var elm = getElement(txt);
	if (elm && elm.value && !elm.disabled)
		{
			var o = parseFloat(elm.value);
			elm.value = o + .125;
		}
}

function activateFlash(objectTag)
{
	var elm = getElement(objectTag);
	if (elm && elm.outerHTML)
		{
			elm.outerHTML = elm.outerHTML;
		}
	}

function decreaseValue(txt)
{
	var elm = getElement(txt);
	if (elm && elm.value && !elm.disabled)
		{
			var o = parseFloat(elm.value);
			elm.value = o - .125;
		}
}

function goBack()
{
	if (history)
		history.go(-1);
}

function disableBack()
{
	if (history)
		history.go(1);
}

function changePage(URL)
{
	location.href=URL;
}

var oTextbox = null;
function addSpecial(Character)
{
	if (window.opener && window.opener.document && oTextbox)
		{
			var elm = MM_findObj(oTextbox, window.opener.document);
			if (elm) elm.value = elm.value + Character;
		}	
	window.close();
}

function addSC(Character)
{
	if (oTextbox)
		{
			var elm = MM_findObj(oTextbox);
			if (elm) elm.value = elm.value + Character;
		}	
	
}

function setCurrentTextbox(ToThis)
{
	oTextbox = ToThis;
}

function openPopup(URL)
{
	var WWidth=500;
	var WHeight=500;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	PDFwin=window.open(URL,"PDFProof","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	//if (PDFwin) PDFwin.focus();	
}

function openBrowsePopup(OverlayID, ComboBoxControl, Template)
{
	var WWidth=700;
	var WHeight=650;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Bwin=window.open("browse.aspx?OID=" + OverlayID + "&CB=" + ComboBoxControl + "&TID=" + Template,"Browse","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Bwin) Bwin.focus();	
}

function openBrowse2Popup(ItemID, ComboBoxControl, ShowType, UniqueTemplateID)
{
	var WWidth=700;
	var WHeight=650;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Bwin=window.open("browse2.aspx?IID=" + ItemID + "&CB=" + ComboBoxControl + "&ST=" + ShowType + "&TID=" + UniqueTemplateID,"Browse","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Bwin) Bwin.focus();	
}

function openChoicePopup(TID, BID)
{
	var WWidth=700;
	var WHeight=600;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Bwin=window.open("browsetemplate.aspx?TID=" + TID + "&BID=" + BID,"Browse","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Bwin) Bwin.focus();	
}


function openImagePopup(IMG, oHeight, oWidth)
{
	if (IMG == '') return;
	var WWidth = oWidth + 100;
	var WHeight = oHeight + 75;
	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=1,scrollbars=1,menubar=0,dependent=1");					
	if (IMGwin) IMGwin.focus();	
}

function closePopup(OID, SV, SB)
{
	if (window.opener && window.opener.document && window.opener.document.frmEditor)
		{
			openWaitWindow(true);
						
			if (SB)	
				window.opener.document.frmEditor.submit();
			
			window.opener.setComboValue(OID,SV);
			window.opener.document.frmEditor.submit();			
		}
	
	window.close();
}

function openFlashImageLibrary()
{
	var WWidth=700;
	var WHeight=650;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Fwin=window.open("browse2.aspx?flash=1","Browse","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Fwin) Fwin.focus();	
}

function openFlashBackTemplates(TGID)
{
	var WWidth=725;
	var WHeight=650;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Gwin=window.open("browseback.aspx?flash=1&TGID=" + TGID,"Browse","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Gwin) Gwin.focus();	
}

function closeFlashPopup(IID)
{
	if (window.opener)
		{
			window.opener.closeFlashImageLibrary(IID);			
		}	
	window.close();
}

function closeFlashPopupBack(BID)
{
	if (window.opener)
		{
			window.opener.closeFlashBackLibrary(BID);			
		}	
	window.close();
}

function openContactsPopup()
{
	var WWidth=700;
	var WHeight=600;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;	

	cwin=window.open("mycontacts.aspx?f=e","contacts","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (cwin) cwin.focus();	
}

function openContactDetailsPopup(qs)
{
	if (qs == '') return;
	var WWidth=600;
	var WHeight=600;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;	

	cwin=window.open("mycontactdetails.aspx?f=editor&" + qs,"contacts","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (cwin) cwin.focus();	
}

function closeContactsPopup()
{
	if (window.opener && window.opener.document && window.opener.document.frmEditor)
		{
			window.opener.document.frmEditor.submit();			
		}
	
	window.close();
}

function closeChoicePopup(TID, BID)
{
	if (window.opener)
		{
			openWaitWindow(true);
			if (BID == 0)
				window.opener.location.href="editor.aspx?ID=" + TID;
			else
				window.opener.location.href="editor.aspx?BID=" + TID;			
		}	
	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 hiLiteBtn(elm)
{		
	if (elm && elm.className && elm.className.substring(0,3) == 'btn')
		{
			if (elm.className.substring(elm.className.length - 6) != '_focus')
				elm.className = elm.className + '_focus';			
		}
}

function blurBtn(elm)
{	
	if (elm && elm.className && elm.className.substring(0,3) == 'btn')
		{	
			if (elm.className.length > 6 && elm.className.substring(elm.className.length - 6) == '_focus')
					elm.className = elm.className.substring(0,elm.className.length - 6);								
		}
}


function textFocus(textbox)
{
	if (textbox && textbox.className)
		{					
			textbox.className = 'textbox_focus';
			hiLite(textbox.id);						
		}
	
}

function textBlur(textbox)
{
	if (textbox && textbox.className)
			textbox.className = 'textbox';
}

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='';
}

function changeValue(ID, toWhat)
{
	var elm = getElement(ID);
	if (elm)
		elm.value=toWhat;
}

function clearCombo(elm)
{
	if (elm)
		elm.selectedIndex=0;
}


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;
}

/* 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)
{
	return MM_findObj(ID)
}

function editContact(id)
{
	changePage('mycontactdetails.aspx?ID=' + id);
}

function confirmExcel()
{
	var answer = window.confirm('This item is setup to allow a spreadsheet upload and you have not uploaded any spreadsheet.  If you wish to continue to add this item to the cart without a spreadsheet click "Ok".  If you wish to go back and add a XLS file click "Cancel".');
	if (answer)
		return true;
	else
		return false;
}

function deleteQuoteImage(img)
{
	var answer = window.confirm('Are you sure you want to delete this image?');
	if (answer)
		changePage('myquoteedit.aspx?delete=' + img);
}

function deleteID(sMsg, sID, sPage)
{
	var answer = window.confirm(sMsg);
	if (answer)
		changePage(sPage + '?delete=' + sID);
}

function deleteSavedTemplate(SID)
{
	var answer = window.confirm('Are you sure you want to delete this saved template?');
	if (answer)
		changePage('myportfolio.aspx?delete=' + SID);
}
function deleteTempCartItem(TID)
{
	var answer = window.confirm('Are you sure you want to delete this from your cart?');
	if (answer)
		changePage('viewcart.aspx?delete=' + TID);
}
function showReceipt(orderID, sType)
{	
	oWindow=window.open("Receipt.aspx?ID=" + orderID + "&RT=" + sType,"Receipt","resizable=1,menubar=0,dependent=1");					
	if (oWindow) oWindow.focus();	
}
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();	
}
function confirmCharge()
{
	if (confirm("Are you sure you want to charge this credit card?")==true)
		return true;
	else
		return false;
}
function confirmMessage(msg)
{
	if (confirm(msg)==true)
		return true;
	else
		return false;
}
function hide(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "hidden";		
	else if (elm && elm.style)
		elm.style.visibility = "hidden";	
}
function show(E)
{
	var elm = getElement(E);
	if (elm && elm.visibility)
		elm.visibility = "visible";		
	else if (elm && elm.style)
		elm.style.visibility = "visible";	
}

function openUploadPopup(ItemID, ComboBoxControl)
{
	var WWidth=700;
	var WHeight=650;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Bwin=window.open("upload.aspx?IID=" + ItemID + "&CB=" + ComboBoxControl ,"Upload","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Bwin) Bwin.focus();	
}

function openCropWindow(ItemID, ImageURL, ImageHeight, ImageWidth)
{
	var WWidth=700;
	var WHeight=600;
	var centerx=(screen.width-WWidth)/2; 
	var centery=(screen.height-WHeight)/2;
			
	Bwin=window.open("crop.aspx?ItemID=" + ItemID + "&ImageURL=" + ImageURL + "&ImageHeight=" + ImageHeight  + "&ImageWidth=" + ImageWidth  + "&CropX=" + cropX + "&CropY=" + cropY + "&CropHeight=" + cropHeight + "&CropWidth=" + cropWidth,"Crop","height=" + WHeight + ",innerHeight=" + WHeight + ",width=" + WWidth + ",innerwidth=" + WWidth + ",top=" + centery + ",left=" + centerx + ",resizable=1,scrollbars=1,menubar=0,dependent=1");					
	if (Bwin) Bwin.focus();	
}

function windowFocus()
{
	try { window.focus(); } catch(e) {}; 		
}

function askToSave(LayoutName, Question)
{
	var sName;
	sName = window.prompt(Question, LayoutName)
	if (sName!='' && sName != null)
		location.href="editor_new.aspx?LayoutName=" + sName + "&Saved=true";
}

//-->