// ---------------------------------------------------------------------

	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Updated:	
		March, 11th, 2006 - Fixed positioning of tooltip when displayed near the right edge of the browser.
		April, 6th 2006, Using iframe in IE in order to make the tooltip cover select boxes.
		
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	
	var dhtmlgoodies_tooltip = false;
	var dhtmlgoodies_tooltipShadow = false;
	var dhtmlgoodies_shadowSize = 4;
	var dhtmlgoodies_tooltipMaxWidth = 200;
	var dhtmlgoodies_tooltipMinWidth = 100;
	var dhtmlgoodies_iframe = false;
	var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;
	function showTooltip(e,tooltipTxt)
	{
		
		// replace "|" by "<br>
		tooltipTxt = tooltipTxt.replace(/\|/g,"<br>");
		// tooltipTxt = tooltipTxt.replace(/--/g,"");
		
		// add style specifics for tooltips 
		tooltipTxt = tooltipTxt.replace(/<table>/g,"<table class='tooltiptable'>");
		
		// alert(tooltipTxt);
		
		
		var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;
	
		if(!dhtmlgoodies_tooltip){
			dhtmlgoodies_tooltip = document.createElement('DIV');
			dhtmlgoodies_tooltip.id = 'dhtmlgoodies_tooltip';
			dhtmlgoodies_tooltipShadow = document.createElement('DIV');
			dhtmlgoodies_tooltipShadow.id = 'dhtmlgoodies_tooltipShadow';
			
			document.body.appendChild(dhtmlgoodies_tooltip);
			document.body.appendChild(dhtmlgoodies_tooltipShadow);	
			
			if(tooltip_is_msie){
				// dhtmlgoodies_iframe = document.createElement('IFRAME');
				dhtmlgoodies_iframe = document.createElement('DIV');				
				dhtmlgoodies_iframe.frameborder='5';
				dhtmlgoodies_iframe.style.backgroundColor='#FFFFFF';
				dhtmlgoodies_iframe.src = '#'; 	
				dhtmlgoodies_iframe.style.zIndex = 100;
				dhtmlgoodies_iframe.style.position = 'absolute';
				document.body.appendChild(dhtmlgoodies_iframe);
			}
			
		}
		
		dhtmlgoodies_tooltip.style.display='block';
		dhtmlgoodies_tooltipShadow.style.display='block';		
		if(tooltip_is_msie)dhtmlgoodies_iframe.style.display='block';
		
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
		var leftPos = e.clientX + 10;
		
		dhtmlgoodies_tooltip.style.width = null;	// Reset style width if it's set 
		dhtmlgoodies_tooltip.innerHTML = tooltipTxt;
		dhtmlgoodies_tooltip.style.left = leftPos + 'px';
		dhtmlgoodies_tooltip.style.top = e.clientY + 10 + st + 'px';
		dhtmlgoodies_tooltip.style.fontSize='8pt';

		
		dhtmlgoodies_tooltipShadow.style.left =  leftPos + dhtmlgoodies_shadowSize + 'px';
		dhtmlgoodies_tooltipShadow.style.top = e.clientY + 10 + st + dhtmlgoodies_shadowSize + 'px';
		
		if(dhtmlgoodies_tooltip.offsetWidth>dhtmlgoodies_tooltipMaxWidth){	/* Exceeding max width of tooltip ? */
			dhtmlgoodies_tooltip.style.width = dhtmlgoodies_tooltipMaxWidth + 'px';
		}
		
		var tooltipWidth = dhtmlgoodies_tooltip.offsetWidth;		
		if(tooltipWidth<dhtmlgoodies_tooltipMinWidth)tooltipWidth = dhtmlgoodies_tooltipMinWidth;
		
		
		dhtmlgoodies_tooltip.style.width = tooltipWidth + 'px';
		dhtmlgoodies_tooltipShadow.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
		dhtmlgoodies_tooltipShadow.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';		
		
		if((leftPos + tooltipWidth)>bodyWidth){
			dhtmlgoodies_tooltip.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
			dhtmlgoodies_tooltipShadow.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + dhtmlgoodies_shadowSize) + 'px';
		}
		
		if(tooltip_is_msie){
			dhtmlgoodies_iframe.style.left = dhtmlgoodies_tooltip.style.left;
			dhtmlgoodies_iframe.style.top = dhtmlgoodies_tooltip.style.top;
			dhtmlgoodies_iframe.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
			dhtmlgoodies_iframe.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';
		
		}
				
	}
	
	function hideTooltip()
	{
		dhtmlgoodies_tooltip.style.display='none';
		dhtmlgoodies_tooltipShadow.style.display='none';		
		if(tooltip_is_msie) {
		      dhtmlgoodies_iframe.style.display='none';	
	    }      	
	}

// ---------------------------------------------------------------------------------------------------

function fCheckValue(sInputFieldId) 
{
	// alert(sInputFieldId);
    sValue = document.getElementById(sInputFieldId).value;
    // alert(sValue);
    if (sValue == "") {
        alert("Kein Suchbegriff eingegeben - No search pattern entered");
        return false;
    } else {
	    return true;
    }    		
}


     
// -----------------------------------------------------------------------------------------------------------
       // begin of function   
       function fNewDivWindow(sToggle) {	       
	     // alert("in fNewDivWindow" + sToggle);   
	     if (sToggle == "close") {
		       if (document.getElementById("coverdiv")) {
                  document.getElementById("coverdiv").style.visibility = "hidden";                     
               } else {
	              alert("Element not existing - please contact admin"); 
               }
               
		       if (document.getElementById("userdiv")) {                       
                     document.getElementById("userdiv").style.visibility = "hidden";                     
               } else {
	              alert("Element not existing - please contact admin"); 
               }                     
         }          
               

         
	     if (sToggle == "open") {                    
		       if (document.getElementById("coverdiv")) {		       
			         // get position of element with id=location
                     obj = document.getElementById("location");			          			       
			         yPos = obj.offsetTop; 
                     if(obj.offsetParent) {
                        while(obj.offsetParent) {	                        
                             yPos += obj.offsetTop;                           
                             obj = obj.offsetParent;
                        }
                     }			     
                     document.getElementById("coverdiv").style.height = yPos + "px";				        		     
                     document.getElementById("coverdiv").style.visibility = "visible";
               } else {
	                 alert("Element not existing"); 
               }                      
                     
		       if (document.getElementById("userdiv")) {                        
                     document.getElementById("userdiv").style.visibility = "visible"; 
               } else {
	                 alert("Element not existing"); 
               }                   		                
         }           
       }
       // end of function




// ---------------------------------------------------------------------------------------------------

function Lesezeichen(SeitenTitel,SeitenURL,Kommentar){

  // alert("SeitenURL:" + SeitenURL);
  // alert("SeitenTitel:" + SeitenTitel);  
  	
  if (window.sidebar)
    {
    // firefox
    window.sidebar.addPanel(SeitenTitel,SeitenURL,Kommentar);
    }
  else if(window.opera && window.print)
    {
    // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',SeitenURL);
    elem.setAttribute('title',SeitenTitel);
    elem.setAttribute('rel','sidebar');
    elem.click();
    }
  else if(document.all)
    {
    // ie
    window.external.AddFavorite(SeitenURL,SeitenTitel);
    }
}
// -----------------------------------------------------------------------------------

function fmodLocation(sAdd){

    sLocation = window.location.pathname;
    if (sAdd != "") {
	        window.location.href = sLocation + "?" + sAdd;
    } else {  
            window.location.href = sLocation;
    }
}
// -----------------------------------------------------------------------------------


// change appearance of cell 
function fChangeStyle(sName,sClass) {
     if(document.getElementById(sName).className) { 
             document.getElementById(sName).className = sClass;
     } else {
	         alert("Ill called function: arguments are: sName, sClass");
     }    
}       

function fMoveOver(name,sClass) {	
        namepic = name + "pic";
        // alert(namepic);
        if (document.getElementById(namepic)) {
               document.getElementById(namepic).src="images/nav/home/over.jpg";
        }          
        if (document.getElementById(name)) {
	            document.getElementById(name).className = sClass; 
        }          
}

function fMoveOut(name,sClass) {
        // alert("Out"); 
        if (document.getElementById(namepic)) {
                document.getElementById(namepic).src="images/nav/home/out.jpg";
        }
        if (document.getElementById(name)) {
	            document.getElementById(name).className = sClass; 
        }               
}
   


//--------------------------------------------------------------------------------
//Begin function fSearchPattern_de
    
    function fSearchPattern_de() {
	     // alert("In function fSearchPattern");

         // Zahlen.sort(Numsort);


	     // initialisation of browser output 

         outBrowser = "<html><head><link rel='STYLESHEET' type='text/css' href='styleCardiac.css'>";
         outBrowser += "<style type='text/css'>";
         outBrowser += "<!--";
         outBrowser += " a:link { text-decoration:underline; font-weight:bold; color:#E00000; }";
         outBrowser += " a:visited { text-decoration:underline; font-weight:bold; color:#000000; }";
         outBrowser += " a:hover { text-decoration:underline; font-weight:bold; background-color:#8CFFDE; }";
         outBrowser += " a:active { text-decoration:underline; font-weight:bold; background-color:#CCFFFF; }";
         outBrowser += "-->";
         outBrowser += "</style>";
         outBrowser += "</head>";
         outBrowser += "<body style='margin-top:0,5cm'>";
         outBrowser += "<table cellpadding='10' cellspacing='10' border='0' width='90%' style='background-color:none'>";
         outBrowser += "<tr><td><span class='txtlarge'>Suchergebnisse</span></td></tr>";
         
	     // Get search string und check
         sSearchPattern = document.searchForm.searchword.value;
         if(sSearchPattern == "Bitte Suchbegriff eingeben") {
            alert("Bitte zuerst Suchbegriff eingeben");
            document.forms["searchForm"].reset();
            return	
         }
         if(sSearchPattern == "") {
            alert("Bitte Suchbegriff eingeben");
            document.forms["searchForm"].reset();
            return	
         }
         // Change to lower case
         outBrowser += "<tr><td><span class='txtstd'>Das Wort '" + sSearchPattern + "' wird in folgenden Dokumenten verwendet:</span></td></tr>";  
         sSearchPattern = sSearchPattern.toLowerCase();
   
	     
	     // Get number of Menu items
         iMenuLength = aIndexEntry.length; 

         iFind=0;
         sPath="|";
         for (zaehler=0; zaehler<iMenuLength; zaehler++) { 
               // alert(aIndexEntry[zaehler].SearchText);
               // Check whether search string is part of the text
               sSearchText = aIndexEntry[zaehler].SearchText.toLowerCase();
               // alert(sIndexText); 
               iSearchText = sSearchText.indexOf(sSearchPattern);
               if (iSearchText>-1) {
	               iSearchPath = sPath.indexOf(aIndexEntry[zaehler].SearchPath);
                   // alert("aIndexEntry[zaehler].SearchPath:" + aIndexEntry[zaehler].SearchPath);
                   if (iSearchPath == -1) {
	                   // add new und unique pathinfo 
	                   sPath = sPath + aIndexEntry[zaehler].SearchPath + "|";
	                   aFind[iFind]=zaehler;
	                   iFind++;  
                   }
	           }     
         } //end for
         outBrowser += "<tr><td>";
         outBrowser += "Es wurden " + iFind + " Treffer erkannt";
         outBrowser += "</td></tr>";

         
         // write all documents with located hits 
         for (zaehler=0; zaehler<iFind; zaehler++) {
                   outBrowser += "<tr><td>";
                   outBrowser += "<a href='" + aIndexEntry[aFind[zaehler]].SearchPath + "' target='mainright'>";
                   outBrowser += aIndexEntry[aFind[zaehler]].SearchTitle;
                   outBrowser += "</a>"
                   outBrowser += "</td></tr>";	         
	     } //end for              
                  
         // Finish output to browser and write result to main window
         outBrowser += "</table></body></html>";
         // alert("outBrowser=" + outBrowser);
         document.open();
         document.write(outBrowser);
         document.close();                                            
    }
    

//End function  
//--------------------------------------------------------------------------------  
//Begin function 
    
    function fChangeLangDE() {
	    
	   // switch to English version    
       location.href='start_de.cfm';
    }  
    
    function fChangeLangEN() {
	    
	   // switch to German version    
       location.href='start_en.cfm';
    }       


//End function
// --------------------------------------------------------------------------------

//Begin function
    
    function fMapCat1(smapcat1,slang) {
	    

         sMap = "notlocated";
         // alert("smapcat1:" + smapcat1); 
         // alert("slang:" + slang); 
         // alert("sMap:" + sMap); 
         

         var mapcat1 = new Array(4);
         for (var i=0; i<mapcat1.length; i++) {
             mapcat1[i] = new Array(2);
         }  


         mapcat1[0][0] = "Systeme";
         mapcat1[0][1] = "Systemlösungen";
         mapcat1[0][2] = "System Solutions";

         mapcat1[1][0] = "Tablartraeger";
         mapcat1[1][1] = "Tablarträger";
         mapcat1[1][2] = "table units";

         mapcat1[2][0] = "2Griffe";
         mapcat1[2][1] = "2Griffe_de";
         mapcat1[2][2] = "2Griffe_en";

         mapcat1[3][0] = "3Griffe";
         mapcat1[3][1] = "3Griffe_de";
         mapcat1[3][2] = "3Griffe_en";

         // Language switch 
         if (slang == "de") {
               k = 1;
               // alert("German setting");
         } else {
              k = 2;
              // alert("English setting");
         }
 
         iLoc=0;
         for (var i=0; i < mapcat1.length; i++) {
           // alert(mapcat1[i][0]); 
           if(mapcat1[i][0] == smapcat1) {
              sMap = mapcat1[i][k];
              iLoc=1;
              // alert("sMap="+sMap);
              break; 
           }
         }

         if(iLoc == 0) {
              sMap = smapcat1;
              // alert("not located");
         }
        
         return sMap; 

    }   



//End function
// --------------------------------------------------------------------------------
//
// Check formfield values provided from user 
//
//Begin function
// 
//

function fCheckForm(formelem) {
     // check fields in formelem
     // alert("in fCheckForm");
     var bCheck = true;
     var inputFields = formelem.getElementsByTagName("input");
     for (i = 0; i < inputFields.length; i++) {
          // alert("Wert: " + inputFields[i].value);  
          // alert("Type: " + inputFields[i].getAttribute('type')); 
          // alert("MinValue: " + inputFields[i].getAttribute('minValue'));
           
          if(inputFields[i].name == "quantity1") {
	            newFieldValue = inputFields[i].value;  	           
                if (isNaN(newFieldValue)) {
                    alert("Es muss eine Zahl eingegeben werden");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
                }	 	          
          } 
        
          // -------- Value type: eMail -------------------------------------------    
          if(inputFields[i].getAttribute('valuetype')) {
	          newFieldValue = inputFields[i].value;
	          if(inputFields[i].getAttribute('valuetype') == "email") {
                 if (newFieldValue ==  "") {
                    alert("Dieses Feld erwartet eine Eingabe der eMail");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
                 }
                 
                 
                 emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	             if(inputFields[i].value.match(emailExp)){
		               // alert("Dies ist eine echte eMail");
	             }else{
		               alert("Dieses Feld erwartet eine Eingabe einer echten eMail-Adresse");
		               inputFields[i].style.backgroundColor='red';
		               inputFields[i].value='';
		               inputFields[i].focus();	                    
                       // return false;
                       bCheck = false; 
	             }
	             // Correct input
	             // inputFields[i].style.backgroundColor='white';        
              }
          }               
            
          
          // -------- Value type: Character -------------------------------------------    
          if(inputFields[i].getAttribute('valuetype')) {
	          newFieldValue = inputFields[i].value;
	          if(inputFields[i].getAttribute('valuetype') == "character") {
                 if (newFieldValue ==  "") {
                    alert("Dieses Feld erwartet eine Eingabe");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
                 }
	             // Correct input
	             // inputFields[i].style.backgroundColor='white';
              }    
          }                       
             
          // -------- Value type: Integer -------------------------------------------    
          if(inputFields[i].getAttribute('valuetype')) {
	          newFieldValue = inputFields[i].value;
	          if(inputFields[i].getAttribute('valuetype') == "integer") {
		         // alert("Integer expected"); 
                 if (newFieldValue ==  "") {
                    alert("Es muss eine Zahl eingegeben werden - es wurde keine Eingabe vorgenommen");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
                 }
                 
                 if (isNaN(newFieldValue)) {
                    alert("Es muss eine Zahl eingegeben werden");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
                 }
	             // Correct input
	             // inputFields[i].style.backgroundColor='white';                 
                           
              }
          }
          
          if(inputFields[i].getAttribute('minValue')) {
	          newFieldValue = inputFields[i].value;
	           
	          
              if (newFieldValue ==  "") {
                    alert("Es muss eine Zahl eingegeben werden - es wurde keine Eingabe vorgenommen");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
              }  
              
              	             
	          // check for integer 
	          // alert("Int:" + parseInt(newFieldValue));
              if (isNaN(newFieldValue)) {
                    alert("Es muss eine Zahl eingegeben werden");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
              }
                     	 
                         
	          if (parseInt(newFieldValue) < parseInt(inputFields[i].getAttribute('minValue'))) 
	          {
		          alert("Falsche Eingabe - minimaler Wert unterschritten");
		          inputFields[i].style.backgroundColor='red';
		          inputFields[i].focus();		          
		          // return false;
		          bCheck = false; 
	          }
	          // Correct input
	          // inputFields[i].style.backgroundColor='white';            
          } 
          
            
          if(inputFields[i].getAttribute('maxValue')) {
	          newFieldValue = inputFields[i].value;
	          
              if (newFieldValue ==  "") {
                    alert("Es muss eine Zahl eingegeben werden - es wurde keine Eingabe vorgenommen");
		            inputFields[i].style.backgroundColor='red';
		            inputFields[i].focus();	                    
                    // return false;
                    bCheck = false; 
              } 	          
	          
	          // alert("newFieldValue:"  + newFieldValue);	  
	          if (parseInt(newFieldValue) > parseInt(inputFields[i].getAttribute('maxValue'))) 
	          {
		          alert("Falsche Eingabe - maximaler Wert überschritten");
		          inputFields[i].style.backgroundColor='red';
		          inputFields[i].focus();		          
		          // return false;
		          bCheck = false; 
	          }
	          // Correct input
	          // inputFields[i].style.backgroundColor='white';   	                      
          }                                          
     }
     return bCheck    
     // alert("end of  fCheckForm");  
}
//End function
// --------------------------------------------------------------------------------	
//
//
//Begin function
// 
//
function fCheckAll() {
	// alert("in function fCheckAll mit aufruf");
    for (k = 0; k < document.forms.length; k++) {
	    	  var formelem = document.forms[k];
	    	  // alert("Name des Formulars:" + formelem.name);
	    	  var bCorrect = fCheckForm(formelem); 
	    	  // alert("bCorrect:" + bCorrect);
	          // var inputFields = formelem.getElementsByTagName("input");	    
    }
    if (bCorrect) {
	    return true;
    } else {     
	    alert("Das Formular ist nicht unvollständig oder falsch ausgefüllt.\n" +
	          "Bitte korrigieren Sie die markierten Felder");
	    return false;
    }     
}
//End function
// --------------------------------------------------------------------------------		
