$(document).ready(function(){$(function(){$("form#add #input_btn").attr("disabled",true).addClass("off");$("#word").keyup(function(){if($("#word").val().length>=3){$("#output_prefix").css("visibility","visible");$("#output").html("Calculating...");$("#input_btn").attr("disabled",false).removeClass("off");$.ajax({type:"POST",url:"addword",cache:true,data:"word="+$("#word").val(),success:function(msg){$("#output").html(msg);},error:function(msg){$("#output").html("Error while processing. Sorry....");}});}else{$("#output").html("");$("#output_prefix").css("visibility","hidden");$("#input_btn").attr("disabled",true).addClass("off");}});});});$(document).ready(function(){$(function(){$("a.vote_down,a.vote_up").click(function(){id=$(this).parent().attr('id');action=$(this).attr('class');val=parseInt($("p#"+id+" ."+action+" span").html());$("p#"+id+" ."+action+" span").html("<img src='img/spinner.gif'/>");$("p#"+id).children("a").unbind('click');$.ajax({type:"POST",data:"action="+action+"&id="+$(this).parent().attr("id"),url:"vote",cache:true,success:function(msg){$("p#"+id+" ."+action+" span").fadeIn().html(val+1);$("p#"+id).children("a").unbind('click').addClass("number_off");$("p#"+id).children("a").children("img").fadeTo("fast",0.5);},error:function(msg){$("p#"+id).html("Error. Sorry");}});});});});
