function indicateTradePrice(priceLevel,pageType){
	if(document.getElementById("pricingtext")){
		if(priceLevel == 'Trade Discount' && pageType != 'clearance'){
			document.getElementById("pricingtext").innerHTML = "Trade Price:";
			document.getElementById("pricingtext").style.color = "#339900";
			document.getElementById("price").style.color = "#339900";
		}
		if(priceLevel == 'Trade Discount' && pageType == 'clearance'){
			document.getElementById("pricingtext").innerHTML = "Trade Price:";
			document.getElementById("pricingtext").style.color = "#339900";
			document.getElementById("clearanceNow").style.color = "#339900";
			document.getElementById("pct").style.color = "#339900";
		}
	}
}

function PopupPic(sPicURL) {
	sPicURL = escape(sPicURL);
     window.open( "/site/latch_popup.htm?http://shopping.netsuite.com"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

function popClearance(){
	clearanceURL = '/site/popups/clearance_pop.html';
	window.open(clearanceURL,'clearancepop','resizable=1,scrollbars=1,width=470,height=620');
}

function hideButtons() 
{
	// this function will hide the features list elements that are blank on item detail pages
				for (i=1; i<6; i++) {
					if (document.getElementById("bul"+i).innerHTML =="") {
					document.getElementById("bul"+i).style.visibility = "hidden";
					}
				}
}

function stripCharacter(words,character) 
{ // strip a character from a string
	//documentation for this script at http://www.shawnolson.net/a/499/
		var spaces = words.length;
		for(var x = 1; x<spaces; ++x){
		 words = words.replace(character, "");   
	 }
	 return words;
}

/* OMTR add to cart */

/****************
* Sample Code - Adds another onSubmit to the form
* 	Parameters
*		form - a form object that you want to add the handle to
*		onSubmit - the function that will replace the form handler
****************/
function addOmnitureOnSubmit(elem, onClick)
{
	if(elem.onclick && !elem.omn_onclickBk) // check for an onClick and make sure it hasn't already been backed up
	{
		elem.omn_onclickBk = elem.onsubmit; // Back up the existing onClick
		elem.onclick = onClick // Add the new onClick
	}
	else if (!elem.onclick) // if no onClick
	{
		elem.onclick = onclick; // Add the new onClick
		elem.omn_onclickBk = true; // Add a flag to Omniture onClick has already been added so it can't be added again and cause an infinitie loop		
	}

}

function OmnitureOnClick(event)
{
	var b  = true // Set the boolean variable to return
	var elem = this;
	if(typeof(elem.omn_onclickBk) == 'function') // if an onClick was backed up run that function 1st
	{
		b = elem.omn_onclickBk(event); //Call the backed up onClick
	}
	/********************Begin Analytics Logic *************************/
		//put you logic here to run after the form validation has passed successfully
		s.pageName='Add to Cart';
		s.events='scAdd';
		s.t();
	/********************End Analytics Logic **************************/	
	return b; //return a boolean
}

//This call adds the on submit function
//if(document.getElementById('cartButton') !=null)
//	addOmnitureOnSubmit(document.getElementById('cartButton'),OmnitureOnClick);

// GA Tracking Code for detail page clicks
function trackGAclick(pfm) { // set GA variable
	_gaq.push(['_setCustomVar',5,'Product Finding Method',pfm,1]);	
	return true;
}

//Monitor the Add to Cart button and call the trackGAclick function when clicked
jQuery(document).ready(function() {
	if(typeof thisItemID != 'undefined'){
		jQuery('#btnAddToCart').click(function() {
			_gaq.push(['_trackEvent', "add-to-cart", thisItemID, visitorCustomVarSlot5 ]);
		});
	}
});

