sbx = new Array();
function showServiceBox( _arg ){
    document.getElementById("servicebox").innerHTML = sbx[_arg];
    document.getElementById("servicebox").style.border = "2px solid #006847";
    document.getElementById("servicebox").style.backgroundColor = "#EAEAEA";
    document.getElementById("servicebox").style.padding = "5px";
}

function hideServiceBox( _arg ){
    document.getElementById("servicebox").innerHTML = "&nbsp;&nbsp;";
    document.getElementById("servicebox").style.border = "2px solid #FFFFFF";
    document.getElementById("servicebox").style.backgroundColor = "#FFFFFF";
    document.getElementById("servicebox").style.padding = "5px";
}

function rel(){
	location.reload(true);
}

// Color settings..
MAINNAVTXT_MOVER_COL = "#999999";
MAINNAVTXT_MOUT_COL = "#FFFFFF";
NAV_MOVER_COL = "#006847";
NAV_MOUT_COL = "#006847";
SUBNAV_MOVER_COL = "#006847";
SUBNAV_MOUT_COL = "#FFFFFF";



function showMenu( obj ){
	document.getElementById(obj).style.visibility='visible';
}

function hideAllMenus(){
	for (i = 0; i < 10; i++){
		if( document.getElementById("subnav" + i) != null ){
			document.getElementById("subnav" + i).style.visibility='hidden';
		}
	}
}

function setSubNavOver( item ) {
	document.getElementById(item).style.backgroundColor=SUBNAV_MOVER_COL;
	document.getElementById(item).style.cursor='pointer';
	document.getElementById(item).style.color='#FFFFFF';    
}

function setSubNavOut( item ) {
	document.getElementById(item).style.backgroundColor=SUBNAV_MOUT_COL;
	document.getElementById(item).style.cursor='auto';
	document.getElementById(item).style.color='#020202';	
}

function getClientWidth(){
	if( navigator.appVersion.indexOf("Mac") != -1 && navigator.appVersion.indexOf("MSIE 5") >-1 ){
		return document.body.clientWidth;
        } else if (navigator.appName != "Microsoft Internet Explorer") {
		return window.innerWidth;
	} else {
		return document.body.offsetWidth;
	}
}

function setIcons(){
	var cent = getClientWidth()/2;
	if (navigator.appName == "Microsoft Internet Explorer") {
            document.getElementById("icon_print").style.top="184px";
            document.getElementById("icon_switch").style.top="184px";
	} else {
            document.getElementById("icon_print").style.top="184px";
            document.getElementById("icon_switch").style.top="184px";
        }
        document.getElementById("icon_print").style.left=cent+418+"px";
        document.getElementById("icon_switch").style.left=cent+388+"px";
        document.getElementById("icon_switch").style.visibility='visible';
        document.getElementById("icon_print").style.visibility='visible';

	 document.getElementById("icon_rus").style.top="184px";
        document.getElementById("icon_rus").style.left=cent+358+"px";
        document.getElementById("icon_rus").style.visibility='visible';

	 document.getElementById("searchbox").style.top="183px";
        document.getElementById("searchbox").style.left=cent+182+"px";
        document.getElementById("searchbox").style.visibility='visible';

}


function setMenuGerman(){
	var y = 205;
	if (navigator.appName != "Microsoft Internet Explorer") {
		y = 205;
	}
	if( navigator.userAgent.indexOf("Safari") != -1 ){
		y = 202;
	} 	
	
	var ypos = y.toString() + "px";
	var x = new Array(336, 238, 130, 96, -88, -146, -233, -233, -340);
	var cent = getClientWidth()/2;
	var elem = null;
	for (i = 0; i < 10; i++){
		elem = document.getElementById("subnav" + i);
		if( elem != null ){
			elem.style.top = ypos;
			elem.style.left = (cent - x[i]).toString() + "px";
		}
	}	
        //icons
        setIcons();
}

function setMenuEnglish(){
	var y = 205;
	if (navigator.appName != "Microsoft Internet Explorer") {
		y = 205;
	} 	
	if( navigator.userAgent.indexOf("Safari") != -1 ){
		y = 202;
	} 
	
	var ypos = y.toString() + "px";
	var x = new Array(336, 252, 143, 147, -10, -146, -233, -233, -340);
	var cent = getClientWidth()/2;
	var elem = null;
	for (i = 0; i < 10; i++){
		elem = document.getElementById("subnav" + i);
		if( elem != null ){
			elem.style.top = ypos;
			elem.style.left = (cent - x[i]).toString() + "px";
		}
	}
        //icons
        setIcons();
}

function openLoginForm( url ){
	var lft = screen.width/2-325;
	var tp = screen.height/2-255;
	var params = "width=600,height=375,left=" + lft + ",top=" + tp + ",resizable=no,scrollbars=yes,status=no";
	details = window.open(url, "sl", params);
	details.focus();
}


function getViewPort(mode){
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	//alert(parseInt(y)-234);
	return (mode == "x") ? x : parseInt(y)-200;
}

function writeTableCell(cssclass){
	document.open();
	document.write('<td class="' + cssclass + '" style="height:' + getViewPort('y') + 'px;">');
	//alert('<td class="' + cssclass + '" style="height:' + getViewPort() + 'px;">');
	document.close();
}

function writeContactTableCell(cssclass){
	document.open();
	document.write('<td class="' + cssclass + '" style="height:' + getViewPort('y') + 'px;width:400px;">');
	//alert('<td class="' + cssclass + '" style="height:' + getViewPort() + 'px;">');
	document.close();
}

function writeContactTableCell2(cssclass){
	document.open();
	document.write('<td class="' + cssclass + '" style="height:' + getViewPort('y') + 'px;width:350px; padding-left:10px;">');
	//alert('<td class="' + cssclass + '" style="height:' + getViewPort() + 'px;">');
	document.close();
}

function writeCellEnd(){
	document.open();
	document.write('</td>');
	document.close();
}

function setBottomMenu(){
	var y = 203;
	if (navigator.appName != "Microsoft Internet Explorer") {
		y = 205;
	}
	if( navigator.userAgent.indexOf("Safari") != -1 ){
		y = 202;
	} 	
	var ypos = y.toString() + "px";
	var cent = getViewPort('x')/2;
        var debugScrollBars = (navigator.appName == "Microsoft Internet Explorer") ? 0 : -10;
	var elem = null;
	//elem = document.getElementById("balken").style.top = (getViewPort('y') + 182) + "px";	
	elem = document.getElementById("balken").style.left = (cent - 447 + debugScrollBars) + "px";		
	elem = document.getElementById("balken").style.visibility = "visible";
	
}

function posBalken(){ 
    var IEOLD = (document.all);
    var CONF = (document.getElementById && !IEOLD);
    if(IEOLD) {
            balken.style.pixelTop = document.body.clientHeight-32+document.body.scrollTop;
            setTimeout("posBalken()",20);
    }else if( navigator.userAgent.toLowerCase().indexOf("safari") != -1 ){
            document.getElementById('balken').style.top = document.body.clientHeight-81+document.body.scrollTop;
            setTimeout("posBalken()",20);
    }else if(CONF) {
            document.getElementById('balken').style.top = document.body.clientHeight-32+document.body.scrollTop;
            setTimeout("posBalken()",20);
    }
}

function startSearch(){
    var q = document.forms['pagesearch'].elements.query.value;
    if( q.length > 0 && q.length < 3 ){
        document.forms['pagesearch'].elements.query.value = q + "*";
        document.forms['pagesearch'].submit();
    } else if( q.length > 2 ) {
        //und verknüpfen..
        var myquery = q.split(" ");
        if(myquery.length > 1){
            var nuquery = new Array();
            for(i=0; i<myquery.length; i++){
                nuquery[nuquery.length] = "+" + myquery[i];
            }
            document.forms['pagesearch'].elements.query.value = nuquery.join(" ");
            document.forms['pagesearch'].submit();
        } else {
            document.forms['pagesearch'].submit();
        }

    }
}
window.name = "mainwin";
window.onresize = rel;

