// Datei: theme.js
// Autor: Martin Plangg
// Zweck: Hauptfunktionen Theme & Page


function ofWriteMail(iName, iDomain)
{
	document.write("<a href=\"javascript:ofOpenMail('" + iName + "', '" + iDomain + "')\">" + iName + "@" + iDomain + "</a>");
}

function ofOpenMail(iName, iDomain)
{
	window.location.replace('mailto:' + iName + '@'+ iDomain); 
} 


var ofMainTabContMinHeight = 600;
var ofMainTabContSubHeight = 145;

function ofWriteMainTabDivElementHead()
{

	var h = ofGetWindowHeight();

	if (document.layers) return;
	
	if (h > (ofMainTabContMinHeight - ofMainTabContSubHeight))
	{
		document.writeln(
			  '<div style="position:relative; height:'
			+ h + 'px; overflow:auto;">')
	} else {
		document.writeln('<div>');
	}

}


function ofWriteMainTabDivElementTail()
{
	document.writeln("</div>");
}


// Fensterhöhe ermitteln
function ofGetWindowHeight()
{
	var retHeight = 0;
	if (window.innerHeight) retHeight = window.innerHeight;
	else if (document.body && document.body.offsetHeight)
		retHeight = document.body.offsetHeight;

	return(Math.max(ofMainTabContMinHeight, retHeight) - ofMainTabContSubHeight);
}



// Datum & uhrzeit anzeigen
function ofShowClock()
{
	var tmpDate = new Date();
	status = "FREIWILLIGE FEUERWEHR BLUDESCH - " + tmpDate.toLocaleString();
	var tmpTime = window.setTimeout("ofShowClock()", 250);
}

// Rechte Maustaste "deaktivieren"
function ofDeactivateRightClick()
{
	if (document.layers) {	// Netscape
		window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
		window.onmousedown = ofClick;
		window.onmouseup = ofClick;
	
		function ofClick(iEvent)
		{
			if (iEvent.which == 3) {
				alert('www.feuerwehr-bludesch.com');
				return false;
			} else  return true;
		}
	}
	if (document.all) {	// IE
		function ofClick() {
			if (event.button == 2 || event.button==3)
				alert('www.feuerwehr-bludesch.com');
		}
		document.onmousedown = ofClick;
	}
}

function ofOpenPopup(iName, iLink, iWidth, iHeight) {
	
	var h = iHeight;
	var w = iWidth;
	var t = 100;
	var l = 100;
	var scroll = "no";

	if (h > (screen.availHeight * 0.9) && screen.availHeight > 0) {
		h = (screen.availHeight * 0.9);
		scroll = "yes";
	}

	if (w > screen.availWidth && screen.availWidth > 0) {
		w = screen.availWidth;
		scroll = "yes";
	}
	
	if (screen.availHeight > 0) {
		t = Math.max(0, (screen.availHeight - h) / 2);
	}
	if (screen.availWidth > 0) {
		l = Math.max(0, (screen.availWidth - w) / 2);
	}
	
	MyWindow = window.open(iLink, iName, "top=" + t + ", left=" + l + ", height=" + h + ", width=" + w + ", location=no, menubar=no, resizable=yes, scrollbars=" + scroll + ", status=no, toolbar=no");
	MyWindow.focus();
}
