function showInfos(disab,showimg){$(disab).attr("disabled","disabled");$(showimg).html("&nbsp;<img src='"+da_base+"img/loading.gif'>").show();}function hideInfos(disab,showimg){$(disab).removeAttr("disabled");$(showimg).hide();}var rattips=new Array("Μηδέν εις το πηλίκο","Λάθος ορισμός","Ελλιπής ορισμός","Ικανοποιητικός ορισμός","Καλός ορισμός","Τέλειος ορισμός!","Μηδέν εις το πηλίκο","Μάπα","Ψιλομπούρδα","Εντάξει","Σωστόοοος...","Τα σπάει!");function rateme(w,d,r,o){$.post(da_base+"lemma/rateme",{w:w,d:d,r:r,o:o},function(txt){var t=txt.split(":");if(t[0]=="1"){$("#ri"+w+"s_"+d).html('<img src="'+da_base+"img/toolbox/s"+t[4]+'.gif" onmouseover="tooltip('+d+", 'Έχετε ήδη βαθμολογήσει το"+(w=="d"?"ν ορισμό":" λήμμα")+'\');" onmouseout="tooltip('+d+",'');\"/>");$("#ri"+w+"v_"+d).html(t[2]);$("#ri"+w+"i_"+d).html('<img src="'+da_base+'img/toolbox/in.gif" class="action_img_disabled" onmouseover="tooltip('+d+", '"+(w=="d"?"Ορισμός":"Λήμμα")+": Μ.Ο.: "+t[1]+"%, Γ.Κ.: "+t[3]+'\');" onmouseout="tooltip('+d+",'');\"/>");}});return false;}function add_new_def(d){showInfos("#addnewdefButton_"+d,"#addnewmessage_"+d);$("#addnewlemma_err_"+d).hide();var de=$("#definition_"+d).val();var ex=$("#example_"+d).val();if(de==""||ex==""||de.match(/^\s+$/)||ex.match(/^\s+$/)){hideInfos("#addnewdefButton_"+d,"#addnewmessage_"+d);$("#addnewlemma_err_"+d).show("normal");}else{var c="|";$("input[name='categu_"+d+"']:checked").each(function(){c+=$(this).val()+"|";});var o=$("input[name='isover18u_"+d+"']:checked:first").val();$.post(da_base+"lemma/addajax",{defid:d,def:de,example:ex,cats:c,isover:o,isidx:$("#isidx").val()},function(txt){$("#lemma_"+d).after(txt);resetTabs(d);});}return false;}function resetTabs(d){$("#tabs_"+d+" > ul").tabs("select",$("#tabs_"+d+" > ul").tabs("length")-1);}function preview(d){showInfos("#previewButton_"+d,"#addnewmessage_"+d);$("#previewarea_"+d).html("&nbsp;<img src='"+da_base+"img/loading.gif'>&nbsp;").show();$("#previewarea_"+d).load(da_base+"lemma/preview",{def:$("#definition_"+d).val(),ex:$("#example_"+d).val()},function(){hideInfos("#previewButton_"+d,"#addnewmessage_"+d);$("#addnewmessage_"+d).hide();});}function previewC(d){showInfos("#previewC_"+d,"#comm_mess_"+d);$("#previewareaC_"+d).html("&nbsp;<img src='"+da_base+"img/loading.gif'>&nbsp;").show();$("#previewareaC_"+d).load(da_base+"lemma/previewc",{c:$("#comment_txt_"+d).val()},function(){hideInfos("#previewC_"+d,"#comm_mess_"+d);$("#comm_mess_"+d).hide();});}function send_comment(d,l){showInfos("#sendComment_"+d,"#comm_mess_"+d);var txt=$("#comment_txt_"+d).val();if(txt==""){$("#new_comment_"+d).html("<div class='error_box'>Κενό σχόλιο;!.</div>").show("normal");hideInfos("#sendComment_"+d,"#comm_mess_"+d);return false;}var o={defid:d,comm:txt};if(l==0){var filter2=/^[0-9]{1,2}$/i;if(!filter2.test($("#captcha_u_c_"+d).val())){$("#new_comment_"+d).html("<div class='error_box'>Το άθροισμα πρέπει να είναι 1 ή 2 ψηφίων.</div>").show("normal");hideInfos("#sendComment_"+d,"#comm_mess_"+d);return false;}o={defid:d,comm:$("#comment_txt_"+d).val(),ex:txt,name:$("#comment_name_"+d).val(),capu:$("#captcha_u_c_"+d).val(),capt:$("#captcha_txt").val()};}$.post(da_base+"lemma/commentajax",o,function(txt){$("#new_comment_"+d).before(txt);hideInfos("#sendComment_"+d,"#comm_mess_"+d);resetTabs(d);$("#comment_txt_"+d).val("");});}function send_report(d){showInfos("#reportButton_"+d,"#reportmessage_"+d);$("#reportmessage2_"+d).load(da_base+"lemma/reportajax",{defid:d,rep:$("#report_txt_"+d).val()},function(){$("#reportmessage_"+d).hide();$("#reportmessage2_"+d).show("normal");});}function send_email(d,w){showInfos("#sendemailButton_"+d,"#emailmessage_"+d);$("#emailmessage2_"+d).hide();var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;var emailfrom=$("#email_from_"+d).val();var emailto=$("#email_to_"+d).val();var captchau=$("#captcha_usertxt_"+d).val();var captcha=$("#captcha_txt").val();var filter2=/^[0-9]{1,2}$/i;if(!filter.test(emailfrom)){$("#emailmessage2_"+d).html("&nbsp;<span class='error_box'>Η διεύθυνση <b>αποστολέα</b> δεν είναι έγκυρη.</span>").show("normal");hideInfos("#sendemailButton_"+d,"#emailmessage_"+d);}else{if(!filter.test(emailto)){$("#emailmessage2_"+d).html("&nbsp;<span class='error_box'>Η διεύθυνση <b>παραλήπτη</b> δεν είναι έγκυρη.</span>").show("normal");hideInfos("#sendemailButton_"+d,"#emailmessage_"+d);}else{if(!filter2.test(captchau)){$("#emailmessage2_"+d).html("&nbsp;<span class='error_box'>Το άθροισμα πρέπει να είναι 1 ή 2 ψηφίων.</span>").show("normal");hideInfos("#sendemailButton_"+d,"#emailmessage_"+d);}else{$("#emailmessage2_"+d).load(da_base+"lemma/sendemailajax",{defid:d,wordid:w,from:emailfrom,to:emailto,ucap:captchau,cap:captcha,mess:$("#email_mess_"+d).val()},function(){$("#emailmessage2_"+d).show("normal");hideInfos("#sendemailButton_"+d,"#emailmessage_"+d);});}}}}function upl(d,before){before==1?showInfos("#do_upload_"+d,"#uping_"+d):hideInfos("#do_upload_"+d,"#uping_"+d);if(before!=1){$("#upd_"+d).show("normal");$("#upiu_"+d).val("");$("#upib_"+d).val("");$("#upyt_"+d).val("");$("#upa_"+d).val("");$("#upt_"+d).val("");}else{$("#upf_"+d).submit();}}$(function(){$("#morecat").click(function(){$("#more_cats").slideToggle("normal");});$("#ascrf").submit(function(){showInfos("#ascrb","#lscr");var v=$("#ascr").val();if(v!=""&&!v.match(/^\s+$/)){$.post(da_base+"scratchpad/quickadd",{l:v},function(txt){$("#ascr").val("");$("#scrul").prepend(txt);hideInfos("#ascrb","#lscr");});}return false;});});function tooltip(theid,txt){document.getElementById("tooltip_"+theid).innerHTML=txt;}function link_to_def(datype,txt){temp=prompt("Σύνδεσμος "+(datype==0?"λήμματος":"ορισμού")+":                                                                                                                              ",da_base+"lemma/show/"+txt);return false;}function w_tag(lemma,txt){temp=prompt("w tag για το λήμμα "+lemma,"[w="+txt+"]"+lemma+"[/w]");return false;}