<!-- Begin

var USER_ID="95148076"; 					   // Mal's e-commerce User ID
var EC_URL="http://ww7.aitsafe.com/cf/";   // Mal's e-commerce Shopping Basket URL 
var ADD_BASKET=EC_URL + "add.cfm?userid="; // Mal's e-commerce Add Basket URL

var RETURN_DNS="www.swifttrading.co.uk";		   // Return URL Address
var gsFILENAME=window.location.pathname;   // Get Current file Path


//** Product Information Type **//
function T_P_INFO(pname, version, price, hash) {
  this.pname=pname
  this.version=version
  this.price=price
  this.hash=hash
}


//--------
//	ViewCurrentOrder: View Current Order in a shopping basket
//--------
function ViewCurrentOrder(){

	var sView_basket=EC_URL + "review.cfm?userid="; // Mal's e-commerce View Basket URL

	// View Current Order //
	sUrlPath = sView_basket + USER_ID;
    location.href = sUrlPath;
	return(0);
}

//--------
//	  AddToOrder: Add a products in a shopping basket
//--------
function AddToOrder(pThisForm, pProductNo){

	var iIndexNo=0;
	var sUrlPath="";
	var sName="";
	var sVersion="";
	var iQuantity=1;
	var sPrice="";
	var sHash="";

	if (pProductNo==""){
	    alert('AddToOrder: Error! No Product Number!');
		return(1);
	}
	
	// Set Index No
	iIndexNo=(pProductNo-1)*3;

	

	// Set Product Information
	sName=tPRODUCT[iIndexNo].pname;
    sPrice=tPRODUCT[iIndexNo].price;
	sVersion=tPRODUCT[iIndexNo].version;
	sHash=tPRODUCT[iIndexNo].hash;

	// Set Quantity	
	iQuantity=parseInt(pThisForm.qty.value);
	// Check Quantity
	if (isNaN(iQuantity)==true){
	    alert('Invalid Quantity Setting!');
		return(1);
	}
	if (iQuantity <= 0 ){
	    alert('Please set the quantity at least one');
		return(1);
	}
	
	// If the price is not a number //
	if (isNaN(sPrice)==true){
	    alert('Please contact us for the price and arrangement at \n "info@swifttrading.co.uk"');
		return(1);
	}

	// Set Shopping Basket URL //
	sUrlPath = ADD_BASKET + USER_ID + "&" + 
	           "product=" + sName +  ":+" + sVersion + "&" + 
			   "price=" + sPrice + "&" + 
			   "qty=" + iQuantity + "&" + 
			   "return=" + RETURN_DNS + gsFILENAME;
	// Add Hash
	// sUrlPath = sUrlPath + "&" + "hash=" + sHash; 
			   
	// Go to Location //
	if (sUrlPath != ""){
	    // alert(sUrlPath);
		window.location.href = sUrlPath;
	}else{
	    alert('AddToOrder: Error! No Location!');
		return(1);
	}
}

//--------
//	  AddToOrder: Add a products in a shopping basket
//--------
function BuyNow(pProductName, pPrice, pQty, pHash){

	var sName="";
	var sVersion="";
	var iQuantity=1;
	var sPrice="";
	var sHash="";

	/**** Parameter Check ****/
	// Check Quantity
	if (pPrice==""){
	    alert('Error! Invalid Price Setting!');
		return(1);
	}
	// Set Quantity	
	iQuantity=parseInt(pQty);
	// Check Quantity
	if (isNaN(iQuantity)==true){
	    alert('Error! Invalid Quantity Setting!');
		return(1);
	}
	if (iQuantity <= 0 ){
	    alert('Error! Please set the quantity at least one');
		return(1);
	}

	//*** Set Shopping Basket URL ***//
	sUrlPath = ADD_BASKET + USER_ID + "&" + 
	           "product=" + pProductName + "&" + 
			   "price=" + pPrice + "&" + 
			   "qty=" + pQty + "&" + 
			   "return=" + RETURN_DNS + gsFILENAME;
	// Add Hash
	// if (pHash != ""){
	//    sUrlPath = sUrlPath + "&" + "hash=" + pHash; 
	//}

	//*** Go to Location ***//
	if (sUrlPath != ""){
	    // alert(sUrlPath);
		window.location.href = sUrlPath;
	}else{
	    alert('AddToOrder: Error! No Location!');
		return(1);
	}
}
// End -->

