
window.isIE=window.navigator.appVersion.indexOf('MSIE')!=-1;
window.isSafari=window.navigator.appVersion.indexOf('Safari')!=-1;

if (typeof(String.trim)=='undefined') String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'')}
String.prototype.pathEnd=function(){var e=this.split('?')[0].split('#')[0].split('/');return e[e.length-1]}
String.prototype.pathFront=function(){var e=this.pathEnd().length;return this.split('?')[0].split('#')[0].substr(0,this.length-e-1)}
String.prototype.trimSlash=function(){return this.replace(/^\/+|\/+$/g,'')}
String.prototype.trimEndSlash=function(){return this.replace(/\/+$/,'')}

function aaPath() {
	try {
	var o = '';
	var a = aaPath.arguments;
	if (a.length) o = a[0].trimEndSlash();
	for (var i=1;i<a.length;i++) if (a[i]) o += (o?'/':'') + a[i].trimSlash();
	return o;
	} catch (ex) {
		var ot = '';
		for (var i=0;i<a.length;i++) ot += a[i]+',';
		alert(ot);
		throw ex;
	}
}

if(typeof Array.prototype.zap=="undefined"){Array.prototype.zap=function(idx){var l=this.length;if(idx<l&&idx>=0){var i=0;var j=0;while(j<l){if(j==idx)i--;else this[i]=this[j];i++;j++;}this.length=l-1;}}}
if(typeof Array.prototype.add=="undefined"){Array.prototype.add=function(h){var l=this.length;this[l]=h;return l}}

function aaEvent(e) {if(typeof(e)=='undefined'&&typeof(window.event)!='undefined')return window.event;return e}
function aaFn(o,f) {return function(a,b,c){return o[f](a,b,c)}} // Function args come from the calling framework
function aaCall(o,f,a,b,c) {return function(){return o[f](a,b,c)}} // Function args come from the function creator
function aaFnpt(o,f) {return function(a,b,c){return o[f](this,a,b,c)}}
function aaEv(o,f,a,b,c) {return function(e){return o[f](this,aaEvent(e),a,b,c)}}
function aaNada(){}
function aaWidth(o){return o.offsetWidth||o.clientWidth}
function aaHeight(o){return o.offsetHeight||o.clientHeight}


function aaU() {var d = new Date();window.myUni = 0;window.myU1 = d.getTime()}
aaU();
function aaUni() {return myU1+'.'+(++myUni)}

window.myObjects={};
function aaRegister(f,n,a,b,c) {
	if(!window[n]){
		log.trace('registered',n);
		myObjects[n]=new f(a,b,c);
		window[n]=myObjects[n];
	}
}

function aaDoScript(u,tg) {
	dbg.trace('aaDoScript',u);
	var scp = document.createElement('script');
	scp.setAttribute('language',"JavaScript");
	document.getElementsByTagName(tg||'body')[0].appendChild(scp);
	scp.setAttribute('src',u);
}

function aaOnDo(tst,fn,a,b,c,ttx) {
	var ic = false;
	var d = new Date();
	if (!ttx) ttx = d.getTime();
	switch (typeof(tst)) {
	case 'string': ic = eval(tst); break;
	case 'function': ic = tst(); break;
	}
	if (ic) fn(a,b,c);
	else {
		if (d.getTime() - ttx > 120000) return alert('never happened');
		setTimeout(function(){aaOnDo(tst,fn,a,b,c,ttx)},50);
	}
}

function aaSetCookie(nn,vv,dd,path) {
	var ck = nn + '=' + escape(vv);
	if (dd && dd > 0) {
		var date = new Date();
		date.setTime(date.getTime() + (dd * 86400000));
		ck += '; expires=' + date.toGMTString();
	}
	ck += '; path=' + (path || '/');
	document.cookie = ck;
}
function aaClearCookie(nn,path) {
	var date = new Date();
	date.setTime(date.getTime()-(3000*24*60*60*1000));
	ck = nn + '=; expires=' + date.toGMTString();
	ck += '; path=' + (path || '/');
	document.cookie = ck;
}
function aaGetCookie(name,dfalt) {
	var v = unescape(aaReadRawCookie(name,document.cookie));
	return v ? v : dfalt;
}
function aaReadRawCookie(nm,ck) {
	var ar,ln,nl,i;
	nm += '=';
	if (ck) ar = ck.split(';');
	else ar = new Array();
	ln = ar.length;
	nl = nm.length;
	document.coCnt = ln;
	for (i=0;i<ln;i++) {	// clip any leading space
		while (ar[i].charAt(0) == ' ') ar[i] = ar[i].substr(1);
	}
	for (i=0;i<ln;i++) {
		if (ar[i].substr(0,nl) == nm) return ar[i].substr(nl);
	}
	return '';
}
function aaEndEvent(e) {
	e = aaEvent(e);
	e.returnValue = false;
	e.cancelBubble = true;
	e.cancel = true;
	if (e.preventDefault) e.preventDefault();
	if (e.stopPropagation) e.stopPropagation();
	return false;
}
function aaFileName() {
	var p = document.location.pathname.split('/');
	return p[p.length-1];
}
function aaLoadCss(url) {
	var css = document.createElement('link');
	css.setAttribute('rel',"stylesheet");
	css.setAttribute('type',"text/css");
	css.setAttribute('href', url);
	document.getElementsByTagName('head')[0].appendChild(css);
}
function aaIDoc(f) {
	var w = f.contentWindow || f.contentDocument;
	if (w.document) return w.document;
	return null;
}
function aaIDocHTML(f) {
	var d = aaIDoc(f);
	if (d && d.body) return d.body.innerHTML;
	return null;
}
function aaExtend(sC,bC) {
	function iH(){};
	iH.prototype = bC.prototype;
	sC.prototype = new iH();
	sC.prototype.constructor = sC;
	sC.bCC = bC;
	sC.bC = bC.prototype;
	sC.prototype.baseCall = function(n,a,b,c,d,e) {this.bC[n].call(this,a,b,c,d,e)};
	sC.prototype.baseConstruct = function(t,a,b,c,d,e) {sC.bCC.call(this,a,b,c,d,e)};
}

function aaLog(scope,tx) {
	aaDoScript('@logme.php?scope='+encodeURIComponent(scope)+'&msg='+encodeURIComponent(tx));
}

// Default debug handler
function aaDbg() {window.myDbgTrc=''}
aaDbg.prototype.ex=function(n,v){dbg.trace('EX:'+n,v)}
aaDbg.prototype.warn=function(n,v){dbg.trace('WARN:'+n,v)}
aaDbg.prototype.dump=function(o){dbg.trace('DUMP:'+o)}
aaDbg.prototype.trace=function(n,v){myDbgTrc=escape(n)+(v!==undefined?'='+escape(v):'')+'\r\n'+myDbgTrc}
aaDbg.prototype.error=function(n,v){alert(n+"="+v)}
aaDbg.prototype.autovar=function(vtx){dbg.trace('VAR:'+vtx)}
aaDbg.prototype.clear=function(){myDbgTrc=''}
window.log=new aaDbg();
window.dbg=log;

function vars() {

	// To break out of outside site frames and into an edit frame.
	if (top.location.host != window.location.host) return top.location = window.location.href;
	//if (top.location.href.indexOf('panel.edit.html') == -1) top.location = editFrameUrl();

	//
	// Application specific variables
	//

	this.remoteUser = '';


	// These are url based paths
	this.appBase 		= this.hostBase;
	this.cmsBase		= this.hostBase+'cms/';
	this.lclBase		= this.cmsBase+'lcl/';
	this.ledBase		= this.cmsBase+'led/';
	this.phpBase		= this.cmsBase+'php/';
	this.panBase		= this.cmsBase+'pan/';
	this.cmsImgBase		= this.cmsBase+'img/';

	this.draftName		= window.location.href.pathEnd() || 'index.html';
	this.draftPage		= aaPath('../../../../ebh/',this.draftName);	//File based path
	this.logFile		= aaPath('../data//','@logs.txt');		//File based path

	this.stdMargins		= '8px 15px';
	this.stdPadding		= '8px 15px';
	this.stdBorder		= '1px solid white';
	this.stdNewWidth	= '120px';
	this.layoutBorderColor	= '#AA0000';

	//
	// Site specific variables
	//

	this.password		= '';
	this.developer		= aaGetCookie('developer');

	this.iconUrl		= 'images';					// Used by the document
	this.iconUrlFw		= 'images';					// Used by the framework
	this.iconDir		= '../../../../ebh/'+'images';			// Relative to phpBase (file system based)

	this.dsLogonPhp		= aaPath(this.phpBase,'ds.logon.php');
	this.dsGetdirPhp	= aaPath(this.phpBase,'ds.getdir.php');
	this.dsGetfilePhp	= aaPath(this.phpBase,'ds.getfile.php');
	this.doPutfilePhp	= aaPath(this.phpBase,'do.putfile.php');
	this.dsUpimagePhp	= aaPath(this.phpBase,'ds.upimage.php');
	this.dsGetlogPhp	= aaPath(this.phpBase,'ds.getlog.php');
	this.dsChksavePhp	= aaPath(this.phpBase,'ds.chksave.php');
	this.dsSendnewsbkgPhp	= aaPath(this.phpBase,'ds.sendnewsbkg.php');
	this.panelUploadimgHmtl	= aaPath(this.panBase,'panel.uploadimg.html');
	this.panelColorpickerHtml = aaPath(this.panBase,'panel.colorpicker.html');

	aaLoadCss(aaPath(this.cmsBase,'cms.css'));

	// Mainly for debugging
	this.debug_rootBase = '';
	this.debug_dirPathBase = '';
	this.debug_dataFileBase = '../data//';
}

vars.prototype.Laura = false;
vars.prototype.hostBase = window.location.protocol+'//'+window.location.host+'/';

vars.prototype.setDeveloper = function(ic) {
	this.developer = ic;
	if (ic) aaSetCookie('developer',true);
	else aaClearCookie('developer');
}

function editFrameUrl() {
	var l = window.location;
	var h = l.protocol+'//'+l.host+'/cms/pan/panel.edit.html?page='+encodeURIComponent(l.href);
	return h;
}

aaRegister(vars,'myVars');

// End of JavaScript area// Default debug handler

function omDebug() {
	this.linecnt = 0;
	this.onEscFn = aaEv(this,'onEsc');
	this.onF2Fn = aaEv(this,'onF2');

	if (window.onkeyup) this.onkeyupSv = window.onkeyup;
	window.onkeyup = this.onF2Fn;
	this.showing = false;
	window.dbg = window.log = this;
}

omDebug.prototype.ex=function(n,v){dbg.trace('EX:'+n,v)}
omDebug.prototype.warn=function(n,v){dbg.trace('WARN:'+n,v)}
omDebug.prototype.dump=function(o){dbg.trace('DUMP:'+typeof(o),typeof(o)=='object'?('\r\n'+this.showBol(o,true).filterPassword()):(o.toString()))}
omDebug.prototype.trace=function(n,v){myDbgTrc=escape(++this.linecnt+') '+n)+(v!==undefined?'='+escape(v):'')+'\r\n'+myDbgTrc}
omDebug.prototype.error=function(n,v){alert(n+"="+v)}
omDebug.prototype.autovar=function(vtx){dbg.trace('VAR:'+vtx)}
omDebug.prototype.clear=function(){myDbgTrc=''}

omDebug.prototype.onF2 = function(ec,e) {
	e = e || event;
	if (e.keyCode == 113) {window.onkeyup=this.onEscFn; aaEndEvent(e); this.show(); return false};
	if (this.onkeyupSv) return this.onkeyupSv.call(ec,e);
	return true;
}

omDebug.prototype.onEsc = function(ec,e) {
	window.onkeyup=this.onF2Fn;
	e = e || event;
	var k = e.keyCode;
	if (this.showing&&(k==27||k==113)) {aaEndEvent(e);this.hide();return false};
	if (this.onkeyupSv) return this.onkeyupSv.call(ec,e);
	return true;
}

omDebug.prototype.hide = function() {
	myIBox.hide();
	if (this.el) this.el.onkeydown = null;
	this.showing = false;
	window.onkeyup=this.onF2Fn;
}

function dbgEq(){var ot='';for(var i=0;i<120;i++)ot+='=';return ot}
omDebug.prototype.show = function() {
	var ot = '';
	ot += '<input type="button" value="close" onclick="myDebug.hide()"/>';
	ot += '<input type="button" value="clear" onclick="dbg.clear();myDebug.hide()"/>';
	ot += '<input type="button" value="mark" onclick="dbg.trace(dbgEq());myDebug.hide()"/>';
	ot += '<xmp style="margin:5px 0 0 0;background-color:#EEEEEE">'+unescape(myDbgTrc).filterPassword()+'</xmp>';
	this.showing = true;
	this.el = myIBox.show(ot);
}

String.prototype.pwSecure = function() {
	return this.replace(/password\=\w*\b/,'password=*');
}

String.prototype.htmlText = function(pass) {
	if (pass) return this;
	var ot = "";
	var c;
	for (var i=0;i<this.length;i++) {
		c = this.substr(i,1);
		switch (c) {
		case '<': ot += '&lt;'; break;
		case '>': ot += '&gt;'; break;
		case '&': ot += '&amp;'; break;
		case '\n': ot += '<br/>'; break;
		case ' ': ot += '&nbsp;'; break;
		case '\t': ot += '&nbsp;&nbsp;&nbsp;&nbsp;'; break;
		case '\r': break;
		default: ot += c; break;
		}
	}
	return ot.pwSecure();
}

omDebug.prototype.showBol = function(obj,txOnly) {
	try {
		var x = 300;
		var ot = "";
		for (var i in obj) {
			if (txOnly)
				ot += i+' ('+typeof(obj[i])+')=';
			else
				ot += '<b>'+i+' ('+typeof(obj[i])+')=</b>';
			try {
				switch (typeof(obj[i])) {
				case 'number':
					ot += obj[i]; break;
				case 'string':
					if (i == 'innerHTML' || i == 'textContent')
						ot += '(NOT SHOWN)';
					else
						ot += obj[i].htmlText(txOnly);
					break;
				case 'boolean':
					ot += obj[i] ? 'true' : 'false'; break;
				case 'object':
					if (obj[i] == null)
						ot += '(null)';
					else
						ot += obj[i].toString();
					break;
				default:
					break;
				}
			}
			catch (ex) {ot += "(ERROR): " + ex.toString().htmlText(txOnly)}
			ot += txOnly ? '\n' : '<br/>';
			if (--x < 0) break;
		}
		if (ot.length > 50000) ot = ot.substr(0,50000);
		return ot;
	} catch (ex) {return "Err:showBol: " + ex}
}

String.prototype.filterPassword = function(){return this.replace(/password=[^&\r\n)('"]*/gi,'password=*')}

aaRegister(omDebug,'myDebug');




function aaEv(o,f,a,b,c) {return function(e){return o[f](this,aaEvent(e),a,b,c)}}
function aaEvent(e) {if(typeof(e)=='undefined'&&typeof(window.event)!='undefined')return window.event;return e}
function aaSetCookie(nn,vv,dd,path) {
	var ck = nn + '=' + escape(vv);
	if (dd && dd > 0) {
		var date = new Date();
		date.setTime(date.getTime() + (dd * 86400000));
		ck += '; expires=' + date.toGMTString();
	}
	ck += '; path=' + (path || '/');
	document.cookie = ck;
}
function aaClearCookie(nn,path) {
	var date = new Date();
	date.setTime(date.getTime()-(3000*24*60*60*1000));
	ck = nn + '=; expires=' + date.toGMTString();
	ck += '; path=' + (path || '/');
	document.cookie = ck;
}
function aaGetCookie(name,dfalt) {
	var v = unescape(aaReadRawCookie(name,document.cookie));
	return v ? v : dfalt;
}
function aaReadRawCookie(nm,ck) {
	var ar,ln,nl,i;
	nm += '=';
	if (ck) ar = ck.split(';');
	else ar = new Array();
	ln = ar.length;
	nl = nm.length;
	document.coCnt = ln;
	for (i=0;i<ln;i++) {	// clip any leading space
		while (ar[i].charAt(0) == ' ') ar[i] = ar[i].substr(1);
	}
	for (i=0;i<ln;i++) {
		if (ar[i].substr(0,nl) == nm) return ar[i].substr(nl);
	}
	return '';
}
function aaEndEvent(e) {
	e = aaEvent(e);
	e.returnValue = false;
	e.cancelBubble = true;
	e.cancel = true;
	if (e.preventDefault) e.preventDefault();
	if (e.stopPropagation) e.stopPropagation();
	return false;
}

/////////////////////////////////////////////////////////////////////////////////////////

function phpLogon() {
	window.onkeydown = aaEv(this,'onkeydown');
	window.password = aaGetCookie('appPassword');
	window.myVL = this;
	this.invalids = 0;
	this.maxInvalids = 5;
	if (window.phpLogonFailed) this.showLogon('Invalid Credentials');
}

phpLogon.prototype.onkeydown = function(ec,e) {
	e = e || event;
	if (e.keyCode == 13) {
		this.doLogon();
		return aaEndEvent(e);
	}
	if (e.keyCode == 76 && e.shiftKey) {this.showLogon(); return aaEndEvent(e)};
	if (e.keyCode == 27) {this.hide(); return aaEndEvent(e)};
	return true;
}

phpLogon.prototype.showLogon = function(msg) {
	var el = this.logonEl;
	msg = msg || 'Please supply password';
	if (!el) {
		el = document.getElementsByTagName('body')[0].appendChild(document.createElement('div'));
		el.style.zIndex = 999;
		el.style.position = 'absolute';
		el.style.top = '50px';
		el.style.left = '50px';
		el.innerHTML = this.logonLayer;
		this.logonEl = el;
		this.msgEl = document.getElementById('phpLogonMsg');
		this.keyEl = document.getElementById('phpLogonPassword');
	}
	el.style.display = null;
	if (this.msgEl) this.msgEl.innerHTML = msg;
	if (this.keyEl) {
		this.keyEl.blur();
		this.keyEl.focus();
	}
}

phpLogon.prototype.hide = function() {
	if (this.logonEl) this.logonEl.style.display = 'none';
	if (this.keyEl) this.keyEl.blur();
}

phpLogon.prototype.cancel = function() {
	this.hide();
	aaClearCookie('appPassword');
	window.location.reload();
}

phpLogon.prototype.doLogon = function() {
	this.hide();
	var pw = this.keyEl.value.replace(/^\s+|\s+$/g,'');
	if (pw.length) {
		aaSetCookie('appPassword',pw);
		window.location.reload();
	}
	else aaClearCookie('appPassword');
}

phpLogon.prototype.logonLayer = '\
	<div style="padding:3px 20px 3px 20px;background-color:#FFFFFF;border:3px double #000099;font-family:arial,helvetica,verdana;font-size:13px;">\
	<div id="phpLogonMsg" style="text-align:center;font-weight:bold;padding:3px 20px 3px 20px"></div>\
	<form method="POST" action="'+window.location.href+'" onsubmit="return false">\
	<input id="phpLogonPassword" name="password" type="password" value=""/>\
	<input name="login" type="button" value="continue" size="12" onclick="myVL.doLogon(); return false"/>\
	<input name="cancel" type="button" value="cancel" onclick="myVL.cancel(); return false"/>\
	</form>\
	</div>\
';

window.myVl = new phpLogon();




function boxpos() {}

boxpos.prototype.centerPlace = function(top,width) {
	var w = this.getDocSize();
	var s = this.getScroll();
	var r = [parseInt(s[0]+(w[0]/2)-(width/2)),parseInt(s[1]+top)];
	if (r[0] < 0) r[0] = 0;
	return r;
}

boxpos.prototype.windowCenter = function() {
	var w = this.getWinSize();
	var s = this.getScroll();
	return [parseInt(s[0]+(w[0]/2)),parseInt(s[1]+(w[1]/2))];
}

boxpos.prototype.pos = function(o) {
	var l,t;
	l = t = 0;
	if (o.offsetParent) {
		l = o.offsetLeft;
		t = o.offsetTop;
		if ('relative,absolute'.indexOf(o.style.position||'z') < 0) while (o = o.offsetParent) {
			l += o.offsetLeft;
			t += o.offsetTop;
		}
	}
	return [l,t];
}

boxpos.prototype.dim = function(o) {
	return [o.offsetWidth||o.clientWidth,o.offsetHeight||o.clientHeight];
}

boxpos.prototype.getDocSize = function() {
	if (document.body && typeof(document.body.offsetWidth) == 'number') {
		return [document.body.offsetWidth,document.body.offsetHeight];
	}
	if (document.body && typeof(document.body.contentWidth) == 'number') {
		return [document.body.contentWidth,document.body.contentHeight];
	}
	return [0,0];
}

boxpos.prototype.getWinSize = function() {
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		return [window.innerWidth,window.innerHeight];
	}
	if (document.documentElement && document.documentElement.clientWidth) {
		//IE 6+ in 'standards compliant mode'
		return [document.documentElement.clientWidth,document.documentElement.clientHeight];
	}
	if( document.body && document.body.clientWidth) {
		//IE 4 compatible
		return [document.body.clientWidth,document.body.clientHeight];
	}
	return [0,0];
}

boxpos.prototype.getScroll = function(dc) {
	dc = dc || document;
	if(dc.body&&(dc.body.scrollLeft||dc.body.scrollTop)) {
		//DOM compliant
		return [dc.body.scrollLeft,dc.body.scrollTop];
	} else if(dc.documentElement&&(dc.documentElement.scrollLeft||dc.documentElement.scrollTop)) {
		//IE6 standards compliant mode
		return [dc.documentElement.scrollLeft,dc.documentElement.scrollTop];
	// Broken when the window is a subframe
	} else if(typeof(window.pageYOffset)=='number') {
		//Netscape compliant
		return [window.pageXOffset,window.pageYOffset];
	}
	return [0,0];
}

aaRegister(boxpos,'myBp');



// Requires lib.position.js for the myBp class

function haze() {
	this.div = null;
	if (!window.myHaze) {
		/*
		var ii = document.createElement('div');
		ii.id = 'iHaze';
		var ot = '';
		ot += 'top:-10000px;';
		ot += 'left:-10000px;';
		ot += 'visibility:hidden;';
		ot += 'position:absolute;';
		ot += 'background: url("'+aaPath(myVars.cmsImgBase,'haze.png')+'") repeat;';
		ot += 'z-index:50;';
		ii.setAttribute('style',ot);
		var el = this.div = document.getElementsByTagName('body')[0].appendChild(ii);
		el.style.position = 'absolute'; // KLUDGE FOR IE
		el.style.top = '-10000px';
		el.style.left = '-10000px';
		el.style.visibility = 'hidden';
		el.style.background = 'url("'+aaPath(myVars.cmsImgBase,'haze.png')+'") repeat';
		el.style.zIndex = 2;
		*/
		var ss = document.getElementById('myStuff');
		if (ss)
			ss.innerHTML += this.html();
		else
			document.write(this.html());
		window.myHaze = this;
	}
}

haze.prototype.html = function() {
return '\
<div id="iHaze" style="\
	top:-10000px;\
	left:-10000px;\
	visibility:hidden;\
	position:absolute;\
	background-color:transparent;\
	background:url(\''+aaPath(myVars.cmsImgBase,'haze.png')+'\') repeat;\
	z-index:50;\
	"\
></div>';
}

haze.prototype.on = function(hazeLvl,o) {
	if (!window.myBp) throw 'lib.position.js is not loaded for lib.haze.js to use';
	this.div = document.getElementById('iHaze');
	this.hazeLvl = hazeLvl ? hazeLvl : 50;
	var d = myBp.getDocSize();
	var w = myBp.getWinSize();
	//var wd = Math.max(w[0],d[0]);
	//elem.clientHeight < elem.scrollHeight
	var wd = d[0];
	var ht = Math.max(w[1],d[1]);
	if (o) {
		var p = myBp.pos(o);
		var d = myBp.dim(o);
		if (p[0]+d[0]>wd) wd = p[0]+d[0];
		if (p[1]+d[1]>ht) ht = p[1]+d[1];
	}
	var el = this.div;
	el.style.top = '0px';
	el.style.left = '0px';
	el.style.width = wd + 'px';
	el.style.height = ht + 'px';
	el.style.zIndex = this.hazeLvl;
	el.style.visibility = 'visible';
}

haze.prototype.off = function() {
	if (!this.div) return;
	this.div.style.visibility = 'hidden';
	this.div.style.top = this.div.style.left = '-10000px';
}

if (!window.myHaze) window.myHaze = new haze();



// Requires lib.haze.js for haze to appear

function iRBox() {
	this.timeout = 0;
	this.haze = true;
	this.bgColor = '#CCCCCC';

	if (!window.myIBox) {
		var ss = document.getElementById('myStuff');
		if (ss)
			ss.innerHTML += this.html();
		else
			document.write(this.html());
		this.div = document.getElementById('ibox1');
		this.inn = document.getElementById('ibox2');
		window.myIBox = this;
	}
	window.myBox = window.myIBox;
}

iRBox.prototype.html = function() {
return '\
<table id="ibox1" cellpadding=0 cellspacing=0 border=0 style="\
	top:-10000px;\
	left:-10000px;\
	width:auto;\
	visibility:hidden;\
	position:absolute;\
	display:block;\
	padding:0;\
	color:black;\
	margin:auto;\
	background-color:transparent;\
	z-index:99;\
	"\
><tr><td id="ibox2"></td></tr></table>';
}

iRBox.prototype.show = function(msg,timeout) {
	if (!this.div) this.div = document.getElementById('ibox1');
	if (!this.inn) this.inn = document.getElementById('ibox2');
	var el = this.div;
	this.msg = msg;
	this.linecnt = 0;
	if (el) {
		if (this.haze && window.myHaze) myHaze.on();
		this.inn.innerHTML = this.top(this.bgColor) + msg + this.end();
		var cp = myBp.centerPlace(50,myBp.dim(el)[0]);
		el.style.top = cp[1]+'px';
		el.style.left = cp[0]+'px';
		el.style.visibility = 'visible';
		if (timeout) setTimeout(function(){myIBox.hide()},timeout);
	}
	return el;
}

iRBox.prototype.showXmp = function(msg,timeout) {
	this.showPanel('<xmp>'+msg+'</xmp>',timeout);
}

iRBox.prototype.showPanel = function(msg,timeout) {
	//this.show('<div style="padding:8px 6px;background-color:'+this.bgColor+'"><div style="float:left;margin-right:10px;"><input type="button" value="close" onclick="myIBox.hide()"/></div><div style="clear:both"></div>'+msg+'</div>',timeout);
	this.show('<div style="padding:8px 6px;background-color:'+this.bgColor+'"><div style="float:right;margin-left:10px;"><input type="button" value="close" onclick="myIBox.hide()"/></div>'+msg+'</div>',timeout);
}

iRBox.prototype.add = function(msg) {
	this.msg += msg;
	if (this.inn) this.inn.innerHTML = this.top(this.bgColor) + this.msg + this.end();
}

iRBox.prototype.addLine = function(msg) {
	this.add('<div style="margin:0px 10px;font-family:courier new;font-size:9pt">'+(++this.linecnt)+') '+msg+'</div>');
}

iRBox.prototype.hide = function() {
	var el = this.div;
	if (el) {
		el.style.visibility = 'hidden';
		this.inn.innerHTML = '';
		if (this.haze && window.myHaze) myHaze.off();
	}
}

iRBox.prototype.top = function(bg) {
	//log.trace('bgColor',bg);
	var ot = '';
	this.tempBgColor = bg;
	ot += '<b class="rxcc">';
	for (var i=1;i<6;i++) ot += '<b class="rx'+i+'" style="border-color:'+bg+'"></b>';
	ot += '</b>';
	ot += '<div class="infoBox" style="padding:8px 10px;background-color:'+bg+'">';
	return ot;
}

iRBox.prototype.end = function() {
	var ot = '</div>';
	ot += '<b class="rxcc">';
	for (var i=5;i>0;i--) ot += '<b class="rx'+i+'" style="border-color:'+this.tempBgColor+'"></b>';
	ot += '</b>';
	return ot;
}

aaRegister(iRBox,'myIBox');











