/**
 * import more files
 */
importJS('js/ufo.js');
importJS('js/swfaddress.js');
importJS('js/pageInfo.js');
importJS('js/formHandler.js');
importJS('js/dom.js');
importJS('js/ajax.js');
importJS('js/ajaxClass.js');
importJS('js/fileupload.js');
importJS('main.php?run=getAllModuleJS');

var menuLoad = false;
var flashIndex = null;
var isIElt7 = false;

function importJS(js)
{
	document.writeln('<script language="javascript" type="text/javascript" src="' + js + '"></script>');
}


/**
 * add an window.onload handler 
 */
window.onload = function()
{
	getElement('ui_ajaxWrapper').style.visibility = 'hidden';
	insertMenu();
	

}

function thisMovie(movieName) 
{
    if (navigator.appName.indexOf("Microsoft") != -1) 
    {
        return window[movieName]
    }

    return document[movieName]

} 

/**
 * insert a UFO 
 */
function insertUFO(obj, id)
{
	UFO.create(obj, id);
}

/**
 * insert the main menu
 */
function insertMenu()
{
	if (menuLoad) return;
	
	var FO = { 	movie:			"flash/menu.swf", 
				id:				"menuUFO",
				name:			"menuUFO", 
				width:			"100%", 
				height:			"100%",
				bgcolor:		"#000000",
				wmode:			'opaque',
				flashvars: 		 'pidYAdjust=-3',
				majorversion:	"8", 
				build:			"0" 
			};
	
	UFO.create(FO, "ui_flashMenu");
	
	menuLoad = true;
}

/**
 * request a new page
 */
function requestPage(path)
{
	try { pageTracker._trackEvent("Ajax", "Page Request", path); } catch(err){}
	
	document.getElementById('ui_ajaxWrapper').style.opacity = '0.5';
	document.getElementById('ui_ajaxWrapper').style.filter = "alpha(opacity = 50)";
	UFO.killAll();
	
	var url = path.replace(/^(.*\/).*?$/, '$1');
	var attr = path.replace(/^.*\/(.*?)$/, '$1');
			
	getAjax({
				run: 	'getAjaxContent',
				url:	url,
				attr:	attr,
				div:	'ui_ajaxWrapper'
			});
	
} 

/**
 * jump to a page
 */
function jump(url)
{
	thisMovie('menuUFO').jumpToPage(url);
}