function addContestItemToCart() {
	if ($F('contestType') == "Select") {
		alert('Please select a Type of Contest');
	} else if ($F('shots') == "") {
		alert('Please enter the # of Shots/Attempts');
	} else if ($F('amount') == "") {
		alert('Please enter the Prize Amount');
	} else {
		var params = $('contests').serialize();
		var container = 'myQuoteWrapper';
		var url = '/index.php?c=putting_contests&m=process&' + params;
		var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

		new Ajax.Updater({ success: container, failure: failureAlert }, url, {
		  method: 'get',
		  parameters: { },
		  evalScripts: true
		});
	}
}

function addShootoutItemToCart() {
	if ($F('contestValue') == "" || $F('contestValue') < 99999) {
		alert('Please enter a Prize Value between $100,000 and $1,000,000');
	} else if ($F('shots') == "") {
		alert('Please enter the # of Shots/Attempts');
	} else {
		var params = $('contests').serialize();
		var container = 'myQuoteWrapper';
		var url = '/index.php?c=shootout_contests&m=process&' + params;
		var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

		new Ajax.Updater({ success: container, failure: failureAlert }, url, {
		  method: 'get',
		  parameters: { },
		  evalScripts: true
		});
	}
}

function addSignItemToCart() {
	var params = $('addSignForm').serialize();
	var container = 'myQuoteWrapper';
	var url = '/index.php?c=signs_banners&m=processSign&' + params;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
}

function addBannerItemToCart() {
	var params = $('addBannerForm').serialize();
	var container = 'myQuoteWrapper';
	var url = '/index.php?c=signs_banners&m=processBanner&' + params;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
}

function addPackageItemToCart() {
	var container 	= 'myQuoteWrapper';
	var params 		= $('addSignForm').serialize();
	var url 		= '/index.php?c=hio_insurance&m=processPackage&' + params;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
}

function addCustomPackageToCart() {
	var container 	= 'myQuoteWrapper';
	var params 		= $('addSignForm').serialize();
	var url 		= '/index.php?c=hio_insurance&m=processCustomPackageToCart&' + params;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
}

function addPrizeItemToPackageCart(prizeId) {
	var container 	= 'packageCartWrapper';
	var prizeId 	= prizeId;
	var shots 		= $F('players');
	var distance 	= $F('distance');
	var hole 		= $F('hole');
	var url 		= '/index.php?c=hio_insurance&m=processPrizeForPackage&prizeId=' + prizeId + '&shots=' + shots + '&distance=' + distance + '&hole=' + hole;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
	resetProcess();
	new Effect.ScrollTo($('header'), { queue: 'front' });

}

function addCashPrizeItemToPackageCart() {
	var container 			= 'packageCartWrapper';
	var cashPrizeName 	= $F('cash_prize_name');
	var cashPrizeValue	= $F('cash_prize_value');
	var shots 				= $F('players');
	var distance 			= $F('distance');
	var hole 				= $F('hole');
	var url 				= '/index.php?c=hio_insurance&m=processCashPrizeForPackage&cashPrizeName=' + cashPrizeName + '&cashPrizeValue=' + cashPrizeValue + '&shots=' + shots + '&distance=' + distance + '&hole=' + hole;
	var failureAlert 		= function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
	resetProcess();
	new Effect.ScrollTo($('header'), { queue: 'front' });

}

function addCustomPrizeItemToPackageCart() {
	var container 			= 'packageCartWrapper';
	var customPrizeName 	= $F('custom_prize_name');
	var customPrizeValue	= $F('custom_prize_value');
	var shots 				= $F('players');
	var distance 			= $F('distance');
	var hole 				= $F('hole');
	var url 				= '/index.php?c=hio_insurance&m=processCustomPrizeForPackage&customPrizeName=' + customPrizeName + '&customPrizeValue=' + customPrizeValue + '&shots=' + shots + '&distance=' + distance + '&hole=' + hole;
	var failureAlert 		= function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
	tb_remove();
	resetProcess();
	new Effect.ScrollTo($('header'), { queue: 'front' });

}

function addAlaCartPackageItemToCart() {
	var container = 'myQuoteWrapper';
	var url = '/index.php?c=hio_insurance&m=processPackageToCart';
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true,
//	  onSuccess: emptyPackageCart,
	  onComplete: tb_remove
	});

}


function removeItemFromCart(itemId) {
	var container = 'myQuoteWrapper';
	var url = '/index.php?c=hio_insurance&m=processRemove&action=remove&itemId=' + itemId;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
}

function removeItemFromPackageCart(itemId) {
	var container = 'packageCartWrapper';
	var url = '/index.php?c=hio_insurance&m=processRemovePackage&action=remove&itemId=' + itemId;
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
}

function emptyCart() {
	var container = 'myQuoteWrapper';
	var url = '/index.php?c=hio_insurance&m=emptyCart';
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
}

function emptyPackageCart() {
	var container 	= 'packageCartWrapper';
	var url 		= '/index.php?c=hio_insurance&m=emptyPackageCart';
	var failureAlert = function() { alert('Sorry there was an error.  Please try again.'); };

	new Ajax.Updater({ success: container, failure: failureAlert }, url, {
	  method: 'get',
	  parameters: { },
	  evalScripts: true
	});
}

function resetProcess() {
	$j("#directions form input").each(function (){
		$j(this).val('');
	});
	$j("a.step").each(function() {
		$j(this).removeClass("active");
	});
	$j("#directions form").addClass("active");
	$j("#step1").addClass("active");
	$j(".signOptions").hide();
	hidePrizes();
	$j("#players").focus();
	return false;
};

function hidePrizes() {
	$j("#carsDiv").hide();
	$j("#tripsDiv").hide();
	$j("#cashDiv").hide();
	$j("#bonusDiv").hide();
	$j("#createDiv").hide();
	$j("a.option").removeClass('active');
}

