// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.

    // convert all characters to lowercase to simplify testing//
	var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***//
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.//
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
     var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
    var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5);

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    var is_mac    = (agt.indexOf("mac")!=-1);
//End of client sniff

function bu1(targt)
{

}

function transp(a)
{

}

function fram(txt)
{

}


function openWin(url, name, width, heigth, scrollbars)
{
name = open(url, name, "width=" + width + ",height=" + heigth + ",scrollbars=" + scrollbars + ",resizable=yes,status=no,toolbar=no,menubar=no");
}

function left(t,s)
{
<!--this function extracts the left part of t separated by s 
return (t.substring(0,t.indexOf(s)));
}

function right(t,s)
{
<!--this function extracts the rigth part of t separated by s 
return (t.substring(t.indexOf(s)+1,t.length));
}


function numsort(a,b)
{return a-b;}
/*
function getSwitchtype(){
	var URL=window.location.search;
	var charindex = URL.indexOf("switch=");
	if(charindex != -1){
		var switchtype1 = URL.slice(charindex+7);
		switchtype1 = switchtype1.toUpperCase(); 
		}
	else
	    switchtype1 = "";
	return switchtype1;
}
*/

function getParameter(parameter){  //parameter has to include "="
//if (((is_ie5up) && (is_mac)) || (is_opera))// IE 5.x MAC
		var URL=unescape(window.location.search);  //old funtion
//	else 
//		var URL=decodeURI(window.location.search);  //new function
	var paralength = parameter.length;
	var charindex = URL.indexOf(parameter);
	if(charindex != -1){
		var ampindex = URL.indexOf("&",charindex);
		if(ampindex == -1)
			var paravalue = URL.slice(charindex+paralength);
		else 
			var paravalue = URL.slice(charindex+paralength,ampindex);
		paravalue = paravalue.toUpperCase(); 
		}
	else
	    paravalue = "";
	return paravalue;
}

function getSwitchtype(){
	return getParameter("switch=");
}

function getPole(){
	return getParameter("pole=");
}

function getCodenr(){
	return getParameter("codenr=");
}

function getmount(){
	return getParameter("mount=");
}

function getEntry(){
	return getParameter("entry=");
}


function rowdelete(tablename,rowstodel) {
	rowstodel.sort(numsort);
	rowstodel.reverse();
	var counterstring="";
	var main = "row";

	if (is_opera) {
		for (var i=0;i<rowstodel.length;i++) {
			counterstring = rowstodel[i].toString(10);
			rowtohide = main.concat(counterstring);			
			document.getElementById(rowtohide).style.visibility = "hidden";
		}
	}
	
	if ((is_ie5up) || (is_nav6up))  {
		for (var i=0;i<rowstodel.length;i++) 
			document.getElementById(tablename).deleteRow(rowstodel[i]-1);
	}
	
	if (is_ie4) {
		for (var i=0;i<rowstodel.length;i++) {
			counterstring = rowstodel[i].toString(10);
			rowtohide = main.concat(counterstring);
			document.all[rowtohide].style.display = "none";
		}
	}
}

function ScaleImgPrint(factor) {
	var i=document.images.length;
	for (var a=0;a<i;a++) 
		document.images[a].height=document.images[a].height*factor;
	if ((is_mac)&&(is_ie5up)){
		selPrintSSheet();
		alert("The page is now optimized for printing.\nYou can print this page by using the PRINT command of your browser.\nBy clicking the REFRESH button the page optimized for viewing on screen will be reloaded.");
		return;
	}	
	else {
		if (((is_win) && (is_ie5up)) || (is_nav6up) || (is_opera6up))
			window.print();
		else { 
			if ((is_win) && (is_ie4))
				ie4print();
			else 
				alert ("Please use the Print Command of your browser!");
		}
	}
	for (var a=0;a<i;a++) 
		document.images[a].height=document.images[a].height/factor;
}

function printit(){
	if (is_mac)	{  // MAC resolution = 72 ppi
		scale = 0.12;
		logowidth = 244;
	}
	else {  // PC resolution = 96 ppi
		scale = 0.16;
		logowidth = 326;
	}
	if (is_ie5up) {
		if (is_mac)	// IE 5.x MAC
				selPrintSSheet();
		if (ecatlogopath.charCodeAt(0) == 35)   //if = '#' then not e-catalog
			logosource = logopath;
		else  //e-catalog
			logosource = ecatlogopath;
		logosource = logosource.concat("knprint.gif");
		document.printlogo.src = logosource;
		document.printlogo.width=logowidth;
		initalizearray();
		loadpicture();
		active =(window.setInterval("checkload()",10));
	}
	else {	//IE 4.x, Netscape, OPERA, etc.
		if ((is_opera6up) || (is_nav6up)) {
			document.printlogo.className = "print-no";
			window.print();
		}
		else {
			if ((is_win) && (is_ie4)) {
				document.all.printlogo.style.display = "none";
				ie4print();
				location.reload();
			}
			else 
				alert ("Please use the Print Command of your browser!");
		}
	}
}

function selPrintSSheet(){   
	var sS=document.styleSheets;
	if(!sS) 
		return;
	for(var i=0; i<sS.length; i++)
		sS[i].title=="Print Page" ? sS[i].disabled=false : sS[i].disabled=true;
}

function initalizearray(){
	var j=0;
	for(var i = 0; i < document.images.length; i++)	{
		if ((document.images[i].name != "") && (document.images[i].name != "printlogo")) {
			pictures[j]=i;
			j++;
		}
	}
}

function loadpicture() {
	index = pictures[nr];
	var screensrc1 = document.images[index].src;
	screensrc1 = screensrc1.substr(0,screensrc1.length-4);
	newpicture = new Image();
	newpicture.src = screensrc1.concat("_q1.gif");
}

function checkload() {
	if (newpicture.complete == false)
		return;
	index = pictures[nr];
	document.images[index].src = newpicture.src;
	document.images[index].width = document.images[index].width * scale;
	nr++;
	if (nr < pictures.length)
		loadpicture();
	else{
		clearInterval(active);
		printpage();
	}
}	

function printpage() {
	if (!is_mac && is_ie5up){	//IE5.x auf PC
		window.print();	
		location.reload();
	}
	if (is_mac && is_ie5up)	//IE5.x auf MAC
		alert("The displayed page is optimized for printing.\nYou can print this page by using the PRINT command of your browser.\nBy pushing the REFRESH button the page optimized for viewing on screen will be loaded again.");
}

function ie4print(){
	var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 	CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
	WebBrowser1.ExecWB(6, 1);
	WebBrowser1.outerHTML = "";  
}

//-------------new print functions-----------------
var prpdone=false;
var rith;
var rii = new Array();
function PrintPageA(){
	if(prpdone){
		PrintPageC();
		return;
	}
	if(document.getElementsByTagName){
		var ic=document.getElementsByTagName("img").length;
		var rits = false;
		for (var ix=0; ix<ic; ix++){
			var io=document.getElementsByTagName("img")[ix];
			var ins=io.name;
			if(ins.length>2){
				if(ins.substr(ins.length-3,3)=="_sc"){
					ins=ins.substr(0,ins.length-3);
					if(ins.length>0){
						var p=ins.lastIndexOf("_");
						if(p>-1) ins=ins.substr(p+1,ins.length-p-1);
						var w=io.width;
						var h=io.height;
						io.width=w*parseFloat(ins);
						io.height=h*parseFloat(ins);
					}
				}
				if(ins.substr(ins.length-3,3)=="_rp"){
					var iss=io.src;
					iss=iss.substr(0,iss.lastIndexOf(".")) + "_q1.gif";
					rii[rii.length]=ix;
					rii[rii.length]=io.height;
					rii[rii.length]=0;
					io.src=iss;
					rits=true;
				}
			}
		}
		if((is_nav||is_opera) && document.getElementById){
			document.getElementById("PrLog").style.display="block";
			document.getElementById("NavRw").style.display="none";
		}
		if(rits){
			rith=window.setInterval("PrintPageB()",1000);
		}else{
			PrintPageC();
		}
		prpdone=true;
	}
}
function PrintPageB(){
	var b;
	var a=rii.length;
	for(b=0;b<a;b+=3){
		if((rii[b+2]==0)&&(document.getElementsByTagName("img")[rii[b]].height != rii[b+1])){
			rii[b+1] = document.getElementsByTagName("img")[rii[b]].height*((is_mac && is_ie5up)?0.15:0.16); 
			document.getElementsByTagName("img")[rii[b]].height=rii[b+1];
			rii[b+2]=1;
		}
	}
	var f=true;
	for(b=0;b<a;b+=3){
		if(rii[b+2]==0) f=false;
	}
	if(f){
		window.clearInterval(rith);
		rii.length=0;
		PrintPageC();
	}
}
function PrintPageC(){
	if(is_ie5up && is_mac){
		alert("The displayed page is optimized for printing.\nYou can print this page by using the PRINT command of your browser.\nBy pushing the REFRESH button the page optimized for viewing on screen will be loaded again.");
		return;
	}
	window.print();
}



function printframe() {
top.display.focus();
top.print(); 

}


