// mootools version
startList = function() 
{
	if(Browser.Engine.trident4) 
	{
		var navRoot = $("nav");
		var chNodes = navRoot.getChildren();
		
		chNodes.each(function(node) {
			node = $(node);
			if(node.get('tag') == "li") {
				node.addEvent('mouseover', function() {
					this.addClass('over');
				});
				node.addEvent('mouseout', function() {
					this.removeClass('over');
				});				
			}
		});
	}
}

window.addEvent('domready', function() {
	startList();
});

function changeLogo(name,path,action){
	if(action == 1){
		document.getElementById(name).src = path + 'images/design/logos/' + name + '.gif';
	}else{
		document.getElementById(name).src = path + 'images/design/logos/' + name + '_grey.gif';
	}
}

/** Present the user with a dialog prompt asking to confirm the requested action **/
function confirmAction(question, action, type){
	var confirmprompt = confirm(question);
	if(confirmprompt){
		if(type=='href'){
			window.location.href=(action);
		}else if(type=='submit'){
			document.action.submit();
		}
	}else{
		 /**
		  * Removed because it caused refresh issues when posted data exists
		  * location.reload(true);
		  */
		 return false;
	}
}

function initialiseDownload(path, serverPath){

	if((serverPath == '') || (serverPath == undefined)){
		serverPath = 'http://www.aapgroup.com.au/advisers/';
	}

	if(path==''){ return false; }

	var isIE = /*@cc_on!@*/false;

	if(isIE == false){

		window.open( serverPath + 'download.php?File=' + path,null,'toolbar=0,location=no,directories=0,status=0,scrollbars=yes,resizable=1,width=1,height=1,top=0,left=0')	;

	}else{

		window.addEvent('domready', loadMOOdal);
		function loadMOOdal() {
			MOOdalBox.open( serverPath + 'download.php?Prompt=1&File=' + path, '', '400 100');
		}

	}
}