
$(function(){function fix(dm){var t=new String(dm);return t.length>1?t:('0'+t);}
$('#country_code').bind('change',function(){if(this.value=='cn'||this.value==''){$('#en_city_hometown').hide();$('#cn_city_hometown').show();$('#about_china_interest').hide();}else{$('#cn_city_hometown').hide();$('#en_city_hometown').show();$('#about_china_interest').show();}});$('#career_level').bind('change',function(){$('.current_status_hide').hide();if(this.value=='5'){$('#student_chooser').show();$('#industry_chooser').hide();}else{$('#industry_chooser').show();}});$('.is_employer').bind('click',function(){if(this.value=='personal'){$('#employer_company_info').hide();}else{$('#employer_company_info').show();}});var svalidator=$('#register_form').bind('invalid-form.validate',function(){if(svalidator.numberOfInvalids()>0){alert('There are serious errors in your form submission, please see the page for details.');}}).validate({focusInvalid:false,rules:{},messages:{},errorElement:'em',onkeyup:false,errorPlacement:function(error,element){if(element.is(':radio')){error.appendTo(element.next());}
else
if(element.is(':checkbox')){error.appendTo(element.parent().parent());}
else{error.appendTo(element.parent());}},submitHandler:function(form){$('#r_btn_submit').hide();$('#processing_img').show();form.elements['birthday'].value=form.elements['bYear'].value+'-'+fix(form.elements['bMonth'].value)+'-'+fix(form.elements['bDay'].value);$.post('/register/continue',$('#register_form').serialize(),function(r){if(r.status=='no'){if(r.errors){alert(security_invalid_data_error);svalidator.showErrors(r.errors);}
else
if(r.error){alert(r.error);}
$('#processing_img').hide();$('#r_btn_submit').show();}
else
if(r.status=='yes'){location.href='/register/propose';}
else{$('#r_btn_submit').show();$('#processing_img').hide();}},'json');}});$('#r_btn_submit').attr('disabled',false);});
