$(document).ready(function() {
//switches
var shopCartImage = false;
var calcToolTips = true;
var iplocator = false;
var estShipDate = true;
var newsletter = false;

/*
//Local delivery link
$('#ctl00_ContentPlaceHolder1_btnShipCost').click(function(){
setTimeout(function(){
$('.tblShippingCostsMeth').each(function(){
if ($(this).text().match(/FREE! Local Delivery/)){$(this).html("<a href='#' style='font-weight:bold;font-size:15px;text-decoration:underline;'>FREE! Local Delivery</a>");}
});
}, 3000)
});
*/

//change shipping calc layout
if ($('#detailPage_shippingCalculatorText').length){
$('#ctl00_ContentPlaceHolder1_txtPostalCode').autofill({value: 'Enter Zip Code',defaultTextColor: '#999',activeTextColor: '#000'});
}

//tabs for site storepages
if($('#tabs').length){$(function() {$("#tabs").tabs();});}

//newsletter text change in input box - uses autofill function
$('#news-text').autofill({value: 'Enter Your Email',defaultTextColor: '#999',activeTextColor: '#000'});

//second page navigation addition
var navHtml = $('#navMenu').html();$('#pagenav2').append(navHtml);

//product detail tooltips
if($('.calc-detail-image-wrap').length && calcToolTips == true){
	$(".calc-img-link > img").attr("title", "");
	$('a.calc-img-link').cluetip({ closePosition: 'title', arrows: true, width: 450, attribute: 'href',cluetipClass: 'jtip',dropShadow: false,sticky: true,mouseOutClose: true}); 
}else{$('.calc-detail-image-wrap').hide();}

//captcha check
if($("#captcha").length>0){
	var param1 = $(document).getUrlParam("RadUrid");
	if (param1 != null){alert("Captcha code incorrect, please try again.");
	$("#captcha input").css("background", "#fcc").select();
	}
}

//search box default text					   
var clearMePrevious = "Search..."; $('#ctl00_txtSearch').val("Search...");
// clear input on focus
$('#ctl00_txtSearch').focus(function(){if($(this).val()== "Search..."){clearMePrevious = $(this).val();$(this).val("");}});
// if field is empty afterward, add text again
$('#ctl00_txtSearch').blur(function(){if($(this).val()==""){$(this).val(clearMePrevious);}});

//home page splash transition
if ($('#s1').length){
$('#s1').after('<div id="nav">').cycle({ 
    fx:     'fade', 
    speed:  500,
	pause: 1,
    timeout: 7000, 
    pager:  '#nav'
});
}

//Remove line breaks in file upload fields and other places
$("#ctl00_ContentPlaceHolder1_panelFileUpload br").remove();
$("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_lblPriceLabel").remove();
$(".formTable br").remove();


//add to cart button agreement link
var addButtonText = $("#ctl00_ContentPlaceHolder1_btnSubmit").val();
$("#detailPage_addToCart").append( "<p style='clear: both; padding: 8px 10px;font-size:12px;'> By clicking " + addButtonText + ", I agree to the <a href='storePage.aspx?id=1371' title='View terms and conditions' target='_blank'>Terms Of Use</a>.</p> ");


//Remove line breaks in file upload fields
$("#ctl00_ContentPlaceHolder1_panelFileUpload br").remove();
$(".formTable br").remove();

//home page splash transition
$(function() {$('div pre code').each(function() {eval($(this).text());});});

//switch cart image from empty to full when cart has products
var cartValue = $("#abreviatedCart").text();if (cartValue != 0){$("#cartpic").removeClass().addClass("cartpic2");}

//make portal form submit when enter is pressed 
if ($('#port-login input').length){$(function() {$("#port-login input").keypress(function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
window.location="http://www.printerorder.com/login.aspx?pid=" + $('#printerId').text() + "&userEmail=" + $('#portUserName').val() + "&userPassword=" + $('#portPassword').val()
return false;} else {return true;}});});};

//Submit newsletter sign up 
if ($('#news-signup').length){$("#news-submit").click(function(e) {e.preventDefault();
window.open("http://visitor.constantcontact.com/d.jsp?m=" + $('#news-id').val() + "&p=oi&ea=" + $('#news-text').val())});
};

//Submit portal information to url and redirect page 
if ($('#submit-port').length){$("#submit-port").click(function(e) {   e.preventDefault();
window.location="http://www.printerorder.com/login.aspx?pid=" + $('#printerId').text() + "&userEmail=" + $('#portUserName').val() + "&userPassword=" + $('#portPassword').val()}); };

//product detail, notice for no file uploaded
if ($('#ctl00_ContentPlaceHolder1_lblUploadInstructions').length){
if ($("#ctl00_ContentPlaceHolder1_lblUploadInstructions").attr("style")){
alert('This Product Requires that you upload a file. Please select your file or files to be uploaded for this order and then click "Add to Cart."');}	};
						   
//conformation alert for edoc builder
$(function() {$("#ctl00_ContentPlaceHolder1_btnAddToCart").click(function() {   
var box = $("#ctl00_ContentPlaceHolder1_CheckBox1"); 
if ($("#ctl00_ContentPlaceHolder1_EDocClient_lblInstructions").css("color") == "red"){
alert('Items marked with an asterisk (*) are not optional. Please enter information for all required items and click "Update Preview" error1');}
else if ($("#ctl00_ContentPlaceHolder1_EDocClient_lblInstructions").is(":contains('Please')")){
alert('Items marked with an asterisk (*) are not optional. Please enter information for all required items and click "Update Preview" error2');}
else if (confirm("By approving this document you are indicating that you understand and agree that we will produce what you have seen in the preview as the final proof before your job is produced. What you have approved is what you will get.Any errors or omissions which are the result of incomplete or inaccurate entries are the sole responsibility of you, the author, and said errors or omissions in now way relieve you of your responsibility to pay for this product according to our normal terms and conditions.")){box.checked = true;}
else{ return false;}}); });

//Begin shopcart offer///////////
var price = 0;
$('.shopCartCellPrice').each(
	function(i){
    		price += parseInt($(this).html().replace(/[$,]/g, ""));
		}										  									 
);
if (price >= 100){$('#shopcart-offer').show();}

$('.shopCartCellItem').each(
		function(i){
			switch($(this).html()){
				case 'Color Copies - Try it!': img = "15301";
					break;
				case '3.5" x 4.25" Memo Pads': img = "15364";
					break;
				default: img ="11108";
			}
			$(this).append('<img class="listPage_categoryImage" style="margin:0 auto;" src="/sites/952/images/products/' + img + '_thumb.jpg"/>');
		}					 
);
//end shopcart offer///////////   

//newsletter signup
if(newsletter == true){
$('#news-signup').html('<fieldset><ul><li><input id="news-text" type="text" name="userName" /><input id="news-submit" type="submit" name="submit" value="Go" /><input id="news-id" type="hidden" name="userName" value="1102000675072" /></li><li><div> <a href="http://www.constantcontact.com/safesubscribe.jsp" target="_blank"> <img src="http://img.constantcontact.com/ui/images1/safe_subscribe_logo.gif" border="0" width="168" height="14" alt=""/></a> </div></li></ul></fieldset>');
}

/*
//google ip locator
if(iplocator == true){
if(google.loader.ClientLocation){visitor_lat = google.loader.ClientLocation.latitude;visitor_lon = google.loader.ClientLocation.longitude;visitor_city = google.loader.ClientLocation.address.city;visitor_region = google.loader.ClientLocation.address.region;visitor_country = google.loader.ClientLocation.address.country;visitor_countrycode = google.loader.ClientLocation.address.country_code;
	$("#storeContentArea").append("<div id='ipinfo' style='clear:both;padding:20px;border:1px #ccc solid;width:200px;margin:20px;'><h2 style='margin:0;'>Customer Location info<\/h2><ul><li>Latitude: " + visitor_lat + " <\/li><li>Longitude: " + visitor_lon + " <\/li><li>City: " + visitor_city + " <\/li><li>Region: " + visitor_region + " <\/li><li>Country: " + visitor_country + " <\/li><li>Country Code: " + visitor_countrycode + " <\/li><\/ul><\/div>");
}
else{$("#storeContentArea").append("<div id='ipinfo'>No ip info found.<\/div>");}}	
*/

//print estimated ship date to calculator based on customer choice of 1 Day, 2 Day, etc...
if (estShipDate == true && $('.calc-detail-wrap').length){
$(getShipDate);
}

});//eof .ready()


//estimate the ship date function
function getShipDate(){
if ($('#estShipHeading').length == ""){
$('.calc-detail-wrap').prepend('<div id="estShipHeading"></div>');
}
daysToShip = 0;
$('.PriceCalc_dd_AllOpts').find(':selected').each(function(){			 
		if ($(this).text().match(/1 Day/)){daysToShip = 1;}
		else if ($(this).text().match(/Next Day/)){daysToShip = 1;}
  		else if ($(this).text().match(/2 Day/)){daysToShip = 2;}
		else if ($(this).text().match(/3 Day/)){daysToShip = 3;}
		else if ($(this).text().match(/4 Day/)){daysToShip = 4;}
		else if ($(this).text().match(/5 Day/)){daysToShip = 5;}
		else if ($(this).text().match(/7 Day/)){daysToShip = 7;}
});
if (daysToShip == 0){
$('.PriceCalc_dd_SomeOpts').find(':selected').each(function(){			 
		if ($(this).text().match(/1 Day/)){daysToShip = 1;}
		else if ($(this).text().match(/Next Day/)){daysToShip = 1;}
  		else if ($(this).text().match(/2 Day/)){daysToShip = 2;}
		else if ($(this).text().match(/3 Day/)){daysToShip = 3;}
		else if ($(this).text().match(/4 Day/)){daysToShip = 4;}
		else if ($(this).text().match(/5 Day/)){daysToShip = 5;}
		else if ($(this).text().match(/7 Day/)){daysToShip = 7;}
});
}
$('#estShipHeading').empty();
$('#estShipHeading').html(document.createTextNode("Ships by... " + calculateBusinessDays(daysToShip)));
}//eof estimated ship date


/* ----------------------------------------------------------------- */
/* ***********  FORM VALIDATION - upload file form  ************* */
$(document).ready(function() {
	$("fieldset li").each(function (i) {
        if ($(this).find("input").hasClass("required") || $(this).find("select").hasClass("required") || $(this).find("textarea").hasClass("required")) {
		$(this).find("span").css('display','inline');
        } else {
         $(this).find("span").css('display','none');
        }
      });
if ($("#customform").length){
    $("#aspnetForm").validate({
		ignore: ".notrequired",
		success: "valid", 
		rules: {
			ctl00$ContentPlaceHolder1$txtContactName: {
				required: true,
				minlength: 2
			},
			ctl00$ContentPlaceHolder1$txtCompany: {
				required: true,
				minlength: 2
			},
			ctl00$ContentPlaceHolder1$txtContactPhone: {
				required: true,
				number: true
			},
			ctl00$ContentPlaceHolder1$txtContactEmail: {
				required: true,
				email: true
			},
			_emailMe_FirstName: {
				required: true,
				minlength: 2
			},
			_emailMe_LastName: {
				required: true,
				minlength: 2
			},
			_emailMe_CompanyName: {
				required: true,
				minlength: 2
			},
			_emailMe_WorkPhone: {
				required: true,
				number: true
			},
			_emailMe_FAX: {
				required: true,
				number: true
			},
			_emailMe_Address: {
				required: true
			},
			_emailMe_Address2: {
				required: true
			},
			_emailMe_City: {
				required: true
			},
			_emailMe_Zip: {
				required: true,
				number: true,
				minlength: 5
			},
			_emailMe_Comments: {
				required: true
			},
			_emailMe_Email: {
				required: true,
				email: true
			}
		},
		messages: {
			ctl00$ContentPlaceHolder1$txtContactName: {
				required: "Please enter a contact name",
				minlength: jQuery.format("At least {0} characters required!")
			},
			ctl00$ContentPlaceHolder1$txtCompany: {
				required: "Please enter your company",
				minlength: jQuery.format("At least {0} characters required!")
			},
			ctl00$ContentPlaceHolder1$txtContactPhone: {
				required: "Please enter a valid phone number",
				number: "Numbers only please"
			},
			ctl00$ContentPlaceHolder1$txtContactEmail_emailMe_Email: {
				required: "Please enter a valid email"
			},
			_emailMe_FirstName: {
				required: "Please enter a first name",
				minlength: jQuery.format("At least {0} characters required!")
			},
			_emailMe_LastName: {
				required: "Please enter a last name",
				minlength: jQuery.format("At least {0} characters required!")
			},
			_emailMe_CompanyName: {
				required: "Please enter a username",
				minlength: jQuery.format("At least {0} characters required!")
			},
			_emailMe_WorkPhone: {
				required: "Please enter a valid phone number",
				number: "Numbers only please"
			},
			_emailMe_FAX: {
				required: "Please enter a valid fax number",
				number: "Numbers only please"
			},
			_emailMe_Address: {
				required: "Please enter a valid address"
			},
			_emailMe_Address2: {
				required: "Please enter a valid address"
			},
			_emailMe_City: {
				required: "Please enter a valid city"
			},
			_emailMe_Zip: {
				required: "Please enter a valid zip code",
				number: "Numbers only please",
				minlength: jQuery.format("At least {0} characters required!")
			},
			_emailMe_Comments: {
				required: "Please enter a message"
			},
			_emailMe_Email: {
				required: "Please enter a valid email"
			}
		}  
	});
   }
});
//Plugin to detect the current url parameters
jQuery.fn.extend({
/**
* Returns get parameters.
*
* If the desired param does not exist, null will be returned
*
* To get the document params:
* @example value = $(document).getUrlParam("paramName");
* 
* To get the params of a html-attribut (uses src attribute)
* @example value = $('#imgLink').getUrlParam("paramName");
*/ 
getUrlParam: function(strParamName){strParamName = escape(unescape(strParamName));var returnVal = new Array();var qString = null;if ($(this).attr("nodeName")=="#document") {
  //document-handler
if (window.location.search.search(strParamName) > -1 ){qString = window.location.search.substr(1,window.location.search.length).split("&");}} else if ($(this).attr("src")!="undefined") {
var strHref = $(this).attr("src")
if ( strHref.indexOf("?") > -1 ){var strQueryString = strHref.substr(strHref.indexOf("?")+1);qString = strQueryString.split("&");}} else if ($(this).attr("href")!="undefined") {
var strHref = $(this).attr("href")
if ( strHref.indexOf("?") > -1 ){var strQueryString = strHref.substr(strHref.indexOf("?")+1);qString = strQueryString.split("&");}} else {return null;}
if (qString==null) return null;
for (var i=0;i<qString.length; i++){
if (escape(unescape(qString[i].split("=")[0])) == strParamName){returnVal.push(qString[i].split("=")[1]);}}
if (returnVal.length==0) return null;else if (returnVal.length==1) return returnVal[0];else return returnVal;}});

//spot colors on pricing calculator
function calcColorI(){
	 $('.calc-img-link').each(function(){						  
			var myBox = $(this);						  
			var calcImgLink = $(this).attr('href');
			if (calcImgLink.match(/[a-zA-Z]{2,}_Gray_\d*/)){
				var calcImgLinkPms = calcImgLink.match(/[a-zA-Z]{2,}_Gray_\d*/);
		
			}else if (calcImgLink.match(/Pantone_[a-zA-Z]{2,}/)){
				var calcImgLinkPms = calcImgLink.match(/Pantone_[a-zA-Z]{2,}/);
		
			}else if (calcImgLink.match(/Process_[a-zA-Z]{2,}/)){
				var calcImgLinkPms = calcImgLink.match(/Process_[a-zA-Z]{2,}/);
		
			}else if (calcImgLink.match(/Reflex_[a-zA-Z]{2,}/)){
				var calcImgLinkPms = calcImgLink.match(/Reflex_[a-zA-Z]{2,}/);
				
			}else if (calcImgLink.match(/Black/)){
				var calcImgLinkPms = calcImgLink.match(/Black/);
				
			}else if (calcImgLink.match(/Red_\d{2,4}/)){
				var calcImgLinkPms = calcImgLink.match(/Red_\d{2,4}/);
				
			}else if (calcImgLink.match(/[a-zA-Z]*_Red/)){
				var calcImgLinkPms = calcImgLink.match(/[a-zA-Z]*_Red/);
				
			}else if (calcImgLink.match(/Violet/)){
				var calcImgLinkPms = calcImgLink.match(/Violet/);
				
			}else if (calcImgLink.match(/[a-zA-Z]*_\d{2,4}/)){
				var calcImgLinkPms = calcImgLink.match(/[a-zA-Z]*_\d{2,4}/);
		
			}
			
			if (calcImgLinkPms != null){
				//alert(calcImgLinkPms);
				var colorName = calcImgLinkPms; 

			$.ajax({
                 type: "GET",
                 url: "/sites/1015/files/calc_images/pmsdata.xml",
                 dataType: "xml",
                 success: function(xml) {
					 $(xml).find('name').each(function(){
                         if ($(this).text() == colorName){ 
							 var hexColor = $(this).siblings().text();
									if (calcImgLinkPms != null){
										myBox.css("background-color", hexColor);
									}
						 }
                     }); //close each(
                 }
				 
             }); //close $.ajax(
			
		}//end if				
  }); //close each(
}// end calcColorI

//convert string $xx,xxx.xx to xxxxx.xx
function convert(x){var _x=x.toString();var _len=_x.length;var _ret="";for(var i=_len;i>0;i--){if(!((_len-i)%3)){_ret=","+_ret;}_ret=_x[i-1]+_ret;}_ret=_ret.substr(0,_ret.length-1);return _ret;}	

function calcjunk(minQuantity, qtyOneUse, qtyTwoUse, qtyThreeUse){
if (minQuantity != 0){//set qty 1 to minimum
$("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity").blur(function () {if ($(this).val() < minQuantity){$(this).val(minQuantity);}});
}
//run through quantity field used to divide full price by
if ($("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity").length && qtyOneUse == true){//get qty1 chosen if its arbitrary or select box and asign variable
	var chosenQtyValue = $("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity").val();
} else if ($('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity :selected').length && qtyOneUse == true){ 
	var chosenQtyValue = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity :selected').text();
}else if ($("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity2").length && qtyTwoUse == true){//get qty2 chosen if its arbitrary or select box and asign variable
	var chosenQtyValue = $("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity2").val();
} else if ($('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity2 :selected').length && qtyTwoUse == true){ 
	var chosenQtyValue = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity2 :selected').text();
}else if ($("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity3").length && qtyThreeUse == true){//get qty3 chosen if its arbitrary or select box and asign variable
	var chosenQtyValue = $("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_tbQuantity3").val();
} else if ($('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity3 :selected').length && qtyThreeUse == true){ 
	var chosenQtyValue = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddQuantity3 :selected').text();
}else{ return false; }


//get total price from PO output
totalprice = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_lblFinalPrice').html().replace(/[$,]/g, "");
var origcalcprice = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_lblFinalPrice').html();
$("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_divResults").html("");

//add text to current price
$('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_divResults').append('<div id="totalcost"><ul><li class="costleft">Total Cost</li><li class="costright">' + origcalcprice + '</li></ul></div>');

//devide total price by the chosen qty and display under total price
division = totalprice/chosenQtyValue;
$('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_divResults').append('<div id="finalcost"><ul><li class="costleft">Unit Price </li><li class="costright">$' + division.toFixed(4) + '</li></ul></div>');


var disMult = new Array();
disMult[0] = 1.000000;
disMult[5] = 1.052632;
disMult[10] = 1.111111;
disMult[15] = 1.176471;
disMult[20] = 1.250000;
disMult[25] = 1.333333;
disMult[30] = 1.428571;
disMult[35] = 1.538462;
disMult[40] = 1.666667;
disMult[45] = 1.818182;
disMult[50] = 2.000000;
disMult[55] = 2.222222;
disMult[60] = 2.500000;
disMult[65] = 2.857143;
disMult[70] = 3.333333;
disMult[75] = 4.000000;
disMult[80] = 5.000000;
disMult[85] = 6.666667;
disMult[90] = 10.000000;
disMult[95] = 20.000000;
$(".calc-parm-inputs").html().match(/Discount (\d+)/);
var stuff = RegExp.$1;
if (stuff != 0){
//discount price Discount 10%
discoutPrice = totalprice * (disMult[stuff] - 1);
$('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_divResults').prepend('<div id="discount-price"><ul><li class="costleft">You Saved </li><li class="costright">-$' + discoutPrice.toFixed(2) + '</li></ul></div>');
//before discount price
preSavingsPrice = totalprice * disMult[stuff];
$('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_divResults').prepend('<div id="prediscount-price"><ul><li class="costleft">Low Everyday Price </li><li class="costright">$' + preSavingsPrice.toFixed(2) + '</li></ul></div>');
}
//display none on calc params that have discountprice in label
$('.PriceCalc_CalcParm').each(function(){								 
		if ($(this).html().match(/Discount (\d+)/)){	
   			$(this).css("display", "none");
		}
		else if ($(this).html().match(/_Spec_/)){
			$(this).css("display", "none");
		}
		else if ($(this).html().match(/Product ID/)){
			$(this).css("display", "none");
		}
});
		//display none on grid params that have discountprice in label
		$('.PriceCalc_GridParm').each(function(){								 
			if ($(this).html().match(/Discount (\d+)/)){	
				$(this).css("display", "none");
			}
			else if ($(this).html().match(/_Spec_/)){
				$(this).css("display", "none");
			}
			else if ($(this).html().match(/Product ID/)){
			$(this).css("display", "none");
			}
		});
		$('.calc-img-link').each(function(){							  
			var href = $(this).attr("href");
			if (href.match(/Spec_/)){
			 $(this).parent().css("display", "none");
			}
			if (href.match(/Discount/)){
			 $(this).parent().css("display", "none");
			}
				if (href.match(/Product_ID/)){
			 $(this).parent().css("display", "none");
			}
		});
		//pick up calc paramerter displays

		var cdisp1 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_1 :selected').text();
		var cdisp2 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_2 :selected').text();
		var cdisp3 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_3 :selected').text();
		var cdisp4 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_4 :selected').text();
		var cdisp5 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_5 :selected').text();
		var cdisp6 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_6 :selected').text();
		var cdisp7 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_7 :selected').text();
		var cdisp8 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_8 :selected').text();
		var cdisp9 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddCalcParm_Spec_9 :selected').text();
		//pick up grid paramerter displays

		var gdisp1 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_1 :selected').text();
		var gdisp2 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_2 :selected').text();
		var gdisp3 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_3 :selected').text();
		var gdisp4 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_4 :selected').text();
		var gdisp5 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_5 :selected').text();
		var gdisp6 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_6 :selected').text();
		var gdisp7 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_7 :selected').text();
		var gdisp8 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_8 :selected').text();
		var gdisp9 = $('#ctl00_ContentPlaceHolder1_PriceCalcCtl1_ddGridParm_Spec_9 :selected').text();
		
		$("#ctl00_ContentPlaceHolder1_PriceCalcCtl1_calcParmInputs").append('<div id="yesdisplay-area"><h6>Product Details...</h6><ul id="yesdisplay-elements"></ul></div>');
		
		if (gdisp1 != ""){$("#yesdisplay-elements").append("<li>" + gdisp1 + "</li>");}
		if (gdisp2 != ""){$("#yesdisplay-elements").append("<li>" + gdisp2 + "</li>");}
		if (gdisp3 != ""){$("#yesdisplay-elements").append("<li>" + gdisp3 + "</li>");}
		if (gdisp4 != ""){$("#yesdisplay-elements").append("<li>" + gdisp4 + "</li>");}
		if (gdisp5 != ""){$("#yesdisplay-elements").append("<li>" + gdisp5 + "</li>");}
		if (gdisp6 != ""){$("#yesdisplay-elements").append("<li>" + gdisp6 + "</li>");}
		if (gdisp7 != ""){$("#yesdisplay-elements").append("<li>" + gdisp7 + "</li>");}
		if (gdisp8 != ""){$("#yesdisplay-elements").append("<li>" + gdisp8 + "</li>");}
		if (gdisp9 != ""){$("#yesdisplay-elements").append("<li>" + gdisp9 + "</li>");}

		if (cdisp1 != ""){$("#yesdisplay-elements").append("<li>" + cdisp1 + "</li>");}
		if (cdisp2 != ""){$("#yesdisplay-elements").append("<li>" + cdisp2 + "</li>");}
		if (cdisp3 != ""){$("#yesdisplay-elements").append("<li>" + cdisp3 + "</li>");}
		if (cdisp4 != ""){$("#yesdisplay-elements").append("<li>" + cdisp4 + "</li>");}
		if (cdisp5 != ""){$("#yesdisplay-elements").append("<li>" + cdisp5 + "</li>");}
		if (cdisp6 != ""){$("#yesdisplay-elements").append("<li>" + cdisp6 + "</li>");}
		if (cdisp7 != ""){$("#yesdisplay-elements").append("<li>" + cdisp7 + "</li>");}
		if (cdisp8 != ""){$("#yesdisplay-elements").append("<li>" + cdisp8 + "</li>");}
		if (cdisp9 != ""){$("#yesdisplay-elements").append("<li>" + cdisp9 + "</li>");}
		$('.calc-main-wrap').show();
		
		if ($('#yesdisplay-elements').html() == ""){
				$('#yesdisplay-area').hide();
			}
		
}//end calcjunk

// Auto-Fill Plugin
// Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
(function($){$.fn.autofill=function(options){var defaults={value:'First Name',defaultTextColor:"#b2adad",activeTextColor:"#333"};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this);obj.css({color:options.defaultTextColor}).val(options.value).focus(function(){if(obj.val()==options.value){obj.val("").css({color:options.activeTextColor});}}).blur(function(){if(obj.val()==""){obj.css({color:options.defaultTextColor}).val(options.value);}});});};})(jQuery);

//function to calculate business day shipping
function calculateBusinessDays(dueDate){
//var dueDate = 10  //number of days to add
var daysToAdd = 0
var mydate = new Date()
//document.write(mydate+"<br><br>")
var day = mydate.getDay()
dueDate = dueDate - (5-day)
if ((5-day) < dueDate || dueDate == 1) {
  daysToAdd = (5-day) + 2 + daysToAdd
} else { // (5-day) >= dueDate
  daysToAdd = (5-day) + daysToAdd
}
while (dueDate != 0) {
  var week = dueDate - 5
  if (week > 0) {
    daysToAdd = 7 + daysToAdd
    dueDate = dueDate - 5
  } else { // week < 0
    daysToAdd = (5 + week) + daysToAdd
    dueDate = dueDate - (5 + week)
  }
}
mydate.setDate(mydate.getDate() + daysToAdd)
return mydate.toDateString();
}