var mDontUnload = false;
var mAlreadyUnloading = false;

function mLoadThis() {
/* #################### GLOBAL LOADER ################### */

	mInitScroll();
	return 1;

/* ###################################################### */
}

function mUnloadThis() {
/* #################### GLOBAL UNLOADER ################### */

	return 1;

/* ######################################################## */
}

/* ######################################################## */
/* ################ DON'T TOUCH CODE BELOW ################ */
/* ######################################################## */

function mClicked() {
	mDontUnload = false;
	mT = '';
	mT += this.target;
//	alert('><>' + mT + '<><');
	if (! (((mT == '_self') || (mT == '_top')) || ((mT == '_parent') || (mT == '')))) { mDontUnload = true; }
	mH = this.href;
	mH = mH.toLowerCase();
	mH = mH.substring(0,10);
	if (mH == 'javascript') { mDontUnload = true; }
}

function mLoading() {
	/* ##### Preloader ausblenden ###### */
	if (document.getElementById) {
		document.getElementById('mpreloadimg').style.display = 'none';
		document.getElementById('mpreloadx').style.display = 'none';
		document.getElementById('mpreloadbg').style.display = 'none';
	}
	/* ##### Links registrieren ##### */
//	var mlinks = document.getElementsByTagName('a');
//	for (var i=0; i < mlinks.length; i++) { mlinks[i].onclick = mClicked; }
	/* #################### */
	mLoadThis();
}

function mUnloading() {
	if ((mAlreadyUnloading) || (mDontUnload )) { return; }
	mAlreadyUnloading = true;
	/* ##### Preloader einblenden ###### */
	if (document.getElementById) {
		document.getElementById('mpreloadbg').style.display = 'block';
		document.getElementById('mpreloadimg').style.display = 'block';
		document.getElementById('mpreloadx').style.display = 'block';
	}
	/* #################### */
	mUnloadThis();
}

window.onload = mLoading;
window.onbeforeunload = mUnloading;
window.onunload = mUnloading;
