﻿
﻿
function stopStartPostLoading(obj){if(postInterval){isRunning=false;clearInterval(postInterval);postInterval=null;if(obj){obj.innerHTML="Play"
obj.style.backgroundImage="url(images/icons/play.gif)";}}
else{isRunning=true;postInterval=setInterval("loadXMLDoc('getposts','tdShouts')",3000);if(obj){obj.innerHTML="Pause"
obj.style.backgroundImage="url(images/icons/pause.gif)";}}}
function postMessage(){if(document.forms["frmPostShout"]["txtComment"].value!=""){document.getElementById("tblPostingTable").style.display="none";document.getElementById("divPostAlert").style.display="";document.getElementById("divPostAlert").innerHTML="<img src='images/ajax-loader.gif'> Posting Message...";loadXMLDoc('postmessage','postmessage');}}
function reShowInterface(){document.getElementById("divPostAlert").innerHTML="";document.getElementById("divPostAlert").style.display="none";document.getElementById("tblPostingTable").style.display="";document.forms["frmPostShout"]["txtComment"].focus();}
var xmlhttp=new Array;var showInterface=false;function loadXMLDoc(query,divObj){xmlhttp[divObj]=null
try{xmlhttp[divObj]=new XMLHttpRequest()}catch(e){try{xmlhttp[divObj]=new ActiveXObject("MSXML2.XMLHTTP.4.0")}catch(e){xmlhttp[divObj]=new ActiveXObject("Microsoft.XMLHTTP")}}
if(xmlhttp[divObj]!=null){if(divObj!="postmessage"){objWindow=document.getElementById(divObj);}
xmlhttp[divObj].onreadystatechange=function(){if(xmlhttp[divObj].readyState==4){if(xmlhttp[divObj].status==200){if(divObj!="postmessage"){var stockChartIsOpen=false;try{if(document.getElementById("divMiniQuote").style.display==""){stockChartIsOpen=true;}}catch(er){}
if(xmlhttp[divObj].responseText=="nothing new"){}
else{if(!stockChartIsOpen){document.getElementById(divObj).innerHTML=(xmlhttp[divObj].responseText);SoundNewMessage(xmlhttp[divObj].responseText)}}
try{if(!stockChartIsOpen){document.getElementById("divUpdateTime").innerHTML="updated: "+(new Date()).toString();}}catch(er){}}
else{if(xmlhttp[divObj].responseText=="login user"){window.location.href="Login.aspx?msg=Please+log+into+StockShouter+to+post."}
else{document.forms["frmPostShout"]["txtComment"].value="";if(stock!=""){}
var newHTML=xmlhttp[divObj].responseText;if(newHTML!="nothing new"){document.getElementById("tdShouts").innerHTML=newHTML;soundManager.play('select');}
reShowInterface();}}}else{if(divObj!="postmessage"){document.getElementById(divObj).innerHTML="<img src='images/ajax-loader.gif' /> Loading Page, Please Wait...";}}}
else{}}
var cm="";var sm="";try{cm=document.forms["frmPostShout"]["txtComment"].value
if(stock!=""){cm="$"+(stock).toUpperCase()+": "+cm;}}
catch(er){}
xmlhttp[divObj].open("GET","_shoutLookup.aspx?trader="+theTrader+"&stock="+stock+"&type="+query+"&cm="+encodeURIComponent(cm)+"&sm="+encodeURIComponent(sm)+"&nc="+(new Date()),true)
xmlhttp[divObj].send(null);}else{alert("Your browser does not support XMLHTTP.")}}
function SoundNewMessage(html){var rArray=html.split(";;*;;");if(rArray[1]!=maxMessageID){soundManager.play('select');}}
function Set_Cookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");}
