function addToBasket(strSKU, strOrigin,quanti,stringVari, currentPrice){
	var strOrigin = strOrigin;
	strOrigin = strOrigin.replace("&", "*")
	var strURL = "processing/addToBasketProcessing.asp?strProductSKU=" + strSKU;
	strURL += "&intQTY="+quanti;
	strURL += "&strOrigin=" + strOrigin;
	strURL += "&strVariations=" + stringVari;
	strURL += "&cPrice=" + currentPrice;
	window.location= strURL ;
}

function fn_addToBasket(strSKU, strOrigin, intQuantity,attName,cPrice){
	var strOrigin = strOrigin;
	strOrigin = strOrigin.replace("&", "*")
	//var strProductQTY = "QTY-" + intId;
	var arrAttName        =new Array();
	var arrVari        =new Array();
	var totalPriceHtml    =document.getElementById("totalPrice"); 
	var currentPrice = cPrice;
	arrAttName = attName.split(",");
	stringVari ="0";
	if (arrAttName.length>1){
				for(p=1;p<=arrAttName.length-1;p++){
					//alert(arrAttName[p]);
						
					elementAtt = document.getElementById(arrAttName[p]);
					stringVari = stringVari+','+elementAtt.value;
					
						 
						
					}
			}
	//alert(attName+oPrice);
	var intQTY = document.getElementById(intQuantity).value;

	if(intQTY <= 0 || intQTY != parseInt(intQTY)){
		alert('Please add a valid quantity');
	}
	else{
		var strURL = "processing/addToBasketProcessing.asp?strProductSKU=" + strSKU;
		strURL += "&intQTY=" + intQTY;
		strURL += "&strOrigin=" + strOrigin;
		strURL += "&strVariations=" + stringVari;
		strURL += "&cPrice=" + currentPrice;
		window.location= strURL ;
	}
}
function fn_addToBasketC(strSKU, strOrigin, intQuantity,attName,cPrice){
	var strOrigin = strOrigin;
	strOrigin = strOrigin.replace("&", "*")
	//var strProductQTY = "QTY-" + intId;
	
	
	var currentPrice = cPrice;
	
	//alert(attName+oPrice);
	var intQTY = document.getElementById(intQuantity).value;

	if(intQTY <= 0 || intQTY != parseInt(intQTY)){
		alert('Please add a valid quantity');
	}
	else{
		var strURL = "processing/addToBasketProcessing.asp?strProductSKU=" + strSKU;
		strURL += "&intQTY=" + intQTY;
		strURL += "&strOrigin=" + strOrigin;
		strURL += "&strVariations=" + attName;
		strURL += "&cPrice=" + currentPrice;
		window.location= strURL ;
	}
}


function fn_typeID(obj){
	//this function is called when the user enters four characters in the property id field   
  
	if(obj != parseInt(obj)){
		alert('The Quantity field must be numeric');
		document.getElementById('intBedsQuantity').select();
		
		return false;
	}
	
}
function getDetails(strSKU){
	var strURL = "beds.asp?strSKU=" + strSKU;	
	window.location = strURL;
}

function removeItem(strSKU,strVari){
	strURL = "processing/removeFrombasket.asp?strSKU=" + strSKU+"&strVariations="+strVari;
	window.location = strURL;
}

function showFullImage(arg){
	var strImagePath = arg;
	//alert(strImagePath);
	window.open(strImagePath,'','')
}
function validationForm(){
	
	
	if(document.shippingForm.strEmail.value==''){document.shippingForm.strEmail.focus();alert('please input email');return false}
	
	
	document.shippingForm.submit();
}

function getAttributValue(attName,oPrice,strSku){
	var arrAttName        =new Array();
	var arrVari        =new Array();
	var totalPriceHtml    =document.getElementById("totalPrice"); 
	var currentPrice = oPrice;
	
	arrAttName = attName.split(",");
	mainImage = document.getElementById('mainLargeImage');
			if (arrAttName.length>1){
					
					for(p=1;p<=arrAttName.length;p++){
					elementAtt = document.getElementById(arrAttName[p]);
					
					//alert(arrAttName[p]);
					arrVari = elementAtt.value.split(",");
					//alert(currentPrice);
						if (arrVari[1]==1){
						currentPrice = (parseFloat(currentPrice)+parseFloat(arrVari[2])).toFixed(2);
						totalPriceHtml.innerHTML = currentPrice;
						imgHidden = document.getElementById(strSku+'_'+arrVari[4]);
							imgPath = imgHidden.value;
							
							mainImage.src=imgPath;
							
						}else if(arrVari[1]==2){
						currentPrice = (parseFloat(currentPrice)-parseFloat(arrVari[2])).toFixed(2);
							totalPriceHtml.innerHTML = currentPrice;
							imgHidden = document.getElementById(strSku+'_'+arrVari[4]);
							imgPath = imgHidden.value;
							
							mainImage.src=imgPath;
							

							//mainImage.src='images/1/100001_14_l.jpg';
							}
							else if(arrVari[1]==0){
						     currentPrice = (parseFloat(arrVari[2])).toFixed(2);
							totalPriceHtml.innerHTML = currentPrice;
							imgHidden = document.getElementById(strSku+'_'+arrVari[4]);
							imgPath = imgHidden.value;
							
							mainImage.src=imgPath;
							
							//mainImage.src='images/1/100001_14_l.jpg';
							}
					}
			}
		
	}
function setVariValue(variValue){
	var arrVari        =new Array();
	
	var totalPriceHtml    =document.getElementById("totalPrice"); 
	var currentPrice = totalPriceHtml.innerHTML;
	arrVari = variValue.split(","); 
	if (arrVari[1]==1){
		currentPrice = (parseFloat(currentPrice)+parseFloat(arrVari[2])).toFixed(2);
						totalPriceHtml.innerHTML = currentPrice;	
						//alert(currentPrice);
						}else if(arrVari[1]==2){
						currentPrice = (parseFloat(currentPrice)-parseFloat(arrVari[2])).toFixed(2);
							totalPriceHtml.innerHTML = currentPrice;		}
	}	
