/*
*/

window.help_popjso = {
	win: null,
	args: null,
	onload: function(o) {
		var b = o.document.getElementById('help_body_tag');
		var wantheight = b.offsetHeight + 50;
		var wantwidth = b.offsetWidth;

		if ( wantheight > b.clientHeight ) {
			var maxh = Math.floor(screen.height*.60);
			// resize/grow the window frame.
			if ( b.offsetHeight > maxh ) {
				o.resizeTo(wantwidth,maxh);
			} else {
				o.resizeTo(wantwidth, wantheight);
			}
		} else if ( wantheight < (b.clientHeight-20) ) {
			// fill the window content.
			var d = o.document.getElementById('help_wrapper');
			d.style.display='block';
			d.style.height=b.clientHeight-20;
		}
	},
	checkLoaded: function() {
		alert(document.getElementById('help_body_tag'));
	}
}

/*
 args: 
  title:
  body: 
  [sub_title:]
*/
var popWindow;
function help_pop(args) {
	setTimeout(checkPop, 3000);
	if ( popWindow ) {
		try { popWindow.close(); } catch(e) {}; // causes the window to raise if opened already.
	}
	popWindow = window.open("/help_get.mhtml?session_id=" + args.session_id + "&token=" + args.token, "help_pop", "width=640,height=300,resizable=1,scrollbars=1,alwaysRaised=1,screenX=0,screenY=0");
	popWindow.focus();
}
function checkPop() {
	try {
		if ( (!popWindow) || (popWindow.innerHeight < 10) ) {
			alert("It appears that your browser is blocking pop-ups from this site.\nIf you wish to view this information, please disable your pop-up blocker.");
		}
	} catch(e) {
		alert("It appears that your browser is blocking pop-ups from this site.\nIf you wish to view this information, please disable your pop-up blocker.");
	}
}
