try{$("#refresh").remove()}catch(e){}if(typeof maxMessages=="undefined"){maxMessages=50}$(document).ready(function(){$("#refresh").remove();chtpos=$("#chatmessage").offset();window.scrollTo(0,chtpos.top);if(window.parent==window){$("#chatmessage").focus()}setTimeout("getMessages()",chatRefresh);$("#chat").after('<div id="autoupdatechatdiv"><input id="autoupdatechat" type="checkbox" checked="checked" value="true" /><label for="autoupdatechat">Auto update chat log</label></div>');$("#teamsayctrl input").click(function(){$("#chatmessage").focus()});$("#teamsayctrl label").accessKeys()});$("#chatform").submit(function(){var a=-1;var b=$("#chatform :radio:checked");if(b.size()>0){a=b.val()}$.ajax({type:"POST",url:pageUri+"+data",data:{ajax:1,message:$("#chatmessage").val(),teamsay:a},success:chatMessage,error:ajaxError});$("#chatmessage").val("");return false});function getMessages(){if($(window).height()>0){if($("#autoupdatechat:checked").size()>0){$.ajax({type:"POST",url:pageUri+"+data",data:{ajax:1},success:chatMessage,error:ajaxError})
}}setTimeout("getMessages()",chatRefresh)}function chatMessage(a,b){if(a==""){return}cnt=$(".chatmessage").size()-1;$("#chatlog").append(a);x=$(".chatmessage:gt("+cnt+")");x.hide();x.fadeIn("fast");cnt=$(".chatmessage").size();oldmsgs=cnt-maxMessages;$(".chatmessage:lt("+oldmsgs+")").remove();if(window.parent&&typeof window.parent.resizeChatWindow=="function"){window.parent.resizeChatWindow()}chtpos=$("#chatmessage").offset();window.scrollTo(0,chtpos.top)}function ajaxError(a,c,b){if(a.status==403){document.location=pageUri}};