// ==ClosureCompiler== // @compilation_level SIMPLE_OPTIMIZATIONS // @output_file_name register.min.js // ==/ClosureCompiler== /***************************************************************** * file: register.js * * Displays the registration menu for guest and new users * *****************************************************************/ function demo() { return '
'+ '

' + '

' + '

' + '
' + ''; } function register_guest() { return '

'+ '

'+ '

'+ '

'+ ''; } function register_pass() { return '

'+ '

' + '

'+ '

'+ '

'+ '

'+ ''; } var referral = 'How did you hear about us?
' + '
' + ''+ '' + '' + '' + '
' + '

' + '
' + '
'; var phone = ''; var notice = '

Please Note

The values shown on the calculator are a pre-valuation.

Item quality needs to be verified for final valuation.

This valuation is not a commitment.

All data is kept private.

'; var invalid_email = '

Email address invalid


Please enter a valid email address.

'; var nomatch_email = '

Email Addresses don\'t match!


Please check your email address to make sure it is correct.

'; var regular_finish = '

Email Addresses don\'t match!


Please check your email address to make sure it is correct.

'; function state(passState, finish, callback_to_submit) { return { state1: { html: demo(), buttons: { Cancel: 0, Next: 1 }, focus: 1, submit: function (ev, but, message, val) { mystate=1; fname = message.children('#name_first'); lname = message.children('#name_last'); sexm = message.children('#sex'); if (but != 0) { if (val['sex'] == -1) { sexm.css("border", "solid #ff0000 2px"); return false; } if (val['first_name'] == '') { fname.css("border", "solid #ff0000 2px"); return false; } else { fname.css("border", ""); } if (val['last_name'] == '') { lname.css("border", "solid #ff0000 2px"); return false; } else { lname.css("border", ""); } if (jQuery('#bademail').is(':visible')) { return false; } if (validateEmail(val['email'], val['confirm_email']) == 'nomatch') { jQuery.prompt.goToState('nomatch'); } else if (validateEmail(val['email'], val['confirm_email'])) { mystate += but; jQuery.prompt.goToState('state' + mystate); } else { jQuery.prompt.goToState('invalid'); } return false; } else { just_logging_in = false; jQuery.prompt.close(); } } }, state2: { html: passState, buttons: {Back: -1,Cancel:0, Next: 1}, submit: function (ev, but, message, val) { mystate = 2; if (but > 0) { if (val['password'] != null) { pass = message.children('password'); conf = message.children('confirmPass'); if (val['password'] != val['confirmPass']) { jQuery('#password').css("border", "solid #ff0000 2px"); jQuery('#confirmPass').css("border", "solid #ff0000 2px"); jQuery('#badpass').show(); return false; } if (val['password'].length < 8) { jQuery("#password").css("border", "solid #ff0000 2px"); jQuery("#shortpass").show(); return false; } } if (val['address_zip'] == '') { jQuery("#address_zip").css("border", "solid #ff0000 2px"); return false; } if (val['address_state'] == '') { jQuery("#address_state").css("border", "solid #ff0000 2px"); return false; } if (val['address_city'] == '') { jQuery("#address_city").css("border", "solid #ff0000 2px"); return false; } if (val['address_street'] == '') { jQuery("#address_street").css("border", "solid #ff0000 2px"); return false; } } if (but != 0) { mystate+= but; jQuery.prompt.goToState('state' + mystate); return false; } just_logging_in = false; jQuery.prompt.close(); } }, state3: { buttons: { Back: -1, Cancel: 0, Next: 1 }, focus: 2, submit: function (ev, but, message, val) { mystate = 3 if (but > 0) { lname = message.children('#referrals'); if (val['hvReferral'] == '9' && val['txtOther'] == '') { jQuery('#other').css('border', 'solid #ff0000 2px'); return false; } if (val['hvReferral'] == '3' && val['referred'] == '') { jQuery('#friend').css('border', 'solid #ff0000 2px'); return false; } if (val['hvReferral'] == '-1') { jQuery('#referrals').css("border", "solid #ff0000 2px"); return false; } else { jQuery('#referrals').css("border", "") } } if (but != 0) { if (val['phone_request'] == 'on') { mystate += but; } else { if (but == 1) { mystate += 2; } else { mystate += but; } } if (mystate == 5 && just_logging_in) { jQuery.each(val, function (i, obj) { str += '&' + i + '=' + obj; }); request = jQuery.ajax( { type: 'POST', url: 'http://' + abundacalc.server + '/trade/process/user/create/', data: '?action=create_user' + str, dataType: 'jsonp' }); request.done(function(data) { get_login_status(); just_logging_in = false; jQuery.prompt.close(); }); } else { jQuery.prompt.goToState('state' + mystate); } return false; } else { just_logging_in = false; jQuery.prompt.close(); } }, html: referral }, state4: { html: phone, buttons: { Back: -1, Cancel: 0, Next: 1 }, focus: 2, submit: function (ev, but, message, val) { mystate = 4; if (but > 0) { lname = message.children('#phone_type'); if (val['phone_type'] == '') { lname.css("border", "solid #ff0000 2px"); return false; } else { lname.css("border", ""); } } if (but != 0) { mystate += but; if (mystate == 5 && just_logging_in) { jQuery.each(val, function (i, obj) { str += '&' + i + '=' + obj; }); request = jQuery.ajax( { type: 'POST', url: 'http://' + abundacalc.server + '/trade/process/user/create/', data: '?action=create_user' + str, dataType: 'jsonp' }); request.done(function(data) { get_login_status(); just_logging_in = false; jQuery.prompt.close(); }); } else { jQuery.prompt.goToState('state' + mystate); } return false; } else { just_logging_in = false; jQuery.prompt.close(); } } }, state5: { html: notice, buttons: [{ title: 'Back', value: -1 }, { title: 'Cancel', value: 0 }, { title: 'Agree and Submit', value: 'submit'}], focus: 2, submit: function (ev, but, message, val) { mystate = 5; if (but == "submit") { jQuery.prompt.goToState('finish'); callback_to_submit(val); return false; } if (but != 0) { if (val['scanner'] == 'on') { mystate += but; } else if (but == -1) { mystate -= 2; } else { mystate += but; } jQuery.prompt.goToState('state' + mystate); return false; } else { just_logging_in = false; jQuery.prompt.close(); } isguest = false; } }, invalid: { html: invalid_email, buttons: { OK: true }, focus: 0, submit: function (v, m, f) { jQuery.prompt.goToState('state1'); return false; } }, nomatch: { html: nomatch_email, buttons: { OK: true }, focus: 0, submit: function (v, m, f) { jQuery.prompt.goToState('state1'); return false; } }, finish: { html: finish, buttons: {} } }; } function Register(pass, finish, call) { jQuery.prompt.close(); var stop = setInterval(function() { clearInterval(stop); jQuery.prompt(state(pass,finish, call)); }, 500); }