var x = screen.width/2-450;
var y = screen.height/2-400;

var listWidth = 900;
var listHeight = 600;
var listHeader = '<div style="border-bottom: 5px solid #CCCCCC; border-right: 5px solid #CCCCCC;"><table cellpadding=0 cellspacing=0 width=100% height=100% bgcolor=ffffff style="border: 1px solid #555555;"><tr><td align=center valign=top><table width=100% cellpadding=0 cellspacing=0><tr><td align=right style="background-image:url(/images/bt_bg_grey.jpg); height: 30px;"><a href="javascript:;" onclick="closeListing()" style="color: FFFFFF;"><b>Close <img src="/images/icon_notok.gif" border=0 align=absmiddle></a></td></tr><tr><td align=center valign=middle height='+listHeight+'>';
var listFooter = '</td></tr></table></div>';

var this_obj;
var oXMLListing;

function getnewmessages(){
		//new messge
		var request = new XHRequest().getObject();
		
		request.onreadystatechange = function() {
			if (request.readyState == 4) {      
				if (request.status == 200) { 
					var new_message = request.responseText;
					document.getElementById("new_message").innerHTML = new_message;
				}
			}
		}
		request.open("GET","/message/new-message.php?r="+Math.random(), true);
		request.send(null);

		setTimeout("getnewmessages()", 10000);
	}

function confirmDelete(url){
	if(confirm("Are you sure?"))
		window.location=url;
}

function showdetail(url, obj){

	this_obj = obj;

	//oBody = document.getElementById('main_body');
	//oBody.className = "body_border_fade";

	
	oBody = document.getElementById('black_screen');
	oBody.style.visibility = 'visible';
	oBody.style.left = 0;
	oBody.style.top = 0;
	oBody.style.width = screen.width;
	oBody.style.height = screen.height;

	hideCombos();

	obj.style.width = listWidth;
	obj.style.height = listHeight+30;
	obj.style.visibility = 'visible';
	obj.innerHTML = listHeader+str_wait+listFooter;

	obj.style.left = x;
	obj.style.top = y;

	if (window.ActiveXObject) {        
		oXMLListing = new ActiveXObject("Microsoft.XMLHTTP");   
	} else if (window.XMLHttpRequest) {       
		oXMLListing = new XMLHttpRequest();     
	}  
	oXMLListing.onreadystatechange = function showListing(){
		var strText="";
		if (oXMLListing.readyState == 4) {      
			if (oXMLListing.status == 200) {        
				var text = oXMLListing.responseText;

				obj.innerHTML = listHeader+'<div style="height: '+listHeight+'; overflow: auto;">'+text+'</div>'+listFooter;			

			}   
		} 	
	}
	oXMLListing.open("GET",url, true);   
	oXMLListing.send(null); 
}


function closeListing(){
	//window.close();
	obj = this_obj;
	obj.style.visibility = 'hidden';

	//oBody = document.getElementById('main_body');
	//oBody.className = "body_border";

	oBody = document.getElementById('black_screen');
	oBody.style.left = -10;
	oBody.style.top = -10;
	oBody.style.width = 1;
	oBody.style.height = 1;
	oBody.style.visibility = 'hidden';

	showCombos();
}

function hideCombos() {
	var arCombo = document.getElementsByTagName("select");
	for(var i=0;i<arCombo.length;i++) {
		arCombo[i].style.visibility="hidden";
	}
}
function showCombos() {
	var arCombo = document.getElementsByTagName("select");
	for(var i=0;i<arCombo.length;i++) {
		arCombo[i].style.visibility="inherit";
	}
}