<!--

// modified var names to avoid potential namespace conflicts 
var __adt_checkFlag=true; 
var __adt_startTime=null; 
var __adt_intervalId=null; 
var __adt_lastId=null; 
var __adt_maximumPollTimeout=30*60*1000; // check for half hour, otherwise stop polling

function checkForMessages(){

	try{
		
		// just for good measure...
		clearInterval(__adt_intervalId);
		
		// check we haven't exceeded maximum poll timeout
		var testDate=new Date();
	
		if((testDate.getTime()-__adt_startTime.getTime()) >= __adt_maximumPollTimeout){
			// stop polling
			return;
		}
		
		if(location.hash != __adt_lastId){
			__adt_lastId=location.hash;
			var iframeEl = document.getElementById? document.getElementById('ifrm'): document.all? document.all['ifrm']: null;
			iframeEl.style.height="auto";
			var newHeight=parseInt(__adt_lastId.substr(1),10);
			newHeight+=100;
			iframeEl.style.height=newHeight+"px";
			//__adt_checkFlag=false;
		}
	
		if(__adt_checkFlag==true){
			//
			__adt_intervalId=setInterval(checkForMessages, 500);
		}
		
	}catch(e){
		// debug
		// alert(e.message);
		//clear up if anything goes wrong
		clearInterval(__adt_intervalId);
		__adt_checkFlag=false;
	}

}

function initPolling(){ 
__adt_startTime=new Date();
__adt_checkFlag=true;
checkForMessages();

}




 function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
 window.onload = func;
 } else {
 window.onload = function() {
 if (oldonload) {
 oldonload();
 }
 func();
 }
 }
}

addLoadEvent(initPolling);



