﻿function updatebasket() {
	document.basket.actn.value='update';
	document.basket.submit()
}
function keepshopping() {
	document.sidenav.action='browse.asp';
	document.sidenav.submit()
}
function emptybasket() {
	document.sidenav.actn.value='empty';
	document.sidenav.submit()
}
function removeproduct(optionid) {
	document.sidenav.actn.value='del';
	document.sidenav.optionid.value=optionid;
	document.sidenav.submit()
}

function showbasket() {
    document.sidenav.submit();
}

function addtobasket(productid,optionid,curr) {
    document.sidenav.curr.value=curr;
	document.sidenav.actn.value='add';
	document.sidenav.productid.value=productid;
	document.sidenav.optionid.value=optionid;
	document.sidenav.submit();
}

function genericsearch() {
    // clear all the inputs except searchtext and post to browse.asp rather than basket.asp
	document.sidenav.cat.value='';
	document.sidenav.productid.value='';
	document.sidenav.optionid.value='';
	document.sidenav.searchcategory.value='';
	document.sidenav.action = 'browse.asp';
    document.sidenav.submit();
}

function refreshbrowse() {
    // refresh browse page to reflect changes to currency or postage option
    document.sidenav.action = 'browse.asp';
	document.sidenav.submit();
}

function setallorderlines(obj)
	{	
	var anObject=obj.form.orderlineshipmentstatus;
	if(anObject.length>=0)
		{
		// loop through the orderlineshipmentstatus lines setting them equal to this
		for (var i = 0; i < anObject.length; ++i) 
			{
			anObject[i].selectedIndex = obj.selectedIndex;
			}
		}
	else
		{
		anObject.selectedIndex = obj.selectedIndex;
		}
	}