<!--
// Hier kommen alle Projekt individuellen JS-Funktionen rein.

function individuell()
{	
}

// Spezielle DHTML NaviEffekte, Bsp: O2
// mu� dann nach der mnav im Navi Header included werden
function mnavHandler(menu,level) {
}

function openSearchWindow (){
	openFreeWindow(url,'search','','','','yes',547,520,0,0);
}

function getSearchWin (languageid, dbcsessionid) {
	f = document.forms.search;
	needle = f.needle.value;
	rule = f.rule.value;
	
	var ar=f.needle.value.split(" ");
	var nd="";
	var con="";
		
	// Verbindung der Suchw�rter ermitteln
	if (f.rule.value) con=f.rule.value;
	if (!con) con="OR";
	
	// W�rter mit Verbindungswort verbinden
	for (i=0; i<ar.length; i++)
	{
		if ((i+1)<ar.length) nd+="'"+ar[i]+"' "+con+" ";
		else nd+="'"+ar[i]+"'";
	}
		
	f.searchString.value=nd;
	
	// Bei Mehreren Mandanten IDs hier anpassen wenn in Mandant 2,3,4... gesucht werden soll
	client1 = f.needle['client\[1\]'];
	client302 = f.needle['client\[302\]'];
	client307 = f.needle['client\[307\]'];
	client303 = f.needle['client\[303\]'];
	url = "page.php?ID="+languageid+"&dbc="+dbcsessionid+"&mod=communicate&searchString="+escape(f.searchString.value)+"&mod=communicate&needle="+needle+"&rule="+rule;
	url+= "&"+escape('client[1]')+'=1';
	url+= "&"+escape('client[302]')+'=302';
	url+= "&"+escape('client[307]')+'=307';
	url+= "&"+escape('client[303]')+'=303';
	url+= "&"+escape('client[398]')+'=398';
	url+= "&"+escape('client[371]')+'=371';
	openSearchWindow();
	return false;
}

function goSearchResult(url) {
	if(top.window.opener) {
		top.window.opener.location.href = url;
		top.window.opener.focus();
	} else {
		window.open(url);
	}
}

function openLocator(){
  file="http://www.voith.de/sys/php/standorte_suche.php3?language=de";
  winname="locator";
  params = "width=436,height=462,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0 ";
  locatorWin = window.open( file, winname , params);
  if(window.focus) setTimeout("locatorWin.focus()",100);  // ohne setTimeout klappt das auf IE5 nicht!
}


//Funktionen die f�r den Workaround f�r den IE Doctype und Height 100% Problem
function getSize() {
    var myWidth = 0, myHeight = 0;
 
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return [ myWidth, myHeight ];
}

function setWindowHeight() {
	var omg = getSize();
	
	var allHeight = 0;
	var children = document.getElementById('mainTable').children[0].children;
	var rowCount = children.length;
	var expandEl = null;
	for (var i = 0; i < rowCount; i++) {
		if (children[i].id !== 'expand') {
			children[i].style.height = 1;
			allHeight = allHeight + children[i].offsetHeight; 
		} else {
			expandEl = children[i]; 
		}
	}
	if (expandEl !== null) {
		expandEl.style.height = omg[1] - allHeight;
	}
}

function setPopupWindowHeight() {
	var trToResize = 3;
	var omg = getSize();
	
	var allHeight = 0;
	var children = document.getElementById('mainTable').children[0].children;
	var rowCount = children.length;
	for (var i = 0; i < rowCount; i++) {
		if (i !== trToResize) {
			children[i].style.height = 1;
			allHeight = allHeight + children[i].offsetHeight; 
		}
	}
	children[trToResize].style.height = omg[1] - allHeight;
}

function openWin(url,weite,hoehe,id,parameters,centered) {
	if (url.indexOf('/appc/') === -1) {
		url = getBaseLocation() + url;
	}
	
	var pos='';
	if (centered) {
		var coord=getWindowCenterCoordinates(weite,hoehe);
		pos=',left='+coord['x']+',top='+coord['y']+'';
	} else {
		pos=',left=50,top=50';
	}
	if (!parameters) parameters='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no';
	if (parameters.indexOf('left=')==-1) parameters+=pos;
	parameters+=',width='+weite+',height='+hoehe;
	popupWin = window.open(url,id,parameters);
}

function getBaseLocation() {
	var count = document.getElementsByTagName('base').length;
	if (count > 0) {
		return document.getElementsByTagName('base')[0].href;
	} else {
		return '';
	}
}

function openFreeWindow(url,name,mbar,sta,loc,tbar,res,scr,width,height,left,top) {
	var currentUrl = self.location.href; 
	var appc = '/appc/';
	if (currentUrl.indexOf('/_testing/') !== -1) {
		appc = '/_testing' + appc;
	}
	url = my_str_replace('../', '', url);
	url = appc + url;
	
	if (res > 1 && scr > 1 && !width && !height) { // alter Aufruf, Signatur hat sich d�mlicherweise ge�ndert.
		width=res;
		height=scr;
		res=0;
		scr=0;
	}
	
	if (!mbar) mbar="no"; else mbar="yes";
	if (!tbar) tbar="no"; else tbar="yes";
	if (!res) res="no"; else res="yes";
	if (!sta) sta="no"; else sta="yes";
	if (!loc) loc="no"; else loc="yes";
	popupWin = openWin(url,width,height,name,'menubar='+mbar+',status='+sta+',location='+loc+',toolbar='+tbar+',resizable='+res+',scrollbars='+scr,true);
}

function my_str_replace (search, replace, subject, count) {
    var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
            f = [].concat(search),
            r = [].concat(replace),
            s = subject,
            ra = r instanceof Array, sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    }

    for (i=0, sl=s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }
        for (j=0, fl=f.length; j < fl; j++) {
            temp = s[i]+'';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {
                this.window[count] += (temp.length-s[i].length)/f[j].length;}
        }
    }
    return sa ? s : s[0];
}

function startList() {
	var i = 0;
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("mainNavi");
		if (navRoot !== null) {
			for (i = 0; i < navRoot.childNodes.length; i++) {
				addFunctionToNode(navRoot.childNodes[i]);
			}
		}
	}
}

//-->
