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 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 hideDropMenu() {
	if(document.getElementById('divCartPopHidden')) {
		document.getElementById('divCartPopHidden').className = 'divCartPopHidden';
	}
}

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();	
}

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, false, false);
		
		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('divSpinLoader'))
			document.getElementById('divSpinLoader').innerHTML = '<img src="'+DIR_WS_TEMPLATE+'images/spinningLoader.gif\" />';
		if(document.getElementById('divZipCode'))
			document.getElementById('divZipCode').style.display = 'none';			
	} else {
		//document.getElementById('divSpinLoader').innerHTML = '<input type="button" value="Calculate" class="calculate" onclick="spinLoader(); return false;" />';
		if(document.getElementById('divSpinLoader'))
			document.getElementById('divSpinLoader').innerHTML = '<input type="image" src="'+DIR_WS_TEMPLATE+'images/GetShippingQuote.png" value="Calculate" onclick="spinLoader(); return false;" />';
		if(document.getElementById('divZipCode'))
			document.getElementById('divZipCode').style.display = '';
		if(document.getElementById('result_shippingRates'))
			document.getElementById('result_shippingRates').innerHTML = '';			
		
		if(document.URL!=HTTP_SERVER+REQUEST_URI) {
			addTopHeight(-160);
		}
	}
}

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 = '';
	}
}
*/

var attr_edited = new Array();

function changeEditVars(attrName, attrID, oldAttrVal) {
	
	if(attrID) {
		
		var newAttrVal = parseInt(document.getElementById('attr' + attrID).value);		
		var newAttrValIndex = document.getElementById('attr' + attrID).selectedIndex;
		var newAttrValText = document.getElementById('attr' + attrID).options[newAttrValIndex].text;
		
		if( newAttrVal != oldAttrVal ) {
			
			if(!attr_edited.inArray(attrName)) {
				attr_edited.push(attrName);
			}
			
		} else {
			
			// remove from edited attr
			if(attr_edited.inArray(attrName)) {
				for(var i=0; i < attr_edited.length; i++ ) { 
					if(attr_edited[i]==attrName){
						attr_edited.splice(i,1); 
					}
				}
			}
			
		}		
	}
	
	if(attr_edited.length && document.getElementById('msgEditVars')){
		// show change of size&color warning message
		if(attr_edited.inArray('Size') && attr_edited.inArray('Color')){
			var msgAlert = 'If your current file does not match these specifications, please re-upload a new file.<br /><br />If you need assistance, please call us at 1-888-888-4211';
		} else if(attr_edited.inArray('Size')){
			var msgAlert = 'Is this the trim size for your current file? If not, please re-upload a new file.<br /><br />If you need assistance, please call us at 1-888-888-4211';
		} else if(attr_edited.inArray('Color')){
			var msgAlert = 'Did you upload a '+ newAttrValText +' file?  If not, please re-upload a new file.<br /><br />If you need assistance, please call us at 1-888-888-4211';
		}
		
		document.getElementById('msgEditVars').innerHTML = msgAlert;
		document.getElementById('msgEditVars').style.display = 'block';
		
	} else {
		// hide warning message
		document.getElementById('msgEditVars').style.display = 'none';
		document.getElementById('msgEditVars').innerHTML = '';
	}
}

function setFreeReviewBtn(turnaround_value){	
	if(turnaround_value == 1){
		if(document.getElementById('divFreeReviewBtn'))
			document.getElementById('divFreeReviewBtn').style.display = 'none';
		if(document.getElementById('divFreeReviewErr'))
			document.getElementById('divFreeReviewErr').style.display = 'block';
		if(document.getElementById('divTurnValue'))	
			document.getElementById('divTurnValue').innerHTML = turnaround_value + ' Day ';
	} else {
		if(document.getElementById('divFreeReviewBtn'))
			document.getElementById('divFreeReviewBtn').style.display = 'block';
		if(document.getElementById('divFreeReviewErr'))
			document.getElementById('divFreeReviewErr').style.display = 'none';
	}
}

function selectThis(elemId) {
	var upsShipping = ['upsCustomFreight','upsGround','ups2DayAir','ups1DayAir'];
	for (var i=0; i<=upsShipping.length; i++)  {
		if (upsShipping[i]==elemId) {
			if(document.getElementById(elemId)) {
				document.getElementById(elemId).className = 'selected';	
			}
		} else {
			if(document.getElementById(upsShipping[i])) {
				document.getElementById(upsShipping[i]).className = '';	
			}
		}
	}
}

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);
	
	
	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(printingRate*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 computeMailing(tmpMailingRate, qty, mailingServiceFee, printingRate) {
	var mailingRate = tmpMailingRate.split(':');
	mailingRate = mailingRate[1];
	
	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(parseFloat(mailingServiceFee) + parseFloat(mailingPostageEstimate));
	nf.setCommas(false);
	nf.setPlaces(2);
	var totalMailingCharge = 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_service_fee'))
		document.getElementById('disp_mailing_service_fee').innerHTML = mailingServiceFee;							
	if(document.getElementById('disp_mailing_postage_estimate'))
		document.getElementById('disp_mailing_postage_estimate').innerHTML = mailingPostageEstimate;								
	if(document.getElementById('disp_mailing_total_price'))
		document.getElementById('disp_mailing_total_price').innerHTML = totalMailingCharge;	
	if(document.getElementById('disp_total_price'))
		document.getElementById('disp_total_price').innerHTML = totalRateMailing;			
}

function checkQtyValue(val, refVal, submitFlag) {	
	var minVal = 500;
	var qtyErrorFlag = false;
	var qtyErrorMsg = '';

	nf = new NumberFormat(val);
	nf.setCommas(false);
	nf.setPlaces(0);
	var val = nf.toFormatted();
	nf = null;

	nf = new NumberFormat(refVal);
	nf.setCommas(false);
	nf.setPlaces(0);
	var refVal = nf.toFormatted();
	nf = null;

	if(!submitFlag) 
		var submitFlag = 'n';

	if(val) {
		if (parseInt(val) > parseInt(refVal)) {
			qtyErrorFlag = true;
			qtyErrorMsg += 'Mailing quantity should not be greater than the order quantity.\n';
			document.getElementById('mailing_quantity').value = refVal;
		}
		if(parseInt(val) < parseInt(minVal)) {
			qtyErrorFlag = true;
			qtyErrorMsg += 'Minimum mailing quantity is '+minVal+'.\n';
			document.getElementById('mailing_quantity').value = minVal;
		}
	} else {
		qtyErrorFlag = true;
		qtyErrorMsg += 'Mailing quantity is blank.\n';
		document.getElementById('mailing_quantity').value = refVal;
	}
	
	if(qtyErrorFlag==true) {			
		alert(qtyErrorMsg);	
		
	} else {
		if(submitFlag=='n')
			computePrice(document.orderPageForm);
		if(submitFlag=='y')
			changeValueButton('submit_project_btn_x');
	}
}

// ------------------------------------------------------------------ //
// For Postcards Mailing
// ------------------------------------------------------------------ //
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;
}

//--- Scriptaculous for Order Pages :: Browse Design Button ---//
var blindUp;	
function execBlinds(){
	blindUp=1;
}
function initBlinds(){
	blindUp=0;
	time=30;
}
function blindDownIfUp(divId){
	execBlinds();
	if(document.getElementById(divId).style.display == 'none'){
		Effect.toggle(divId ,'BLIND', { duration: 0.2 });
		time=30;
	}
}
function blindUpIfDown(divId){		
	if(document.getElementById(divId).style.display != 'none'){
		Effect.toggle(divId, 'BLIND', { duration: 0.2 });
	}
}
function updatePageState(divId, linkId){
	if(document.getElementById(divId).style.display != 'none'){
		document.getElementById(linkId).className = 'optClickSub';
		if(blindUp==1){
			if(time==0){
				Effect.toggle(divId, 'BLIND', { duration: 0.2 });
			}else{
				time--;
			}
		}
	}else{
		document.getElementById(linkId).className = 'optClick';
	}
	setTimeout('updatePageState(\''+divId+'\',\''+linkId+'\')', 100);
}

// for Confirm Size
function setSizeValues(jobType) {
	var oForm = document.orderPageForm;
	var sizeHtml = '';
	for (var i=0; i < oForm.elements.length; i++) {
		if(oForm.elements[i].name.match(/attr/)) {			
			var tdName = oForm.elements[i].name.replace("attr","td_");
			if(document.getElementById(tdName)) {
				if(document.getElementById(tdName).innerHTML.match(/Size/)) {					
					var selObj = document.getElementById(oForm.elements[i].name);
					var sizeAttrId = oForm.elements[i].name;
					
					sizeHtml += '<select name="'+oForm.elements[i].name+'_confirm" id="'+oForm.elements[i].name+'_confirm" onchange="setSize(\''+oForm.elements[i].name+'\', this.value);">';
					for (var j=0; j < selObj.options.length; j++) {
						sizeHtml += '<option value="'+selObj.options[j].value+'"'+(selObj.options[j].selected==true ? ' selected' : '')+'>'+selObj.options[j].text+'</option>';	
					}					
					sizeHtml += '</select>';
				}
			}
		}
  }
	
	var widthHeightHtml = '';
	if(document.getElementById('width')) {
		widthHeightHtml += '<select id="width_confirm" name="width_confirm" onchange="setCustomSize(this.id, this.value, \'width\');">';
		var widthObj = document.getElementById('width');
		for (var i=0; i < widthObj.options.length; i++) {
			widthHeightHtml += '<option value="'+widthObj.options[i].value+'"'+(widthObj.options[i].selected==true ? ' selected' : '')+'>'+widthObj.options[i].text+'</option>';
		}
		widthHeightHtml += '</select>';
	}
	widthHeightHtml += '<span class="dim">x</span>';
	if(document.getElementById('height')) {
		widthHeightHtml += '<select id="height_confirm" name="height_confirm" onchange="setCustomSize(this.id, this.value, \'height\');">';
		var heightObj = document.getElementById('height');
		for (var i=0; i < heightObj.options.length; i++) {
			widthHeightHtml += '<option value="'+heightObj.options[i].value+'"'+(heightObj.options[i].selected==true ? ' selected' : '')+'>'+heightObj.options[i].text+'</option>';
		}
		widthHeightHtml += '</select>';
	}

	if(jobType=='order') {
		document.getElementById('confUpl').style.top = '65px';
		document.getElementById('goButton').innerHTML = '<input type="button" value="GO" class="go" onclick="changeValueButton(\'place_order_btn_x\');" />';
	} else if(jobType=='review') {
		document.getElementById('confUpl').style.top = '130px';
		document.getElementById('goButton').innerHTML = '<input type="button" value="GO" class="go" onclick="changeValueButton(\'submit_project_btn_x\');" />';
	}

	document.getElementById('divSizeConfirm').innerHTML = sizeHtml;                          
	document.getElementById('divWidthHeightConfirm').innerHTML = widthHeightHtml;
	
	if(PRODUCT_ID==45) {
		setSize('', 'custom', 'n');
	} else {
		setSize(sizeAttrId, selObj.value, 'n');
	}
}

function setSize(attrId, attrValue, computeFlag) {	
	if(!computeFlag) var computeFlag = 'y';
	
	if(attrValue=='custom') {
		if(document.getElementById('tr_Width'))
			document.getElementById('tr_Width').style.display = '';
		if(document.getElementById('tr_Height'))
			document.getElementById('tr_Height').style.display = '';
		if(document.getElementById('height'))
			document.getElementById('height').disabled = false;
		if(document.getElementById('width'))
			document.getElementById('width').disabled = false;
		if(document.getElementById('height_confirm'))
			document.getElementById('height_confirm').disabled = false;
		if(document.getElementById('width_confirm'))
			document.getElementById('width_confirm').disabled = false;
		
		if(document.getElementById('divSizeConfirm'))
			document.getElementById('divSizeConfirm').style.display = 'none';
		if(document.getElementById('divWidthHeightConfirm'))
			document.getElementById('divWidthHeightConfirm').style.display = '';
	} else {
		if(document.getElementById('tr_Width'))
			document.getElementById('tr_Width').style.display = 'none';
		if(document.getElementById('tr_Height'))
			document.getElementById('tr_Height').style.display = 'none';
		if(document.getElementById('height'))
			document.getElementById('height').disabled = true;
		if(document.getElementById('width'))
			document.getElementById('width').disabled = true;
		if(document.getElementById('height_confirm'))
			document.getElementById('height_confirm').disabled = true;
		if(document.getElementById('width_confirm'))
			document.getElementById('width_confirm').disabled = true;
		
		if(document.getElementById('divSizeConfirm'))
			document.getElementById('divSizeConfirm').style.display = '';
		if(document.getElementById('divWidthHeightConfirm'))
			document.getElementById('divWidthHeightConfirm').style.display = 'none';
	}
	
	if(document.getElementById(attrId))
		document.getElementById(attrId).value = attrValue;

	if(computeFlag=='y')
		computePrice(document.orderPageForm);
}

function setCustomSize(attrId, attrValue, newAttrId) {
	document.getElementById(newAttrId).value = attrValue;
	
	computePrice(document.orderPageForm);
}

function setDefaultValues(type) {
	var frm = document.orderPageForm;
	var vals = '';
	
	for (var i=0; i < frm.elements.length; i++) {
		if(frm.elements[i].name.match(/attr/)) {
			if(frm.elements[i].name!='attr27') {
				if(!vals.match(frm.elements[i].name)) {
					vals += frm.elements[i].name+':'+frm.elements[i].value+';';
				}
			} else {
				for (var j=0; j < frm.attr27.length; j++) {
					if (frm.attr27[j].checked==true) {
						if(!vals.match(frm.elements[i].name)) {
							vals += 'attr27:'+frm.attr27[j].value+';';
						}
					}
				}
			}
		}
	}
	
	if(type=='initial') {
		frm.initial_vars.value = vals;
	} else {
		frm.final_vars.value = vals;
	}
}