var mDontUnload = false;
var mAlreadyUnloading = false;
var mStartUp = true;

function mClicked() {
	mDontUnload = false;
	mT = '';
	mT += this.target;
	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 mShowAlert() {
/*	if (! (document.referrer) || (document.referrer.slice(7,18) != 'www.myon.it')) {
		document.getElementById('mpreloadx').style.display = 'block';
		document.getElementById('mpreloadbg').style.display = 'block';
//		document.getElementById('malertmsg').style.display = 'block';
		return;
	} */
}

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';
//		document.getElementById('malertmsg').style.display = 'none';
	}
	if (mStartUp) {
		/* ##### Silbentrennung ##### */
		if (typeof(Hyphenator) != 'undefined') { Hyphenator.hyphenateDocument(); }
		/* ##### Links registrieren ##### */
		var mlinks = document.getElementsByTagName('a');
		for (var i=0; i < mlinks.length; i++) { mlinks[i].onclick = mClicked; }
		/* #################### */
		/* mShowAlert(); */
	}
	mStartUp = false;
}

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';
	}
	/* #################### */
}

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