
/*
* Check software serial number
*/
function checkSerial() {
    if($('#serialNeeded').val(1)) 
    {
        var srl = $('#serial1').val() + $('#serial2').val() + $('#serial3').val() + $('#serial4').val() + $('#serial5').val();
        if(srl.length==20) {
            $.ajax
            ({
                type: 'POST',
                processData: true,
                url: '/user/serialcheck/',
                data: 'serial='+srl,
                dataType: 'html',
                success: function(data){
                    if(data == 'true') {
                    	if($('.successSerial').css('display') == 'none')
                    	{
	                        $('.buttons').removeAttr('disabled');
	                        $('.errorSerial').css('display', 'none');
	                        $('.successSerial').html('Ok!');
	                        $('.successSerial').css('display', 'inline');
	                        bounceAnimation($('.successSerial'));
                    	}
                    }
                    else {
                        
                        $('.errorSerial').html(data);
                        if($('.errorSerial').css('display') != 'inline')
                        {
                        	$('.successSerial').css('display', 'none');
                            $('.errorSerial').css('display', 'inline');
                            bounceAnimation($('.errorSerial'));
                        }
                    }
                }
            });
        }
    }
}

/*
* payement validation, then send user to paypal or bank account identification
*/
function sendBill() {
    if($("input:checked").val() == "P") {
    	document.getElementById('formSerial').submit();
    } else {
        document.location.href="/payment/moneyOrder/";
    }
}
