/*Limit symbols*/ (function($){$.fn.extend({limit:function(limit,element){var interval,f;var self=$(this);$(this).focus(function(){interval=window.setInterval(substring,100)});$(this).blur(function(){clearInterval(interval);substring()});substringFunction="function substring(){ var val = $(self).val();var length = val.length;if(length > limit){$(self).val($(self).val().substring(0,limit));}";if(typeof element!='undefined')substringFunction+="if($(element).html() != limit-length){$(element).html((limit-length<=0)?'0':limit-length);}";substringFunction+="}";eval(substringFunction);substring()}})})(jQuery); function getCaptha(){ now = new Date(); $('#captcha img').attr('src', aveabspath+'inc/captcha.php?cd=' + now); }; function cAction(obj,action){ var cid = $(obj).parents('.mod_comment_box').attr('id'); if (action=='answer'){ $('#parent_id').val(cid); $('#mod_comment_new').insertAfter('#'+cid); return; } if (UGROUP==1){ $.get(aveabspath+'index.php',{ module: 'comment', action: action, docid: DOC_ID, Id: cid },function(){ if (action=='delete'){ $(obj).parents('.mod_comment_comment').eq(0).remove(); } if (action=='open'){ $(obj).unbind('click') .click(function(){cAction(obj,'close');}) .html(COMMENT_SITE_CLOSE); } if (action=='close'){ $(obj).unbind('click') .click(function(){cAction(obj,'open');}) .html(COMMENT_SITE_OPEN); } if (action=='unlock'){ $(obj).unbind('click') .click(function(){cAction(obj,'lock');}) .attr('title',COMMENT_LOCK_LINK) .find('img').attr('src',aveabspath+'modules/comment/templates/images/lock.gif'); } if (action=='lock'){ $(obj).unbind('click') .click(function(){cAction(obj,'unlock');}) .attr('title',COMMENT_UNLOCK_LINK) .find('img').attr('src',aveabspath+'modules/comment/templates/images/unlock.gif'); } }); } }; function validate(formData,jqForm,options){ $('.alert').remove(); var form = jqForm[0]; if (!form.comment_author_name.value){ alert(COMMENT_ERROR_AUTHOR); $(form.comment_author_name).focus(); return false; } if (!form.comment_author_email.value){ alert(COMMENT_ERROR_EMAIL); $(form.comment_author_email).focus(); return false; } if (!form.comment_text.value){ alert(COMMENT_ERROR_TEXT); $(form.comment_text).focus(); return false; } if (IS_IM && !form.securecode.value){ alert(COMMENT_ERROR_CAPTCHA); $(form.securecode).focus(); return false; } return true; }; function setClickable(){ $('.editable_text').click(function(){ var cid = $(this).parents('.mod_comment_box').attr('id'); var revert = $(this).html(); var textarea = '
'; var charsLeft = ''+COMMENT_CHARS_LEFT+'
'; var buttonSave = ' '; var buttonReset = ''; $(this).after('