var XssHttpRequestCount=0;
var XssHttpRequestWatchList=[];
var X=function(){
	this.ins=++XssHttpRequestCount;
	this.u;
	this.so;
	this.w;
	this.wc=0;
	this.to=30;
	this.responseText=null;
	this.responseXML=null;
	this.status=null;
	this.readyState=0;
};
X.prototype.onreadystatechange=function(){};
X.prototype.onerror=function(){};
X.prototype.onload=function(){};
X.prototype.ss=function(s){
	this.status=s;
};
X.prototype.srs=function(a){
	if(this.readyState<a||a==0){
		this.readyState=a;
		this.onreadystatechange();
		if(this.readyState=='2'){
			this.srs(3);
			eval("if(typeof XssHttpRequest"+this.ins+"Loaded!='undefined'){this.responseText=XssHttpRequest"+this.ins+"Loaded;this.ss('200');}else{alert('invalidresponsefromserver.');}");
			this.so.parentNode.removeChild(this.so);
			this.srs(4);
			this.onload();
		}
	}
};
X.prototype.open=function(m,u,n){
	this.u=u;
	this.so=document.createElement('script');
	this.so.setAttribute('id','XssHttpRequest'+this.ins);
	if(navigator.userAgent.indexOf('Safari')){
		this.so.setAttribute('charset','utf-8');
	}
};
X.prototype.send=function(){
	this.srs(1);
	this.so.setAttribute('type','text/javascript');
	this.so.setAttribute('src',this.u+((this.u.indexOf('?')!=-1)?'&':'?')+'XssHttpRequestVar=XssHttpRequest'+this.ins+'Loaded');
	this.so=document.getElementsByTagName('head')[0].appendChild(this.so);
	XssHttpRequestWatchList[this.ins]=this;
	this.w=setInterval('XssHttpRequestWatchList['+this.ins+'].wl()',1000);
};
X.prototype.wl=function(){
	this.wc++;eval("if(typeof XssHttpRequest"+this.ins+"Loaded!='undefined'){clearInterval(this.w);this.srs(2);}else if(this.wc==this.to){clearInterval(this.w);this.onerror('TimedOut');}");
};
var XssHttpRequest=X;


//include source for XssHttpRequest from link above

function record_of_the_day() {
    request = new XssHttpRequest();
    request.open("GET", "http://divingalmanac.com/widget/insite_widget.php", true);
    request.onreadystatechange=function() {
		
//if(request.readyState==3) {
//eval('document.getElementById(\'divingalmanac\').innerHTML = \'<div style="text-align:center;"><img src="http://divingalmanac.com/images/loading.gif" width="64" height="64" alt="" /></div>\';');        
//}

        if(request.readyState==4) {
            eval(request.responseText); //execute the javascript.
        }
    }
    request.send(null);
}