/*-------------------------------GLOBAL VARIABLES------------------------------------*/

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
var bias;
var bgstyleold;
/*-----------------------------------------------------------------------------------------------*/

//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/
getBrowserInfo();

function getBrowserInfo() {
	if (checkIt('konqueror')) {
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser 	= "Safari";
	else if (checkIt('omniweb')) browser 	= "OmniWeb";
	else if (checkIt('opera')) browser 		= "Opera";
	else if (checkIt('webtv')) browser 		= "WebTV";
	else if (checkIt('icab')) browser 		= "iCab";
	else if (checkIt('msie')) browser 		= "IE";
	else if (checkIt('firefox')) browser 		= "Firefox";
	else if (!checkIt('compatible')) {
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS) {
		if (checkIt('linux')) OS 		= "Linux";
		else if (checkIt('x11')) OS 	= "Unix";
		else if (checkIt('mac')) OS 	= "Mac"
		else if (checkIt('win')) OS 	= "Win"
		else OS 								= "an unknown operating system";
	}
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
/*Funktionen Javascript windowsize



*/
function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function neuAufbau () {
  if (Weite != Fensterweite() || Hoehe != Fensterhoehe()){
  /*  location.href = location.href;*/
  document.write("Weite: " + Weite + " Höhe: " + Hoehe);
  }
}

function initN () {
/* Überwachung von Netscape initialisieren */
if (!window.Weite && window.innerWidth) {
/*   window.onresize = neuAufbau;*/
  Weite = Fensterweite();
  Hoehe = Fensterhoehe();
}
}
function initE () {
/* Überwachung von Internet Explorer initialisieren */
if (!window.Weite && document.body && document.body.offsetWidth) {
/*   window.onresize = neuAufbau;*/
  Weite = Fensterweite();
  Hoehe = Fensterhoehe();
}
}


/*Funktionen Javascript für hkw-Seite


*/
var pnrold = "";
var ovrlpicold= "";
var offsetold= 0;

var pnrakt=0;



function initOpac(pnr,text,istext)
{
if ((browser=='IE')&&(version < 7)) {
document.getElementById('inside').style.right = bias+'px';
document.getElementById('rahmen').style.width = Weite;
}
else {bias=0;
document.getElementById('projdescr').style.left = '0px';}

offset = 0;
ovrlpic = 'ovrl'+pnr;

document.getElementsByName(ovrlpic)[0].className = "opac";
if (istext=="1"){
document.getElementById('textdescr').className = "nontransp";}
else{
document.getElementsByName(pnr)[0].className = "nontransp";}
document.getElementById("bildunterschrift").firstChild.nodeValue = text;
pnrold = pnr;
ovrlpicold=ovrlpic;
offsetold = offset;
istextold = istext;
pnrakt = pnr;
}
function move(offset,pnr,text,bias,istext)
{


offset = offset;
ovrlpic = 'ovrl' + pnr;
document.getElementsByName(ovrlpicold)[0].className = "ovrlhidden";
if (istextold=="1"){
document.getElementById('textdescr').className = "transp";}
else{
document.getElementsByName(pnrold)[0].className = "transp";}

offset_bias=eval(offset+bias);
document.getElementById("inside").style.right = offset_bias+'px';                
document.getElementsByName(ovrlpic)[0].className = "opac";

if (istext=="1"){
document.getElementById('textdescr').className = "nontransp";}
else{
document.getElementsByName(pnr)[0].className = "nontransp";}

document.getElementById("bildunterschrift").firstChild.nodeValue = text;      

pnrold=pnr;
pnrakt=pnr;
ovrlpicold=ovrlpic;
offsetold = offset;
istextold = istext;
ctchr = document.getElementById("catcher");
if (ctchr) {
bod = document.getElementsByTagName("body")[0];
bod.removeChild(ctchr);
bod.style.backgroundImage = "url(pic/bg.gif)";
bod.style.height = "100%";}

}

function makebig(bigpic,bildnr,w,h)
{
if (bildnr == pnrakt) {

/*	bod 				= document.getElementById('main');*/
bod 				= document.getElementsByTagName('body')[0];
mainaround				= document.getElementById('main-around')
	overlay 			= document.createElement('div');
	overlay.id			= 'black_v';
		

	inneres = document.createElement('div');
	inneres.id = 'bigpicdiv';
	inneres.innerHTML = "<a href='javascript:kill()'><img src='"+bigpic+"' class='bigpic' id='bigpica' width='"+w+"' height='"+h+"'></a>";
next = document.createElement('div');
next.id = 'nextpic';
	next.innerHTML = "TESTTEXT";	
	bod.appendChild(overlay);
/*	mainaround.appendChild(next);	*/
	bod.appendChild(inneres);
	bgstyleold=bod.style.background;
/*	bod.style.background='black';*/
	}
}
function kill(){
/*	bod 				= document.getElementById('main');*/
bod 				= document.getElementsByTagName('body')[0];
	bod.removeChild(overlay);
	bod.removeChild(inneres);
/*	bod.style.background='#FFFFFF';*/
	

	bod.style.background=bgstyleold;
	bod.style.backgroundImage = bgstyleold;
/*	bod.style.height = "100%"; */
}