/*checkout.js - performs the jquery form checking and help*/

$(document).ready(function() {

$('#checkout').find('#cbtn').click(function(e) {
e.preventDefault();
var isGood=true;
var errArr = new Array();
	if ($('.coerrormsg').length > 0) {$('.coerrormsg').fadeOut(300);}
//check the "required" fields in each of the displayed fieldsets are filled in and create a DOM element containing a notice for each one if it's not.
	$(this).parents('form').find('.required').each(function(){
	var msg="This field is required &#9654;";
		if (!$(this).val().length) {
		var w = $(this).width()+"px";
		var pos = $(this).position();
		var posleft = pos.left-130+"px";
		var postop = pos.top+3+"px";
		var cVar = $('.coerrormsg').length;
		$(this).parent().append('<p class="coerrormsg" id="msg'+cVar+'"></p>');
		var el = "#msg"+cVar;
		$(el).css('position','absolute').css('left',posleft).css('line-height','20px').css('top',postop).css('padding','3px').css('background-color','#cc0000').css('color','#ffffff').css('font-weight','bold').html(msg).hide().fadeIn(300).end();
		isGood=false;};//end if

});//end if

if (isGood) {
$(this).parents('form').submit();
}
});//end error checking


if ($('#checkoutConf').length > 0) {
$('#checkoutConf').submit();
}

});//end document ready
