
function cart_qty_inc(theForm, idx) {
	if ( theForm.elements["quantity[]"] ) {
		var the_obj = theForm.elements["quantity[]"];
		if ( the_obj.length == undefined ) {
			the_obj.value = parseInt(the_obj.value) + 1;
			cart_qty_check(theForm, the_obj.value, idx);
			return;
		} else {
			for (var i = 0;i <= the_obj.length;i++) {
				if ( i == idx ) {
					the_obj[i].value = parseInt(the_obj[i].value) + 1;
					cart_qty_check(theForm, the_obj[i].value, idx);
					return;
				}
			}
		}
	}
}
function cart_qty_dec(theForm, idx) {
	if ( theForm.elements["quantity[]"] ) {
		var the_obj = theForm.elements["quantity[]"];
		if ( the_obj.length == undefined ) {
			the_obj.value = parseInt(the_obj.value) - 1;
			if ( parseInt(the_obj.value) < 0 ) { the_obj.value = '0'; }
			cart_qty_check(theForm, the_obj.value, idx);
			return;
		} else {
			for (var i = 0;i < the_obj.length;i++) {
				if ( i == idx ) {
					the_obj[i].value = parseInt(the_obj[i].value) - 1;
					if ( parseInt(the_obj[i].value) < 0 ) { the_obj[i].value = '0'; }
					cart_qty_check(theForm, the_obj[i].value, idx);
					return;
				}
			}
		}
	}
}
function cart_set_val(theForm, value, idx) {
	if ( theForm.elements["quantity[]"] ) {
		var the_obj = theForm.elements["quantity[]"];
		if ( the_obj.length == undefined ) {
			the_obj.value = value;
			if ( parseInt(the_obj.value) < 0 ) { the_obj.value = '0'; }
		} else {
			for (var i = 0;i < the_obj.length;i++) {
				if ( i == idx ) {
					the_obj[i].value = value;
					if ( parseInt(the_obj[i].value) < 0 ) { the_obj[i].value = '0'; }
					return;
				}
			}
		}
	}
}

function cart_qty_check(theForm, value, idx) {
	if ( theForm.elements["sqty[]"] ) {
		var the_obj = theForm.elements["sqty[]"];
		if ( the_obj.length == undefined ) {
			if ( parseInt(the_obj.value) < parseInt(value) ) {
				alert('Your selection is higher than the in-stock value.  Auto-adjusted');
				cart_set_val(theForm, the_obj.value, idx);
				return;
			}
		} else {
			for (var i = 0;i < the_obj.length;i++) {
				if ( i == idx ) {
					if ( parseInt(the_obj[i].value) < parseInt(value) ) {
						alert('Your selection is higher than the in-stock value.  Auto-adjusted');
						cart_set_val(theForm, the_obj[i].value, idx);
					}
					return;
				}
			}
		}
	}
}



var urlAddress = "http://www.wholesalerubbermaidsupply.com"; 
var pageName = "Wholesale Rubbermaid Supply"; 
function addToFavorites() { 
	if (window.external) { 
		window.external.AddFavorite(urlAddress,pageName) 
	} else { 
		alert("Sorry! Your browser doesn't support this function."); 
	}
} 
