var Browser , getVersion, encryption, width, height, swf, versionArray, bwidth, bheight = null;
var newpage = false;
var agentdetails = new Array();
var bilder = new Array();
var mousepos;
//if (navigator.appName != "Microsoft Internet Explorer") init_mousemove();
//else{
document.onmouseover = Mausklick;
//}

function popup(url) {
	ok = window.open(url, 'popup', 'width=350,height=270,scrollbars=no,toolbar=no,status=no,resizable=yes,menubar=no,location=no,directories=no,top=10,left=10');
  	if (ok) return false;
  	else return true;
}
function Mausklick (Ereignis) {
  if (!Ereignis)
    Ereignis = window.event;
	xPos=Ereignis.screenX;
	yPos=Ereignis.screenY;
}
function init_mousemove() {
  if(document.layers) {
    document.captureEvents(Event.MOUSEMOVE);
    document.captureEvents(Event.KEYPRESS);
  }
  document.onmousemove =	dpl_mouse_pos;
}
function dpl_mouse_pos(e) {
    xPos = e? e.pageX : window.event.x
  	yPos = e? e.pageY : window.event.y
  	if (document.all && !document.captureEvents) {
   	 xPos += document[docEl].scrollLeft
   	 yPos += document[docEl].scrollTop
  	}
  	mousepos =yPos;
  	if (document.layers)
   		routeEvent(e)
}
function decide(){
  var chkAgent1=navigator.userAgent;
  var chkVersion=navigator.appVersion.substring(0,3);
  var IE=chkAgent1.search(/MSIE/i);
  var Netscape=chkAgent1.search(/Netscape/i);
  var Opera=chkAgent1.search(/Opera/i);
  var Mozilla=chkAgent1.search(/Mozilla/i);
  var compatible=chkAgent1.search(/compatible/i);
  var Firefox=chkAgent1.search(/Firefox/i);
  var Gecko = chkAgent1.search(/Gecko/i);
  if (IE != -1 && compatible != -1 && Mozilla != -1 && Netscape == -1 && chkVersion == "4.0" ){
  	Browser = "MSIE";
	var startpos = navigator.userAgent.search(/MSIE/i);
	var startid = startpos + 5;
	var end = startpos + 8;
	getVersion = navigator.userAgent.substring(startid,end);
  }
  if (Browser == "MSIE" && getVersion <7) return(0);
  else return (1);
}
function Checks(){
	window.location.href = "https://www.linss.de/navi.php?section=home";
	/***
	if (decide()) window.location.href = "https://www.linss.de/navi.php?section=home";
	else{
    	window.location.href = "https://www.linss.de/divpage/navi.php?section=home"
	}
	***/
}
/*********
Check for Flash-Plugin and get Version Information (not supported in all IE Versions)
**********/
function chkFlash(){
  var plugin=null;
  for(var i=0; i<navigator.plugins.length; i++){
      if (navigator.plugins[i].filename == "NPSWF32.dll" || navigator.plugins[i].filename == "flash.ocx"){
	plugin=1;
      } else plugin = 0;
      var pluginIdent = navigator.plugins[i].description.split(" ");
      if(pluginIdent[0] == "Shockwave" && pluginIdent[1] == "Flash"){
        var isSwfEnabled = true;
        versionArray = pluginIdent[2].split(".");
      }
  }
  if (navigator.mimeTypes["application/x-shockwave-flash"]){
    if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null)plugin=1;
  }
return (plugin);
}
function chkRes(){
  encryption = navigator.userAgent.indexOf(' U') != -1 ? 'strong' : 'weak';
  width=window.screen.width;
  height=window.screen.height;
  bwidth = document.body.clientWidth;
  bheight = document.body.clientHeight;
 //return (encryption, width, height);
}
// ***************************** Funktionen für das Pulldown-Menü
var open;
var id;
var hidden="true";

function clicked(url){
  document.location.href = "navi.php?section="+escape(url)
}
function clr(m){
 for (var i=1;i<7;i++){
 	if (i!=m){
		if (document.getElementById("menue"+i)!=null){
		 	document.getElementById("menue"+i).style.backgroundColor='#005EC4';
			document.getElementById("menue"+i).style.color='#FFFFFF';
		}
	}
 }
}
function showit(id){
 m=id.substring(2,1);
 document.getElementById("menue"+m).style.backgroundColor='#FFFFFF';
 document.getElementById("menue"+m).style.color='#005EC4';
 clr(m);
 if (hidden != "true"){
    hide_layer(open);
    show_layer(id);
  }
  else show_layer(id);
}
function show_layer(x){
  hidden="false";
  open=x;
  if(document.layers)
    document.layers[x].visibility="show";
  else{
    document.getElementById(x).style.visibility = "visible";
  }
}
function hide_layer(x){
  clr(0);
  hidden="true";
  if(document.layers)
    document.layers[x].visibility="hide";
  else{
    //document.all[x].style.visibility="hidden";
    document.getElementById(x).style.visibility = "hidden";
  }
}
/**********
Code to avoid event bubbling event handling for IE4+, NN6+, Opera 7+ (and probably any browser coming up and trying to implement DOM Level 2)
**********/
function containsDOM (container, containee) {
  var isParent = false;
  do {
    if ((isParent = container == containee))
      break;
    containee = containee.parentNode;
  }
  while (containee != null);
  return isParent;
}
function checkMouseEnter (element, evt) {
  if (element.contains && evt.fromElement) {
      return !element.contains(evt.fromElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}
function checkMouseLeave (element, evt) {
  if (element.contains && evt.toElement) {
      return !element.contains(evt.toElement);
  }
  else if (evt.relatedTarget) {
      return !containsDOM(element, evt.relatedTarget);
  }
}
function testit (element, evt){
  if (navigator.appName == "Microsoft Internet Explorer"){
	if ((evt.toElement.tagName.toLowerCase() == "body") || (evt.toElement.id =="menue") || (evt.toElement.id == "menuebar") || (evt.toElement.tagName.toLowerCase() == "html") || (evt.toElement.tagName.toLowerCase() == "img"))hide_layer(element);
  }else{
	if ((evt.relatedTarget.id != element) && (evt.relatedTarget.id !="navileft") || (evt.relatedTarget.id == "body")) hide_layer(element);
  }
}
/*******
Detect buggy IE
*******/
function detectIE(){
  var chkAgent1=navigator.userAgent;
  var chkVersion=navigator.appVersion.substring(0,3);
  var IE=chkAgent1.search(/MSIE/i);
  var Netscape=chkAgent1.search(/Netscape/i);
  var Opera=chkAgent1.search(/Opera/i);
  var Mozilla=chkAgent1.search(/Mozilla/i);
  var compatible=chkAgent1.search(/compatible/i);
  var Firefox=chkAgent1.search(/Firefox/i);
  var Gecko = chkAgent1.search(/Gecko/i);
  if (IE != -1 && compatible != -1 && Mozilla != -1 && Netscape == -1 && chkVersion == "4.0" ){
  	Browser = "MSIE";
	var startpos = navigator.userAgent.search(/MSIE/i);
	var startid = startpos + 5;
	var end = startpos + 8;
	getVersion = navigator.userAgent.substring(startid,end);
  }
if (Browser == "MSIE" && getVersion >=5 && getVersion <6) return("buggy");
else return ("ok");
}
function yoffset(){
	var yoff=window.pageYOffset();
return yoff;
}
function detectSP2(){
	var sp2 = false;
  	sp2 = (window.navigator.userAgent.indexOf("SV1") != -1);
  	if (sp2) return true
  	else return false;
}
function ie7sp2bug(){
	var sp2=false;
	if (detectSP2() == true) sp2=true;
	if (navigator.userAgent.search(/MSIE7/) == -1) sp2=true;
	return sp2;
}
function pwinprops(pwin){
	pwin.locationbar="no";
	pwin.statusbar="no";
	pwin.menubar="no";
	pwin.dependent="yes";
	pwin.personalbar="no";
	pwin.scrollbars="no";
	pwin.toolbar="no";
	pwin.resizable="no";
	pwin.screenX=0;
	pwin.screenY=0;
	pwin.top=0;
}
function showlager(status){
	lagerstatus = window.open("./shop/showavail.php?status="+status, "Lagerstatus", "width=305,height=195");
	lagerstatus.focus();
}
function changepic(bild,inh) {
	document.getElementById('B'+bild).src="./propicsel/" +inh;
	bilder[bild]=inh;
}
function showPic(inh,artnr) {
	var id="zoom"+artnr;
	if (document.getElementById(id).src.substr(-20,20)==inh.substr(-20,20)) MachLeer(id);
 	else{
		document.getElementById(id).src=inh;
		document.getElementById(id).style.height="100%";
		document.getElementById(id).style.width="100%";
		document.getElementById(id).style.visibility="visible";
	}
}
function MachLeer(id) {
	document.getElementById(id).src="pics/leer.jpg";
	document.getElementById(id).style.height="0px";
	document.getElementById(id).style.visibility='hidden';
	document.getElementById('s'+id).style.visibility='visible';
}

function replaceHistory(){
	var url=window.location.search;
	var spos=url.search(/action=SAVE/i);
	if (spos!=-1){
		var url1=url.substr(0,spos);
		var url2=url.substr(spos+12);
		url=url1+url2
		location.replace(url);
	}
}
/*** Für Badpartner News ***/
function show(divid){
	if (document.layers)
  	  	document.layers[divid].visibility="show";
  	else{
  	  	document.getElementById(divid).style.visibility = "visible";
 	 }
}
function overandout(inout,id){
	return 0;
	alert(inout,id);
	if (inout=="in"){
		id.style.backgroundColor='#FFFFFF';
		id.style.color='#005EC4';
	}else{
		id.style.backgroundColor='#005EC4';
		id.style.color='#FFFFFF';
	}
}
function mach(art) {
	switch(art) {
		case "all":
			markall(document.forms["angebot"].elements["auswahl[]"]);
			break;
		case "none":
			marknone(document.forms["angebot"].elements["auswahl[]"]);
			break;
		case "markbest":
			if (checkmark(document.forms["angebot"].elements["auswahl[]"])) {
				document.angebot.submit();
			} else {
				alert("\r\n      Bitte mindestens eine Position markieren!");
				document.angebot.aktion.value="";
			}
			break;
		default : break;
	}
}
function markall(field) {
	field.checked=true;
	for(i = 0; i < field.length; i++) field[i].checked = true;
}
function marknone(field) {
	field.checked=false;
	for(i = 0; i < field.length; i++) field[i].checked = false;
}
function checkmark(field) {
	marked=0;
	if (field.checked) marked=1;
	else {
		for(i = 0; i < field.length; i++) if (field[i].checked) marked=1;
	}
	return marked;
}