//shopping cart ajax functions
function cjax_add(pid,frompage,quantity) {
	randomseed = $random(0,10000000);
	new Ajax('/ajax_cart.php?mode=add&quantity=' + quantity + '&frompage=' + frompage + '&pid=' + pid, {
		update: 'minicart',
		evalScripts: false,
		onComplete: function() { 
			MOOdalBox.open("/item_added.php?pid=" + pid + "&quantity=" + quantity + "&frompage=" + frompage + "&randseed=" + randomseed, quantity + " ITEMS ADDED TO YOUR CART", "moodalbox 500 400"); 
			$('top_cart').innerHTML = '<a href="/cart.php?frompage=' + frompage + '" style="height: 28px;"><div id="small_cart_icon"></div><strong>Checkout Now</strong></a>';
			setTimeout("cjax_update('" + frompage + "')",1200);
		}
	}).request();
}

function cjax_add_closeout(pid,frompage,quantity) {
	randomseed = $random(0,10000000);
	new Ajax('/ajax_cart_closeout.php?mode=add&quantity=' + quantity + '&frompage=' + frompage + '&pid=' + pid, {
		update: 'minicart',
		evalScripts: false,
		onComplete: function() { 
			MOOdalBox.open("/item_added.php?pid=" + pid + "&quantity=" + quantity + "&frompage=" + frompage + "&randseed=" + randomseed, quantity + " ITEMS ADDED TO YOUR CART", "moodalbox 500 400"); 
			$('top_cart').innerHTML = '<a href="/cart.php?frompage=' + frompage + '" style="height: 28px;"><div id="small_cart_icon"></div><strong>Checkout Now</strong></a>';
			setTimeout("cjax_update('" + frompage + "')",1200);
		}
	}).request();
}

function cjax_update(frompage) {
	new Ajax('/ajax_cart.php?mode=update&frompage=' + frompage, {
			update: 'minicart',
			evalScripts: false
		}).request();
}

function cjax_add_finish(pid,finish,quantity,frompage) {
	randomseed = $random(0,10000000);
	new Ajax('/ajax_cart.php?mode=addfinish&finish=' + finish + '&pid=' + pid, {
		evalScripts: false,
		onComplete: function() { 
			MOOdalBox.open("/item_added.php?finish=selected&pid=" + pid + "&quantity=" + quantity + "&frompage=" + frompage + "&randseed=" + randomseed, quantity + " ITEMS ADDED TO YOUR CART", "moodalbox 500 400"); 
			setTimeout("cjax_update('" + frompage + "')",1200);
		}
	}).request();	
}

