windowWidth = 0;
windowHeight = 0;

resizeTimeoutID = null;
dataXML = "<xml></xml>";

function getFlashMovie(movieName) {
    // function to get flashmovie object to communicate with javascript
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}

function sendCodeToFlash(movieid,str) {
    // send a string to the flasobject
	getFlashMovie(movieid).sendCodeToFlash(str);
}

function getCodeFromFlash(str) {
    // do something with the stringcode
	if (str.indexOf("showPage=") == 0){
        // card xml data is being send and should be saves for further processing
        dataString = str.slice(str.indexOf("=")+1);
	    showPage(dataString);
    }
	
    if (str.indexOf("closePage=") == 0){
		closePage();     
    }
}

function initSite(){
	$(window).resize(resizeSite);
	window.onresize = resizeSite;
	
	resizeSite();
}

function resizeSite() {
	if (resizeTimeoutID) {
		clearTimeout(resizeTimeoutID);
	}
	resizeTimeoutID = setTimeout("resizeStart()", 100);
}

function resizeStart() {
	windowWidth = $(window).width();
	windowHeight = $(window).height();	
	$("#topmenuHolder").css("height", "100%");
	$("#topmenuHolder").css("width", "100%");
	$("#topmenuHolder").attr("height", "100%");
	$("#topmenuHolder").attr("width", "100%");
}

jQuery(document).ready(function() {
	loadData();
});

function loadData() {
	$(document).ready(function() {
		$.ajax( {
			type : "GET",
			url : "data/menudata.xml",
			dataType : "xml",
			success : function(xml) {
				dataXML = xml;
				initSite();
			}
		});
	});
}
