/***********************************************************************
*
* getCartItem		-	Gets the Actinic Cart Value & No of Items
*
* Input: nIndex	-	Cart item index to retrieve
*							1 = TOTAL_VALUE
*							3 = CART_COUNT
*
* Returns:				Requested cart item or 0 (zero) if not found
*
************************************************************************/

//CART_CONTENT = Cookie name
//1 = TOTAL_VALUE
//3 = CART_COUNT

function getCartItem(nIndex)
	{
	var act_cart= getCookie("CART_CONTENT")
	var sTemp =(act_cart != null) ? sTemp=act_cart.split("\t"):0;
	return (sTemp.length > 0) ? sTemp[nIndex] : 0;
	}
	
/***********************************************************************
*
* win	- calls up the WUP window
*
* Input   - None
* Returns - None
************************************************************************/

function win()
	{
	var sMsg = window.open("paycash1.htm","","height = 507, width = 400, left = 378, top = 40");
	}

/***********************************************************************
*
* GotoAnchor - JS for jumping to an anchor - some user agents don't handle
*				anchors correctly if BASE HREF is present
*
* Input: 				sAnchor
*
* Returns:				nothing
*
************************************************************************/

function GotoAnchor(sAnchor)
	{
	window.location.hash = sAnchor;
	}

/***********************************************************************
*
* getFullCart		-	fetches cart content summary
*
* Returns:		-	HTML string for summary display
*
* Graham Bradley 2006
* Comments & bug reports to web@gbradley.co.uk
*
************************************************************************/

function getFullCart(){

var path="/cgi-bin/";					// path from your root folder to the cgi-bin
var sID=1;						// Actinic script number

var cookie=getCartItem(4);
if (!cookie){
	return "No items in cart.";
	}
var re=new Array();
var match=new Array();
var total=0;
var str;
re[0]=/tax=((\d|\.)*)/g;
re[1]=/cur=([^&]*)&/g;
re[2]=/&(.*)/g;
for (i=0;i<re.length;i++){
	match[i]=re[i].exec(cookie);
	match[i]=match[i][1];
	}
match[0]=(match[0]/100)+1;
lines=match[2].split("&");
store=new Array();
re[0]=/^(\d*)x/;
re[1]=/x([^>]*)>/;
re[2]=/>([^>]*)>/;
re[3]=/>([^>]*)$/;

str="<table width='100%'>";
for (i=0;i<lines.length;i++){
	for (j=0;j<re.length;j++){
		detail=lines[i].match(re[j]);
		store[j]=detail[1];
		}
	store[3]=store[3]*1;
	str+="<tr><td valign='top'>"+store[0]+"x </td><td><a href='http://"+document.domain+path+"ss00000"+sID+".pl?PRODREF="+store[1]+"&NOLOGIN=1'>"+store[2]+"...</a></td><td align='right' valign='top'>"+match[1]+(store[3]).toFixed(2)+"</td></tr>";
	total+=store[3];
	}
gTotal=((Math.ceil(total*match[0]*100))/100).toFixed(2);
if (match[0] > 1){
	vat=((Math.round((gTotal-total)*100))/100).toFixed(2);
	str+="<tr><td colspan='2'>VAT</td><td align='right'>"+match[1]+vat+"</td></tr>";
	}
str+="</table><table width='100%'><tr><td><b>Total</b></td><td align='right'><b>"+match[1]+gTotal+"</b></td></tr></table>";
return str;
}