if (top !== self) {
	alert('The URL ' + self.location.href + ' cannot be viewed inside a frame.  You will be redirected.');
	top.location.href = self.location.href;
}
//
//
var $D = YAHOO.util.Dom, //
$C = $D.getElementsByClassName, //
$E = YAHOO.util.Event, //
$CONN = YAHOO.util.Connect, //
$ = YAHOO.util.Dom.get, //
$LANG = YAHOO.lang, //
$J = YAHOO.lang.JSON, //
sString = 'some text', //
$W = YAHOO.widget, //
$L = YAHOO.log, //
o1 = {}, //
LampcmsException = function(message, exceptionName) {
	this.message = message;
	this.name = exceptionName || "LampcmsException";
},
/**
 * 
 */
oAjaxObject = {
handleSuccess : function(o) {
	// alert('got something');
	// This member handles the success response
	// must determine what the result is for:
	// can be for doc or tpl or can be a text with css
	// we should test the returned text which should always be a JSON object
	var json, sDoc, sTpl, errDiv, strMessage = '', //
	eLogin = $("nbar"), //
	strContentType = $LANG.trim(o.getResponseHeader["Content-Type"]);
	// alert(strContentType);
	switch (strContentType) {
	case 'text/json; charset=UTF-8':
		try {
			json = $J.parse(o.responseText);
			// alert(json);
		} catch (e) {
			alert("Invalid json data in responceText " + $LANG.dump(e) + " strContentType " + strContentType + "\noRespnose: " + $LANG.dump(o.responseText));
		}

		switch (true) {
		case json.hasOwnProperty('error'):
			oSL.setLoginError(json.error);
			break;

		case json.hasOwnProperty('exception'):
			if (json.hasOwnProperty('errHeader')) {
				strMessage += '<u>' + json.errHeader + '</u><br>';
			}

			errDiv = document.createElement('div');
			errDiv.id = 'exc';
			var mainDiv = $C('yui-b', 'div')[0];
			$D.insertBefore(errDiv, mainDiv.firstChild);

			errDiv.innerHTML = strMessage + json.exception;
			if ($('go')) {
				$('go').disabled = false;
			}
			break;

		case json.hasOwnProperty('redirect'):
			window.location.assign(json.redirect);
			break;

		case json.hasOwnProperty('navbar'):
			oSL.fMakeNavBar(json);
			break;

		case json.hasOwnProperty('message'):
			eLogin.innerHTML = json.message;
			// oSL.fColorChange(eLogin, '#00FF00', '#FFFFFF');
			break;

		}

	}
},
handleFailure : function(o) {
	alert($LANG.dump(o));
}
}, //
oSL = {
toString : function() {
	return 'object oSL';
},
oCallback : {
success : oAjaxObject.handleSuccess,
failure : oAjaxObject.handleFailure,
scope : oAjaxObject
},//
fAddIcon : function(s, b) {
	var el = (typeof (s) === 'string') ? $(s) : s;

	if (!this.eLoader) {
		this.eLoader = document.createElement("img");
		this.eLoader.src = '/images/ajax-loader.gif';
		this.eLoader.id = "loadericon";
	}
	// $L("314 el: " + el + " oEditor.eLoader: " + oEditor.eLoader, "user");
	if (this.eLoader) {
		if (b && b === true) {
			el.innerHTML = '';
		}

		el.appendChild(this.eLoader);

	}
}, //
fRemoveIcon : function() {
	if (this.eLoader && this.eLoader.parentNode) {
		$L('include.js 118 eLoader parent: ' + this.eLoader.parentNode + ' id: ' + this.eLoader.parentNode.id);
		this.eLoader.parentNode.removeChild(this.eLoader);
	}
},
/**
 * Compares 2 HTML form Dom nodes
 * 
 * @param {Object}
 *            oNewForm a new HTML form, usually the one use tries to submit
 * @param {Object}
 *            oOldForm an old HTML form, usually the one with default values
 *            (valued when page first loaded)
 * @return boolean true if at least one of new form's values is different from
 *         the same one in old form or if the new form has a form element that
 *         is not present in the old form.
 */
fCompareForms : function(oNewForm, oOldForm) {
	$L($CONN.setForm(oNewForm));
	$L($CONN.setForm(oOldForm));

	if ($CONN.setForm(oNewForm) === $CONN.setForm(oOldForm)) {
		return true;
	}

	return false;
},//
/**
 * Use color animation to change background-color of an element slowly from one
 * color to a new color, then back to sFromColor, then set backgroundColor to
 * its original (the one before this function) This can be used to display
 * changes or to attract attention to some message inside a div like to a new
 * error message.
 * 
 * @param {Object}
 *            el
 * @param {Object}
 *            sToColor
 */
fColorChange : function(el, sFromColor, sToColor) {
	$L('starting fColorChange for ' + el);
	var myChange, curBg, myChangeBack, //              
	element = (typeof el === 'string') ? $(el) : el, //
	sToColor = (sToColor && typeof sToColor === 'string') ? sToColor : '#FF0000', //
	sFromColor = (sFromColor && typeof sFromColor === 'string') ? sFromColor : '#FFFFFF';

	$L('element is: ' + element);

	if (element) {

		curBg = $D.getStyle(element, 'background-color');
		$D.setStyle(element, 'background-color', sFromColor);
		myChange = new YAHOO.util.ColorAnim(element, {
			backgroundColor : {
				to : sToColor
			}
		});

		/**
		 * Change the background back to what if was before the animation
		 * started
		 */
		myChangeBack = function() {
			element.style.backgroundColor = curBg;
		}

		myChange.onComplete.subscribe(myChangeBack);
		myChange.animate();

	}
}, //
fMakeMeNav : function(id, o) {

	$L('178 id is: ' + id);
	// return true; // for testing without navbar just return here
	var oMerged = null;
	if (o && o.merged) {
		oMerged = o.merged;
		$L('193 merged: ' + oMerged);
	}

	$L('101 starting fMakeMeNav ' + id, "warn");
	// var id = 'menav';
	var elMenav = $(id);
	$L('104 elMenav ' + elMenav, "warn");
	if (elMenav == 'undefined' || null === elMenav) {
		return true;
	}

	/**
	 * Here we do some fancy things by cloning node, then removing contents or
	 * cloned node's parent with an empty string effectively wiping out the
	 * cloned node, then appending the new clone as a child of the 'nbar'
	 * element.
	 * 
	 * This is interesting, but what if the parent of cloned node was already
	 * the 'nbar' div? Then we just did something complicated that resulted in
	 * the same exact html and dom structure as before: we cloned node,
	 * destroyed the cloned node, then appended the clone to the same parent...
	 * 
	 * Why do we need to do this anyway?
	 * 
	 * This can be understood IF the id passed to this method is different from
	 * 'nbar', for example if the HTML of the navigation menu was in some other
	 * div on the page, like maybe it was on the left menu and what we doing is
	 * moving it to the nvar (to the top)
	 */

	var elParent = elMenav.parentNode;
	$L('218 elParent.id: ' + elParent.id);
	if (elParent.id !== 'nbar') {
		var elClone = elMenav.cloneNode(true);
		elParent.innerHTML = '';
		var nRoot = $('nbar');
		nRoot.appendChild(elClone);
	} else {
		$L('Dude! this does not make sense', "warn");
		elClone = elMenav;
	}

	$L('192 elMenav ' + elMenav, "warn");
	/**
	 * o1 is just a new namespace o1.oMenu is our top menu bar
	 */
	o1.oMenu = new $W.MenuBar(elClone, {
	position : "static",
	autosubmenudisplay : true,
	hidedelay : 550,
	iframe : false,
	lazyload : false
	});

	$L('201 elMenav ' + elMenav, "warn");
	o1.oMenu.render();

	$L('204 elMenav ' + elMenav, "warn");
	this.makeSwitchMenu(oMerged);
	$L('206 elMenav ' + elMenav, "warn");

}, //
fMakeNavBar : function(o) {
	var sHTML = o.navbar, //
	eNavBar = $('nbar');
	if (!eNavBar) {
		return false;
	}
	/**
	 * If we already have the o1.oMenu (a top nav bar object) then use its'
	 * destroy() method to completely destroy it, including all sub-menus and
	 * remove all event listeners
	 */
	if (o1 && o1.oMenu) {
		o1.oMenu.destroy(); // this also destroys menav div element itself
	}
	/**
	 * Here we stick the html (value of o.navbar) as the innerHTML of the DOM
	 * element with id 'nvar', which is our top div on the page. So whatever
	 * html it may have had before, it will now have the totally new html
	 */
	eNavBar.innerHTML = sHTML;
	this.fMakeMeNav('menav', o);
}, //
fGetErrTd : function() {
	this.eErrTd = $("titleWarning");
	return this.eErrTd;
}, //
setLoginError : function(message) {

	if (this.eErrTd) {
		$D.setStyle(oSL.eErrTd, "backgroundColor", "#FFFFCC");
		this.eErrTd.innerHTML = message;
		this.fColorChange(oSL.eErrTd, '#FFFFFF', '#FF0000');
		$('go').disabled = false;
	} else {
		alert(message);
	}
}, //
validateLogin : function(oFrm) {
	if (oFrm && oFrm.elements) {
		for ( var element in oFrm.elements) {
			var fElement = oFrm.elements[element];
			if (fElement && fElement.name) {
				var elName = oFrm.elements[element].name;
				if (elName === 'login' || elName === 'pwd') {
					if ('' === fElement.value) {
						fElement.style.borderWidth = "2px";
						fElement.style.borderStyle = "solid";
						fElement.style.borderColor = "#FF0000";
						if (oFrm.elements['r']) {
							this.setLoginError(oFrm.elements['r'].value);
						}
						return false;
					} else {
						fElement.style.borderWidth = '';
						fElement.style.borderStyle = '';
						fElement.style.borderColor = '';
					}
				}
			}
		}
	}

	return true;
},//   
fLogin : function(o) {
	var target = $E.getTarget(o), //
	errTd = oSL.fGetErrTd(), //
	formObject = $("frmLogin");
	formObjectTest = $("sampleForm");

	/**
	 * This one is for a style editor form on that page the form name is
	 * 'sampleForm' and we just want to disable the submittion of that form when
	 * button is clicked
	 */
	if (target && target.type && formObjectTest && target.type.toLowerCase() === 'submit') {
		$E.stopEvent(o);
		return;
	}

	if (target && target.type && formObject && target.type.toLowerCase() === 'submit') {

		$E.stopEvent(o);

		if (oSL.validateLogin(formObject)) {
			target.disabled = true;
			if (errTd) {
				oSL.fAddIcon(errTd);
			}
			$CONN.setForm(formObject);
			// This example facilitates a POST transaction.
			// An HTTP GET can be used as well.
			$CONN.asyncRequest("POST", "/index.php", oSL.oCallback, "ajaxid=1");
		}
	} else {
		if (target.nodeName && target.nodeName.toLowerCase() === 'a' && target.href.toLowerCase().match('logout')) {
			$E.stopEvent(o);
			target.href = '#';
			oSL.fAddIcon(target);

			/*
			 * resetFormState() is very important because if the page has had
			 * another setForm() ran for a different form, the $CONN will still
			 * be configured with a different form object
			 */
			$CONN.resetFormState();
			$CONN.asyncRequest("GET", "/index.php?a=logout&ajaxid=1", oSL.oCallback);
		}
	}

},//
fMakeLangSelect : function(id) {
	/*
	 * 
	 * var oSplitButton1 = new $W.Button("splitbutton1", { type: "split", menu:
	 * "splitbutton1select" }); }
	 */
	$E.onAvailable(id, function() {
		if ($('splitbutton1')) {
			var oSplitButton1 = new $W.Button("splitbutton1", {
			type : "split",
			menu : "splitbutton1select"
			});
		}
	});
}, //
/**
 * Closure based object constructor do NOT use 'new' to instantiate!
 * 
 * @param {Object}
 *            o
 */
oSwitcharoo : function(o) {

	/**
	 * Upon calling this constructor validate the input object and may throw
	 * LampcmsException if object is missing some expected elements
	 */
	this.validateParsed(o);

	/**
	 * These vars will be private through closure: any function of returned
	 * object will have access to these but they cannot be accessed directly no
	 * can they be changed directly
	 */
	var oUsers = o.users, //
	sMenuId = "switcmenu1", //
	sSwitchItemId = "switcher1", //
	sPostUrl = '/index.php', //
	sLabel = o.sLabel;
	$L('361 oUsers: ' + $LANG.dump(oUsers));

	var oRet = {
	toString : function() {
		return 'Switcharoo object';
	},//
	onMenuItemClick : function(p_sType, p_aArgs, p_oValue) {
		$L('412 include.js p_oValue: ' + p_oValue, 'warn');
		$CONN.asyncRequest('POST', oSL.oS.getPostUrl(), oSL.oCallback, oSL.oS.makeFormParams(p_oValue));
	},//
	getMenuId : function() {
		return sMenuId;
	},//
	getSwitchItemId : function() {
		return sSwitchItemId;
	},//
	getPostUrl : function() {
		return sPostUrl;
	},//
	getUid : function(sUsername) {
		for ( var uid in oUsers) {
			if (oUsers[uid] === sUsername) {
				return uid;
			}
		}

		return null;
	},//
	makeFormParams : function(uid) {
		var result;
		// var uid = this.getUid(sUsername);
		if (!uid) {
			throw new LampcmsException('userid not found for this username: ' + sUsername);
		}

		result = 'qf_version=' + o.qf_version + '&a=' + o.a + '&uid=' + uid;
		
		$L('441 include.js result: ' + result, 'warn');
		
		return result;
	}, //
	getA : function() {
		return o.a;
	},//
	getToken : function() {
		return o.qf_version;
	},//
	getSwitchText : function() {
		return sLabel;
	},//
	getUsersArray : function() {
		var oMyUser, aMyUsers = [];
		for ( var id in oUsers) {
			oMyUser = {
			text : oUsers[id],
			onclick : {
			fn : oSL.oS.onMenuItemClick,
			obj : id
			}
			};
			aMyUsers.push(oMyUser);
		}

		return aMyUsers;
	}
	}

	return oRet;
},// 
// A workaround for XSL-to-XHTML systems that don't
// implement XSL 'disable-output-escaping="yes"'.
//
// sburke@cpan.org, Sean M. Burke.
// - I hereby release this JavaScript code into the public domain.
check_decoding : function() {
	var d = $('cometestme');

	if (!d) {
		alert("Can't find an id='cometestme' element?");
		throw LampcmsException("Can't find an id='cometestme' element?");
	} else if (!('textContent' in d)) {
		// It's a browser with a halfassed DOM implementation (like IE6)
		// that doesn't implement textContent! Assume that if it's that
		// dumb, it probably doesn't implement disable-content-encoding.

	} else {
		ampy = d.textContent;

		// alert("432 Got " + ampy);

		if (ampy === undefined) {
			// alert('436 Firefox developers suck ballz and eats shit');
			throw LampcmsException("'cometestme' element has undefined text content?!");
		}
		if (ampy === '') {
			// alert(' 440 Firefox developers suck ballz and eats shit');
			throw LampcmsException("'cometestme' element has empty text content?!");
		}

		if (ampy == "\x26") {
			// alert(' 445 Firefox developers suck ballz and eats shit');
			this.is_decoding = true;
		} else {
			// alert('448 Firefox developers suck ballz and eats shit');
			if (ampy == "\x26amp;") {
				// alert('765 this is ' + this);
				// alert('451 Firefox developers suck ballz and eats shit');
				this.is_decoding = false;
			} else {
				// alert('454 Firefox developers suck ballz and eats shit');
				throw LampcmsException('Insane value: "' + ampy + '"!');
			}
		}

	}

	var msg = (this.is_decoding === undefined) ? "I can't tell whether the XSL processor supports disable-content-encoding!D" : this.is_decoding ? "The XSL processor DOES support disable-content-encoding" : "The XSL processor does NOT support disable-content-encoding";

	// alert(msg);

	return msg;
}, //
go_decoding : function() {
	if (!(document.getElementById)) {

		alert("Your browser sucks eggs.\n\nConsider upgrading to Internet Explorer 6, Firefox, or Mozilla or Chrome.");
	}

	// alert('473');
	this.check_decoding();

	if (this.is_decoding) {
		// alert("No work needs doing -- already decoded!");
		return;
	}

	// var to_decode = document.getElementsByName('decodeable');
	var to_decode = $C('decodeable');

	if (!(to_decode && to_decode.length)) {
		// alert("No work needs doing -- no elements to decode!");
		return;
	}

	var s;
	for ( var i = to_decode.length - 1; i >= 0; i--) {
		s = to_decode[i].textContent;

		if (s == undefined || (s.indexOf('&') == -1 && s.indexOf('<') == -1)) {
			// the null or markupless element needs no reworking
		} else {
			to_decode[i].innerHTML = s; // that's the magic
		}
	}

	return;
}, //
makeSwitchMenu : function(o) {
	try {
		$L('515 o ' + o, "window");
		if (!o || (o === null)) {
			$L('517 o is null', "window");
			var o = this.parseSwitchForm();
			$L('397 o: ' + $LANG.dump(o), "window");
		} else {
			$L('418 o: ' + $LANG.dump(o), "warn");
		}
		if (this.oS) {

			// delete (this['oS']);
		}
		$L('527 o: ' + $LANG.dump(o), "warn");
		this.oS = this.oSwitcharoo(o);
		$L('529 o: ' + $LANG.dump(o), "warn");
	} catch (e) {
		$L("424 Caught error: " + e.message, "error");
		return false;
	}

	// $L('412 items: ' + $LANG.dump(this.oS.getMenuItems()) + ' messenger
	// uid: ' + this.oS.getUid('messenger'));
	/**
	 * check if oMenu exists, if it has menu oWelcome if oWelcome already has
	 * item with id 'switcharoo' then remove it (along with sub-menu) append
	 * item with id 'switcharoo' and submenu find the newly created item object
	 * and subscribe it to onClick event
	 */
	if (o1 && o1.oMenu) {
		$L('489 starting this is ' + this);

		var oSwitchMenu, oMenuBar = o1.oMenu;
		$L('493');
		var aItems = oMenuBar.getItems();
		$L('495');

		var oWelcomeMenu = aItems[0].cfg.getProperty("submenu");
		$L('497');

		var aMyUsers = this.oS.getUsersArray();
		$L('560 aMyUsers: ' + $LANG.dump(aMyUsers));

		var sSubId = this.oS.getMenuId();
		$L('501 sSubId ' + sSubId);

		var oSub1 = new $W.Menu(sSubId);

		var sLabelText = this.oS.getSwitchText();
		// $L('504 sLabelText ' + sLabelText + ' oSub1 ' +
		// $LANG.dump(oSub1));

		var sMyItemId = this.oS.getSwitchItemId();
		$L('571 sMyItemId ' + sMyItemId);

		oSub1.addItems(aMyUsers);

		// $L('575: ' + $LANG.dump(oSub1));

		oWelcomeMenu.insertItem( {
		id : sMyItemId,
		text : sLabelText
		}, 0);

		// $L('582: ' + $LANG.dump(oWelcomeMenu));
		/**
		 * oSwitchMenu is now the first menuItem in the welcom menu
		 */
		oSwitchMenu = oWelcomeMenu.getItem(0);

		$L('589');
		oSwitchMenu.cfg.setProperty("submenu", oSub1);
		$L('591');

		oWelcomeMenu.render();
		$L('594');

	}
}, //
validateParsed : function(oRes) {
	if (!oRes.a || !oRes.qf_version || !oRes.sLabel || !oRes.users) {
		throw new LampcmsException('Not all required elements found in form');
	}
}, //
parseSwitchForm : function() {
	var sLabel, sName, sType, elParent, sQfv, oRes = {}, oUsers = {}, bUser = false, oFrm = $('fSwitch');
	$L('591 oFrm ' + oFrm, "warn");
	if (!oFrm || !oFrm.elements) {
		throw new LampcmsException('Form "fSwitch" not found in document');
	}

	elParent = oFrm.parentNode;
	$L('545 form parent: ' + elParent);
	/**
	 * Now can remove actual form from the page
	 */
	if (elParent) {
		elParent.removeChild(oFrm);
	}

	for ( var element in oFrm.elements) {
		var fElement = oFrm.elements[element];
		if (fElement) {
			sName = fElement.name;
			sType = fElement.type;
			if ((sName) && (sName === 'a' || sName === 'qf_version')) {
				oRes[sName] = fElement.value;
			}
			if (fElement.type === 'submit') {
				oRes['sLabel'] = fElement.value;
			}
			// if (sName === 'amerged' && fElement.options) {
			if (sName === 'uid' && fElement.options) {
				$L('399 num options: ' + fElement.options.length);
				for ( var i = 0; i < fElement.options.length; i++) {
					var oOption = fElement.options[i];
					if (oOption.value && oOption.text) {
						bUser = true;
						oUsers[oOption.value] = oOption.text;
					}
				}
				if (bUser) {
					oRes['users'] = oUsers;
				}
			}
		}
	}

	$L('634 ', "warn");
	this.validateParsed(oRes);
	$L('414 oRes: ' + $LANG.dump(oRes));

	return oRes;
},//
makeHomeTabs : function() {
	/*
	 * var rootdiv1 = $("mybody"); if (rootdiv1 == "undefined") { alert('no
	 * element "mybody"'); };
	 */
	var rootdiv1, aRoot = $C('yui-b', 'div', 'yui-main');
	if (aRoot && aRoot[0]) {
		rootdiv1 = aRoot[0];
	}
	$L('544 rootdiv1: ' + rootdiv1);

	var recentHTML = rootdiv1.innerHTML;

	rootdiv1.innerHTML = "";
	$L('537 rootdiv1: ' + rootdiv1);
	var navblock = $("navBlock");
	if (navblock == "undefined") {
		alert('no element "navBlock"');
	}
	$L('542 navblock: ' + navblock);

	var aLinks = navblock.getElementsByTagName("a");
	var tabView = new $W.TabView();
	$L('546 tabView: ' + tabView);

	for ( var i = 0; i < aLinks.length; i++) {
		var sTitle = aLinks[i].getAttribute("title");
		// if aLinks[i].getAttribute("href") has ? then separate by &, else
		// by ?
		var href = aLinks[i].getAttribute("href");
		var separator = (href.search(/\?/) > 0) ? "&" : "?";
		var sHref = href + separator + "do=home";

		if (i === 0) {
			tabView.addTab(new $W.Tab( {
			label : sTitle,
			content : recentHTML,
			active : true
			}));
		} else {
			tabView.addTab(new $W.Tab( {
			label : sTitle,
			dataSrc : sHref,
			cacheData : true,
			active : false
			}));
		}

	}
	$L('570 tabView: ' + tabView);
	navblock.innerHTML = "";
	tabView.appendTo(rootdiv1);
}, //
/**
 * Parse data object, depending of keys and values update elements on the page.
 * 
 * @param {Object}
 *            o parsed json data returned from server after processing form
 *            values.
 */
fParseQf : function(json) {
	$L($LANG.dump(json));

	var strMessage = '', aAvatars, i = 0, el, formField, eMessageDiv = $('qfe');

	switch (true) {

	case json.hasOwnProperty('exception'):
		if (json.hasOwnProperty('errHeader')) {
			strMessage += '<u>' + json.errHeader + '</u><br>';
		}
		eMessageDiv.innerHTML = '<div id="qfErrors">' + strMessage + json.exception + '</div>';
		break;

	case json.hasOwnProperty('success'):
		// this is doc
		if (eMessageDiv) {
			strMessage += json.success;
		}
		if (json.blog_title && json.blog_title.val) {
			if (this.eH1) {
				this.eH1.innerHTML = json.blog_title.val;
			}
		}
		if (this.eH2 && json.blog_description && json.blog_description.val) {
			this.eH2.innerHTML = json.blog_description.val;
		}
		for ( var formField in json) {
			if (json.hasOwnProperty(formField) && json[formField].hasOwnProperty('err')) {
				// alert('formField: ' + formField + 'err: ' +
				// json[formField].err);
				strMessage += '<br><u>' + json[formField].err + '</u><br>';
			}
		}

		/**
		 * If avatar has been updated, then we will have an element 'avatar'
		 * which is an array and its 'val' will be a full html img src tag to
		 * avatar We will need to update all divs with class 'avatar' Normally
		 * there will be 2 of these divs: one under the profile form itself and
		 * one in the user's template nav bar.
		 */
		if (json.avatar && json.avatar.val && json.avatar.val !== '') {
			$Y.log('this is ' + this, 'warn');
			$D.setStyle(this.aTrs, 'visibility', '');
			$D.setStyle(this.aTrs, 'display', '');

			aAvatars = $C('avatar', 'div');
			if (aAvatars) {
				for (i = 0; i < aAvatars.length; i += 1) {
					aAvatars[i].innerHTML = json.avatar.val;
				}
			} else {
				$Y.log('no div with class "avatar"', 'warn');
			}
		}

		eMessageDiv.innerHTML = strMessage;
		this.fColorChange('qfmessage', '#00FF00', '#FFFFFF'); // eMessageDiv
		break;

	case json.hasOwnProperty('errors'):
		if (json.hasOwnProperty('errHeader')) {
			strMessage += '<u>' + json.errors.errHeader + '</u><br>';
		}

		eMessageDiv.innerHTML = '<div id="qfErrors">' + strMessage + json.errors.errMessage + '</div>';
		this.aEls = [];
		for (formField in json) {
			if (json.hasOwnProperty(formField) && json[formField].hasOwnProperty('err')) {
				el = $('a' + formField);
				if (el) {
					el.style.backgroundColor = '#FFFFCC';
					this.aEls.push(el);
				}
			}
		}

		this.fColorChange('qfmessage', '#FF0000', '#FFFFFF'); // eMessageDiv
		break;

	}

	if (oSL.oFrm && oSL.oFrm.elBtnSubmit) {
		oSL.oFrm.elBtnSubmit.disabled = false;
	}
	var elPbar = $('progressBar'), elAvatarField = $('aavatar');
	if (elPbar) {
		elPbar.parentNode.removeChild(elPbar);
	}
	if (elAvatarField) {
		$D.setStyle(elAvatarField, 'display', 'block');
	}

}, //
/**
 * Get translated value of a string if it exists in oLampcmsTr object This
 * object is usually added (sometimes) directly to the html page from the
 * clsWebPage->addTranslatedJson()
 * 
 * @param string
 *            s a string to translate
 * 
 * @param string
 *            sTrPage a translation page where to find the string
 */
translateTrString : function(s, sPage) {

	// $L('starting translateTrString ' + s + ' 888 this is: ' + this);

	if (!s || !sPage) {
		throw new LampcmsException('oSL.translateTrString() requires 2 arguments!');
	}

	if (!this.oLampcmsTr || !this.oLampcmsTr[sPage]) {
		this.formatTrKey(s);
	}

	return (this.oLampcmsTr[sPage][s]) ? this.oLampcmsTr[sPage][s] : this.formatTrKey(s);

}, //
/**
 * In case translation string was not translated (not found in translation
 * lookup table) then we usually return the untranslated key, but first we need
 * to format the key nicely, at least convert it to upper case and replace
 * underscores with spaces
 * 
 * @param {Object}
 *            s
 */
formatTrKey : function(s) {
	var first, rest;
	if (!s) {
		throw new LampcmsException('oSL.formatTrKey() requires one non-empty string parameter');
	}

	first = s.substr(0, 1);
	rest = s.substr(1, s.length - 1);
	s = first.toUpperCase() + rest.toLowerCase();

	return s = s.replace('_', ' ');
}

}, //
doExit = function() {
	alert("somethig wrong");
	return;
}, //
/*
 * myLogReader = new $W.LogReader(),
 */

//
set_tbl_new = function() {

	var obj1 = document.getElementById('tblNew');
	//
	if (typeof obj1 != 'undefined') {
		//
		if (obj1.style.display == "none") {
			obj1.style.display = "block";
			// alert(1);
		} else {
			obj1.style.display = "none";
			// alert(2);
		}

	}

};

$E.onDOMReady(function() {

	oSL.fMakeLangSelect('langForm'); // temporaraly commented out on June 6
		// 09
		$E.addListener('nbar', "click", oSL.fLogin);
		oSL.fMakeMeNav('menav'); // making this onAvailable results in
		// rendering menu twice when loaded by ajax
		try {
			oSL.go_decoding();
		} catch (e) {
			alert("Caught error: " + e.message, "error");
			return false;
		}
		// oSL.fShowMenu();

		if ($W.LogMsg && $W.LogReader) {
			$E.onContentReady('loaded', function() {
				var myLogReader = new $W.LogReader();
			})
		}

	});
