<!--
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 selectedTab = 'standard';

function swapOn(theImage) {
	theImage.src="/images/" + theImage.src.substring(theImage.src.lastIndexOf('/')+1,theImage.src.length-4) + "_on.gif";
}
function swapOff(theImage) {
	theImage.src="/images/" + theImage.src.substring(theImage.src.lastIndexOf('/')+1,theImage.src.length-7) + ".gif";
}

function swapTab(tab) {
	if(tab == 'blank' && selectedTab != 'blank') {
        document.getElementById('tabBlank').style.backgroundColor = "#ffffff";
	}
	if(tab == 'custom' && selectedTab != 'custom') {
        document.getElementById('tabCustom').style.backgroundColor = "#ffffff";
	}
	if(tab == 'standard' && selectedTab != 'standard') {
        document.getElementById('tabStandard').style.backgroundColor = "#ffffff";
	}
	
}

function swapTabMO(tab) {
	if(tab == 'blank' && selectedTab != 'blank') {
        document.getElementById('tabBlank').style.backgroundColor = "#f7f7f7";
		}
	if(tab == 'custom' && selectedTab != 'custom') {
        document.getElementById('tabCustom').style.backgroundColor = "#f7f7f7";
		}
	if(tab == 'standard' && selectedTab != 'standard') {
        document.getElementById('tabStandard').style.backgroundColor = "#f7f7f7";
		}
	
}


function displayCustomVerseFields(theSelect) {
	if(theSelect[theSelect.selectedIndex].value == 'custom')
		document.getElementById("formCustom").style.display = "block";
	else
		document.getElementById("formCustom").style.display = "none";
}
function switchTab(tab) {
	if(tab == 'standard') {
		try{
		document.getElementById('formCustom').style.display = "none";
		document.getElementById('formBlank').style.display = "none";
		document.getElementById('formStandard').style.display = "block";
        
        document.getElementById('hrefStandard').style.color = "#184B65";
        document.getElementById('hrefStandard').style.fontWeight = "bolder";
        document.getElementById('hrefStandard').style.textDecoration = "none";
        
        document.getElementById('hrefCustom').style.color = "#C9A86D";
        document.getElementById('hrefCustom').style.fontWeight = "normal";
        document.getElementById('hrefCustom').style.textDecoration = "none";
        
        document.getElementById('hrefBlank').style.color = "#C9A86D";
        document.getElementById('hrefBlank').style.fontWeight = "normal";
        document.getElementById('hrefBlank').style.textDecoration = "none";
        
        document.getElementById('tabStandard').style.top = "1px";
        document.getElementById('tabCustom').style.top = "0px";
        document.getElementById('tabBlank').style.top = "0px";

        document.getElementById('formStandard').style.top = "-1px";
        document.getElementById('formCustom').style.top = "0px";
        document.getElementById('formBlank').style.top = "0px";

		document.getElementById('tabStandard').style.backgroundColor = "#ffffff";
        document.getElementById('tabStandard').style.borderLeft ="solid #cccccc";
        document.getElementById('tabStandard').style.borderRight ="solid #cccccc";
        document.getElementById('tabStandard').style.borderTop ="solid #cccccc";
        document.getElementById('tabStandard').style.borderBottom ="solid #ffffff";
        document.getElementById('tabStandard').style.borderWidth ="1px";
        
		document.getElementById('tabCustom').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabCustom').style.borderLeft ="solid #f7f7f7";
        document.getElementById('tabCustom').style.borderRight ="solid #cccccc";
        document.getElementById('tabCustom').style.borderTop ="solid #f7f7f7";
        document.getElementById('tabCustom').style.borderBottom ="solid #cccccc";
        document.getElementById('tabCustom').style.borderWidth ="1px";
        
		document.getElementById('tabBlank').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabBlank').style.borderLeft ="1px solid #f7f7f7";
        document.getElementById('tabBlank').style.borderRight ="0px solid #f7f7f7";
        document.getElementById('tabBlank').style.borderTop ="1px solid #f7f7f7";
        document.getElementById('tabBlank').style.borderBottom ="1px solid #cccccc";
        }
        catch(Error){}
        
		selectedTab = 'standard';

		// enable all s2s elements
		document.getElementById('s2b_1verse').disabled = false;

		// disable all s2c elements
		
		try
		{
			document.getElementById('s2c_1font').disabled = true;
		}
		catch(Error)
		{
			document.getElementById('s2c_1fontSt').disabled = true;	
		}
		document.getElementById('s2c_2verse1').disabled = true;
		document.getElementById('s2c_3verse2').disabled = true;
		document.getElementById('s2c_4verse3').disabled = true;
		document.getElementById('s2c_5verse4').disabled = true;
		document.getElementById('s2c_6verse5').disabled = true;
	} else if(tab == 'custom') {
		document.getElementById('formStandard').style.display = "none";
		document.getElementById('formBlank').style.display = "none";
		document.getElementById('formCustom').style.display = "block";
        
        document.getElementById('hrefCustom').style.color = "#184B65";
        document.getElementById('hrefCustom').style.fontWeight = "bolder";
        document.getElementById('hrefCustom').style.textDecoration = "none";
        
        document.getElementById('hrefStandard').style.color = "#C9A86D";
        document.getElementById('hrefStandard').style.fontWeight = "normal";
        document.getElementById('hrefStandard').style.textDecoration = "none";
        
        document.getElementById('hrefBlank').style.color = "#C9A86D";
        document.getElementById('hrefBlank').style.fontWeight = "normal";
        document.getElementById('hrefBlank').style.textDecoration = "none";
        
        document.getElementById('tabStandard').style.top = "0px";
        document.getElementById('tabCustom').style.top = "1px";
        document.getElementById('tabBlank').style.top = "0px";
        
        document.getElementById('formStandard').style.top = "0px";
        document.getElementById('formCustom').style.top = "-1px";
        document.getElementById('formBlank').style.top = "0px";
        
		document.getElementById('tabCustom').style.backgroundColor = "#ffffff";
        document.getElementById('tabCustom').style.borderLeft ="solid #cccccc";
        document.getElementById('tabCustom').style.borderRight ="solid #cccccc";
        document.getElementById('tabCustom').style.borderTop ="solid #cccccc";
        document.getElementById('tabCustom').style.borderBottom ="solid #ffffff";
        document.getElementById('tabCustom').style.borderWidth ="1px";
        
		document.getElementById('tabStandard').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabStandard').style.borderLeft ="1px solid #f7f7f7";
        document.getElementById('tabStandard').style.borderRight ="0px solid #f7f7f7";
        document.getElementById('tabStandard').style.borderTop ="1px solid #f7f7f7";
        document.getElementById('tabStandard').style.borderBottom ="1px solid #cccccc";
                
		document.getElementById('tabBlank').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabBlank').style.borderLeft ="solid #f7f7f7";
        document.getElementById('tabBlank').style.borderRight ="solid #f7f7f7";
        document.getElementById('tabBlank').style.borderTop ="solid #f7f7f7";
        document.getElementById('tabBlank').style.borderBottom ="solid #cccccc";
        document.getElementById('tabBlank').style.borderWidth ="1px";
        
		selectedTab = 'custom';

		// disable all s2s elements
		document.getElementById('s2b_1verse').disabled = true;

		// enable all s2c elements
		try
		{
			document.getElementById('s2c_1font').disabled = false;
		}
		catch(Error)
		{
			document.getElementById('s2c_1fontSt').disabled = false;
		}
		document.getElementById('s2c_2verse1').disabled = false;
		document.getElementById('s2c_3verse2').disabled = false;
		document.getElementById('s2c_4verse3').disabled = false;
		document.getElementById('s2c_5verse4').disabled = false;
		document.getElementById('s2c_6verse5').disabled = false;
	} else if(tab == 'blank') {
		document.getElementById('formStandard').style.display = "none";
		document.getElementById('formCustom').style.display = "none";
		document.getElementById('formBlank').style.display = "block";
        
        document.getElementById('hrefBlank').style.color = "#184B65";
        document.getElementById('hrefBlank').style.fontWeight = "bolder";
        document.getElementById('hrefBlank').style.textDecoration = "none";
        
        document.getElementById('hrefStandard').style.color = "#C9A86D";
        document.getElementById('hrefStandard').style.fontWeight = "normal";
        document.getElementById('hrefStandard').style.textDecoration = "none";
        
        document.getElementById('hrefCustom').style.color = "#C9A86D";
        document.getElementById('hrefCustom').style.fontWeight = "normal";
        document.getElementById('hrefCustom').style.textDecoration = "none";
        
        document.getElementById('tabStandard').style.top = "0px";
        document.getElementById('tabCustom').style.top = "0px";
        document.getElementById('tabBlank').style.top = "1px";
        
        document.getElementById('formStandard').style.top = "0px";
        document.getElementById('formCustom').style.top = "0px";
        document.getElementById('formBlank').style.top = "-1px";
        
		document.getElementById('tabBlank').style.backgroundColor = "#ffffff";
        document.getElementById('tabBlank').style.borderLeft ="solid #cccccc";
        document.getElementById('tabBlank').style.borderRight ="solid #cccccc";
        document.getElementById('tabBlank').style.borderTop ="solid #cccccc";
        document.getElementById('tabBlank').style.borderBottom ="solid #ffffff";
        document.getElementById('tabBlank').style.borderWidth ="1px";
        
		document.getElementById('tabStandard').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabStandard').style.borderLeft ="solid #f7f7f7";
        document.getElementById('tabStandard').style.borderRight ="solid #cccccc";
        document.getElementById('tabStandard').style.borderTop ="solid #f7f7f7";
        document.getElementById('tabStandard').style.borderBottom ="solid #cccccc";
        document.getElementById('tabStandard').style.borderWidth ="1px";
        
		document.getElementById('tabCustom').style.backgroundColor = "#f7f7f7";
        document.getElementById('tabCustom').style.borderLeft ="1px solid #f7f7f7";
        document.getElementById('tabCustom').style.borderRight ="0px solid #f7f7f7";
        document.getElementById('tabCustom').style.borderTop ="1px solid #f7f7f7";
        document.getElementById('tabCustom').style.borderBottom ="1px solid #cccccc";

		selectedTab = 'blank';

		// disable all s2s elements
		document.getElementById('s2b_1verse').disabled = true;

		// disable all s2c elements
		try
		{
			document.getElementById('s2c_1font').disabled = true;
		}
		catch(Error)
		{		
			document.getElementById('s2c_1fontSt').disabled = true;
		}
		document.getElementById('s2c_2verse1').disabled = true;
		document.getElementById('s2c_3verse2').disabled = true;
		document.getElementById('s2c_4verse3').disabled = true;
		document.getElementById('s2c_5verse4').disabled = true;
		document.getElementById('s2c_6verse5').disabled = true;
	}
}

function checkReturnAddressFields(theCheckbox) {
	document.getElementById('s3_3returncolor').disabled = !theCheckbox.checked;
	document.getElementById('s3_4return1').disabled = !theCheckbox.checked;
	document.getElementById('s3_5return2').disabled = !theCheckbox.checked;
	document.getElementById('s3_6return3').disabled = !theCheckbox.checked;
	document.getElementById('s3_7return4').disabled = !theCheckbox.checked;
	if (!theCheckbox.checked) {
		document.getElementById('s3_4return1').value = '';
		document.getElementById('s3_5return2').value = '';
		document.getElementById('s3_6return3').value = '';
		document.getElementById('s3_7return4').value = '';
		//prevRetAddr();
	}


}

function checkCustomClosingFields(theCheckbox) {
	try
	{
		document.getElementById('s2_2font').disabled = !theCheckbox.checked;
	}
	catch(Error)
	{
		document.getElementById('s2_2fontSt').disabled = !theCheckbox.checked;
	}
	document.getElementById('s2_3closing1').disabled = !theCheckbox.checked;
	document.getElementById('s2_4closing2').disabled = !theCheckbox.checked;
	document.getElementById('s2_5closing3').disabled = !theCheckbox.checked;
	document.getElementById('s2_6closing4').disabled = !theCheckbox.checked;
	if (!theCheckbox.checked) {
		document.getElementById('s2_3closing1').value = '';
		document.getElementById('s2_4closing2').value = '';
		document.getElementById('s2_5closing3').value = '';
		document.getElementById('s2_6closing4').value = '';
		//previewCard(document.getElementById('orientation').value);
	}
}

function copyShipping() {
  if (document.frmOINF.copyshipping.checked) {
    document.frmOINF.BillFirstName.value = document.frmOINF.ShipFirstName.value;
    document.frmOINF.BillLastName.value = document.frmOINF.ShipLastName.value;
    document.frmOINF.BillCompany.value = document.frmOINF.ShipCompany.value;
    document.frmOINF.BillAddress.value = document.frmOINF.ShipAddress.value;
    document.frmOINF.BillCity.value = document.frmOINF.ShipCity.value;
    document.frmOINF.BillStateSelect.value = document.frmOINF.ShipStateSelect[document.frmOINF.ShipStateSelect.selectedIndex].value;
//    document.frmOINF.BillState.value = document.frmOINF.ShipState.value;
    document.frmOINF.BillZip.value = document.frmOINF.ShipZip.value;
    document.frmOINF.BillCountry.value = document.frmOINF.ShipCountry[document.frmOINF.ShipCountry.selectedIndex].value;
    document.frmOINF.BillPhone.value = document.frmOINF.ShipPhone.value;
    document.frmOINF.BillFax.value = document.frmOINF.ShipFax.value;
    document.frmOINF.BillEmail.value = document.frmOINF.ShipEmail.value;
    return false;
  }
}

function copyShippingAcnt() {
  if (document.frmACNT.copyshipping.checked) {
    document.frmACNT.Customer_BillFirstName.value = document.frmACNT.Customer_ShipFirstName.value;
    document.frmACNT.Customer_BillLastName.value = document.frmACNT.Customer_ShipLastName.value;
    document.frmACNT.Customer_BillCompany.value = document.frmACNT.Customer_ShipCompany.value;
    document.frmACNT.Customer_BillAddress.value = document.frmACNT.Customer_ShipAddress.value;
    document.frmACNT.Customer_BillCity.value = document.frmACNT.Customer_ShipCity.value;
    document.frmACNT.Customer_BillStateSelect.value = document.frmACNT.Customer_ShipStateSelect[document.frmACNT.Customer_ShipStateSelect.selectedIndex].value;
//    document.frmACNT.Customer_BillState.value = document.frmACNT.Customer_ShipState.value;
    document.frmACNT.Customer_BillZip.value = document.frmACNT.Customer_ShipZip.value;
    document.frmACNT.Customer_BillCountry.value = document.frmACNT.Customer_ShipCountry[document.frmACNT.Customer_ShipCountry.selectedIndex].value;
    document.frmACNT.Customer_BillPhone.value = document.frmACNT.Customer_ShipPhone.value;
    document.frmACNT.Customer_BillFax.value = document.frmACNT.Customer_ShipFax.value;
    document.frmACNT.Customer_BillEmail.value = document.frmACNT.Customer_ShipEmail.value;
    return false;
  }
}



/*
from http://www.alistapart.com/articles/popuplinks/
*/

//var _POPUP_FEATURES = 'location=0, statusbar=0, menubar=0, width=400, height=300';
var _POPUP_FEATURES = '';

function raw_popup(url, target, features) {
	if (isUndefined(features)) {
		features = _POPUP_FEATURES;
	}
	if (isUndefined(target)) {
		target = '_blank';
	}
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}

function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function isUndefined(v) {
	var undef;
	return v===undef;
}

/*
end code from http://www.alistapart.com/articles/popuplinks/
*/






function updateCard() {
	//alert('function updateCard');	
	//alert(document.getElementById('AttributeValue[5]'));
	if (document.getElementById('s2b_1verse')) {
//		if (document.all) {
			// MSIE4+
			//buildS7();
			changeVerse();
			//updateText();
			//changeLogo();
			//updateEnvelope();
//		}
	}
}


function buildS7()   {

    var S7URL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + document.getElementById('AttributeValue[5]')[document.getElementById('AttributeValue[5]').selectedIndex].value + "trn?&layer=0&size=275,200&layer=0&op_colorize=";
    alert (S7URL);
    alert(document.getElementById('AttributeValue[2]')[document.getElementById('AttributeValue[2]').selectedIndex].value);
   //switch (document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value) {
   switch (document.getElementById('AttributeValue[2]')[document.getElementById('AttributeValue[2]').selectedIndex].value) {
     case 'red':
       S7URL += "255,0,0";
        break;
     case 'burgundy':
       S7URL += "132,6,30";
        break;
     case 'hunter':
       S7URL += "0,107,63";
        break;
     case 'black':
       S7URL += "0,0,0";
        break;
     case 'blue':
       S7URL += "13,3,137";
        break;
     case 'gold':
       S7URL += "176,130,0";
        break;
     case 'brown':
       S7URL += "163,105,47";
        break;
     case 'silver':
       S7URL += "148,148,148";
        break;
     default:
       alert('default');
   }

alert(S7URL);
}


function changeVerse() {
//    var S7URL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn?&layer=0&size=275,200&layer=0&op_colorize=";
//   switch (document.getElementById('s2a_1imprintcolor')[document.getElementById('s2a_1imprintcolor').selectedIndex].value) {
//     case 'red':
//       S7URL += "255,0,0";
//        break;
//     case 'burgundy':
//       S7URL += "132,6,30";
//        break;
//     case 'hunter':
 //      S7URL += "0,107,63";
//        break;
//     case 'black':
//       S7URL += "0,0,0";
//        break;
//     case 'blue':
//       S7URL += "13,3,137";
//        break;
//     case 'gold':
//       S7URL += "176,130,0";
//        break;
//     case 'brown':
//       S7URL += "163,105,47";
 //       break;
//     case 'silver':
//       S7URL += "148,148,148";
//        break;
//     default:
//       alert('default');
//   }

//if (document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value == "") {
//      document.getElementById('vimage').src = "http://www.holidaycardsunlimited.com/Merchant2/graphics/prodLayout/verses/selv_red.jpg";
//  } else{
//	document.getElementById('vimage').src = S7URL;
//  }
var orientation = document.getElementById('orientation').value;
previewCard(orientation);
}

function previewCard(card_orient)  {
//must figure out here which tab is displayed

//set hidden field on form
//document.getElementById('orientation').value = card_orient;
//ML 9/09
try
{
    if (document.getElementById('s2c_1font').disabled)
    {
        prevtype = "Standard";
    }
}
catch(Error)
{
    if (document.getElementById('s2c_1fontSt').disabled)
    {
        prevtype = "Standard";
    }
}
if (document.getElementById('s2b_1verse').disabled)
{
prevtype = "Custom";
}
//ML 9/22/09
try
{
    if (document.getElementById('s2c_1font').disabled && document.getElementById('s2b_1verse').disabled)
    {
        prevtype="Blank";
    }
}
catch(Error)
{
    if (document.getElementById('s2c_1fontSt').disabled && document.getElementById('s2b_1verse').disabled)
    {
        prevtype="Blank";
    }
}
if (prevtype == "Standard") {
	var pcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_test5?$prod300x250$&$verse=HolidayCards/";
	pcURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";
	var clayer="1";
}
if (prevtype == "Custom")
{
	var pcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_custom5?$prod300x250$";
	//build URL for custom verse
	var cv1 = document.getElementById('s2c_2verse1').value;
	var cv2 = document.getElementById('s2c_3verse2').value;
	var cv3 = document.getElementById('s2c_4verse3').value;
	var cv4 = document.getElementById('s2c_5verse4').value;
	var cv5 = document.getElementById('s2c_6verse5').value;
	if (card_orient == "v") 
	{
		pcURL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5) + "&$vfontsize=144";
	}
	else
	{
		pcURL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5) + "&$vfontsize=192";
	}
	//ML 9/22/09 trycatch
	try
	{
	    ccfont = "&$vfont="+ document.getElementById('s2c_1font')[document.getElementById('s2c_1font').selectedIndex].text;
	}
	catch(Error)
	{
	    ccfont = "&$vfont="+ document.getElementById('s2c_1fontSt')[document.getElementById('s2c_1fontSt').selectedIndex].text;
	}
	pcURL += ccfont;
	var clayer="2";
}
if (prevtype == "Blank")
{
	var pcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_custom5b?$prod300x250$";
	//pcURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";
	var clayer="1";
}
	var cl1 = document.getElementById('s2_3closing1').value;
	var cl2 = document.getElementById('s2_4closing2').value;
	var cl3 = document.getElementById('s2_5closing3').value;
	var cl4 = document.getElementById('s2_6closing4').value;
	pcURL += "&$text="+ escape(cl1) + "\\par " + escape(cl2) + "\\par " + escape(cl3) + "\\par " + escape(cl4);
	pcURL += "&layer="+clayer+"&op_colorize=";
//alert(document.getElementById('s2_font')[document.getElementById('s2_font').selectedIndex].text);
  switch (document.getElementById('s2a_1imprintcolor')[document.getElementById('s2a_1imprintcolor').selectedIndex].value) 
{
     case 'red':
        pcURL += "255,0,0";
	ctcolor="&$red=255&$grn=0&$blu=0&$vred=255&$vgrn=0&$vblu=0";
	pcURL += ctcolor;
        break;
     case 'burgundy':
        pcURL += "132,6,30";
	ctcolor="&$red=132&$grn=6&$blu=30&$vred=132&$vgrn=6&$vblu=30";
	pcURL += ctcolor;
        break;
     case 'hunter':
        pcURL += "0,107,63";
	ctcolor="&$red=0&$grn=107&$blu=63&$vred=0&$vgrn=107&$vblu=63";
	pcURL += ctcolor;
        break;
     case 'black':
        pcURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	pcURL += ctcolor;
        break;
     case 'blue':
        pcURL += "13,3,137";
	ctcolor="&$red=13&$grn=3&$blu=137&$vred=13&$vgrn=3&$vblu=137";
	pcURL += ctcolor;
        break;
     case 'gold':
        pcURL += "176,130,0";
	ctcolor="&$red=176&$grn=130&$blu=0&$vred=176&$vgrn=130&$vblu=0";
	pcURL += ctcolor;
        break;
     case 'brown':
        pcURL += "163,105,47";
	ctcolor="&$red=163&$grn=105&$blu=47&$vred=163&$vgrn=105&$vblu=47";
	pcURL += ctcolor;
        break;
     case 'silver':
        pcURL += "148,148,148";
	ctcolor="&$red=148&$grn=148&$blu=148&$vred=148&$vgrn=148&$vblu=148";
	pcURL += ctcolor;
        break;
     default:
        pcURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	pcURL += ctcolor;
   }
try{
    ctfont = "&$font="+ document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text;
}
catch(Error){
    ctfont = "&$font="+ document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text;
}

pcURL += ctfont;
//code to differentiate on font size goes here
if (card_orient == "h") {
try{
switch (document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text) {
	case 'Baskerville':
		pcURL += "&$fontsize=140";
		break;
	case 'Baskerville Italic':
		pcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		pcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		pcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		pcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		pcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		pcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		pcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		pcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		pcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		pcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		pcURL += "&$fontsize=180";
		break;
	case 'Futura':
		pcURL += "&$fontsize=145";
		break;
	default:
		pcURL += "&$fontsize=150";
	}
}
catch(Error){
switch (document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text) {
	case 'Baskerville':
		pcURL += "&$fontsize=140";
		break;
	case 'Baskerville Italic':
		pcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		pcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		pcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		pcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		pcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		pcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		pcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		pcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		pcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		pcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		pcURL += "&$fontsize=180";
		break;
	case 'Futura':
		pcURL += "&$fontsize=145";
		break;
	default:
		pcURL += "&$fontsize=150";
	}
}
}
if (card_orient == "v") {
try{
switch (document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text) {
	case 'Baskerville':
		pcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		pcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		pcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		pcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		pcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		pcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		pcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		pcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		pcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		pcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		pcURL += "&$fontsize=180";
		break;
	case 'Futura':
		pcURL += "&$fontsize=145";
		break;
	default:
		pcURL += "&$fontsize=150";
	}
 }
 catch(Error){
switch (document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text) {
	case 'Baskerville':
		pcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		pcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		pcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		pcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		pcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		pcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		pcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		pcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		pcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		pcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		pcURL += "&$fontsize=180";
		break;
	case 'Futura':
		pcURL += "&$fontsize=145";
		break;
	default:
		pcURL += "&$fontsize=150";
	}
 }
}
//
pcURL += "&layer=1&textAttr=72,norm,maxRes,noWrap&layer=2&textAttr=72,norm,maxRes,noWrap";
//pcURL += "&layer=2&textAttr=72,norm,maxRes,noWrap";
document.getElementById('incardpreview').src = pcURL;

}


function builds7URL(vtype, card_orient,versenum,cv1,cv2,cv3,cv4, cv5, vfont, cl1, cl2, cl3, cl4, clfont, color, template)
{
	if (location.protocol == 'https:') {
		var s7URL = "https://a248.e.akamai.net/f/248/9086/1.ccd/s7diod-isorigin.scene7.com/is/image/HolidayCards/";
	} else {
		var s7URL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/";
	}
	

	if (vtype == "Standard") {
		s7URL += card_orient + "1_test5?$" + template + "$&$verse=HolidayCards/";
		s7URL += versenum + "trn";
		var eclayer = "1";
	}
	if (vtype == "Custom")
	{
		s7URL += card_orient + "1_custom5?$" + template + "$";
		if (card_orient == "v") 
		{
			s7URL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5) + "&$vfontsize=144";
		}
		else
		{
			s7URL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5);
		}
	   if (card_orient == "h") {
         switch (vfont) {
		case 'Baskerville':
			s7URL += "&$vfontsize=240";
			break;
		case 'Classic Roman' :
			s7URL += "&$vfontsize=160";
			break;
		case 'Copperplate' :
			s7URL += "&$vfontsize=260";
			break;
		case 'University Roman':
			s7URL += "&$vfontsize=180";
			break;
		case 'Nadianne':
			s7URL += "&$vfontsize=190";
			break;
		case 'Bickley Script':
			s7URL += "&$vfontsize=215";
			break;	
		case 'French Script':
			s7URL += "&$vfontsize=205";
			break;
		case 'Basilica':
			s7URL += "&$vfontsize=180";
			break;
		case 'Park Avenue':
			s7URL += "&$vfontsize=292";
			break;
		case 'Florentine':
			s7URL += "&$vfontsize=180";
			break;
		case 'Citadel':
			s7URL += "&$vfontsize=180";
			break;
		case 'Futura':
			s7URL += "&$vfontsize=145";
			break;
		default:
			s7URL += "&$fontsize=150";
		}
	}
	ccfont = "&$vfont="+ vfont;
	s7URL += ccfont;
	var eclayer = "2";
}
// end custom
if (vtype == "Blank")
{
	s7URL += card_orient + "1_custom5b?$" + template + "$";
	var eclayer="1";
}
s7URL += "&$text="+ escape(cl1) + "\\par " + escape(cl2) + "\\par " + escape(cl3) + "\\par " + escape(cl4);
s7URL += "&layer="+eclayer+"&op_colorize=";
switch (color) {
     case 'red':
       s7URL += "255,0,0";
	 ctcolor="&$red=255&$grn=0&$blu=0&$vred=255&$vgrn=0&$vblu=0";
	 s7URL += ctcolor;
       break;
     case 'burgundy':
       s7URL += "132,6,30";
	 ctcolor="&$red=132&$grn=6&$blu=30&$vred=132&$vgrn=6&$vblu=30";
	 s7URL += ctcolor;
       break;
     case 'hunter':
       s7URL += "0,107,63";
	 ctcolor="&$red=0&$grn=107&$blu=63&$vred=0&$vgrn=107&$vblu=63";
	 s7URL += ctcolor;
       break;
     case 'black':
       s7URL += "0,0,0";
	 ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	 s7URL += ctcolor;
       break;
     case 'blue':
       s7URL += "13,3,137";
	 ctcolor="&$red=13&$grn=3&$blu=137&$vred=13&$vgrn=3&$vblu=137";
	 s7URL += ctcolor;
       break;
     case 'gold':
       s7URL += "176,130,0";
	 ctcolor="&$red=176&$grn=130&$blu=0&$vred=176&$vgrn=130&$vblu=0";
	 s7URL += ctcolor;
       break;
     case 'brown':
       s7URL += "163,105,47";
	 ctcolor="&$red=163&$grn=105&$blu=47&$vred=163&$vgrn=105&$vblu=47";
	 s7URL += ctcolor;
       break;
     case 'silver':
       s7URL += "148,148,148";
	 ctcolor="&$red=148&$grn=148&$blu=148&$vred=148&$vgrn=148&$vblu=148";
	 s7URL += ctcolor;
       break;
     default:
       s7URL += "0,0,0";
	 ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	 s7URL += ctcolor;
   }
ctfont = "&$font=" + clfont;
s7URL += ctfont;
//code to differentiate on font size goes here
if (card_orient == "h") {
switch (clfont) {
	case 'Baskerville':
		s7URL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		s7URL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		s7URL += "&$fontsize=160";
		break;
	case 'University Roman':
		s7URL += "&$fontsize=180";
		break;
	case 'Nadianne':
		s7URL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		s7URL += "&$fontsize=215";
		break;	
	case 'French Script':
		s7URL += "&$fontsize=205";
		break;
	case 'Basilica':
		s7URL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		s7URL += "&$fontsize=180";
		break;
	case 'Florentine':
		s7URL += "&$fontsize=180";
		break;
	case 'Citadel':
		s7URL += "&$fontsize=180";
		break;
	case 'Futura':
		s7URL += "&$fontsize=145";
		break;
	default:
		s7URL += "&$fontsize=150";
	}
}
if (card_orient == "v") {
switch (clfont) {
	case 'Baskerville':
		s7URL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		s7URL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		s7URL += "&$fontsize=160";
		break;
	case 'University Roman':
		s7URL += "&$fontsize=180";
		break;
	case 'Nadianne':
		s7URL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		s7URL += "&$fontsize=215";
		break;	
	case 'French Script':
		s7URL += "&$fontsize=205";
		break;
	case 'Basilica':
		s7URL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		s7URL += "&$fontsize=180";
		break;
	case 'Florentine':
		s7URL += "&$fontsize=180";
		break;
	case 'Citadel':
		s7URL += "&$fontsize=180";
		break;
	case 'Futura':
		s7URL += "&$fontsize=145";
		break;
	default:
		s7URL += "&$fontsize=150";
	}
}
s7URL += "&layer=1&textAttr=72,norm,maxRes,noWrap&layer=2&textAttr=72,norm,maxRes,noWrap";
return s7URL;
}

function basketPreview(theUrl) {
 var prevWindow = window.open(theUrl, 
                             "enlargedCardPrevWindow", 
                             "height=750,width=750,align=center"); 
}

///////////////////////////////////////////////////////
function epreviewCard(card_orient)  {
try
{
    if (document.getElementById('s2c_1font').disabled)
    {
    prevtype = "Standard";
    }
}
catch(Error)
{
    if (document.getElementById('s2c_1fontSt').disabled)
    {
    prevtype = "Standard";
    }
}
if (document.getElementById('s2b_1verse').disabled)
{
prevtype = "Custom";
}
try
{
    if (document.getElementById('s2c_1font').disabled && document.getElementById('s2b_1verse').disabled)
    {
    prevtype="Blank";
    }
}
catch(Error)
{
    if (document.getElementById('s2c_1fontSt').disabled && document.getElementById('s2b_1verse').disabled)
    {
    prevtype="Blank";
    }
}
if (prevtype == "Standard") {
	var epcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_test5?$zoom750x750$&$verse=HolidayCards/";
	epcURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";
	var eclayer = "1";
}
if (prevtype == "Custom")
{
	var epcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_custom5?$zoom750x750$";
	var cv1 = document.getElementById('s2c_2verse1').value;
	var cv2 = document.getElementById('s2c_3verse2').value;
	var cv3 = document.getElementById('s2c_4verse3').value;
	var cv4 = document.getElementById('s2c_5verse4').value;
	var cv5 = document.getElementById('s2c_6verse5').value;
	if (card_orient == "v") 
	{
		epcURL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5) + "&$vfontsize=144";
	}
	else
	{
		epcURL += "&$vtext="+ escape(cv1) + "\\par " + escape(cv2) + "\\par " + escape(cv3) + "\\par " + escape(cv4) + "\\par " + escape(cv5);
	}


	if (card_orient == "h") {
	//ML trycatch 9/22/09
	try{
	    switch (document.getElementById('s2c_1font')[document.getElementById('s2c_1font').selectedIndex].text) {
		case 'Baskerville':
			epcURL += "&$vfontsize=240";
			break;
		case 'Classic Roman' :
			epcURL += "&$vfontsize=160";
			break;
		case 'Copperplate' :
			epcURL += "&$vfontsize=260";
			break;
		case 'University Roman':
			epcURL += "&$vfontsize=180";
			break;
		case 'Nadianne':
			epcURL += "&$vfontsize=190";
			break;
		case 'Bickley Script':
			epcURL += "&$vfontsize=215";
			break;	
		case 'French Script':
			epcURL += "&$vfontsize=205";
			break;
		case 'Basilica':
			epcURL += "&$vfontsize=180";
			break;
		case 'Park Avenue':
			epcURL += "&$vfontsize=292";
			break;
		case 'Florentine':
			epcURL += "&$vfontsize=180";
			break;
		case 'Citadel':
			epcURL += "&$vfontsize=180";
			break;
		case 'Futura':
			epcURL += "&$vfontsize=145";
			break;
		default:
			epcURL += "&$fontsize=150";
		}
		}
		catch(Error)
		{
	    switch (document.getElementById('s2c_1fontSt')[document.getElementById('s2c_1fontSt').selectedIndex].text) {
		case 'Baskerville':
			epcURL += "&$vfontsize=240";
			break;
		case 'Classic Roman' :
			epcURL += "&$vfontsize=160";
			break;
		case 'Copperplate' :
			epcURL += "&$vfontsize=260";
			break;
		case 'University Roman':
			epcURL += "&$vfontsize=180";
			break;
		case 'Nadianne':
			epcURL += "&$vfontsize=190";
			break;
		case 'Bickley Script':
			epcURL += "&$vfontsize=215";
			break;	
		case 'French Script':
			epcURL += "&$vfontsize=205";
			break;
		case 'Basilica':
			epcURL += "&$vfontsize=180";
			break;
		case 'Park Avenue':
			epcURL += "&$vfontsize=292";
			break;
		case 'Florentine':
			epcURL += "&$vfontsize=180";
			break;
		case 'Citadel':
			epcURL += "&$vfontsize=180";
			break;
		case 'Futura':
			epcURL += "&$vfontsize=145";
			break;
		default:
			epcURL += "&$fontsize=150";
		}
		}
	}
// ML 9/22/09  try catch
try
{
	ccfont = "&$vfont="+ document.getElementById('s2c_1font')[document.getElementById('s2c_1font').selectedIndex].text;
}
catch(Error)
{
	ccfont = "&$vfont="+ document.getElementById('s2c_1fontSt')[document.getElementById('s2c_1fontSt').selectedIndex].text;
}
	epcURL += ccfont;
	var eclayer = "2";
}
if (prevtype == "Blank")
{
	var epcURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/" + card_orient + "1_custom5b?$zoom750x750$";
	//pcURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";
	var eclayer="1";
}
var cl1 = document.getElementById('s2_3closing1').value;
var cl2 = document.getElementById('s2_4closing2').value;
var cl3 = document.getElementById('s2_5closing3').value;
var cl4 = document.getElementById('s2_6closing4').value;
epcURL += "&$text="+ escape(cl1) + "\\par " + escape(cl2) + "\\par " + escape(cl3) + "\\par " + escape(cl4);
epcURL += "&layer="+eclayer+"&op_colorize=";
switch (document.getElementById('s2a_1imprintcolor')[document.getElementById('s2a_1imprintcolor').selectedIndex].value) {
     case 'red':
       epcURL += "255,0,0";
	ctcolor="&$red=255&$grn=0&$blu=0&$vred=255&$vgrn=0&$vblu=0";
	epcURL += ctcolor;
        break;
     case 'burgundy':
       epcURL += "132,6,30";
	ctcolor="&$red=132&$grn=6&$blu=30&$vred=132&$vgrn=6&$vblu=30";
	epcURL += ctcolor;
        break;
     case 'hunter':
       epcURL += "0,107,63";
	ctcolor="&$red=0&$grn=107&$blu=63&$vred=0&$vgrn=107&$vblu=63";
	epcURL += ctcolor;
        break;
     case 'black':
       epcURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	epcURL += ctcolor;
        break;
     case 'blue':
       epcURL += "13,3,137";
	ctcolor="&$red=13&$grn=3&$blu=137&$vred=13&$vgrn=3&$vblu=137";
	epcURL += ctcolor;
        break;
     case 'gold':
       epcURL += "176,130,0";
	ctcolor="&$red=176&$grn=130&$blu=0&$vred=176&$vgrn=130&$vblu=0";
	epcURL += ctcolor;
        break;
     case 'brown':
       epcURL += "163,105,47";
	ctcolor="&$red=163&$grn=105&$blu=47&$vred=163&$vgrn=105&$vblu=47";
	epcURL += ctcolor;
        break;
     case 'silver':
       epcURL += "148,148,148";
	ctcolor="&$red=148&$grn=148&$blu=148&$vred=148&$vgrn=148&$vblu=148";
	epcURL += ctcolor;
        break;
     default:
       epcURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0&$vred=0&$vgrn=0&$vblu=0";
	epcURL += ctcolor;
   }
try{   
    ctfont = "&$font="+ document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text;
}
catch(Error){
    ctfont = "&$font="+ document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text;
}
epcURL += ctfont;
//code to differentiate on font size goes here
if (card_orient == "h") {
try{
switch (document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text) {
	case 'Baskerville':
		epcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		epcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		epcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		epcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		epcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		epcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		epcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		epcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		epcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		epcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		epcURL += "&$fontsize=180";
		break;
	case 'Futura':
		epcURL += "&$fontsize=145";
		break;
	default:
		epcURL += "&$fontsize=150";
	}
   }
catch(Error){
switch (document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text) {
	case 'Baskerville':
		epcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		epcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		epcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		epcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		epcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		epcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		epcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		epcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		epcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		epcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		epcURL += "&$fontsize=180";
		break;
	case 'Futura':
		epcURL += "&$fontsize=145";
		break;
	default:
		epcURL += "&$fontsize=150";
	}
 
  }
}

if (card_orient == "v") {
try{
switch (document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text) {
	case 'Baskerville':
		epcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		epcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		epcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		epcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		epcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		epcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		epcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		epcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		epcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		epcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		epcURL += "&$fontsize=180";
		break;
	case 'Futura':
		epcURL += "&$fontsize=145";
		break;
	default:
		epcURL += "&$fontsize=150";
	}
   }
  catch(Error){
switch (document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text) {
	case 'Baskerville':
		epcURL += "&$fontsize=140";
		break;
	case 'Classic Roman' :
		epcURL += "&$fontsize=160";
		break;
	case 'Copperplate' :
		epcURL += "&$fontsize=160";
		break;
	case 'University Roman':
		epcURL += "&$fontsize=180";
		break;
	case 'Nadianne':
		epcURL += "&$fontsize=190";
		break;
	case 'Bickley Script':
		epcURL += "&$fontsize=215";
		break;	
	case 'French Script':
		epcURL += "&$fontsize=205";
		break;
	case 'Basilica':
		epcURL += "&$fontsize=180";
		break;
	case 'Park Avenue':
		epcURL += "&$fontsize=180";
		break;
	case 'Florentine':
		epcURL += "&$fontsize=180";
		break;
	case 'Citadel':
		epcURL += "&$fontsize=180";
		break;
	case 'Futura':
		epcURL += "&$fontsize=145";
		break;
	default:
		epcURL += "&$fontsize=150";
	}
  
  }
}
 epcURL += "&layer=1&textAttr=72,norm,maxRes,noWrap&layer=2&textAttr=72,norm,maxRes,noWrap";
// var prevWindow = window.open(epcURL, 
//                             "enlargedCardPrevWindow", 
//                             "height=750,width=750,align=center"); 
    var prevWindow = window.open('', 
                             "enlargedCardPrevWindow", 
                             "height=750,width=750,align=center"); 

	var tmp = prevWindow.document;
	tmp.write('<html><head><title>popup</title>');
	tmp.write('<link rel="stylesheet" href="/style/style.css" type="text/css" />')
	tmp.write('</head><body><br/<br/><p class="note">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Actual layout and sizing are not shown.  Our Art Department will set up your verse and closing to be visually appropriate on your actual card.</p>');
	tmp.write('<p><img src="'+ epcURL+'"/></p>');
	tmp.write('</body></html>');
	tmp.close();



}

function enlargeEnv(envnum)
{
var urlEnvEnlarge = "http://s7ondemand7.scene7.com/is/image/HolidayCards/env"+envnum+"lrg?$zoom750x750$";
 var newWindow = window.open(urlEnvEnlarge, 
                             "enlargedEnvelopeWindow", 
                             "resizable,height=750,width=750,align=center");
}

function S7RetAddr(ra1, ra2, ra3, ra4, retcolor, retfont, rtemplate, rawidth, raheight)
{
	if (location.protocol == 'https:') {
		var raURL = "https://a248.e.akamai.net/f/248/9086/1.ccd/s7diod-isorigin.scene7.com/is/image/HolidayCards/";
	} else {
		var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/";
	}


	//var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreview6?$env300x100$";
	switch (rtemplate) {
		case 'cart75x75' :	
			raURL += "EnvPreview6?&layer=comp&wid=75&hei=75&fmt=jpeg&qlt=75,0&op_sharpen=0&resMode=sharp&op_usm=0.5,0.5,2,0&$font=Arial&$red=153&$grn=153&$blu=153&$fontsize=180&$text=This is text";
			break;
		case 'zoom750x750' :
			raURL += "EnvPreview6?&layer=comp&wid=750&hei=750&fmt=jpeg&qlt=75,0&op_sharpen=0&resMode=sharp&op_usm=0.5,0.5,2,0&$font=Arial&$red=153&$grn=153&$blu=153&$fontsize=180&$text=This is text";
			break;
	}


	//raURL += "EnvPreview6?&layer=comp&wid=75&hei=75&fmt=jpeg&qlt=75,0&op_sharpen=0&resMode=sharp&op_usm=0.5,0.5,2,0&$font=Arial&$red=153&$grn=153&$blu=153&$fontsize=180&$text=This is text";
	//raURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";
	
	raURL += "&$text="+ escape(ra1) + "\\par " + escape(ra2) + "\\par " + escape(ra3) + "\\par " + escape(ra4);
	raURL += "&layer=2&op_colorize=";

  switch (retcolor) {
     case 'red':
        raURL += "255,0,0";
	ctcolor="&$red=255&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'burgundy':
        raURL += "132,6,30";
	ctcolor="&$red=132&$grn=6&$blu=30";
	raURL += ctcolor;
        break;
     case 'hunter':
        raURL += "0,107,63";
	ctcolor="&$red=0&$grn=107&$blu=63";
	raURL += ctcolor;
        break;
     case 'black':
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'blue':
        raURL += "13,3,137";
	ctcolor="&$red=13&$grn=3&$blu=137";
	raURL += ctcolor;
        break;
     case 'gold':
        raURL += "176,130,0";
	ctcolor="&$red=176&$grn=130&$blu=0";
	raURL += ctcolor;
        break;
     case 'brown':
        raURL += "163,105,47";
	ctcolor="&$red=163&$grn=105&$blu=47";
	raURL += ctcolor;
        break;
     case 'silver':
        raURL += "148,148,148";
	ctcolor="&$red=148&$grn=148&$blu=148";
	raURL += ctcolor;
        break;
     default:
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
   }
ctfont = "&$font="+ retfont;
raURL += ctfont;
raURL += "&layer=1&textAttr=72,norm,maxRes,noWrap";
return raURL;

}


function prevRetAddr()  {
//Preview Return Address
//	var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreview4?&layer=0&size=300,200&$text=test this";
//	var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreviewML?&layer=0&size=300,200";
	var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreview6?$env300x100$";
	var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreview6?&layer=comp&wid=300&hei=100&fmt=jpeg&qlt=75,0&op_sharpen=0&resMode=sharp&op_usm=0.5,0.5,2,0&$font=Arial&$red=153&$grn=153&$blu=153&$fontsize=180&$text=This is text";
	raURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";

	var ra1 = document.getElementById('s3_4return1').value;
	var ra2 = document.getElementById('s3_5return2').value;
	var ra3 = document.getElementById('s3_6return3').value;
	var ra4 = document.getElementById('s3_7return4').value;
	raURL += "&$text="+ escape(ra1) + "\\par " + escape(ra2) + "\\par " + escape(ra3) + "\\par " + escape(ra4);
	raURL += "&layer=2&op_colorize=";
	var theCheckbox = document.getElementById('s2_1closing');
  switch (document.getElementById('s3_3returncolor')[document.getElementById('s3_3returncolor').selectedIndex].value) {
     case 'red':
        raURL += "255,0,0";
	ctcolor="&$red=255&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'burgundy':
        raURL += "132,6,30";
	ctcolor="&$red=132&$grn=6&$blu=30";
	raURL += ctcolor;
        break;
     case 'hunter':
        raURL += "0,107,63";
	ctcolor="&$red=0&$grn=107&$blu=63";
	raURL += ctcolor;
        break;
     case 'black':
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'blue':
        raURL += "13,3,137";
	ctcolor="&$red=13&$grn=3&$blu=137";
	raURL += ctcolor;
        break;
     case 'gold':
        raURL += "176,130,0";
	ctcolor="&$red=176&$grn=130&$blu=0";
	raURL += ctcolor;
        break;
     case 'brown':
        raURL += "163,105,47";
	ctcolor="&$red=163&$grn=105&$blu=47";
	raURL += ctcolor;
        break;
     case 'silver':
        raURL += "148,148,148";
	ctcolor="&$red=148&$grn=148&$blu=148";
	raURL += ctcolor;
        break;
     default:
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
   }
if (theCheckbox.checked == false)
	{
		ctfont = "&$font=Baskerville"

}
else
{
	try{
	    ctfont = "&$font="+ document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text;
	    }
	catch(Error){
	    ctfont = "&$font="+ document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text;
	}
}
raURL += ctfont;
raURL += "&layer=1&textAttr=72,norm,maxRes,noWrap";
document.getElementById('showra').src = raURL;

}

function enlargeRetAddr()  {
//Enlarge Return Address
	var raURL = "http://s7ondemand7.scene7.com/is/image/HolidayCards/EnvPreview6?$env750x300$&$fontsize=144&$text=test this";

	raURL += document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value + "trn";

	var ra1 = document.getElementById('s3_4return1').value;
	var ra2 = document.getElementById('s3_5return2').value;
	var ra3 = document.getElementById('s3_6return3').value;
	var ra4 = document.getElementById('s3_7return4').value;
	raURL += "&$text="+ escape(ra1) + "\\par " + escape(ra2) + "\\par " + escape(ra3) + "\\par " + escape(ra4);
	raURL += "&layer=2&op_colorize=";
	var theCheckbox = document.getElementById('s2_1closing');
  switch (document.getElementById('s3_3returncolor')[document.getElementById('s3_3returncolor').selectedIndex].value) {
     case 'red':
        raURL += "255,0,0";
	ctcolor="&$red=255&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'burgundy':
        raURL += "132,6,30";
	ctcolor="&$red=132&$grn=6&$blu=30";
	raURL += ctcolor;
        break;
     case 'hunter':
        raURL += "0,107,63";
	ctcolor="&$red=0&$grn=107&$blu=63";
	raURL += ctcolor;
        break;
     case 'black':
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
        break;
     case 'blue':
        raURL += "13,3,137";
	ctcolor="&$red=13&$grn=3&$blu=137";
	raURL += ctcolor;
        break;
     case 'gold':
        raURL += "176,130,0";
	ctcolor="&$red=176&$grn=130&$blu=0";
	raURL += ctcolor;
        break;
     case 'brown':
        raURL += "163,105,47";
	ctcolor="&$red=163&$grn=105&$blu=47";
	raURL += ctcolor;
        break;
     case 'silver':
        raURL += "148,148,148";
	ctcolor="&$red=148&$grn=148&$blu=148";
	raURL += ctcolor;
        break;
     default:
        raURL += "0,0,0";
	ctcolor="&$red=0&$grn=0&$blu=0";
	raURL += ctcolor;
   }
if (theCheckbox.checked == false)
	{
		ctfont = "&$font=Baskerville"

}
else
{
	try{
	    ctfont = "&$font="+ document.getElementById('s2_2font')[document.getElementById('s2_2font').selectedIndex].text;
	}
	catch(Error){
	    ctfont = "&$font="+ document.getElementById('s2_2fontSt')[document.getElementById('s2_2fontSt').selectedIndex].text;
	}
}
raURL += ctfont;
raURL += "&layer=1&textAttr=72,norm,maxRes,noWrap";

 var prevWindow = window.open(raURL, 
                             "enlargedRAPrevWindow", 
                             "resizable,height=350,width=750,align=center"); 



}




/*
function NNchangeVerse() {
	var wTxt = "<img src='http://www.holidaycardsunlimited.com/Merchant2/graphics/prodLayout/verses/" + document.PRODProducts.elements[11][document.PRODProducts.elements[11].selectedIndex].value + "_" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value + ".jpg'  name='bigPic'>";
	document.layers['imageLayer'].document.open();
	document.layers['imageLayer'].document.write(wTxt);
	document.layers['imageLayer'].document.close();
}
*/
/*
function updateText() {
	txtLine1.innerText = document.PRODProducts.elements[19].value;
	txtLine1.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	txtLine2.innerText = document.PRODProducts.elements[21].value;
	txtLine2.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	txtLine3.innerText = document.PRODProducts.elements[23].value;
	txtLine3.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
}
*/
/*
function NNupdateText() {
	var tClass = "insideText" + document.prod.elements[14][document.PRODProducts.elements[14].selectedIndex].value
	var text1 = "<div class=" + tClass + " align=center>" + document.PRODProducts.elements[19].value + "</div>";
	var text2 = "<div class=" + tClass + " align=center>" + document.PRODProducts.elements[21].value + "</div>";
	var text3 = "<div class=" + tClass + " align=center>" + document.PRODProducts.elements[23].value + "</div>";
	document.layers['NNtxtLine1'].document.open();
	document.layers['NNtxtLine1'].document.write(text1);
	document.layers['NNtxtLine1'].document.close();
	document.layers['NNtxtLine2'].document.open();
	document.layers['NNtxtLine2'].document.write(text2);
	document.layers['NNtxtLine2'].document.close();
	document.layers['NNtxtLine3'].document.open();
	document.layers['NNtxtLine3'].document.write(text3);
	document.layers['NNtxtLine3'].document.close();
}
*/
/*
function NN6updateText() {
	elm = document.getElementById("txtLine1");
	elm.innerHTML = document.PRODProducts.elements[19].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	elm = document.getElementById("txtLine2");
	elm.innerHTML = document.PRODProducts.elements[21].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	elm = document.getElementById("txtLine3");
	elm.innerHTML = document.PRODProducts.elements[23].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
}
*/

<!-- Envelope stuff -->
/*
function updateEnvelope() {
	envlText1.innerText = document.PRODProducts.elements[30].value;
	envlText1.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	envlText2.innerText = document.PRODProducts.elements[32].value;
	envlText2.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	envlText3.innerText = document.PRODProducts.elements[34].value;
	envlText3.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;

	if( (document.PRODProducts.elements[30].value == "") 
		&& (document.PRODProducts.elements[32].value == "") 
		&& (document.PRODProducts.elements[34].value == "") )
			envlText2.innerText = " ";
}
*/
/*
function NNupdateEnvelope() {
	var text1 = "<div class=envelopeText align=center>" 
							+ document.PRODProducts.elements[30].value + "</div>"
	var text2 = "<div class=envelopeText align=center>" 
							+ document.PRODProducts.elements[32].value + "</div>"
	var text3 = "<div class=envelopeText align=center>" 
							+ document.PRODProducts.elements[34].value + "</div>"

	if( (document.PRODProducts.elements[30].value == "") 
		&& (document.PRODProducts.elements[32].value == "") 
		&& (document.PRODProducts.elements[34].value == "") )
			text2 = "<div class=envelopeText align=center>  </div>";

	document.layers['NNenvlText1'].document.open();
	document.layers['NNenvlText1'].document.write(text1);
	document.layers['NNenvlText1'].document.close();
	document.layers['NNenvlText2'].document.open();
	document.layers['NNenvlText2'].document.write(text2);
	document.layers['NNenvlText2'].document.close();
	document.layers['NNenvlText3'].document.open();
	document.layers['NNenvlText3'].document.write(text2);
	document.layers['NNenvlText3'].document.close();
}
*/
/*
function NN6updateEnvelope() {
	elm = document.getElementById("envlText1");
	elm.innerHTML = document.PRODProducts.elements[30].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	elm = document.getElementById("envlText2");
	elm.innerHTML = document.PRODProducts.elements[32].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;
	elm = document.getElementById("envlText3");
	elm.innerHTML = document.PRODProducts.elements[34].value;
	elm.className = "insideText" + document.PRODProducts.elements[14][document.PRODProducts.elements[14].selectedIndex].value;

	if( (document.PRODProducts.elements[30].value == "") 
		&& (document.PRODProducts.elements[32].value == "") 
		&& (document.PRODProducts.elements[34].value == "") )
			elm.innerHTML = " ";
}
*/


function getInitialTotalCost(price){

 var initialTotalCost = price * 100;
 initialTotalCost = ((Math.round(initialTotalCost * 100)) / 100);
 initialTotalCost = initialTotalCost.toFixed(2);
 return "$" + initialTotalCost;
}


function initProductPage(){
 addIdsAndEvents();
 //volumePricePreview(100);
 return "";
} 



function addEvent(obj, evType, fn, useCapture){
 if(obj.addEventListener){
  obj.addEventListener(evType, fn, useCapture);
  return true;
  } 
 else if(obj.attachEvent){
  var r = obj.attachEvent("on"+evType, fn);
  return r;
  } 
 else{
  alert("Handler could not be attached");
  }
}


function addIdsAndEvents(){
 
 //Verse
//alert(document.getElementById('s2b_1verse')[document.getElementById('s2b_1verse').selectedIndex].value);
 var elementVerseContent = document.getElementById('s2b_1verse');
//alert(elementVerseContent);
// elementVerseContent.setAttribute("id", "idVerseContent");
 addEvent(elementVerseContent, "change", updateCard);
 //Color
 var elementVerseColor = document.getElementById('s2a_1imprintcolor');
 //elementVerseColor.setAttribute("id", "idVerseColor");
 addEvent(elementVerseColor, "change", updateCard);
 //Text line1
 //var elementTextLine1 = document.PRODProducts.elements[19];
 //elementTextLine1.setAttribute("id", "idTextLine1");
 //addEvent(elementTextLine1, "keyup", updateCard);
 //Text line2
 //var elementTextLine2 = document.PRODProducts.elements[21];
 //elementTextLine2.setAttribute("id", "idTextLine2");
 //addEvent(elementTextLine2, "keyup", updateCard);
 //Text line3
 //var elementTextLine3 = document.PRODProducts.elements[23];
 //elementTextLine3.setAttribute("id", "idTextLine3");
 //addEvent(elementTextLine3, "keyup", updateCard);
 //Logo
// var elementLogo = document.PRODProducts.elements[28];
// elementLogo.setAttribute("id", "idLogo");
// addEvent(elementLogo, "change", logoPrice);
 
 //Envelope line1
// var elementEnvelopeLine1 = document.PRODProducts.elements[30];
// elementEnvelopeLine1.setAttribute("id", "idEnvelopeLine1");
// addEvent(elementEnvelopeLine1, "keyup", updateCard);
 //Envelope line2
// var elementEnvelopeLine2 = document.PRODProducts.elements[32];
// elementEnvelopeLine2.setAttribute("id", "idEnvelopeLine2");
// addEvent(elementEnvelopeLine2, "keyup", updateCard);
 //Envelope line3
// var elementEnvelopeLine3 = document.PRODProducts.elements[34];
// elementEnvelopeLine3.setAttribute("id", "idEnvelopeLine3");
// addEvent(elementEnvelopeLine3, "keyup", updateCard);
//alert("Made it to the bottom of the add ids and events code");
 return;
}


function updateQuantity(prodcode, pv1, pv2, pv3, pv4, pv5, pv6, pv7, pv8, pv9, pv10, pv11, pv12, pv13, pv14, pv15, pv16, pv17, pv18, pv19, pv20, pv21, pv22, pv23)
{
 var customerCardsRequested = document.getElementById('Quantity').value;
 var cardsPerBox = 25;
 var customerCardsRequired = customerCardsRequested;
 var ceil = Math.ceil(customerCardsRequested);
 var remainder = customerCardsRequested % cardsPerBox;
 if(remainder > 0)
{
  customerCardsRequired = customerCardsRequested - remainder + cardsPerBox;
}
 document.getElementById('Quantity').value = customerCardsRequired;
 volumePricePreview(prodcode, customerCardsRequired, pv1, pv2, pv3, pv4, pv5, pv6, pv7, pv8, pv9, pv10, pv11, pv12, pv13, pv14, pv15, pv16, pv17, pv18, pv19, pv20, pv21, pv22, pv23);
 return;
}


function volumePricePreview(prodcode, customerCardsRequired, pv1, pv2, pv3, pv4, pv5, pv6, pv7, pv8, pv9, pv10, pv11, pv12, pv13, pv14, pv15, pv16, pv17, pv18, pv19, pv20, pv21, pv22, pv23){

 var previewCostPerItem;
 var previewTotalCost;
 var discountPercentage = 0;
 var discountPrice = 0;
 var previewCostPerItem = pv1;

 previewTotalCost = previewCostPerItem * customerCardsRequired;
 //Calculate discount 
 if(customerCardsRequired > 9999){
  discountPrice = pv23;
  }
 else if(customerCardsRequired > 8999){
  discountPrice = pv22;
  }
 else if(customerCardsRequired > 7999){
  discountPrice = pv21;
  }
 else if(customerCardsRequired > 6999){
  discountPrice = pv20;
  } 
 else if(customerCardsRequired > 5999){
  discountPrice = pv19;
  } 
 else if(customerCardsRequired > 4999){
  discountPrice = pv18;
  } 
 else if(customerCardsRequired > 3599){
  discountPrice = pv17;
  }
  else if(customerCardsRequired > 3299){
  discountPrice = pv16;
  }
 else if(customerCardsRequired > 2699){
  discountPrice = pv15;
  }
 else if(customerCardsRequired > 2399){
  discountPrice = pv14;
  }
 else if(customerCardsRequired > 2099){
  discountPrice = pv13;
  }
 else if(customerCardsRequired > 1799){
  discountPrice = pv12;
  }
 else if(customerCardsRequired > 1499){
  discountPrice = pv11;
  }
 else if(customerCardsRequired > 1199){
  discountPrice = pv10;
  }
 else if(customerCardsRequired > 924){
  discountPrice = pv9;
  }
 else if(customerCardsRequired > 624){
  discountPrice = pv8;
  }
 else if(customerCardsRequired > 424){
  discountPrice = pv7;
  }
 else if(customerCardsRequired > 274){
  discountPrice = pv6;
  }
 else if(customerCardsRequired > 124){
  discountPrice = pv5;
  }
 else if(customerCardsRequired > 99){
  discountPrice =  pv4;
  }
 else if(customerCardsRequired > 74){
  discountPrice =  pv3;
  }
 else if(customerCardsRequired > 49){
  discountPrice =  pv2;
  }
 else if(customerCardsRequired > 0){
  discountPrice =  pv1;
  }

 //clean up numbers
 previewCostPerItem = ((Math.round(discountPrice * 100)) / 100);
 previewTotalCost = (previewCostPerItem * customerCardsRequired);
 previewTotalCost = ((Math.round(previewTotalCost * 100)) / 100);
 previewCostPerItem = previewCostPerItem.toFixed(2);
 previewTotalCost = previewTotalCost.toFixed(2);
var strPrices = "'" + prodcode + "'," + pv1 + ","+ pv2 + ","+pv3 + ","+pv4 + ","+pv5 + ","+pv6 + ","+pv7 + ","+pv8 + ","+pv9 + ","+pv10 + ","+pv11 + ","+pv12 + ","+pv13 + ","+pv14 + ","+pv15 + ","+pv16 + ","+pv17 + ","+pv18 + ","+pv19 + ","+pv20 + ","+pv21 + ","+pv22 + ","+pv23;
 //Do output
//var info =  '<div class="small">Click Recalculate Pricing to see your volume pricing.</div>' + 
var info =	     '<table id="priceInfo">' + 
//	    '<tr>' +
//	       '<td colspan="2" align="center"><a href="javascript:updateQuantity('+strPrices+');"><img src="/images/btnRecalc.gif" alt="Recalculate Pricing" /></a></td>' +
//           '</tr>' +
             '<tr>' + 
              '<td>Your Price per Card:</td>' + 
              '<td class="right"><b>$' +
               previewCostPerItem + 
              '</b></td>' + 
             '</tr>' + 
             '<tr>' +  
              '<td>Total for ' + customerCardsRequired + ' Cards:</td>' + 
              '<td class="right"><b>$' + 
                previewTotalCost + 
              '</b></td>' + 
             '</tr>' + 
		'<tr>' +
		'<td colspan="2" align="center">' +
		  '<span class="small"><a href="http://www.holidaycardsunlimited.com/Merchant2/merchant.mvc?Screen=Pricing&amp;Product_Code=' + prodcode + '" onclick="link_popup(this,' + 
		'\'location=0, statusbar=0, menubar=0, width=230, height=430, scrollbars=1\'' +
		'); return false;">See all discounted pricing for this card</a></span>' +
		'</td>' +
		'</tr>' +
            '</table>'; 
 document.getElementById("costPerCard").innerHTML = info;
 return;
}


function showFontInfoWindow(url){
 var newWindow = window.open(url, 
                             "fontInfoWindow", 
                             "resizable,scrollbars,height=600,width=600"); 
}

function showLogoInfoWindow(url){
 var newWindow = window.open(url, 
                             "logoInfoWindow", 
                             "resizable,scrollbars,height=600,width=650"); 
}
function showEnlargedCard(cardnum){
var urlEnlarge = "http://s7ondemand7.scene7.com/is/image/HolidayCards/sq2000?$zoom750x750$&$card=is{HolidayCards/" + cardnum+ "}";
//var urlEnlarge = "http://s7ondemand7.scene7.com/is/image/HolidayCards/"+cardnum+"?$zoom750x750$";
 var newWindow = window.open(urlEnlarge, 
                             "enlargedCardWindow", 
                             "resizable,height=750,width=750,align=center"); 
}

function showCalendarCard(cardnum) {
var urlCCEnlarge = "http://s7ondemand7.scene7.com/is/image/HolidayCards/"+cardnum+"Full?$cal300x900$";
//var urlCCEnlarge = "http://s7ondemand7.scene7.com/is/image/HolidayCards/"+cardnum+"Full?$cal300x900$";

 var newWindow = window.open(urlCCEnlarge, 
                             "enlargedCalCardWindow", 
                             "scrollbars, resizable,height=950,width=350,align=top"); 
}

function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

function expandBasket(theClass) {
	var theRows = getElementsByClass('row_' + theClass);
	for (i=0; i<theRows.length; i++) {
		if (theRows[i].style.display == 'none') {
			if(navigator.appName.indexOf("Microsoft") > -1){
				theRows[i].style.display = 'block';
			} else {
				theRows[i].style.display = 'table-row';
			}
		} else {
			theRows[i].style.display = 'none';
		}
	}
	
	var toggleSwitch = document.getElementById('toggler_' + theClass);
	if(toggleSwitch.src == location.protocol + '//www.holidaycardsunlimited.com/images/expand.gif') {
		toggleSwitch.src = location.protocol + '//www.holidaycardsunlimited.com/images/collapse.gif';
	} else {
		toggleSwitch.src = location.protocol + '//www.holidaycardsunlimited.com/images/expand.gif';
	}
}



/* ------------  Begin JQuery to support flyouts ---------------- */
/*
note - see http://coolwebdeveloper.com/tag/null-is-null-or-not-an-object-javascript-error/
for a description of the use of the noConflict function and the replacement of
the $ with jQuery
*/

if (jQuery) {
	
	// the next 3 functions fix the IE7 ClearText problem with fades
	jQuery.fn.fadeIn = function(speed, callback) { 
	    return this.animate({opacity: 'show'}, speed, function() { 
	        if (jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	}; 
	 
	jQuery.fn.fadeOut = function(speed, callback) { 
	    return this.animate({opacity: 'hide'}, speed, function() { 
	        if (jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	}; 
	 
	jQuery.fn.fadeTo = function(speed,to,callback) { 
	    return this.animate({opacity: to}, speed, function() { 
	        if (to == 1 && jQuery.browser.msie)  
	            this.style.removeAttribute('filter');  
	        if (jQuery.isFunction(callback)) 
	            callback();  
	    }); 
	}; 

	var onMenuchristmascardsbydesign = false;
	var onImgchristmascardsbydesign = false;
	var onMenuchristmascardsbymessage = false;
	var onImgchristmascardsbymessage = false;
	var onMenuchristmascardsbyaudience = false;
	var onImgchristmascardsbyaudience = false;
	var onMenuchristmascardsbycarddetails = false;
	var onImgchristmascardsbycarddetails = false;
	var onMenushowcasechristmascards = false;
	var onImgshowcasechristmascards = false;
	var onAnything = false;

	jQuery.noConflict();
	showFromMenu = function(){
		var divId = jQuery(this).attr("id").split("_")[1];
		eval("onImg" + divId.replace(/-/g,'') + " = true");
		jQuery("#bb_"+divId).fadeIn("400");
		onAnything = true;
	};
	hideFromMenu = function(){
		var divId = jQuery(this).attr("id").split("_")[1];
		eval("onImg" + divId.replace(/-/g,'') + " = false");
		setTimeout(function(){
			eval("if (!onAnything && !onMenu" + divId.replace(/-/g,'') + ") jQuery('#bb_" + divId + "').fadeOut('400')");
			eval("if (onAnything && !onMenu" + divId.replace(/-/g,'') + ") jQuery('#bb_" + divId + "').hide()");
		},50);
		onAnything = false;
	};
	showFromImg = function(){
		var divId = jQuery(this).attr("id").split("_")[1];
		eval("onMenu" + divId.replace(/-/g,'') + " = true");
		onAnything = true;
	};
	hideFromImg = function(){
		var divId = jQuery(this).attr("id").split("_")[1];
		eval("onMenu" + divId.replace(/-/g,'') + " = false");
		setTimeout(function(){
			eval("if (!onAnything && !onImg" + divId.replace(/-/g,'') + ") jQuery('#bb_" + divId + "').fadeOut('400');");
			eval("if (onAnything && !onImg" + divId.replace(/-/g,'') + ") jQuery('#bb_" + divId + "').hide();");
		},50);
		onAnything = false;
	};


	jQuery.noConflict();
	jQuery(document).ready(function(){
		jQuery('.cattree-hover').hover( showFromMenu, hideFromMenu);
		jQuery('.popout').hover( showFromImg, hideFromImg);
	});
}

/* ------------  End JQuery to support flyouts ---------------- */


function shipViaMsgCtrl(dropdown){
	if (document.getElementById('shipviamsg')) {
		var shipviamsg = document.getElementById('shipviamsg');
		if (dropdown.value == 'BROK_UPS_CUSTOM:11') {
			shipviamsg.style.color = '#f00';
		} else {
			shipviamsg.style.color = '#555';
		}
	}
}

function checkVendor(cardname,vendor) {
  if(vendor=="CC")
   {
    //alert(document.getElementById('s2a_1imprintcolor')[document.getElementById('s2a_1imprintcolor').selectedIndex].value);
    var customVerseInk = document.getElementById('s2a_1imprintcolor')[document.getElementById('s2a_1imprintcolor').selectedIndex].value;
    //var selfSeal = document.getElementById("s3_1selfseal_standard").value;
    var selfSeal="standard";
    var vendorcard = cardname;
    if(customVerseInk=="goldf" || customVerseInk=="silverf"){
        vendorcard = vendorcard.substring(0,10) + 'F';
    }
    if(document.getElementById("s3_1selfseal_selfseal").checked==true)
    {
        selfSeal = "selfseal";
        vendorcard = vendorcard.substring(0,5) + 'L' + vendorcard.substring(5,11);
    }    
	document.getElementById('vendCode').value = vendorcard;
	//alert(document.getElementById('vendCode').value);
	alert(vendor);
  }
    return true;
}