<!-- Scripting by m:com cologne -->
var lastan="";
var cdversion=false;
function laden(name, erstes, zweites) {  
     appname = navigator.appName;
     appversion = navigator.appVersion;
  if (browserOK) {     
    Bilder[name] = new Array(3);
    Bilder[name][0] = new Image();
    Bilder[name][0].src = erstes;
    Bilder[name][1] = new Image();
    Bilder[name][1].src = zweites;
  }
}

function an(name){
     appname = navigator.appName;
     appversion = navigator.appVersion;
  if (browserOK) {
    
     if ((name.indexOf("snav") >= 0) && (appname.indexOf("Netscape") >= 0) && appversion.substr(0,1) == "4") {
       //alert(navigator.appVersion);
       	   doc = document.snav.document; // 
	   }
     else if ((name.indexOf("unav") >= 0) && (appname.indexOf("Netscape") >= 0) && appversion.substr(0,1) == "4") {
		//alert(window.document.layers.length);
	 	  doc = window.document.nav.document; 
	   }   
	 else {
	   doc = document; }  
	 if(lastan != "") {
	    doc.images[lastan].src = Bilder[lastan][0].src;
	 } 
	 if(doc.images[name]){
	 	doc.images[name].src = Bilder[name][1].src;
	 	lastan = name;
	 }
  }
}

function aus(name){
     appname = navigator.appName;
	 appversion = navigator.appVersion;
     if ((name.indexOf("snav") >= 0) && (appname.indexOf("Netscape") >= 0) && appversion.substr(0,1) == "4") {
	   doc = document.snav.document; 
	 } else {
	   doc = document; }  
  if (browserOK) {
	 if(lastan != "") {
		  if(!doc.images[lastan]) {
		      //alert("Lastan: "+lastan);
		  }
	    doc.images[lastan].src = Bilder[lastan][0].src;
	 }  
	 lastan = "";
  }
}


function m_an(name,layer){
  if (browserOK) {
     if (document.images) {
		if ( document.getElementsByTagName ) {
		    if ((navigator.appName == "Netscape") && navigator.appVersion.substr(0,1) != "4") {
			     doc = document;
			
			}else if (navigator.appName == "Netscape") {
			    
				doc = document.getElementsByTagName("*");
			
			}else {
			    
		        doc =document.getElementById(layer).document ;
			}
		}else {
			doc = document.layers[layer].document
		}
	}
	if(lastan != "") {
	    doc.images[lastan].src = Bilder[lastan][0].src;
	 } 
	 //alert(doc.images[name].src);
	 doc.images[name].src = Bilder[name][1].src;
	 lastan = name;
	 //alert(doc.images[name].src);
  }
}

function m_aus(name,layer){
  if (browserOK) {
	 if(lastan != "") {
	     if (document.images) {
			if ( document.getElementsByTagName ) {
				if ((navigator.appName == "Netscape") && navigator.appVersion.substr(0,1) != "4"){	     
				 	doc = document;
				}else if (navigator.appName == "Netscape") {
					doc = document.getElementsByTagName("*");
				}else {
			        doc =document.getElementById(layer).document ;
				}
			}else {
				doc = document.layers[layer].document
			}
		}
	    doc.images[lastan].src = Bilder[lastan][0].src;
	 }  
	 lastan = "";
  }
}


function helpan(name){
 
  if (browserOK) {
	   document.images["ftext"].src = Bilder[name][1].src;	
  }
}


   function openlink(lnk, typ, stat, opn) {
       openlink(lnk, typ, stat, opn, '');
   }


   function openlink(lnk, typ, stat, opn, winpar) {
       //alert(lnk + " " + opn);
	   if(stat) {
           var lnkparam = "";
		   /*
           if(typ == 1 || typ == 2){	
               if(typ == 1){
                   lnkparam = "strLink=" + escape(lnk);
               } else {
			       lnkparam = "strFile=" + escape(lnk);
               }
			   lnk = "/showdata.php?" + lnkparam;
           }
		   */
	   }
       if(!opn) {
	       location.href = lnk;
	   } else {
	      if(winpar == "") {
			winpar = 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, width=800, height=600';
          }
		  if(typ == 1){
 	      		openexternal(lnk, winpar);
		  } else {
			  //openexternal(lnk, winpar);
			  newWin = window.open (lnk,"Extern",winpar);
			  setTimeout("newWin.focus()",500);
          }
	   }
   }

   function openlink_neu(lnk, typ, stat, opn, winpar) {
       var lnkparam = "";
       if(typ == 1 || typ == 2){	
           if(typ == 1){
               lnkparam = "strLink=" + escape(lnk);
           } else {
               lnkparam = "strFile=" + escape(lnk);
           }
           lnk = "/showdata.php?" + lnkparam;
       }
       if(!opn) {
	       location.href = lnk;
	   } else {
	      if(winpar == "") {
			winpar = 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, width=800, height=600';
          }
		  if(typ == 1){
 	      		openexternal(lnk, winpar);
		  } else {
			  newWin = window.open (lnk,"Extern",winpar);
			  setTimeout("newWin.focus()",500);
          }
	   }
   }

   function openexternal(page)
   {
		wshelp = window.open (page, 'Extlink','width=700,height=420,location=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes,scrollbars=yes,screenY=80,screenX=80');
		wshelp.focus();
   }

   function openexternal(page,winpar)
   {
		wshelp = window.open (page, 'Extlink',winpar);
		wshelp.focus();
   }

function openpage(page, features, type) {
    if(page != "") {
	    if(type == "O") {
	      if (page != "") {
	        parent.location.href="print.php?page_id=" +page + "&type=" +type;
		  }
		} else {
		    //window.open (dynamicserver + "/print.php?page_id=" + page + '&type=' + type, 'winxtra','height=360,width=540,scrollbars');
		    window.open ("print.php?page_id=" + page + "&type=" +type, 'winxtra',features);
		}
	}	
}

function selectpage(page,type) {
  openpage(page,'height=360,width=540,scrollbars',type);
}

  function openenglish_static()
{
wsopen=window.open('englisch.htm','Fenster1','width=300,height=200')
wsopen.focus();
}

  function not_available() 
  	{
	    seite = 'not_available.htm';
		window.open(seite, 'Fenster2', 'width=200,height=120,scrollbars,screenY=80,screenX=80');  
	}
	
 function forgot_password(lang,rootkuerzel) 
  	{
	    seite = 'forgot_password.php?lang=' + lang + '&rootkuerzel=' + rootkuerzel;
		window.open(seite, 'Fenster3', 'width=300,height=200,scrollbars,screenY=80,screenX=80');  
	}



function reiternav(page_id) {
   if(!embeddedpage) {
      location.href = "index.php?page_id="+page_id;
   } else {
      document.mainform.subpage.value = page_id;
	  document.mainform.submit();
   }
}
   
   
function ausblenden()
	{
	 document.all.alertdiv.style.visibility='hidden';			
	}

  
  function alertdivshow(text) {
           	document.all.alertdiv.style.visibility='visible';
			document.all.alertdiv.innerHTML = "<span class=\"normal\">";
			document.all.alertdiv.innerHTML += text;
			document.all.alertdiv.innerHTML += "</span>";
			setTimeout("ausblenden()",5000);
  }

function load_content(x)
{
  if (x == "")
  {
  }
  else
  {
    //teil = x.indexOf("http://");
    teil = -1;
    if (teil == "-1")
    {
      document.location.href = x;
    }
    else
    {
window.open(x,"Fenster","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600");
    }
  }
}

function dosearch(strLang){
   q = document.mainform.q.value;
   if (strLang == "de"){
        x = 'http://search.bayer.com/newbayer/suche.php?tag=D%&wf=12421&ps=10&hilfe=0&q='+ q;
   } else {
        x = 'http://search.bayer.com/newbayer/search.php?tag=E%&wf=12421&ps=10&hilfe=0&q='+ q;
   }
   document.location.href = x;
}


function getprintstatic()
 	{  
	seite = location.pathname;
	linkanf = seite.lastIndexOf("page");
	if (linkanf == -1) {
	    linkanf = seite.lastIndexOf("anw");
	} 
	charnum = seite.length - linkanf + 1;
	seite = 'print_' + seite.substr(linkanf,charnum);
	return seite;
  }

  
if (document.layers) brows = "ns";
if (document.getElementById) brows = "ie";  // bei nn5 und ie5 

var activ_div = "";
var ontime = 0;

function show(ebene) 
	{
	 if(navigator.appName.indexOf("Microsoft") > -1 || !kvswf ) {
	    //debug('show '+ ebene+' ' + activ_div);
	    if( activ_div != ebene ) {
			if( ebene != "" ) {
				if ( brows == "ie") {
				     var eb = document.getElementById(ebene);
				     eb.style.visibility =  "visible";
					 var ab = document.getElementById("abdeck");
					 if(ab) {
					    ab.style.visibility = "visible";
					    ab.style.left = eb.style.left;
					    ab.style.top = eb.style.top;
					    ab.width = eb.clientWidth;
					    ab.height = eb.clientHeight;
					 }
					 
					}
				else {
					eval('document.layers["'+ebene+'"].visibility="show"');
					//alert(document.layers[ebene].visibility);
					}
			}
			if ( activ_div != "" ) {
				if ( brows == "ie") {
				    eval('document.getElementById("' + activ_div + '").style.visibility =  "hidden"')  ;
					 //document.getElementById("abdeck").style.visibility = "hidden";
					}
				else {
					eval('document.layers["'+ activ_div +'"].visibility="hidden"');
					}
			}
		}
		activ_div = ebene;
		ontime = new Date().getTime();
	  }
	}

function hide_it(ebene,e)
{
     e = e || window.event;
     //var target = e.srcElement || e.target;
     var related = e.relatedTarget || e.toElement;
	 //var nodes = "";
     while (related.id != ebene && related.nodeName != 'BODY')
	 {
          related = related.parentNode;
		  //nodes += related.nodeName+"("+related.id+")&nbsp;";
	 }
     //debug("Mouseout " + related.id);
     if (related.id != ebene) {
	    hide(ebene);
	 	return;
	 }
}

function mouseOutEventHandler(e) {
     e = e || window.event;
     var target = e.srcElement || e.target;
     if (target != this) return;

     var related = e.relatedTarget || e.toElement;
     while (related != this && related.nodeName != 'BODY')
          related = related.parentNode;
     if (related == this) return;
   
     // the rest of the function
}

function show_it(ebene,e)
{
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
   targ = targ.parentNode;
var tname;
tname=targ.tagName;
debug("You clicked on a " + tname + " element.");
}
	
	
function hide(ebene) 
	{    
	    //debug('hide '+ ebene);
	    if(navigator.appName.indexOf("Microsoft") > -1 || !kvswf) {
		 if (activ_div != ""){
	      	if(document.layers) 
	      		document.layers[activ_div].visibility="hide"; 
	    	else 
	      		eval('document.getElementById("' + activ_div + '").style.visibility ="hidden"')  ;
			    document.getElementById("abdeck").style.visibility = "hidden";

			activ_div = "";	
	    }
		} else {
		  if(ontime>0) {
		  	var currtime = new Date().getTime()-ontime;
			if (currtime > 500) {
	      		document.getElementById(activ_div).style.visibility ="hidden";
			    document.getElementById("abdeck").style.visibility = "hidden";
			}
		  }
		}
	}

	function debug(info) {
	   idfield = document.getElementById('debug');
	   idfield.innerHTML += info + "<br>";
	}
	
function hidemozillamenues() {
    if(navigator.appName.indexOf("Microsoft") == -1) {
	   hide(activ_div);
	}
}

function zoombild(bildname, width, height, strHeadline) {
//        MM_openBrWindow('/zoombild.html?bildpfad='+bildname+'&width'+width+'&height'+height+'&strHeadline='+strHeadline,'zoombild','scrollbars=no,width='+width+',height='+height);
    if (strHeadline) {
        openlink(dynamicserver+'/zoombildclose.php?bildpfad='+bildname+'&width='+width+'&height='+height+'&strHeadline='+strHeadline,1,false,true,'scrollbars=no,width='+width+',height='+height);
    } else {    
        openlink(dynamicserver+'/zoombildclose.php?bildpfad='+bildname+'&width='+width+'&height='+height,1,false,true,'scrollbars=no,width='+width+',height='+height);
    }
}

function gohome(){
	seite = location.href;
	if(seite.indexOf("host") > 0){
	    linkanf = seite.indexOf("host");
		linkend = seite.indexOf("&&");
		hostname = seite.substring(linkanf+5,linkend);
  	    //alert(hostname);
		document.location.href = "http://" + hostname;
  	}
		
}


function do_submit(operate) {
    if(!cdversion) {
	    if(operate.indexOf("callpage_") == 0) {
		    document.mainform.page_id.value = operate.replace(/callpage_/,"");
			operate = "";
		}
	    document.mainform.operate.value = operate;
		document.mainform.submit();
	} else {
	    if(operate.indexOf("callpage_") == 0) {
		    var page = operate.replace(/callpage_/,"");
			location.href = 'page' + page + '.htm';
		} else if(operate == "selectanw") { 
		    selectanw();
		} else {
		    not_available(lang);
		}
	}
}


function submitenter(page,sfield,server,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   do_search(page,sfield,server);
   return false;
   }
else
   return true;
}


function not_available() {
   alert ('In der CD Version nicht verfügbar');
}


function order_action(operate,item_id) {
    document.mainform.operate.value = operate;
    document.mainform.item_id.value = item_id;
	document.mainform.submit();
}

function selectcountry(landid) {
   var seite;
   if(!cdversion) {
   	seite = "print.php?page_id=" + weltweit + "&type=K&land="+landid;
  } else {
    seite = "land" + weltweit + "_" + landid + ".htm";
  }
  window.open(seite,'Contact','width=620, height=420, menubar=yes, resizable=yes, scrollbars=yes, screenY=80, screenX=80');
}


function openbewerbung() {
   var seite;
   if(!cdversion) {
   	location.href = "index.php?page_id=" + bewerbung;
  } else {
    not_available();
  }
}


function selectbereich(bereich_id) {
   location.href = "index.php?bereich_id=" + bereich_id;
}

var hint_timer;
function showhint(hint) {
   status = hint;
   hint_timer=30;
   var hintobj = document.getElementById('jshint');
   var X = event.clientX+document.body.scrollLeft;
   var Y = event.clientY+document.body.scrollTop;
   var hd = hintobj.style.visibility;
   hintobj.style.visibility = 'visible';
   hintobj.style.left = X;
   hintobj.style.top = Y;
   hintobj.innerText = hint;
   hidehint();
}

function hidehint() {
   if(hint_timer > 0) {
   	 hint_timer -= 1;
     setTimeout('hidehint()',100);
   } else {
   	var hintobj = document.getElementById('jshint');
   	hintobj.style.visibility = 'hidden';
   }
 }
 
 function do_search(searchpage,searchfield,server) {
     if(!server) {
	     if(searchfield) {
		 	document.mainform.suchfeld.value = document.mainform[searchfield].value
		 }
	     //document.mainform.suchfeld.value = document.all.suchfeld2.innerText;
	     do_submit('callpage_' + searchpage);
	 } else {
	     if(!searchfield) {
		 	searchfield = "suchfeld";
		 }
 		 svalue = document.mainform[searchfield].value;
		 //sele = document.getElementById("search");
		 //sele.innerText = svalue;
		 target = server+"/index.php?ext=1&page_id=" + searchpage + "&suchfeld=" + escape(svalue);
// AR 04/07
//		 openexternal(target,'width=1024,height=700,resizable=yes,scrollbars=yes');
		 openexternal(target,'width=1024,height=700,resizable=yes,scrollbars=yes');
	 }
 }
 
  function sendprodukt(prod,anw,lang)
{
seite = 'prodnotfound.php?prod=' + escape(prod) + '&lang=' + lang + '&anw_id=' + anw; 
wsopen=window.open(seite,'Fenster4','width=500,height=460')
wsopen.focus();
}

function bookmarkpage(seitenname) {
    bookmarkurl = location.href;
    if (document.all) {
		window.external.AddFavorite(bookmarkurl,seitenname);
	} else {
	   alert('Your Browser does not support this feature');
	}
  }

  
  function selectbrand() {
     var sel = document.mainform.brand;
	 location.href = sel.options[sel.selectedIndex].value;
  }

  var selectedqbox="1";
  
  function selectquickprod(rub_id) {
  	return 1;
    var sbox;
	if(selectedqbox) {
		sbox = document.getElementById("psel_"+selectedqbox);
		sbox.style.visibility = 'hidden';
	}
	sbox = document.getElementById("psel_"+rub_id);
	if(sbox) {
		sbox.style.visibility = 'visible';
		selectedqbox = rub_id;
	}
  }
  
  function selectprod() {
    //alert(document.mainform.prod_service_select.options[document.mainform.prod_service_select.selectedIndex].value);
    prod_id = document.mainform.prod_service_select.options[document.mainform.prod_service_select.selectedIndex].value;
   document.mainform.prod_service_id.value = prod_id;
   document.mainform.submit();
  }
  
  
  function shiftmenu() {
	var menu = document.getElementById("iframe_nav");
	var body =document.getElementById("body");
	if(menu) {
		if(body.scrollTop > 89) {
			menu.style.top = body.scrollTop;
		} else {
			menu.style.top = 89;
		}
	}
  }
  
  function openmodule(div) {
	var moddiv = document.getElementById(div);
	moddiv.style.visibility= 'visible';
  }
  
  function closemodule(div) {
	var moddiv = document.getElementById(div);
	moddiv.style.visibility= 'hidden';
  }
  
  function validate_JS_selection(val)
  {
	var valarr = val.split('|');
	val = valarr[0];
	var lnk = valarr[1];
	var prodsuche_result = valarr[2];
	if(lnk) {
		if(lnk.substr(0,1) != "/" && lnk.substr(0,7) != "http://") {
			lnk = "http://" + lnk;
		}
	    location.href = lnk;
	} else {
		document.mainform.prod_service_id.value = val;
		document.mainform.page_id.value = prodsuche_result;
		document.mainform.submit()
	}
  }

function countclose(){ 
 	document.all.counter.style.visibility='hidden';
}

function opencounter(lngWidth,lngHeight,lngTop,lngLeft,strPicName,strLink)
{
	document.getElementById("counter").innerHTML += "<iframe style=\"position:absolute;width:"+lngWidth+"px;height:"+lngHeight+"px;top:"+lngTop+";left:"+lngLeft+";\"></iframe>";
//	document.getElementById("counter").innerHTML += "<div onclick=\"countclose();\" style=\"position:absolute;width:"+lngWidth+"px;height:"+lngHeight+"px;top:"+lngTop+";left:"+lngLeft+";border:1px solid\"><img src=\""+strPicName+"\" border=0 alt=\"Counter\" onclick=\"countclose();\" style=\"width:"+lngWidth+"px; height:"+lngHeight+"px;\"></div>";
	document.getElementById("counter").innerHTML += "<div style=\"position:absolute;width:"+lngWidth+"px;height:"+lngHeight+"px;top:"+lngTop+";left:"+lngLeft+";border:1px solid\"><a href=\""+strLink+"\"><img src=\""+strPicName+"\" border=0 alt=\"Counter\" onclick=\"countclose();\" style=\"width:"+lngWidth+"px; height:"+lngHeight+"px;\"></a></div>";
	document.getElementById("counter").style.visibility ='visible';
	setTimeout("countclose()",9000);
}

    function openPopupWithTimeout(strUrl,lngTimeout,lngWidth,lngHeight,lngTop,lngLeft){
        objWindow = window.open(strUrl,'popupTimeout','top='+lngTop+',left='+lngLeft+', width='+lngWidth+', height='+lngHeight+',toolbar=no, location=no, status=no, menubar=no, scrollbars=auto, resizable=no');
        objWindow.focus();
        setTimeout('objWindow.close()',lngTimeout);
    }
