// JavaScript Document

//MM_preloadImages('images/popup_ok.jpg', 'images/popup_cancel.jpg', 'images/module_title_left.jpg', 'images/popup_close.jpg', 'images/module_title_right.jpg', 'images/loading.gif', 'images/tracker_thisone.gif', 'images/tracker_always.gif');

function show_popup( content, title, callback )
{
	var offset;
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = document.body.clientWidth-2;
	  winH = document.body.clientHeight-2;
	  offset = self.pageYOffset;
	  if (offset != 0) winH = document.body.parentNode.scrollHeight;
//	  alert("MOZILLA: H:"+winH+". W:"+winW+". OS:"+offset);
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth-19;
	  winH = document.body.offsetHeight-4;
	   offset = document.body.scrollTop;	  
	   if (offset > 0) winH = document.body.parentNode.scrollHeight;
//	  alert("MSIE: H:"+winH+". W:"+winW+". OS:"+offset);
	 }
	}
	var canvas = document.createElement('div');
	canvas.id = 'canvas';
	canvas.style.width = winW + "px";
	canvas.style.height = document.body.parentNode.scrollHeight + "px";
	document.body.appendChild(canvas);
	canvas.style.top = offset;
	
	try {
		document.getElementById('my_embed').style.visibility = 'hidden';
	} catch(e) { }
	
	var popup = document.createElement('div');
	popup.id = 'popup';
	popup.style.top = 200 + offset + 'px';
	
	if (title == 'DEMO USER')
	{
		content = "<img src=\'images/demo_warning.jpg\'>";
		popup.style.width = "489px";		
	}
	var out = new Array();
	
	out.push("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td height=\"18\" width=\"7\"><img src=\"images/module_title_left.jpg\" height=\"18\" width=\"7\" border=\"0\"></td><td class=\"module_header\"><img src=\"images/popup_close.jpg\" align=\"right\" style=\"cursor: pointer;\" onclick=\"remove_popup();\">"+title+"</td><td height=\"18\" width=\"7\"><img src=\"images/module_title_right.jpg\" border=\"0\" height=\"18\" width=\"7\"></td></tr></table></td></tr><tr valign=\"top\"><td bgcolor=\"#FFFFFF\" width=\"100%\" valign=\"top\"><table border=\"0\" cellspacing=\"2\" cellpadding=\"\" width=\"100%\"><tr valign=\"top\"><td bgcolor=\"#333333\" width=\"100%\" class=\"dailyroutine\"><div id=\"popup_content\" style=\"padding: 5px;\">"+content+"</div><hr style=\"width: 0px; clear: both; border: 0px #333333;\"><div style=\"background-color: #222222; text-align: right; padding: 7px;\">");
	if (callback != 'NONE')
	{
		out.push ("<img src=\"images/popup_cancel.jpg\" style=\"cursor: pointer;\" onclick=\"remove_popup();\">");
	
		if (callback != 'NULL')
		{
			out.push("<img src=\"images/popup_ok.jpg\" style=\"cursor: pointer;\" onclick=\""+callback+";\">");
		}
	}	
	out.push("</div></td></tr></td></tr></table></td></tr></table>");

	popup.innerHTML = out.join("");
	
	document.body.appendChild(popup);
	try {
		document.getElementById('question').focus();
	} catch(e) { }
}




function remove_popup()
{
	document.body.removeChild(document.getElementById('popup'));
	document.body.removeChild(document.getElementById('canvas'));
	try {
	document.getElementById('my_embed').style.visibility = '';
	} catch(e) { }
}


