//Diverse Elemente bei kleiner Fenstergröße verändern
function check_resolution() {
	//array aus IDs die ausgeblendet werden sollen
	var array = new Array();
	var obj;

	if (document.body.offsetWidth < 995) {
		for(i = 0; i < array.length; i++) {
			obj = document.getElementById(array[i])
			if(obj)
				obj.style.display = 'none'
		}
	} else {
		for(i = 0; i < array.length; i++) {
			obj = document.getElementById(array[i])
			if(obj)
				obj.style.display = ''
		}
	}
}
window.onresize = window.onload = check_resolution;


function changePic(id, status) {
  if (status=="1") {
    for (i=0; i<5; i++) {
      document.getElementById('fischrichtung_'+i).style.display = 'none';
    }
    document.getElementById('fischrichtung_'+[id]).style.display = 'block';
  } else {
    for (i=0; i<4; i++) {
      document.getElementById('fischrichtung_'+i).style.display = 'none';
    }
    document.getElementById('fischrichtung_4').style.display = 'block';
  }
}


// flash detect
var benoetigteVersion = 6;
var flash2Installiert = false;
var flash3Installiert = false;
var flash4Installiert = false;
var flash5Installiert = false;
var flash6Installiert = false;
var flash7Installiert = false;
var hoechsteVersion = 7;
var aktuelleVersion = 0;
var richtigeVersion = false;
var browserAol = (navigator.appVersion.indexOf("AOL") != -1) ? true : false;
var browserInternetExplorer  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var betriebssystemWindows = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;

if(browserInternetExplorer && betriebssystemWindows && !browserAol) {
	document.write('<scr' + 'ipt language=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	document.write('flash6Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installiert = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('<\/scr' + 'ipt\> \n');
}

function detectFlash() {
	if (navigator.plugins) {
		if(navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var istVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashInfo = navigator.plugins["Shockwave Flash" + istVersion2].description;
			var flashVersion = parseInt(flashInfo.substring(16));
			flash2Installiert = flashVersion == 2;
			flash3Installiert = flashVersion == 3;
			flash4Installiert = flashVersion == 4;
			flash5Installiert = flashVersion == 5;
			flash6Installiert = flashVersion == 6;
			flash7Installiert = flashVersion == 7;
		}
	}

	for(var i = 2; i <= hoechsteVersion; i++)
		if (eval("flash" + i + "Installiert") == true)
			aktuelleVersion = i;

	if(navigator.userAgent.indexOf("WebTV") != -1) aktuelleVersion = 4;

	if(aktuelleVersion >= benoetigteVersion)
		richtigeVersion = true;
}
detectFlash();
// end flash detect

function getAdr(prefix, postfix, lnkparam, lnktxt) {
	lnktxt = lnktxt.replace(/TMPL_MAIL/, prefix + '@' + postfix);
	document.write('<a ' + lnkparam + ' href="mailto:' + prefix + '@' + postfix + '">' + lnktxt);
}


var sel;
function HideSelects(x,y,w,h) {
	if(xIE4Up && !xMac) {
		var selx, sely, selw, selh, i
		if(!sel)
			sel = document.getElementsByTagName("SELECT");
		for(i = 0; i < sel.length; i++) {
			selx = xPageX(sel[i]);
			sely = xPageY(sel[i]);
			selw = sel[i].offsetWidth;
			selh = sel[i].offsetHeight;
			sel[i].style.visibility = (selx + selw > x && selx < x + w && sely + selh > y && sely < y + h) ? "hidden" : "visible";
		}
	}
}

function getAdr(prefix, postfix, text) {
	document.write('<a href="mailto:' + prefix + '@' + postfix + '">' + prefix + '@' + postfix + '</a>');
}

function checkContact() {
	if (document.getElementById('kontaktemail').value == '' || document.getElementById('kontaktemail').value == 'E-Mail-Adresse') {
		alert ('Bitten geben Sie eine E-Mail-Adresse an!');
		return false;
	}
}

var tmp_value = new Array();

function init_contact_focus() {
	inputs = document.getElementById('kontakt_text').getElementsByTagName('FORM')[0].getElementsByTagName('INPUT');
	for(i=0; i<inputs.length; i++) {
		inputs[i].tmp_value = inputs[i].value;
		inputs[i].onfocus = function() {
			this.value = '';
		}
		inputs[i].onblur = function () {
			if (this.value == '') {
				this.value = this.tmp_value;
			}
		}
	}
}
