
$(document).ready(function(){$("#registryFormButton").click(function(){$(".errorMessage").css('display','none');$("input").removeClass('error');$("#Registration_email").removeClass('error');$("#Registration_username").removeClass('error');$("#Registration_email_error").css('display','none');$("#Registration_username_error").css('display','none');var email=$("#Registration_email").val();var username=$("#Registration_username").val();var password=$("#Registration_password").val();var password_confirm=$("#Registration_password_confirm").val();var about_us=$("#Registration_about_us").val();var i_agree=$("#Registration_i_agree").attr('checked')?1:0;var verify_code=$("#Registration_verify_code").val();jQuery.ajax({url:'/user/checkregisterfields/?email='+email+'&username='+username+'&password='+password+'&password_confirm='+password_confirm+'&about_us='+about_us+'&i_agree='+i_agree+'&verify_code='+verify_code,dataType:'json',success:function(data){var str="";var first_error=null;for(key in data){str+=data[key]+"\n";$("#Registration_"+key).addClass('error');if(!first_error)first_error=key;}
if(str){alert(str);$("#Registration_"+first_error).focus();return false;}
$('#registerForm').submit();return true;},async:false});});$(".button").hover(function(){$(this).css('background-position','bottom right');$('#'+this.id+' span').css('background-position','bottom left');},function(){$(this).css('background-position','top right');$('#'+this.id+' span').css('background-position','top left');});simple_tooltip(".help","tooltip");});function setPersonInfoBlock(obj){var value=$(obj).val();if(value==1){$("#personInfoBlock-1").css('display','none');$("#personInfoBlock-2").css('display','none');}else{if(IE='\v'=='v'){$("#personInfoBlock-1").css('display','block');$("#personInfoBlock-2").css('display','block');}else{$("#personInfoBlock-1").css('display','table-row');$("#personInfoBlock-2").css('display','table-row');}}}
function checkFields(fields,url,form_name,form_id){$(".errorMessage").css('display','none');$("input").removeClass('error');url_part="";for(key in fields){if(fields[key]=='radio')value=$(":radio[name="+form_name+"["+key+"]]").filter(":checked").val();else value=$("#"+form_name+"_"+key).val();if(typeof(value)=='undefined')value='';url_part+=(url_part)?"&"+key+"="+value:"?"+key+"="+value;}
jQuery.ajax({url:url+url_part,dataType:'json',success:function(data){var str="";var first_error=null;for(key in data){str+=data[key]+"\n";$("#"+form_name+"_"+key).addClass('error');$("label[for='"+form_name+"_"+key+"']").addClass('error');if(!first_error)first_error=key;}
if(str){alert(str);$("#"+form_name+"_"+first_error).focus();return false;}
$('#'+form_id).submit();return true;},async:false});}
function simple_tooltip(target_items,name){$(target_items).each(function(i){$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");var my_tooltip=$("#"+name+i);$(this).removeAttr("title").mouseover(function(){my_tooltip.css({opacity:0.8,display:"none"}).fadeIn(400);}).mousemove(function(kmouse){my_tooltip.css({left:kmouse.pageX+15,top:kmouse.pageY+15});}).mouseout(function(){my_tooltip.fadeOut(400);});});}