// HANDLE WINDOW.ONLOAD:s ----------------------------------------------------


if (document.getElementById && document.getElementsByTagName && document.createTextNode) {
	window.onload = init;
}

var onLoads = new Array;

function init() {
	for (var i = 0; i < onLoads.length; i++) {
		eval(onLoads[i]);
	}
}

function addOnLoad(func) {
	onLoads[onLoads.length] = func;
}


// BROWSER DETECT ------------------------------------------------------------

var userBrowser = detectBrowser();

function detectBrowser() {
	var agent 	= navigator.userAgent.toLowerCase();
	
	this.isSafari	= (agent.indexOf('safari') != -1);
	this.isSafari2 = (this.isSafari && (parseFloat(agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).substring(0,agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).indexOf(' '))) >=  300));
	this.isOpera	= (agent.indexOf('opera') != -1);
	this.isNN		= (agent.indexOf('netscape') != -1);
	this.isFF		= (agent.indexOf('firefox') != -1);		
	this.isIE		= (agent.indexOf('msie') != -1);
		
	return this;
}


// CHANGE URLS WITH DROP-DOWNS -----------------------------------------------

function DD_goUrl() {
	window.location.href = this.options[this.options.selectedIndex].value;
}


// MAIN FUNCTIONS

addOnLoad("ALAO.init()");

var ALAO = 
{
	init : function() 
	{
		ALAO.loginInit();
	},
	
	loginInit : function() 
	{
		$('#login .login_psw').val($('#login label:last').text());
		$('#login .login_psw').focus( function() 
		{ 
			$('#login .login_psw').val('');
			$('#login .login_psw').css('color','#000');			
		});	

		$('#login .login_user').val($('#login label:first').text());
		$('#login .login_user').focus( function() 
		{ 
			$('#login .login_user').val('');
			$('#login .login_user').css('color','#000');			
		});	
	}
}

function setClass(divId)
{
    if(document.getElementById(divId).className == 'showDiv' )
    {
        document.getElementById(divId).className='hideDiv';
        document.getElementById("a"+divId).className='';
    }
    else if(document.getElementById(divId).className == 'hideDiv' )
    {
        document.getElementById(divId).className='showDiv';
        document.getElementById("a"+divId).className='FG_orange';
    }
}


function openPopupWindow(strURL, intW, intH) {
	window.open(strURL, 'popupWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=Yes,scrollbars=no,resizable=yes,width=' + intW + ',height=' + intH + '');
}

function showModal(linkURL, title) {
    var width = 255;
    var height = 250;
    var left = (screen.width / 2) - (width / 2);
    var top = (screen.height / 2) - (height / 2) - 150;
    if (window.showModalDialog) 
    {
        window.showModalDialog(linkURL, title, "dialogWidth:"+width+"px;dialogHeight:"+height+"px;dialogTop:"+top+"px;dialogLeft:"+left);
    }
    else 
    {
        window.open(linkURL, title,
						'height='+height+',width='+width+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes');
    }
}

function openPopupWindow(strURL, intW, intH) {
	window.open(strURL, 'popupWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=Yes,scrollbars=no,resizable=yes,width=' + intW + ',height=' + intH + '');
} 
