// GOI CART MOD FUNCTIONS

function Asc(String)
{

	return String.charCodeAt(0);

}

function Chr(AsciiNum)
{

	return String.fromCharCode(AsciiNum)

}


function Reverse(str)
{

	return str.split('').reverse().join('')

}

function Mid(str, start, len)
{

    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}

	
	
function encrypt(str) {


var x = '';
var i = '';
var tmp = '';

for(i = 0; i < str.length; i++)
{

x = Mid(str, i, 1)
tmp = tmp + Chr(Asc(x) + 1)
}

return Reverse(tmp);

}

	
	
	
	// buyItem - adds an item to the shooping basket
	function buyItem(productid,qty,price) {
	
		if ( price == '') {
  		alert("Please select a price option");
  		return false;
		} else {
		}
	
		
		
		if ( qty < '1') {
  		alert("Please enter the quantity that you require.");
  		return false;
		} else {
		}	
	
	
	varCartData = encrypt(productid +"|" +qty +"|" +price);
	window.location="shopping.asp?action=add&cartdata=" +varCartData;
	//window.location="shopping.asp?action=add&item=" +productid +"&count=" +qty +"&price=" +price;

	               
	}