var t=setTimeout("autoconnect()",3000); function autoconnect() { chat = parent.document.getElementById("frame_chatbox").contentWindow; chatcheck = chat.document.getElementById("chatbox").innerHTML.length; if (chatcheck <= 180) { chat.CB_disconnect(); } else { return; } }