var send_button,remote_chat,local_chat,hidden_question;function initialize_chat(){send_button=document.getElementById("send_button");remote_chat=document.getElementById("remote_chat");local_chat=document.getElementById("local_chat");hidden_question=document.getElementById("question");var a=document.getElementById("contact_button");remote_chat.value="Please wait.....\n\n";hidden_question.value="";remote_say("<wait><wait><wait><wait><wait>Hello, how can we help you?");send_button.onclick=function(){send_text()};a.onclick=function(){validate(this,["FirstName","LastName","Email","AreaCode","Exchange","Suffix","WhereLive"],["First Name","Last Name","Email Address","Area Code","Phone Exchange","Phone Suffix","State"],"-Please Select-");return false}}function send_text(){var a=trim(local_chat.value);local_say(a);local_chat.value="";if(a.length>0){remote_say("Please wait a moment...  <wait><wait><wait>//I can send your question to someone who may be able to help...we will get back to you promptly, but can you let me know how to contact you?//Please provide your contact information below.<form>")}else{remote_say("Please type your question in the box below and click the Send button.")}}function local_say(b){var a="you> "+trim(b)+"\n\n";remote_chat.value+=a;hidden_question.value+=b}function remote_say(a){send_button.disabled=true;slow_type(a)}function slow_type(f){var d;if(f.match(/^<[^>]*>/)){var a=f.match(/^<([^>]*)>/);d=a[1];f=f.replace(/^<([^>]*)>/,"")}else{d=""}var e,c,b;if(d=="wait"){e=1000;c="";b=f}else{if(d=="form"){toggle_layer("local_chat_holder");set_height("chat_floatover","450px");toggle_layer("contact_fields");remote_chat.scrollTop=remote_chat.scrollHeight;c="";b=f}else{e=Math.floor(25+(Math.random()*(80)));c=f.charAt(0);b=f.substring(1)}}type_char(c);if(f.length>1){window.setTimeout("slow_type('"+b+"')",e)}else{remote_append("\n\n");send_button.disabled=false;remote_chat.scrollTop=remote_chat.scrollHeight}}function type_char(a){if(a=="|"){remote_backspace()}else{if(a=="`"){remote_append("'")}else{if(a=="/"){remote_append("\n")}else{remote_append(a)}}}remote_chat.scrollTop=remote_chat.scrollHeight}function remote_backspace(){var a=remote_chat.value.substring(0,remote_chat.value.length-1);remote_chat.value=a}function remote_append(a){remote_chat.value+=a}function trim(a){return a.replace(/^\s*|\s*$/g,"")}function toggle_layer(a){if(a==null||a==""){return}expand(a)}function set_height(b,a){if(document.all){document.all[b].style.height=a}else{document.getElementById(b).style.height=a}};
