	var _gaq = _gaq || [];
	_gaq.push(['_setAccount','UA-23389469-1']);
	_gaq.push(['_setDomainName',window.location.hostname],['_setAllowHash',false], ['_trackPageview'], ['_trackPageLoadTime']);
	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();

// mals cart script
function upDate(){
	qty="0"; sub="0.00";
	querystring=parent.document.URL.substring(document.URL.indexOf('?')+1);
	if (querystring.charAt(0)!="q"){querystring="";}
	if (querystring){
	today=new Date();
	millisecs_in_half_hour=1800000;
	expireDate = new Date(today.getTime() + millisecs_in_half_hour);
	document.cookie=querystring+"&exp="+expireDate+";path=/;expires="+expireDate.toGMTString();
	}else{
	if (document.cookie !=""){
	thisCookie=document.cookie.split("; ");
	for (i=0; i<thisCookie.length; i++) {
	if (thisCookie[i].split("=")[0]=="qty"){
	querystring=thisCookie[i];
	expireDate=thisCookie[i].split("exp=")[1];
	}}}}
	if (querystring){
	querystring=querystring.split("&");
	qty=querystring[0].split("=")[1]; if (qty==""){qty="0";}qty=parseInt(qty);
	sub=querystring[1].split("=")[1]; if (sub==""){sub="0.00";}
	}
	if (qty=="1") { strS = ""; } else { strS = "s"; }
	update=document.write("Shopping Cart: "+qty+" Item"+strS+" ($"+sub+")");
	return update;
}

// jquery
$(document).ready(function(){
	// round corners
	$('.homeBox, .ctaLink, .RoundCorner').corner("10px");
	
	// drop-down navigation (DISABLED)
	/*
		$('ul#nav li').hover(
			function(){ $(this).children('ul').show(); },
			function(){ $(this).children('ul').hide(); }
		);
	*/
	
	// search box text
	jSearchBoxText = "Search Our Site";
	jSearchBoxInput = $("form#searchform input#s");
	jSearchBoxInput.val(jSearchBoxText);
	jSearchBoxInput.focus(function() {
		jUserSearchInput = jSearchBoxInput.val();
		if ((jUserSearchInput == '') || (jUserSearchInput == jSearchBoxText)) { jSearchBoxInput.val(''); }
	}).blur(function() {
		jUserSearchInput = jSearchBoxInput.val();
		if (jUserSearchInput == '') { jSearchBoxInput.val(jSearchBoxText); }
	});
	
	// add to cart validation
	$('form.item_add_to_cart').submit(function(){
	
		// get item values
		iInitPrice = parseFloat($(this).children('.price').val());
		iQty = parseInt($(this).children('.qtyField').children('.qty').val());
		strSize = $(this).children('.sizeField').children('.select_size').children('option:selected').val();
		iAddtlPrice = parseFloat($(this).children('.sizeField').children('.select_size').children('option:selected').attr('addtl_price'));
		strGrind = $(this).children('.grindField').children('.select_grind').children('option:selected').val();
		
		// validation
		if ( (iQty<=0) || (!isNumeric(iQty))) {
			alert('Please enter a valid quantity.');
			return false;
		}
		if (strSize=='') {
			alert('Please select a size.');
			return false;
		}
		if (strGrind=='') {
			alert('Please select a grind.');
			return false;
		}
		
		// adjust price based on size selected
		iNewPrice = parseFloat(iInitPrice+iAddtlPrice);
		$(this).children('.price').val(parseFloat(iNewPrice));
		
	});
	
	// redirect blog link from nav (NOT IN USE)
	// $("ul#nav li a:contains('PAGETITLE')").attr('target','_blank');
	
	// anti spam form validation
	$('input,textarea').keypress(function(){
		this.form.elements.pv.value='verified';
	});
	
	// png fix for old IE browsers
	$(document).pngFix();
});
