var XMLRequest;
var addToBasketX;
var webroot = "http://www.pools.com";


	<!-- JS Code to handle image flyout -->

	function flyOutImage(image)
	{
		var bUI = document.getElementById("blockUI");
		bUI.style.display = "block";

		var iUI = document.getElementById("bigImage");
		iUI.style.display = "block";

		

	}


	function getPriceUpdate(productID, attributeID, salePriceApply)
	{
		var URL = webroot + "/catalog/liveprice.cfm?sale_price_apply=" + salePriceApply + "&attributevalueidlist=" + attributeID + "&id=" + productID + "&RUFN=" + Math.random();
		XMLRequest = new XMLHttpRequest();

		
		XMLRequest.onreadystatechange=dataOp;
		XMLRequest.open("GET", URL, true);
		XMLRequest.send(null);
		
		
	
	}

	function dataOp()
	{
			if(XMLRequest.readyState==4)
			{
				var xmlDoc=XMLRequest.responseXML.documentElement;
				var pDispDiv = document.getElementById("priceDisp");
	
				var divHTML;

				var sale_price_apply = xmlDoc.getElementsByTagName("Sale_Apply")[0].childNodes[0].nodeValue;
				
			
				divHTML = "<p align='left'><font class='smalltext'>SKU: " + xmlDoc.getElementsByTagName("SKU")[0].childNodes[0].nodeValue + "</font><br/>"

				if(sale_price_apply == "Yes")
				{
					var sale_price = xmlDoc.getElementsByTagName("Sale_Price")[0].childNodes[0].nodeValue;
					divHTML += "<font class='hdrprodlbl'>Price:</font> <font class='textprice'><S>" + xmlDoc.getElementsByTagName("Price")[0].childNodes[0].nodeValue + "</S>&nbsp;<font color='#CC3300'>" + sale_price + "</font></font></p>";

				}else{
					divHTML += "<font class='hdrprodlbl'>Price:</font> <font class='textprice'>" + xmlDoc.getElementsByTagName("Price")[0].childNodes[0].nodeValue + "</font></p>";
				}

				
				

				var attributeST = xmlDoc.getElementsByTagName("AttributeST")[0].childNodes[0].nodeValue;
				var attributeSTLink = xmlDoc.getElementsByTagName("AttributeSTLink")[0].childNodes[0].nodeValue;



				if(attributeST != "null")
				{
					if(attributeSTLink != "null")
					{
						divHTML += "<a href='" + attributeSTLink + "'><span style='color: rgb(103, 103, 103);' class='navbtm'><b>" + attributeST + "</a></span>";
					}else{
						divHTML += "<span style='color: rgb(103, 103, 103); align: left;' class='navbtm'><b>" + attributeST + "</b></span>";
					}
			
				}


				pDispDiv.innerHTML = divHTML;
				

			}
	

	}

	<!-- Edited September, 2009 - Anthony Wild - No Attribute Quick Add to Cart [Web 2.0 Initiative Phase One]-->

	function quickAdd(divID, productID, varprice, originalPrice)
	{
		var URL = webroot + "/catalog/quickAddtoBasket.cfm?id=" + productID + "&quantity=1&varprice=" + varprice + "&original_price=" + originalPrice + "&relProdDiv=" + divID + "&RFUD=" + Math.random();
		
		addToBasketX = new XMLHttpRequest();
		addToBasketX.onreadystatechange=quickAddOpt;
		addToBasketX.open("GET", URL, "true");
		addToBasketX.send(null);
	}

	function quickAddOpt()
	{
		if(addToBasketX.readyState==4)
		{
			var xmlDoc=addToBasketX.responseXML.documentElement;
			var divID = xmlDoc.getElementsByTagName("divID")[0].childNodes[0].nodeValue;
			var cartQuantity = xmlDoc.getElementsByTagName("CartQuantity")[0].childNodes[0].nodeValue;
			var cartDivID = document.getElementById("cartField");	
					

			//Disable the Clicked Button by Overwrite
			var pageRelDiv = document.getElementById(divID);
			pageRelDiv.innerHTML = "<img style='border: 0px' src='" + webroot + "/images/orange-added-to-cart-faded.jpg'><br/><a href='" + webroot + "/index.cfm?fuseaction=basket'>go to cart</a>";

			//Update Cart Quantity
			cartDivID.innerHTML = cartQuantity + " items";
			


		}
	}

	<!-- End No Attribute Quick Add -->

	<!-- Edited June 24th, 2008 - Anthony Wild - Implement Bulk Order Quantity Entry i.e. Pool Coves...  -->

	
	function buyProduct()
	{
	
		
	
		//take the val from bulkQuantity and add it to the regular dropdown and select it.
		//do a check on the text value and act_buy
		
		//trim ze whitespace off the bat
		document.form1.bQuantity.value = (document.form1.bQuantity.value).replace(/^\s*|\s*$/g,'');
		

		
		if(document.form1.quantity[document.form1.quantity.selectedIndex].text == "More")
			{
				
				//NaN Verification
				if(isNaN(document.form1.bQuantity.value))
				{
					window.alert("Please enter a valid numeric quantity in the text field");
					document.form1.bQuantity.value = ""
					document.form1.bQuantity.focus();
					return false; //cancel form submission / bail out
				}
			
				var newOpt = new Option(document.form1.bQuantity.value,document.form1.bQuantity.value);
				document.form1.quantity.options.add(newOpt);
				document.form1.quantity.value = document.form1.bQuantity.value;
						
			}
			
		document.form1.fuseaction.value='buy';
		document.form1.submit();
			
		
	}
	
	function swapQuantityField()
	{
	
		
	
		if(document.form1.quantity[document.form1.quantity.selectedIndex].text == "More")
		{
			document.getElementById("regQuantity").style.display = "none";
			document.getElementById("bulkQuantity").style.display = "inline";
		}
			
	}
	
	
	
	<!-- End Edit for Bulk Order implementation -->
	
		
	function SendVote_request(ReviewID, vValue){
        param = 'id=' + ReviewID + '&vValue=' + vValue;
        http( 'POST' , 'act_review_vote.cfc?method=SubmitVote' , SendVote_response , param ); 
    }
    
    function SendVote_response(obj){
		if (obj > 0)
			document.getElementById("VoteLabel" + obj).innerHTML = "Thank you for your vote!"; 
    }
	
	function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
	}
   
	function dropdownHandler(recalc,isPackage,hasImage,hasPackage,attr)
	{
		//kludge for problem with back button
		document.form1.fuseaction.value='product_test'
		//recalc tells us if we need to reload and recalculate
		//isPackage tells us if we need to popup package info
		//has image tells us if we need to popup color swatch
		//isPackage and hasImage are mutually exclusive
		//attr is the id of the selected attribute
		//hasPackage tells us if this attribute has packages, if so we need to reload the page to refresh the package options.

		newWin = "";
		if(isPackage)
		{
			packageWin=window.open("index.cfm?fuseaction=package_details&popup=1&id="+attr,"packageWin","width=450,height=300,menubar,status,scrollbars");
			packageWin.focus();
			newWin = "packageWin";
		}
		else if(hasImage)
		{
			swatch=window.open("index.cfm?fuseaction=swatch&popup=1&id="+attr,"swatch","width=200,height=200,menubar,status,scrollbars");
			swatch.focus();
			newWin = "swatch";
		}
		
		if(recalc)
		{
			// a way to resubmit entire form for when a 'size' changes, so that we can get
			// the new set of 'packages' refreshed... 
			if(hasPackage == 1)
				{
					document.form1.submit();
				}
			
			//document.form1.submit();
			//dynamically run through the list of product attributes (attribute1, attribute2, ect) until 'attributecount' is reached.
			// put all these current attributes in a list and send it off.
			
			//Edited Wednesday, June 11th, 2008 - Anthony Wild - Pull Attribute ID from radio array
			
			var newlist = "";
			var tempSafe = "";
			for (i = 1; i <= form1.attributecount.value; i++)
				{
					//newlist = newlist  + eval('form1.attribute' + i + '.value') + ',';
					newlist = newlist + eval(getCheckedValue(document.forms['form1'].elements['attribute' + i])) + ',';
					
					
				}
			newlist = newlist.replace('"','');
			newlist = newlist.replace("'","");
			newlist = newlist.replace("<","");
			newlist = newlist.replace(">","");
			newlist = newlist.replace("(","");
			newlist = newlist.replace(")","");
			newlist = newlist.replace(";","");
			newlist= newlist.replace(" ","");
			// trim off the trailing comma (hack!)
			var mycleanlist = String(newlist).substring(0,newlist.length - 1);
			//alert(mycleanlist);
			//pass the new attribute list to the iframe
			//document.getElementById('getprice').src = 'getprice.cfm?id=' + form1.id.value + '&attributevalueidlist=' + mycleanlist + '&sale_price_apply=' + form1.sale_price_apply.value;
			//Edited - Anthony Wild - AJAX compatibility - 2009. September. Phase One Revamp
			getPriceUpdate(form1.id.value, mycleanlist, form1.sale_price_apply.value);

			pHeight = 0;
			//update the attributevalueidlist hidden field
			document.form1.attributevalueidlist.value = mycleanlist;
		}
	}
