function checkValues() {
	var greatDealsPromo = document.singupPromosNewsletters.greatDealsPromo.checked;
	var greatDealsNewsletter = document.singupPromosNewsletters.greatDealsNewsletter.checked;
	var email = document.singupPromosNewsletters.emailAddress.value;
	
	var $errorFlag = false;
	var	$errorMsg = '';	
	
	if(greatDealsPromo==false && greatDealsNewsletter==false) {
		$errorFlag = true;
		$errorMsg += 'Please select which newsletter you would like to subscribe\n';	
	}
	
	if(!email) {
		$errorFlag = true;
		$errorMsg += 'Please provide your email address\n';	
	}
	
	if($errorFlag==true) {
		alert($errorMsg);
		return false;
	} else {
		return true;
	}
}

var newwindow = '';
function popitupImage(url) {
	newwindow=window.open(url,'htmlname','width=504,height=416,resizable=1,scrollbars=yes');   
}

function hideDropMenu() {
	if(document.getElementById('divCartPopHidden')) {
		document.getElementById('divCartPopHidden').className = 'divCartPopHidden';
	}
}

function popUp(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="custom") strOptions="scrollbars,status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}

function submitQuote() {
	var myForm = document.orderPageForm;
	var product_id = myForm.product_id.value;
	var total_price = myForm.total_price.value;
	myForm.submit_quote_btn_x.value = '1';
	myForm.submit();	
}

// ------------------------------------------------------------------ //
// if ($current_page!='catalog_newdb_calendars') { 
// ------------------------------------------------------------------ //
function spinLoader() {
	if(document.getElementById('zip_code').value!='' && document.getElementById('zip_code').value!='Enter' && document.getElementById('zip_code').value!='Enter Zip Code') {	
		computePrice(document.orderPageForm);
		
		if(document.URL!=HTTP_SERVER+REQUEST_URI) {
			addTopHeight(150);
		}

	} else {
		alert('Please enter zipcode to calculate shipping.');
	}
	return false;
}

function setVisibility(value) {
	if(value==true) {
		if(document.getElementById('zipCodeSet'))
			document.getElementById('zipCodeSet').className = 'tabContInv';					
		if(document.getElementById('divSpinLoader'))
			document.getElementById('divSpinLoader').innerHTML = '<a href="javascript:;" onClick="spinLoader(); return false;">Calculate Shipping</a>';
		if(document.getElementById('shipMethodSet'))
			document.getElementById('shipMethodSet').className = '';																										
		if(document.getElementById('shippingTitle'))
			document.getElementById('shippingTitle').innerHTML = '<strong>SHIPPING TO <a href="javascript:setVisibility(false);" class="txtBlue">'+document.getElementById('zip_code').value+'</a></strong>';
		if(document.getElementById('printArrival'))
			document.getElementById('printArrival').style.display = '';	
	} else {
		if(document.getElementById('zipCodeSet'))
			document.getElementById('zipCodeSet').className = '';																			
		if(document.getElementById('divSpinLoader'))
			document.getElementById('divSpinLoader').innerHTML = '<a href="javascript:;" class="elemFloatL" onclick="spinLoader(); return false;">Calculate Shipping</a>';
		if(document.getElementById('shipMethodSet'))
			document.getElementById('shipMethodSet').className = 'tabContInv';																										
		if(document.getElementById('shippingTitle'))
			document.getElementById('shippingTitle').innerHTML = 'SHIPPING RATES & TRANSIT TIMES';
		if(document.getElementById('printArrival'))
			document.getElementById('printArrival').style.display = 'none';	
		
		if(document.URL!=HTTP_SERVER+REQUEST_URI) {
			addTopHeight(-160);
		}
	}
}

function highLight(valLength,valName,valNode) {
	if(valName=='radioTurn') {
		for(i=0;i<valLength;i++) {
			if(i==valNode) {
				document.getElementById(valName+valNode).className='op_div_radio_highlight';
			} else {
				document.getElementById(valName+i).className='op_div_radio';
			}
		}
	} else if(valName=='radioMail') {
		//alert(valLength+'-'+valName+'-'+valNode);
		for(i=0;i<valLength;i++) {
			if(i==valNode) {
				document.getElementById(valName+valNode).className='mailing_radio_highlight';
			} else {
				document.getElementById(valName+i).className='mailing_radio';
			}
		}
	} else if(valName=='radioShip') {
		for(i=0;i<valLength;i++) {
			if(i==valNode) {
				document.getElementById(valName+valNode).className='ups_radio_highlight';
			} else {
				document.getElementById(valName+i).className='ups_radio';
			}
		}
		if(valNode!='CF') {
			if(document.getElementById('radioShipCF')) {
				document.getElementById('radioShipCF').className='ups_radio';
			}
		} else {
			if(document.getElementById('radioShipCF')) {
				document.getElementById('radioShipCF').className='ups_radio_highlight';
			}
		}
	}
}

function highLightDiscount(divId) {
	document.getElementById(divId).className='upsDiscountHighLight';
}

function highLightDiscountOff(divId) {
	if(document.getElementById(divId)) {
		document.getElementById(divId).className='upsDiscount';
	}
}
// ------------------------------------------------------------------ //
// } 
// ------------------------------------------------------------------ //

function hitEnter (field, event) {
  var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  if (keyCode == 13)
    return true;
  else
    return false;
}

function moveFocus(fieldId, buttonId) {
	var field = document.getElementById(fieldId);
	var button = document.getElementById(buttonId);
	
	if(field.value.length==5) {
		button.focus();
	}
}

function updatePricingDisplay(upsRate) {
	var upsRate = upsRate;
	var printingRate = document.orderPageForm.total_price.value;
	var totalRate = parseFloat(upsRate) + parseFloat(printingRate);
	var regularRate = totalRate;
	var unitRate = parseFloat(printingRate)/parseInt(document.orderPageForm.qty.value);
	
	/*var turnTemp = document.orderPageForm.turnaround_temp.value;
	if(!upsTransit)
		var upsTransit = 0;
	
	var estDays = computeDateEst(turnTemp,upsTransit);	
	alert(estDays);*/
	
	if(document.orderPageForm.total_price_overwrite) {
		var printingRateOverwrite = document.orderPageForm.total_price_overwrite.value;
	} else {
		var printingRateOverwrite = '';
	}
	var totalRateOverwrite = parseFloat(upsRate) + parseFloat(printingRateOverwrite);
	var unitRateOverwrite = parseFloat(printingRateOverwrite)/parseInt(document.orderPageForm.qty.value);
	
	var promo = PROMO;
	var promo_code_percentage = PROMO_CODE_PERCENTAGE;
	var promo_code_amount = PROMO_CODE_AMOUNT;
	var promo_code_max = PROMO_CODE_MAX;
	var coupon_field_code = parseFloat(document.orderPageForm.coupon_field_code.value);
	var coupon_field_discount_percentage = parseFloat(document.orderPageForm.coupon_field_discount_percentage.value);
	var coupon_field_discount_amount = parseFloat(document.orderPageForm.coupon_field_discount_amount.value);
	var coupon_field_max_discount = parseFloat(document.orderPageForm.coupon_field_max_discount.value);
	
	if(coupon_field_code){
		if(
				(!promo_code_percentage && !isNaN(coupon_field_discount_percentage) && coupon_field_discount_percentage ) || 
				(promo_code_percentage && !isNaN(coupon_field_discount_percentage) && coupon_field_discount_percentage > promo_code_percentage) || 
				(!promo_code_amount && !isNaN(coupon_field_discount_amount) && coupon_field_discount_amount) || 
				(promo_code_amount && !isNaN(coupon_field_discount_amount) && coupon_field_discount_percentage > promo_code_amount)){
			promo = 'y';
			promo_code_percentage = coupon_field_discount_percentage;
			promo_code_amount = coupon_field_discount_amount;
			promo_code_max = coupon_field_max_discount;
		}
	}
		
	if(promo && promo=='y' && (!totalRateOverwrite || totalRateOverwrite==0 || (typeof(has_markdown != 'undefined') && has_markdown))) {			
		if(promo_code_percentage && promo_code_percentage!='') {
			nf = new NumberFormat(promo_code_percentage/100);
			nf.setCommas(false);
			nf.setPlaces(2);
			var promo_code_percent = nf.toFormatted();
			nf = null;
			
			if(typeof(has_markdown) != 'undefined' && has_markdown){
				total_price = total_price_overwrite;
			}
		
			nf = new NumberFormat(totalRate*promo_code_percent);
			nf.setCommas(false);
			nf.setPlaces(2);
			var discount_price = nf.toFormatted();
			nf = null;			
			
			if(document.getElementById('div_discount_text')){
				document.getElementById('div_discount_text').innerHTML = promo_code_percentage+'% Off';
			}
			
		} else if(promo_code_amount && promo_code_amount!='') {
			nf = new NumberFormat(promo_code_amount);
			nf.setCommas(false);
			nf.setPlaces(2);
			var discount_price = nf.toFormatted();
			nf = null;							
		
			if(document.getElementById('div_discount_text')){
				document.getElementById('div_discount_text').innerHTML = promo_code_amount+' Off';
			}
		}

		if(promo_code_max && promo_code_max!='') {
			if(discount_price>promo_code_max) {
				nf = new NumberFormat(promo_code_max);
				nf.setCommas(false);
				nf.setPlaces(2);
				var discount_price = nf.toFormatted();
				nf = null;							
			}
		}
		
		totalRate = parseFloat(upsRate) + parseFloat(printingRate) - discount_price;
		
		if(document.getElementById('disp_discount_price'))
			document.getElementById('disp_discount_price').innerHTML = discount_price;
		if(document.getElementById('discount_field'))
			document.getElementById('discount_field').className='shippingCalculatorTDVisible';

		if(document.getElementById('disp_unit_price'))
			document.getElementById('disp_unit_price').innerHTML = new_unit_price;
		if(promo_code_max && document.getElementById('disp_max_discount'))
			document.getElementById('disp_max_discount').innerHTML = 'Up to $'+promo_code_max;

		if(document.getElementById('disp_printing_text')){
			document.getElementById('disp_printing_text').innerHTML = 'Regular Print Cost';
		}
		
	} else if(totalRateOverwrite > 0){
		nf = new NumberFormat(totalRate-totalRateOverwrite);
		nf.setCommas(false);
		nf.setPlaces(2);
		var discount_price = nf.toFormatted();
		nf = null;	
		
		nf = new NumberFormat(added_price+discount_price);
		nf.setCommas(false);
		nf.setPlaces(2);
		var added_price = -nf.toFormatted();
		nf = null;
		
		totalRate = parseFloat(upsRate) + parseFloat(printingRateOverwrite) - discount_price;
		unitRate = unitRateOverwrite;
		
		if(document.getElementById('div_discount_text')){
			document.getElementById('div_discount_text').innerHTML = '<span style="font-weight:normal;font-style:italic;">Economic Relief Discount</span>';
		}

		if(document.getElementById('disp_discount_price'))
			document.getElementById('disp_discount_price').innerHTML = total_price_overwrite;
		if(document.getElementById('discount_field'))
			document.getElementById('discount_field').className='shippingCalculatorTDHidden';
			//document.getElementById('discount_field').className='shippingCalculatorTDVisible';
		
		if(document.getElementById('disp_printing_text')){
			document.getElementById('disp_printing_text').innerHTML = 'Regular Print Cost';
		}						

	} else {
		if(totalRateOverwrite<=0)
			document.getElementById('discount_field').className='shippingCalculatorTDHidden';

		if(document.getElementById('disp_printing_text')){
			document.getElementById('disp_printing_text').innerHTML = 'Print Cost';
		}						
	}
	
	nf = new NumberFormat(unitRate);
	nf.setPlaces(2);
	var unitRate = nf.toFormatted();
	nf = null; 
	
	nf = new NumberFormat(totalRate);
	nf.setPlaces(2);
	var totalRate = nf.toFormatted();
	nf = null; 

	nf = new NumberFormat(printingRate);
	nf.setPlaces(2);
	var printingRate = nf.toFormatted();
	nf = null; 

	nf = new NumberFormat(upsRate);
	nf.setPlaces(2);
	var upsRate = nf.toFormatted();
	nf = null; 
	
	nf = new NumberFormat(regularRate);
	nf.setPlaces(2);
	var regularRate = nf.toFormatted();
	nf = null; 
	
	if(document.getElementById('disp_unit_price'))
		document.getElementById('disp_unit_price').innerHTML = unitRate;
	if(document.getElementById('disp_total_price'))
		document.getElementById('disp_total_price').innerHTML = totalRate;
	if(document.getElementById('disp_regular_price'))
		document.getElementById('disp_regular_price').innerHTML = regularRate;
	if(document.getElementById('disp_printing_price'))
		document.getElementById('disp_printing_price').innerHTML = printingRate;
	if(document.getElementById('disp_shipping_price'))
		document.getElementById('disp_shipping_price').innerHTML = upsRate;
	//document.getElementById('quoteRatesDisplay').className = 'quoteExpanded';
	if (CURRENT_PAGE!='catalog_newdb_newudesign') {
		if(document.getElementById('quoteRatesDisplayExpand'))
			document.getElementById('quoteRatesDisplayExpand').className = 'shippingCalculatorTDVisible';
	}
}

function showShippingOptions() {
	if(!document.getElementById('disp_total_price').innerHTML || document.getElementById('disp_total_price').innerHTML==0) {
		alert('Please select a product to calculate shipping.');
	} else {
		if(document.getElementById('shippingOptionsTd'))
			document.getElementById('shippingOptionsTd').className = 'shippingCalculatorTDVisible';
		if(document.getElementById('shippingCalculatorTD'))
			document.getElementById('shippingCalculatorTD').className = 'shippingCalculatorTDVisible';
		if(document.getElementById('textCalculate'))
			document.getElementById('textCalculate').className = 'shippingCalculatorTDHidden';
		if(document.getElementById('priceCalculate'))
			document.getElementById('priceCalculate').className = 'shippingCalculatorTDVisible';
	}
}

function displayShippingOptions() {
	if(!document.getElementById('disp_total_price').innerHTML || document.getElementById('disp_total_price').innerHTML==0) {
		alert('Please select a product to calculate shipping.');
	} else {
		if(document.getElementById('shippingTitle'))
			document.getElementById('shippingTitle').className = 'shippingCalculatorTDVisible';	
		if(document.getElementById('shippingCalculatorTD'))
			document.getElementById('shippingCalculatorTD').className = 'shippingCalculatorTDVisible';
		if(document.getElementById('shippingCalculatorRes'))
			document.getElementById('shippingCalculatorRes').className = 'shippingCalculatorTDVisible';
		if(document.getElementById('calculateShippingRate'))
			document.getElementById('calculateShippingRate').className = 'shippingCalculatorTDHidden';
		
		if(document.URL!=HTTP_SERVER+REQUEST_URI) {			
			addTopHeight(60);
		}
	}
}

function computeMailing(mailingRate, qty, mailingServiceFee) {
	var printingRate = parseFloat(document.orderPageForm.total_price.value);
	var mailingServiceFee = parseFloat(mailingServiceFee);
	var mailingPostageEstimate = parseFloat(mailingRate*qty);
	var totalRateMailing = printingRate+mailingServiceFee+mailingPostageEstimate;
	var discountPrice = 0;
	
	var promo = PROMO;
	var promo_code_percentage = PROMO_CODE_PERCENTAGE;
	var promo_code_amount = PROMO_CODE_AMOUNT;
	var promo_code_max = PROMO_CODE_MAX;
	var coupon_field_code = parseFloat(document.orderPageForm.coupon_field_code.value);
	var coupon_field_discount_percentage = parseFloat(document.orderPageForm.coupon_field_discount_percentage.value);
	var coupon_field_discount_amount = parseFloat(document.orderPageForm.coupon_field_discount_amount.value);
	var coupon_field_max_discount = parseFloat(document.orderPageForm.coupon_field_max_discount.value);
	
	if(coupon_field_code){
		if(
				(!promo_code_percentage && !isNaN(coupon_field_discount_percentage) && coupon_field_discount_percentage ) || 
				(promo_code_percentage && !isNaN(coupon_field_discount_percentage) && coupon_field_discount_percentage > promo_code_percentage) || 
				(!promo_code_amount && !isNaN(coupon_field_discount_amount) && coupon_field_discount_amount) || 
				(promo_code_amount && !isNaN(coupon_field_discount_amount) && coupon_field_discount_percentage > promo_code_amount)){
			promo = 'y';
			promo_code_percentage = coupon_field_discount_percentage;
			promo_code_amount = coupon_field_discount_amount;
			promo_code_max = coupon_field_max_discount;
		}
	}
	
	if(promo && promo=='y') {
		if(promo_code_percentage && promo_code_percentage!='') {
			nf = new NumberFormat(promo_code_percentage/100);
			nf.setCommas(false);
			nf.setPlaces(2);
			var promo_code_percent = nf.toFormatted();
			nf = null;
		
			nf = new NumberFormat(printingRate*promo_code_percent);
			nf.setCommas(false);
			nf.setPlaces(2);
			var discountPrice = nf.toFormatted();
			nf = null;
			
		} else if(promo_code_amount && promo_code_amount!='') {
			nf = new NumberFormat(promo_code_amount);
			nf.setCommas(false);
			nf.setPlaces(2);
			var discountPrice = nf.toFormatted();
			nf = null;
		}

		if(promo_code_max && promo_code_max!='') {
			if(discountPrice>promo_code_max) {
				nf = new NumberFormat(promo_code_max);
				nf.setCommas(false);
				nf.setPlaces(2);
				var discountPrice = -nf.toFormatted();
				nf = null;
			}
		}
	}
	
	nf = new NumberFormat(mailingPostageEstimate);
	nf.setCommas(false);
	nf.setPlaces(2);
	var mailingPostageEstimate = nf.toFormatted();
	nf = null; 

	nf = new NumberFormat(totalRateMailing-discountPrice);
	nf.setCommas(false);
	nf.setPlaces(2);
	var totalRateMailing = nf.toFormatted();
	nf = null; 

	//alert(typeof(printingRate));
	//alert(typeof(mailingServiceFee));
	//alert(typeof(mailingPostageEstimate));
	
	if(document.getElementById('disp_mailing_postage_estimate'))
		document.getElementById('disp_mailing_postage_estimate').innerHTML = mailingPostageEstimate;			
	if(document.getElementById('disp_total_price'))
		document.getElementById('disp_total_price').innerHTML = totalRateMailing;			
}

// ------------------------------------------------------------------ //
// if(isset($_GET['mailing']) && $_GET['mailing']==1) {
// ------------------------------------------------------------------ //
function switchMailingTab(tabName) {
	var tabOutput = '';
	var tabContent = '';	

	switch (tabName) {
		case 'pm':
			tabOutput += '<li id="currentFixed"><a href="javascript:;" onclick="switchMailingTab(\'pm\');">Postcard Mailing</a></li>\n';
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'usps\'); return false;">USPS Postage</a></li>\n';
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'ls\'); return false;">List Services</a></li>\n';

			tabContent += '<strong>Mailing Service Includes</strong>\n';
			tabContent += '<ul>\n';
			tabContent += '	<li>List Preparation (single file)</li>\n';
			tabContent += '	<li>CASS Certification</li>\n';
			tabContent += '	<li>Address Ink Jetting</li>\n';
			tabContent += '	<li>Postal Pre-sorting</li>\n';
			tabContent += '	<li>Drop-off at Local USPS Office</li>\n';
			tabContent += '</ul>\n';
			tabContent += '<strong>Mailing Turnaround</strong>\n';
			tabContent += '<p>Mailing preparation is an additional 2-3 Business Days.<br/>Estimated USPS Delivery Time is based on Postage selected. </p>\n';
		break;
		case 'usps':
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'pm\');">Postcard Mailing</a></li>\n';
			tabOutput += '<li id="currentFixed"><a href="javascript:;" onclick="switchMailingTab(\'usps\'); return false;">USPS Postage</a></li>\n';
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'ls\'); return false;">List Services</a></li>\n';

			tabContent += '<table bgcolor="#4f81bd" border="0" class="quoteSmall" cellspacing="1" cellpadding="10" width="100%" style="white-space:normal;">\n';
			tabContent += '	<tr>\n';
			tabContent += '		<td style="color:#FFFFFF;"><strong>Size</strong></td>\n';
			tabContent += '		<td style="color:#FFFFFF;"><strong>USPS Postage*</strong></td>\n';
			tabContent += '		<td style="color:#FFFFFF;"><strong>In Transit - Southern California*</strong></td>\n';
			tabContent += '		<td style="color:#FFFFFF;"><strong>In Transit- Nationwide*</strong></td>\n';
			tabContent += '	</tr>\n';
			tabContent += '	<tr bgcolor="#FFFFFF">\n';
			tabContent += '		<td><strong>4.25&quot; x 6&quot;</strong> </td>\n';
			tabContent += '		<td>First Class $0.223</td>\n';
			tabContent += '		<td>1-2 Business Days</td>\n';
			tabContent += '		<td>2-3 Business Days</td>\n';
			tabContent += '	</tr>\n';
			tabContent += '	<tr bgcolor="#FFFFFF">\n';
			tabContent += '		<td rowspan="2"><strong>4.75&quot; x 6.25&quot; to 6&quot; x 11&quot;</strong> </td>\n';
			tabContent += '		<td>First Class $0.369</td>\n';
			tabContent += '		<td>1-2 Business Days</td>\n';
			tabContent += '		<td>2-3 Business Days</td>\n';
			tabContent += '	</tr>\n';
			tabContent += '	<tr bgcolor="#FFFFFF">\n';
			tabContent += '		<td>Standard Bulk $0.257</td>\n';
			tabContent += '		<td>1-2 Business Days</td>\n';
			tabContent += '		<td>5-14 Business Days</td>\n';
			tabContent += '	</tr>\n';
			tabContent += '</table>\n';
			tabContent += '<br /><div class="arialFont12">*Estimated USPS Postage and Transit Times.</div>\n';
		break;
		case 'ls':
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'pm\');">Postcard Mailing</a></li>\n';
			tabOutput += '<li><a href="javascript:;" onclick="switchMailingTab(\'usps\'); return false;">USPS Postage</a></li>\n';
			tabOutput += '<li id="currentFixed"><a href="javascript:;" onclick="switchMailingTab(\'ls\'); return false;">List Services</a></li>\n';

			tabContent += '<strong>Targeted List</strong>\n';
			tabContent += '<ul>\n';
			tabContent += '	<li>Choose Business and Consumer List</li>\n';
			tabContent += '	<li>Target prospects by demographics, zip code, zip-radius</li>\n';
			tabContent += '</ul>\n';
			tabContent += '<strong>Our Data Partners</strong><br />\n';
			tabContent += '<img src="../images/equitrans.png" />\n';				
		break;
	}
	
	document.getElementById('pcmTabs').innerHTML = tabOutput;
	document.getElementById('pcmCont').innerHTML = tabContent;
}
// ------------------------------------------------------------------ //
// }
// ------------------------------------------------------------------ //

function changeZipcode(valueFlag) {
	if (valueFlag=='y') {
		if(!document.getElementById('zip_code').value || document.getElementById('zip_code').value=='' || document.getElementById('zip_code').value=='Enter' || document.getElementById('zip_code').value=='Enter Zip Code') {
			document.getElementById('zip_code').maxLength = 14;
			document.getElementById('zip_code').value = 'Enter Zip Code';
		}
	} else {
		if(!document.getElementById('zip_code').value || document.getElementById('zip_code').value=='' || document.getElementById('zip_code').value=='Enter' || document.getElementById('zip_code').value=='Enter Zip Code') {
			document.getElementById('zip_code').maxLength = 5;
			document.getElementById('zip_code').value = '';
		}
	}
}

function changeEditVars(attrName) {
	if(attrName) {
		if(document.getElementById('edit_vars'))
			document.getElementById('edit_vars').value = attrName;
	} else {
		if(document.getElementById('edit_vars'))
			document.getElementById('edit_vars').value = '';
	}
}

function showHiddenBox(boxType) {
	if(boxType=='shipping') {
		document.getElementById('shippingCalculatorTD').className = 'opCalcPop';
		document.getElementById('emailQuote').className = 'opMailPop tabContInv';
	} else if(boxType=='quote') {
		document.getElementById('shippingCalculatorTD').className = 'opCalcPop tabContInv';
		document.getElementById('emailQuote').className = 'opMailPop';
	} else {
		document.getElementById('shippingCalculatorTD').className = 'opCalcPop tabContInv';
		document.getElementById('emailQuote').className = 'opMailPop tabContInv';
	}
}

// ------------------------------------------------------------------ //
// Begin :: order_page_xml.php
// ------------------------------------------------------------------ //
function setTurnStyles(turnVal){
	var turnOpts = document.orderPageForm.attr27;
	if(turnVal==4) {
		document.getElementById('radioTurn1').style.color = '#000000';
		document.getElementById('radioTurn1').style.fontWeight = 'normal';
		
		var turnArrs = new Array();
		for(var i=0; i<turnOpts.length; i++) {
			turnArrs.push(turnOpts[i].value);
		}
		turnArrs.sort();		
		
		turnOpts[0].disabled = false;						
		document.getElementById('div_attr27_'+turnArrs[0]).style.textDecoration = 'none';
		document.getElementById('div_attr27_'+turnArrs[0]+'_rprice').style.textDecoration = 'none';
		
		if(document.getElementById('4dayUpgrade'))
			document.getElementById('4dayUpgrade').style.display = 'none';		
			
	} else if(turnVal==6) {
		document.getElementById('radioTurn1').style.color = '#CC0000';
		document.getElementById('radioTurn1').style.fontWeight = 'bold';

		var turnArrs = new Array();
		for(var i=0; i<turnOpts.length; i++) {
			turnArrs.push(turnOpts[i].value);
		}
		turnArrs.sort();
		
		turnOpts[0].disabled = true;
		if(turnOpts[0].checked){
			turnOpts[1].checked = true;
			document.getElementById('radioTurn0').className='op_div_radio';
			document.getElementById('radioTurn1').className='op_div_radio_highlight';
		}
		
		document.getElementById('div_attr27_'+turnArrs[0]).style.textDecoration = 'line-through';
		document.getElementById('div_attr27_'+turnArrs[0]+'_rprice').style.textDecoration = 'line-through';
		
		if(document.getElementById('4dayUpgrade'))
			document.getElementById('4dayUpgrade').style.display = '';
	}
}

function setFolding(foldValue) {
	document.getElementById('folding_temp').value = foldValue;
}

function setProofingHours() {
	var typeFolded = new Array(5,22,47,69);
	var typeMultiPage = new Array(6,21,38,66,67,68);	
	var typeMailed = new Array(49);	
	
	var productId = '{$product_id}';
	var foldValue = document.getElementById('folding_temp').value;
	var turnValue = document.getElementById('turnaround_temp').value;
	
	var proofingTurnOrder = '';
	var proofingTurnFree = '';
	
	if(turnValue==1) {
		proofingTurnOrder = '2';
		proofingTurnFree = '4';
	} else if(turnValue==2) {
		proofingTurnOrder = '3';
		proofingTurnFree = '5';
	} else if(turnValue==4) {
		proofingTurnOrder = '4';
		proofingTurnFree = '6';
	} else if(turnValue==6) {
		proofingTurnOrder = '6';
		proofingTurnFree = '8';
	} else {
		proofingTurnOrder = '6';
		proofingTurnFree = '8';
	}
	/*
	if(document.getElementById('proofing_time_order'))
		document.getElementById('proofing_time_order').innerHTML = '('+proofingTurnOrder+' Business Hours)';
	if(document.getElementById('proofing_time_free'))
		document.getElementById('proofing_time_free').innerHTML = '('+proofingTurnFree+' Business Hours)';
		*/
	if(document.getElementById('proofing_time_order'))
		document.getElementById('proofing_time_order').innerHTML = proofingTurnOrder+' Hours';
	if(document.getElementById('proofing_time_free'))
		document.getElementById('proofing_time_free').innerHTML = proofingTurnFree+' Hours';
}
// ------------------------------------------------------------------ //
// End :: order_page_xml.php
// ------------------------------------------------------------------ //

function getUrlParams() {
	var selTurnaround = document.getElementById('turnaround_temp').value;
	var selZipcode = document.getElementById('zip_code').value;
	var selDate = document.getElementById('estDate').innerHTML.replace(" ","-");
	
	var optShipping = document.orderPageForm.ups_shipping;
	for(var i=0; i<optShipping.length; i++) {
		if(optShipping[i].checked==true) {
			var selShipping = optShipping[i].value;
			selShipping = selShipping.replace(" ","-");
		}
	}
	
	if(selShipping=='UPS-Ground') {
		var selTransit = document.getElementById('ups_transit_ground').value;
	} else if(selShipping=='UPS-2nd Day Air') {
		var selTransit = '2';
	} else {
		var selTransit = '1';		
	}
	
	return GB_showCenter('Estimated Arrival Date', '/index.php?main_page=print_arrival&turn='+selTurnaround+'&zip='+selZipcode+'&ship='+selShipping+'&date='+selDate+'&transit='+selTransit, 650, 900);
	//alert('selTurnaround:'+selTurnaround+'\n'+'selZipcode:'+selZipcode+'\n'+'selShipping:'+selShipping);
	return false;
}