// AVOID IE4 ERROR MESSAGES
if(window.focus){
	self.focus();
}
var myDomain='http://www.nzflower.co.nz';
function clearBasket(){
	if(confirm('Are you sure you want to clear your basket?')){
		clrBskt=document.cookie.indexOf('TheBasket');
		document.cookie='TheBasket=.';
		reFresh();
	}
}
function goOrder(){
	if((window.opener)&&(!window.opener.closed)){
		window.opener.focus();
		window.opener.top.location=myDomain+'/shop/basket.php';
		self.close();
	}else{
		if(confirm('Because the main window has been closed, this window will now load the basket form ...\n\nOnce there, please click the CHECKOUT and PAY button to transfer to the secure order form.')){
			if(window.navigator.appName.indexOf("Netscape")==-1){
				window.moveTo(0,0);			//	Was 1,1
				var Wide=screen.width;
				var High=screen.height-30;	//	Was 54
				window.resizeTo(Wide,High);
			}else{
				window.moveTo(1,1);
				window.outerHeight=screen.availHeight;
				window.outerWidth=screen.availWidth;
			}
			window.top.location.href=myDomain+'/shop/basket.php';
		}
	}
}
function leapTo(form) {
	var myIndex = form.dest.selectedIndex;
	if (form.dest.options[myIndex].value != '') {
		var myUrl = form.dest.options[myIndex].value;
		if (myUrl.indexOf('http://') == -1) {
			top.location.href = (myDomain+myUrl);
		} else {
			myWin = window.open(myUrl);
		}
	}
}
function presentValue(value){
	if(value<=0.9999){
		newPounds='0';
	}else{
		newPounds=parseInt(value);
	}
	dec='1';
	for(var i=1;i<=2;i++){
		dec=dec+'0';
	}
	if(value>0){
		newPence=Math.round((value+.000008-newPounds)*(eval(dec)));
	}else{
		newPence=0;
	}
	compstring='9';
	for(var i=1;i<=2-1;i++){
		if(eval(newPence)<=eval(compstring))newPence='0'+newPence;
		compstring=compstring+'9';
	}
	newString=newPounds+'.'+newPence+'';
	return(newString);
}
function reFresh(){
	self.location.href=self.location.href;	
}
function removeItem(itemNo){
	if(confirm('Remove product number '+itemNo+' from your basket?')){
		newItemList=null;
		itemList=0;
		for(var i=0;i<=fullList.length;i++){
			if(fullList.substring(i,i+1)=='['){
				itemStart=i+1;
			}else if(fullList.substring(i,i+1)==']'){
				itemEnd=i;
				theItem=fullList.substring(itemStart,itemEnd);
				itemList++;
				if(itemList!=itemNo){
					newItemList=newItemList+'['+fullList.substring(itemStart,itemEnd)+']';
				}
			}
		}
		remvItem=document.cookie.indexOf('TheBasket');
		document.cookie='TheBasket='+newItemList+';expires=Friday, 1-Jan-2015 00:00:00 GMT';
		reFresh();
	}
}
function updateBasket(){
	newItemList=null;
	itemList=0;
	for(var i=0;i<=fullList.length;i++){
		if(fullList.substring(i,i+1)=='['){
			thisItem=1;
			itemStart=i+1;
			fullstart=i+1;
		}else if(fullList.substring(i,i+1)==']'){
			itemEnd=i;
			itemList++;
			thiselement='quant'+itemList;
			newItemList=newItemList+'['+field1+'|'+field2+'|'+field3+'|'+document.SubmitForm.elements[thiselement].value+']';
		}else if(fullList.substring(i,i+1)=='|'){
			if(thisItem==1)field1=fullList.substring(itemStart,i);
			if(thisItem==2)field2=fullList.substring(itemStart,i);
			if(thisItem==3)field3=fullList.substring(itemStart,i);
			thisItem++;
			itemStart=i+1;
		}
	}
	index=document.cookie.indexOf('TheBasket');
	document.cookie='TheBasket='+newItemList+';expires=Friday, 1-Jan-2015 00:00:00 GMT';
	reFresh();
}
