// simplecart.js version 1.1.0 2009-05-04
//
// javascript client-side functions for SimpleCart PHP system
//
// copyright © 2007-2009 WebAware Pty Ltd
//---------------------------------------------------------------------


function SimpleCart(instanceName) {
	this.instanceName = instanceName;
}

// class methods

SimpleCart.clearCart = function() {
	return confirm("Clear shopping cart of all items - are you sure?");
}

SimpleCart.onSubmitPayPal = function(frm) {
	var errmsg = SimpleCart.validatePayPal();
	var waiting = document.getElementById("waiting");

	if (errmsg.length > 0)
	{
		alert(errmsg);
		return false;
	}

	if (waiting)
		waiting.style.visibility = "visible";

	return true;
}

// default validation function for PayPal form
// to replace with own instance if required, simply implement the method again in page head
SimpleCart.validatePayPal = function(frm) {
	return '';
}

// submit a cart item update form, to update the qty of an item in a cart
SimpleCart.submitCartUpdate = function(cartitemid) {
	var frm = document.getElementById("cartForm_" + cartitemid);
	if (frm)
		frm.submit();
	return false;
}

// instance public methods
