// JavaScript Document

function accPopup(theURL,winName,features) {
		var newwindow=window.open(theURL,winName,features);
		return false;
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() { //courtesy Bobby van der Sluis, http://www.alistapart.com/articles/footers
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			if (document.getElementById('content')) {
			var contentHeight=document.getElementById('content').offsetHeight;
			}
			var footerElement=document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			if (windowHeight-(contentHeight+footerHeight)>=110) {
				footerElement.style.top=(windowHeight-(contentHeight+footerHeight+100))+'px';
			} else {
				footerElement.style.top='0px';
			}
		}
	}
}

function addPreloader() {
		document.write("<div style=\"position:absolute;top:360px;left:300px;z-index:2;\" id=\"preloader\"><img src=\"../grafik/hg/loading.gif\" /></div>");
}

function removePreloader() {
		var p = document.getElementById('preloader');
		p.parentNode.removeChild(p);
}

function setupTooltipper(l) {
	if (document.getElementById){
		var navPath = document.getElementById("nav");
		var navElements = navPath.getElementsByTagName("li");
		var numNav = navElements.length;
		var defaultTxt = 'Willkommen auf westrick.de';
		var toolTxt = Array('Unsere Kompetenzen und unser Leistungsspektrum', 'Unser vierstufiges Sanierungskonzept', 'Eine Übersicht über unsere Referenzen', 'Neuere Publikationen zum Thema Insolvenzrecht','Adresse und Anfahrt');
		if (l=='en') { 
			toolTxt = Array('Our fields of competence and range of services', 'Our four-stage reorganisation concept', 'An overview of our references', 'Recent publications in insolvency law','Address and directions');
			defaultTxt = 'Welcome to westrick.de';
		}
		for (var i=0;i<numNav;i++) {
			//toolTxt[i]=navElements[i].firstChild.getAttribute("title");
			//navElements[i].firstChild.removeAttribute("title");
			navElements[i].firstChild.curNo = i;
			navElements[i].firstChild.onmouseover = function() {
				toolPath = document.getElementById('tooltips');
				nuTooltip = document.createTextNode(toolTxt[this.curNo]);
				toolPath.replaceChild(nuTooltip,toolPath.firstChild);
				//toolPath.className = "shown";
				}
			navElements[i].firstChild.onmouseout = function() {
				//document.getElementById('breadcrumbs').className = "shown";
				nuTooltip = document.createTextNode(defaultTxt);
				toolPath = document.getElementById('tooltips');
				toolPath.replaceChild(nuTooltip,toolPath.firstChild);
				//toolPath.className = "hidden";
				}	
		}
		
	}
}

function formHiLite() {
	var f = document.forms[0];
	for(var i = 0; i < f.elements.length; i++) {
        var e = f.elements[i];
		if (e.type == "text" || e.type == "textarea" || e.type == "select-one") {
			e.onfocus = function() {this.style.borderColor='#713C2A'};
        	e.onblur = function() {this.style.borderColor='#C4AF9C'};
			}
    }
}


