/* (c) 2009 Jean Luc BIELLMANN - EES - contact@adressesetservices.com */

function Main () {
	objMain = this;
}
Main.prototype = {
	disableselect : function () {
		return false;
	},
	innerHtml : function (name,content) {
		var l= $(name).firstChild.length;
		$(name).firstChild.replaceData(0, l, content);
	},
	info : function (title,mess) {
		I($('div_info_title'),title);
		I($('div_info_message'),mess);
		objMain.showInfo();
		return true;
	},
	showInfo : function () {
		if ($('div_info_message')) 
			if ($('div_info_message').innerHTML.length) {
				$('div_info').style.display='block';
				var w = $('div_info').offsetWidth; 
				var h = $('div_info').offsetHeight; 
				$('div_info').style.left = parseInt(document.viewport.getWidth()/2-w/2)+'px';
				$('div_info').style.top = parseInt(document.viewport.getHeight()/2-h/2)+'px';
				$('div_info_button').focus();
			}
	},
	startup : function () {
		var i = 0;
		var j = 0;
		var as = '';
		var lastloc = '';
		var uls = document.getElementsByClassName('ulmenu');
		
		for (i=0;i<uls.length;i++) {
			as = uls[i].getElementsByTagName('a');
			for (j=0;j<as.length;j++)
				if (as[j].href==document.location) {
					Cookie.set('alsa_lastloc',document.location,7);
					as[j].style.color='#f0f0f0';
					return true;
				}
		}
		// no location : get previous
		if (Cookie.get('alsa_lastloc')) {
			lastloc = Cookie.get('alsa_lastloc').replace(/^.*index.php/,'');
			for (i=0;i<uls.length;i++) {
				as = uls[i].getElementsByTagName('a');
				if (lastloc != null)
					for (j=0;j<as.length;j++)
						if (as[j].href.replace(/^.*index.php/,'')==lastloc) {
							as[j].style.color='#ffffff';
							as[j].style.textDecoration='underline';
							return true;
						}
			}
		}
	}
};
var _main = new Main();
