<!-- //
/************************************************************************************************
                                     						  	///   ///      ////  /      ///	
STORIS Management Systems						              	/    /  /      /     /     /  / 
Copyright 2009						                      		///  /  /  //  ///   /     /  / 
eStoris : Virtual Store						                	  /  /  /      /     /     /  / 
						                                      	///  ///       /     ////  ///
Tools Interfaces & eCommerce Applications

Program name:  sy599frm.js
Program Desc.: General validation functions used on main cart page...

Patch notes:

************************************************************************************************/
// called after a Qty is changed...
function formatNum(expr, decplaces) {
	var myNumber = parseFloat(expr.value)
	var returnValue = ""
	if (!isNaN(myNumber)){
		var str = "" + Math.round(eval(myNumber) * Math.pow(10,decplaces));
		while(str.length <= decplaces) {
			str = "0" + str
		}
		var decpoint = str.length - decplaces
		if (decplaces > 0){
			expr.value = str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
		}else{
			expr.value = myNumber;
		}
		returnValue = str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
	}else{
		expr.value = expr.defaultValue;
		showMessage("The quantity you enter must be a numeric value.", 400, 300)
		expr.focus();
		expr.select();
	}
	return returnValue
}

function clearCart(objForm) {
  smsForm = objForm
  smsForm.hidSessionCart.value = "" 
  smsForm.hidNextLink.value = "sy599frm.asp"
  smsForm.action = "subCart.asp"
  smsForm.submit()
}

function removeFromCart(prodNumber, UniqueID, KitValue){
	showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your cart</h1>', 400, 300)
	location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=RemoveFromCart")
}

function addToWishList(prodNumber, UniqueID, KitValue){
	if(KitValue!="0"){
		var r=confirm('This item is part of a group of products. By moving this one item, the other items in the group will also be moved to your wish list.');
		if (r==true){
			showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your wish list</h1>', 400, 300)
			location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=MoveToWL")
		}else{
			void(0);
		}
	}else{
		showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your wish list</h1>', 400, 300)
		location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=MoveToWL")
	}
	
}

function addToCart(prodNumber, UniqueID, KitValue){
	if(KitValue!="0"){
		var r=confirm('This item is part of a group of products. By moving this one item, the other items in the group will also be moved to your cart.');
		if (r==true){
			showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your cart</h1>', 400, 300)
			location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=MoveToCart")
		}else{
			void(0);
		}
	}else{
		showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your cart</h1>', 400, 300)
		location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=MoveToCart")
	}
}

function RemoveFromWL(prodNumber, UniqueID, KitValue){
	showMessage('<img src="images/ajax-loader.gif" class="loader"><h1 class="loader">Please wait while we update your wish list</h1>', 400, 300)
	location.href = ("processReformatWishList.asp?prodno=" + prodNumber + "&kitid=" + UniqueID + "&cartAction=WLRemove")
}
// -->