































 
 
 
 
 
 
 
 
 
 

                









var contentIframeName = 'contentiframe';
var scrollableAreaName = 'scrollableArea';
var navigationName = 'navigation';
var subnavigationContentName = 'subnavigationContent';
var headerLinksName = 'headerLinks';
var activateSpeechName = 'activateSpeech';
var deactivateSpeechName = 'deactivateSpeech';
var activateSpeechLinkName = 'activateSpeechLink';
var deactivateSpeechLinkName = 'deactivateSpeechLink';
var headerTextName = 'headerText';
var headerTextDivName = 'headerTextDiv';
var speechAreaName = 'speechArea';

var speechFileForBookmark = '*.swf';
var iframeSizeOffset = (document.all)?3:15;

var isSpeechDeactivated = true;
var isModeOffline = false;

var maxTriesForContentResize = 2;
var countTriesForContentResize = 0;

var contactID = 1100411;

// Method for logging into the cmdServer.log
// Only short texts are allowed
function log (level, text) {
   doAsyncAjaxCall ("../../menu/" + -1 + "_eDAEF2-HOMEPAGE_pdoLog/index.html?loglevel=" + level + "&logmsg=" + encodeURIComponent(text), null, "doNothing");
}

function logMsg (text) {
   log (100, text);
}

function logInf (text) {
   log (120, text);
}

function logErr (text) {
   log (200, text);
}

function logFat (text) {
   log (300, text);
}

function resizeContentIframe() {

   var offset = 0;
   var iframe = getElement(contentIframeName);
   var iframeFrames = parent.frames[contentIframeName].frames;
   var iframeBody;
   
   // Look if we have a frameset within the content iframe
   // This must be checked first, since IE seems to find a body tag even when there's a frameset within the content iframe
   // The if-query doesn't fail if there is an iframe, although it should do so. 
   if (iframeFrames.length > 0) {
      // Did not find a body? Perhaps we have a frameset?! Try it!
      if (iframeFrames && iframeFrames.length > 0) {
         var iframeContentFrame = iframeFrames['Content'];
         if (iframeContentFrame) {
            var iframeContentFrameBodyArr = iframeContentFrame.document.getElementsByTagName('body');
            if (iframeContentFrameBodyArr.length > 0) {
               iframeBody = iframeContentFrameBodyArr[0];
            }
         }
      }
   } 
   // IframeBody is only filled when there is an Frame (not iframe!) with name "Content".
   if (!iframeBody ) {
      // There's no frameset within the iframe; look for the body tag
      var iframeBodyArr = parent.frames[contentIframeName].document.getElementsByTagName('body');
      if (iframeBodyArr.length > 0) {
         iframeBody = iframeBodyArr[0];
      }
   }

   // OK. now we should have an iframeBody object. Let's change it's size.
   if (iframeBody) {
      var iframeHeight = getElementHeight(iframeBody) + 0 + iframeSizeOffset;
      if (iframeHeight > iframeSizeOffset) {
         iframe.height = (iframeHeight > 420)?iframeHeight:420;  // -20, damit kein unnoetiger Scrollbalken entsteht
      } else {
         iframe.height = 420;
         if (countTriesForContentResize < maxTriesForContentResize) {
            window.setTimeout('resizeContentIframe()', 1000);
            countTriesForContentResize++;
         } else {
            countTriesForContentResize = 0;
         }
      }
   } else {
      iframe.height = 420;
      if (countTriesForContentResize < maxTriesForContentResize) {
         window.setTimeout('resizeContentIframe()', 1000);
         countTriesForContentResize++;
      } else {
         countTriesForContentResize = 0;
      }
   }
   
   // Anpassung der Gesamthoehe
   var scrollableArea = getElement(scrollableAreaName);
   var heightOfAllButContent = 707 - 440;
   
   var availableHeight;
   var screenheight = screen.availHeight;
   var agent = navigator.userAgent.toLowerCase();
   
   //Fix Problem with height in FF and other browsers without IE
   	if (iframe.height > screenheight && agent && !agent.indexOf("msie")>-1) {

	    scrollableArea.style.height = "0%";

	} else {
		
		availableHeight = screenheight - heightOfAllButContent - 30 - 150;  // 30px Puffer, 150px fuer Browser Buttonleisten und Menue
		scrollableArea.style.height = availableHeight + "px";
	}

/*
   if (iframe.height < availableHeight) {
      iframe.height = availableHeight - 30;
   }
*/
   
/*
   alert("screenheight = " + screen.availHeight + 
   			"\niframeheight = " + iframe.height +
   			"\navailableHeight = " + availableHeight +
   			"\nscrollableArea = " + scrollableArea.style.height);
*/    
}

function getElementHeight(element) {
   return getElementSize(element, 'Height');
}

function getElementWidth(element) {
   return getElementSize(element, 'Width');
}

function getElementSize(element, orientation) {
   var attributeName = 'offset' + orientation;
   if (document.all) {
      attributeName = 'scroll' + orientation;
   }
   if (typeof element != 'undefined') {
      if (typeof eval ('element.' + attributeName) != 'undefined') {
         return eval("element." + attributeName);
      } else {
         return 0;
      }
   } else {
      return 0;
   }
}

function getParentElement(elementName) {
   if (parent) {
      return parent.document.getElementById(elementName);
   } else {
      return false;
   }
}

function getElement(elementName) {
   if (document.getElementById(elementName)) {
      return document.getElementById(elementName);
   }else {
      return getParentElement(elementName);
   }
}

function showPage (obj, params) {
   var itemID = getMenuIdFromObject (obj);
   var languageID = getLanguageIdFromObject (obj);
   return showPageForID (itemID, languageID, params);
}


function showPageForIDWithAnker(itemID, languageID, anker){
   return showPageForID(itemID, languageID, null, anker);
}


function showPageForID(itemID, languageID, params, anker) {
   var doc = document;
   if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent;
   }
   if (params) {
      if (params.indexOf("?") != 0) {
         params = "?" + params;
      }
   } else {
      params = "";
   }

   if (anker) {
      if (anker.indexOf("#") != 0) {
         anker = "#" + anker;
      }
   } else {
      anker = "";
   }

   clearSearchForm();   
   
   //scrollToTop();

   if (!languageID) languageID = 1;
   var item = new Item (itemID, languageID);

   var doSSL = item.ssl == 'true';
   var isSSL = top.location.protocol == "https:";
   var url = "";

   if (doSSL && !isSSL) {
      url = 'https://' + top.location.hostname + '/servlet/PB/menu/' + itemID + '_l' + languageID + '/index.html' + params + anker;
   } else if (!doSSL && isSSL) {
      url = 'http://' + top.location.hostname + '/servlet/PB/menu/' + itemID + '_l' + languageID + '/index.html' + params + anker;
   }
   

   if (item.pagetype == 'DAEF2-MICROSITE') {
      if (url == '') {
         url = '../../menu/' + item.contentItemID + '_l' + languageID + '/index.html' + params + anker;
      }
      // TODO: korrekte Implementierung
/*      alert ("Microsites sind noch nicht implementiert. Der Seiteninhalt wird nun in einem neuen Fenster im herkömmlichen Layout dargestellt.");*/
      window.open (url, 'Microsite', 'location=no,menubar=no,scrollbars=yes,toolbar=yes,status=no,resizable=yes,width=985,height=770');
   } else {
      if (url != "") {      
         top.location.href = url;
         return false;
      }
      if ('true' == item.refreshContent) {
         doc.refreshContent(item.contentItemID, item.contentPagePart, params , anker);         
      } else {      	
         // refresh navi only when content is NOT refreshed, since on content refresh navi is refreshed automatically by 'onload' of content iframe
         doc.refreshNavi(item);
         doc.refreshSubnavi(item);
         doc.doWebco(item.contentItemID);
      }
   }

   return false;
}

function refreshNavi (item) {
   // reload navigation
   var menuID = item.naviItemID;
   var languageID = item.languageID;
   var navi = getElement(navigationName);
   getHTMLCodeFromURL ('../../menu/' + menuID + '_eDAEF2-HOMEPAGE_pnavi_l' + languageID + '_yno/index-1283743949068.html?ContentType=text/plain', navi);
}

function popup (url, title, width, height) {
   window.open (url, title, 'location=yes,menubar=no,scrollbars=yes,toolbar=yes,status=no,resizable=yes,width='+width+',height='+height);
}


function refreshSubnavi (item) {
   // reload subnavigation
   var menuID = item.subnaviItemID;
   var languageID = item.languageID;
   var subnavi = getElement(subnavigationContentName);
   getHTMLCodeFromURL ('../../menu/' + menuID + '_eDAEF2-HOMEPAGE_psubnavi_l' + languageID + '/index.html?ContentType=text/plain', subnavi);
}

function refreshHeader(item) {
   // reload header
   var menuID = item.contentItemID;
   var headerText = item.headerText;
   var headerTextBgColor = item.headerTextBgColor;
   var languageID = item.languageID;
   var speechFileHtmlCode = item.speechFileHtmlCode;
   var speechFileName = item.speechFileName;

   // hilite header links
   var headerLinks = getElement(headerLinksName);
   var links = headerLinks.getElementsByTagName("div");
   for (var i=0; i<links.length; i++) {
      var elem = links[i];
      if (elem.getAttribute("ID") != "itemid" + menuID) {
         removeClass (elem, "hilite");
      } else {
         addClass (elem, "hilite");
      }
   }
   
   // show/hide image within header
   refreshHeaderText (headerText, headerTextBgColor, languageID);

   // speech file handling (only if content is refreshed)
   if ('true' == item.refreshContent) {
      getElement(speechAreaName).innerHTML = speechFileHtmlCode;
      if (speechFileName.length > 0) {      
         if (speechFileHtmlCode.length == 0) {
            setSpeechLink(true, false, menuID);
         } else {
            setSpeechLink(false, true, menuID);
         }
      } else {
         setSpeechLink(false, false, menuID);
      }
   }

   // TITLE tag
   if ('true' == item.refreshContent) {
      top.document.title = "Deutsche Ärzte Finanz - " + unescapeUnicode(item.title);
   }
}


function refreshHeaderText (headerText, headerTextBgColor, languageID) {
   var headerTextDiv = getElement(headerTextDivName);
   var headerTextElem = getElement(headerTextName);
   hideElement(headerTextDivName);
   if (headerText != "") {
      headerTextElem.innerHTML = "";
      if (headerTextBgColor == "headertextblue") {
         addClass (headerTextElem, "headertextblue");
         if (hasClass (headerTextElem, "headertextorange")) {
            removeClass (headerTextElem, "headertextorange");
         }
      }
      if (headerTextBgColor == "headertextorange") {
         addClass (headerTextElem, "headertextorange");
         if (hasClass (headerTextElem, "headertextblue")) {
            removeClass (headerTextElem, "headertextblue");
         }
      }
      
      headerTextElem.innerHTML = charRefToUnicode(headerText);
      
      showElement(headerTextDivName);
   }
}

function refreshHeaderGrafik(item) {
   // send ajax call to reload header grafik
	
	var menuID = item.contentItemID;

   	doAsyncAjaxCall ("../../menu/" + menuID + "_eDAEF2-HOMEPAGE_pheadergrafik/index.html", null, "refreshHeaderGrafik");
}

function setHeaderGrafikBG(response){
	// reload header grafik
	
	if(response){
	
		var headergrafikpath = filterContent(response, "#HEADERGRAFIK-START#", "#HEADERGRAFIK-END#");	
	
		var headergrafikDIV = document.getElementById("headerImage");
		
		if(headergrafikDIV && headergrafikpath.length > 0){
			
			headergrafikDIV.style.backgroundImage = "url(" + headergrafikpath + ")";
		}
	}
}

function filterContent(content, startprefix, endprefix){
	
	var pos_start = content.indexOf(startprefix);
	var pos_end = content.indexOf(endprefix);
	
	if(pos_start == -1) pos_start = 0;
	else pos_start = pos_start + startprefix.length;
		
	if(pos_end == -1) pos_end = content.length;
	
	var contentlength = pos_end - pos_start
	
	return content.substr(pos_start, contentlength);
}

function charRefToUnicode(str) {
	return str.replace(/&#(([0-9]{1,7})|(x[0-9a-f]{1,6}));?/gi, function(match, p1, p2, p3, offset, s){return String.fromCharCode(p2 || ("0" + p3));});
}

function getContentMenuID() {
   var menuID = 0;
   var doc = document;
   if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent;
   }
   var iframe = doc.frames[contentIframeName];
   if (iframe && typeof iframe.getCurrentMenuID == 'function') {
      menuID = iframe.getCurrentMenuID();
   } else {
   	if(getElement(contentIframeName)) {
         var url = getElement(contentIframeName).src;
         menuID = getMenuIdFromUrl(url);
   	}
   }
   return menuID;
}

function scrollToTop() {
   var doc = document;
   if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent;
   }

    var hash = doc.frames[contentIframeName].location.hash;
    
   //Wenn Anker benutzt werden, soll nicht nach oben gescrollt werde.
   if (doc.frames[contentIframeName].location.hash == ''){    
       if (typeof doc.getElement(contentIframeName).scrollIntoView == 'object' || typeof doc.getElement(contentIframeName).scrollIntoView == 'function') {
          doc.getElement(contentIframeName).scrollIntoView("true");
       }
   }else{
        doc.frames[contentIframeName].document.getElementsByName(hash.substring(1))[0].scrollIntoView("true");
   }
}

function setDivContent(iframe)
{
	var ziel = document.getElementById("iframeSrc");
	var body = parent.frames[iframe.name].document.getElementsByTagName('body')[0];
	ziel.innerHTML = body.innerHTML;
}

/*	sr: 25.06.2008: neue Funktionen fuer soft rebrush Aenderungen. Ermitteln der iframe-Hoehe anhand der Elemente 
	Leider ist das ein einziges Gefrickel. Bei Aenderungen sollte der Iframe entfernt und das CSS ueberarbeitet werden.
*/


function prepareCurrentContent() {
   var doc = document;
   if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent;
   }
   var iframe = doc.frames[contentIframeName];
   var menuID = 1100292;
   if (iframe && typeof iframe.getCurrentMenuID == 'function') {
      menuID = iframe.getCurrentMenuID();
   }
   var languageID = 1;
   if (iframe && typeof iframe.getCurrentLanguageID == 'function') {
      languageID = iframe.getCurrentLanguageID();
   }
   prepareContent (menuID, languageID);
}

function prepareContent(menuID, languageID, refresh) {
   //resizeContentIframe();

   var doc = document;
   if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent;
   }

   //scrollToTop();

   var contentMenuID = getContentMenuID();
   if (contentMenuID != 0) {
      menuID = contentMenuID;
   }

   var item = new Item(menuID, languageID);
   if ('true' == item.changeContentLinks) {
      changeLinksWithinContent();
   }

   // reload navi & Co.; needed for "back" button functionality of the browser
   var doRefreshNow = true;
   var iframe = doc.frames[contentIframeName];
   if (iframe && typeof iframe.doRefresh == 'function') {
      doRefreshNow = iframe.doRefresh();
   }

   if (doRefreshNow) {
      doc.refreshSubnavi(item);
      doc.refreshHeader(item);
      doc.refreshHeaderGrafik(item);
      doc.refreshNavi(item);
   }
   doc.doWebco(item.contentItemID);
}

function refreshContent (menuID, pagepart, params, anker) {
   var content = getElement(contentIframeName);
   var ts = (new Date()).getTime();
   if (params) {
      if (params.indexOf("?") != 0) {
         params = "?" + params;
      }
   } else {
      params = "";
   }
   
   if (anker) {
      if (anker.indexOf("#") != 0) {
         anker = "#" + anker;
      }
   } else {
      anker = "";
   }  
   
   content.src = '../../menu/' + menuID + (pagepart!=''?'_p'+pagepart:'') + '/index-' + ts + '.html' + params + anker;
}

function changeLinksWithinContent() {
   if (!isModeOffline) {
      var content = parent.frames[contentIframeName].document;
      if (content.links) {
         for (i=0; i<content.links.length; i++) {
            var thisLink = content.links[i];
            if ((thisLink.target == '_top' || thisLink.target == 'contentiframe') && getMenuIdFromObject (thisLink) != 0) {
               thisLink.onclick = function() { return showPage(this) };
            }
         }
      }
   }
}

function getMenuIdFromObject (obj) {
   return getMenuIdFromUrl (obj.href);
}

function getMenuIdFromUrl (url) {
   var menuID = 0;
   var arr = url.split('/menu/');
   if (arr.length >= 2) {
      menuID = arr[1].split('/')[0].split('_')[0];
   }
   return menuID;
}

function getLanguageIdFromObject (obj) {
   return getLanguageIdFromUrl (obj.href);
}

function getLanguageIdFromUrl (url) {
   var languageID = 1;
   var arr = url.split('/menu/');
   if (arr.length >= 2) {
      var params = arr[1].split('/')[0].split('_');
      for (var i=0; i<params.length; i++) {
         if (params[i].indexOf("l") == 0) {
            languageID = params[i].substring(1, params[i].length);
         }
      }
   }
   return languageID;
}

function stopSpeechFile (itemID) {
   var ts = (new Date()).getTime();
   doAsyncAjaxCall('../../menu/' + itemID + '_eDAEF2-HOMEPAGE_pdeactivatespeech_yno/index-' + ts + '.html', getElement(speechAreaName));
   hideElement(deactivateSpeechName);
   showElement(activateSpeechName);
   isSpeechDeactivated = true;
   return false;
}

function stopSpeechFileTemporary (itemID) {
   var ts = (new Date()).getTime();
   getElement(speechAreaName).innerHTML = "";
   return false;
}

function startSpeechFile (itemID) {
   var ts = (new Date()).getTime();
   doAsyncAjaxCall('../../menu/' + itemID + '_eDAEF2-HOMEPAGE_pactivatespeech_yno/index-' + ts + '.html', getElement(speechAreaName));
   hideElement(activateSpeechName);
   showElement(deactivateSpeechName);
   isSpeechDeactivated = false;
   return false;
}

function setSpeechLink (showActivateLink, showDeactivateLink, itemID) {
   var ts = (new Date()).getTime();
   var content = parent.document;
   if (content.links) {
      for (i=0; i<content.links.length; i++) {
         var thisLink = content.links[i];
         if (thisLink.id == activateSpeechLinkName) {
            thisLink.href = "../../menu/" + itemID + "_eDAEF2-HOMEPAGE_pactivatespeech_yno/index-" + ts + ".html";
            thisLink.onclick = function() { return startSpeechFile(itemID) };
         }
         if (thisLink.id == deactivateSpeechLinkName) {
            thisLink.href = "../../menu/" + itemID + "_eDAEF2-HOMEPAGE_pdeactivatespeech_yno/index-" + ts + ".html";
            thisLink.onclick = function() { return stopSpeechFile(itemID) };
         }
      }
   }

   if (showActivateLink) {
      showParentElement(activateSpeechName);
   } else {
      hideParentElement(activateSpeechName);
   }

   if (showDeactivateLink) {
      showParentElement(deactivateSpeechName);
   } else {
      hideParentElement(deactivateSpeechName);
   }

}

function hideElement(elementID) {
   if (getElement(elementID)) {
      getElement(elementID).style.display = 'none';
   }
}

function showElement(elementID) {
   if (getElement(elementID)) {
      getElement(elementID).style.display = 'inline';
   }
}

function hideParentElement(elementID) {
   if (getParentElement(elementID)) {
      getParentElement(elementID).style.display = 'none';
   }
}

function showParentElement(elementID) {
   if (getParentElement(elementID)) {
      getParentElement(elementID).style.display = 'inline';
   }
}

function showSearch() {
   return submitSearchForm();
}

function loadWithinContentIframe(url) {
   if (getElement(contentIframeName)) {
      getElement(contentIframeName).src = url;
   } else if (getParentElement(contentIframeName)) {
      getParentElement(contentIframeName).src = url;
   }
}

function getSpeechFileHtmlCode (filename) {
   var speechFileHtmlCode = "%3c%6f%62%6a%65%63%74%20%63%6c%61%73%73%69%64%3d%27%63%6c%73%69%64%3a%44%32%37%43%44%42%36%45%2d%41%45%36%44%2d%31%31%63%66%2d%39%36%42%38%2d%34%34%34%35%35%33%35%34%30%30%30%30%27%20%77%69%64%74%68%3d%27%30%27%20%68%65%69%67%68%74%3d%27%30%27%20%69%64%3d%27%73%70%65%65%63%68%66%69%6c%65%27%3e%0d%0a%3c%70%61%72%61%6d%20%6e%61%6d%65%3d%27%6d%6f%76%69%65%27%20%76%61%6c%75%65%3d%27%2f%64%61%65%66%32%2f%73%77%66%2f%25%66%69%6c%65%6e%61%6d%65%25%27%3e%3c%2f%70%61%72%61%6d%3e%0d%0a%3c%70%61%72%61%6d%20%6e%61%6d%65%3d%27%71%75%61%6c%69%74%79%27%20%76%61%6c%75%65%3d%27%68%69%67%68%27%3e%3c%2f%70%61%72%61%6d%3e%0d%0a%3c%70%61%72%61%6d%20%6e%61%6d%65%3d%27%4c%4f%4f%50%27%20%76%61%6c%75%65%3d%27%66%61%6c%73%65%27%3e%3c%2f%70%61%72%61%6d%3e%0d%0a%3c%65%6d%62%65%64%20%73%72%63%3d%27%2f%64%61%65%66%32%2f%73%77%66%2f%25%66%69%6c%65%6e%61%6d%65%25%27%20%77%69%64%74%68%3d%27%30%27%20%68%65%69%67%68%74%3d%27%30%27%20%6c%6f%6f%70%3d%27%66%61%6c%73%65%27%20%71%75%61%6c%69%74%79%3d%27%68%69%67%68%27%20%74%79%70%65%3d%27%61%70%70%6c%69%63%61%74%69%6f%6e%2f%78%2d%73%68%6f%63%6b%77%61%76%65%2d%66%6c%61%73%68%27%3e%3c%2f%65%6d%62%65%64%3e%0d%0a%3c%2f%6f%62%6a%65%63%74%3e%0d%0a";
   return unescape(speechFileHtmlCode.replace (/%25%66%69%6c%65%6e%61%6d%65%25/g, filename));
}

function loadSpeechFile (filename) {
   if (!isSpeechDeactivated) {
      getElement(speechAreaName).innerHTML = getSpeechFileHtmlCode (filename);
   }
}

function unloadSpeechFile() {
   getElement(speechAreaName).innerHTML = "";
}

function addBookmark() {
   var done = false;
   var url = getElement(contentIframeName).src;
   var menuID = getMenuIdFromUrl(url);
   var languageID = getLanguageIdFromUrl (url);
   var url = top.location.protocol + "//" + top.location.host + "/servlet/PB/menu/" + menuID + "/index.html";
   var title = "Deutsche Ärzte Finanz - " + getCurrentPageName(menuID, languageID);
   if (typeof window.external == "object") {
      try {
         window.external.AddFavorite(url, title);
         done = true;
      } catch (e) {
      }
   }
   if (!done) {
      alert ("Ihr\u0020Browser\u0020l\u00e4sst\u0020auf\u0020Grund\u0020von\u0020Sicherheitseinstellungen\u0020kein\u0020automatisches\u0020Bookmarking\u0020zu.\u0020Bitte\u0020klicken\u0020Sie\u0020auf\u0020OK.\u0020Wir\u0020f\u00fchren\u0020dann\u0020einen\u0020Reload\u0020aus.\u0020Danach\u0020k\u00f6nnen\u0020Sie\u0020das\u0020Lesezeichen\u0020\u00fcber\u0020die\u0020Men\u00fcleiste\u0020des\u0020Browsers\u0020setzen.");
      top.location.href = url;
   } else {
      loadSpeechFile (speechFileForBookmark);
   }
   return false;
}

function reloadCompletePageWithIframeID() {
	if(getElement(contentIframeName)) {
      var menuID = getContentMenuID();
      var currentMenuID = getMenuIdFromUrl(top.location.href);
      if (menuID != currentMenuID) {
         top.location.href = "../../menu/" + menuID + "/index.html";
      }
	}
   return false;
}

function getHTMLCodeFromURL (url, obj) {
   doAsyncAjaxCall (url, obj, "innerHTML");
}

function doAsyncAjaxCall (url, obj, type) {
   var separator = "?";
   var ind = url.indexOf ("?");
   if (ind >= 0) {
      separator = "&";
   }
   url += separator + "ContentType=text/html";
   callAjax (url, true, obj, type);
}

function doSyncAjaxCall (url) {
   return callAjax (url + "?ContentType=text/plain", false);
}

function createXMLHttp() {
   if (typeof XMLHttpRequest != 'undefined') {
      return new XMLHttpRequest();
   } else if (window.ActiveXObject) {
      var avers = ["Microsoft.XmlHttp", "MSXML2.XmlHttp","MSXML2.XmlHttp.3.0", "MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.5.0"];
      for (var i = avers.length -1; i >= 0; i--) {
         try {
            httpObj = new ActiveXObject(avers[i]);
            return httpObj;
         } catch(e) {
         }
      }
   }
   return false;
}

function callAjax (url, doAsynchronous, obj, type) {
//alert ("doing " + ((doAsynchronous)?"ab":"") + "synchronous AJAX call '" + url + "', type='" + type + "'");
   if (!type) {
      type = "innerHTML";
   }
   try {
      var xmlHttp = createXMLHttp();
      if (xmlHttp) {
         xmlHttp.open('GET', url, doAsynchronous);
         xmlHttp.setRequestHeader("enctype", "application/x-www-form-urlencoded");
         if (doAsynchronous) {
            xmlHttp.setRequestHeader("Content-Type", "text/html");
            xmlHttp.setRequestHeader("Pragma", "no-cache"); 
            xmlHttp.setRequestHeader("Cache-Control", "no-cache, must-revalidate"); 
            xmlHttp.onreadystatechange = function () {
               if (xmlHttp.readyState == 4) {
//alert ("retrieved answer for async AJAX call '" + url + "': " + trim(xmlHttp.responseText));
                  if (type == 'innerHTML') {
                     obj.innerHTML = xmlHttp.responseText.replace(/ +/g, ' ').replace(/^\s+/g, '').replace(/\s+$/g, '');  // = "trim()", replaced it since the Praxisvermittlung had a problem to call "trim()"
                  } else if (type == 'doNothing') {
                     // do nothing, just hope that this call did what it should have done
                  } else if (type == 'refreshHeaderGrafik') {
                     setHeaderGrafikBG(xmlHttp.responseText.replace(/ +/g, ' ').replace(/^\s+/g, '').replace(/\s+$/g, '')); // = "trim()", replaced it since the Praxisvermittlung had a problem to call "trim()"
                  }
               }
            };
         } else {
            xmlHttp.setRequestHeader("Content-Type", "text/plain");
         }
         xmlHttp.send(null);
      }
      if (!doAsynchronous) {
         var retStr = trim(xmlHttp.responseText);
//alert ("xml=" + xmlHttp.responseXML.xml)
//alert ("retrieved answer for sync AJAX call '" + url + "': '" + retStr + "'");
         return retStr;
      }
   } catch(except) {
//      alert ("Error: " + except.toString());
      return false;
   }
}

/* SEARCH functions */
var bIsSearching  = false;
function setIsSearching(bState) {
	bIsSearching = bState;
}

function submitSearchForm () {
	searchForm = document.forms["searchform"];
	if (checkSearchForm()) {
      hideElement(activateSpeechName);
      hideElement(deactivateSpeechName);
      var item = new Item (1098647, 1);
      refreshSubnavi(item);
      refreshHeader(item);
	  refreshHeaderGrafik(item);
      refreshNavi(item);
		searchTermValue = searchForm.SEARCHTERM.value;
		while (searchTermValue.search(/_/)!=-1) {
		      searchTermValue = searchTermValue.replace(/_/,String(" "));
		}
		searchForm.SEARCHTERM.value=searchTermValue;
		searchForm.submit();
		clearSearchForm();
	}
   
	return false;	
}

function getDocument() {
   var doc = document;
   if (typeof top.getElement == 'function' && top.getElement(contentIframeName)) {
      doc = top.document;
   } else if (parent && typeof parent.getElement == 'function' && parent.getElement(contentIframeName)) {
      doc = parent.document;
   }
   return doc;
}

function clearSearchForm() {

   var doc = getDocument();
   var searchForm = doc.forms["searchform"];
   var searchTerm = searchForm.SEARCHTERM;
   searchTerm.value="";

}

function checkSearchForm() {
	searchForm = document.forms["searchform"];
	var conf = true;
	if ( 3 > searchForm.SEARCHTERM.value.length) {
		alert("Bitte geben Sie beim Suchbegriff mindestens 3 Zeichen ein!");
		searchForm.SEARCHTERM.focus();
		return false;
	}
	if (bIsSearching) {
		conf = !confirm("Sie suchen bereits. Möchten Sie das Suchergebnis nicht abwarten? (OK für Abwarten)");
	}
	if (conf) {
	   setIsSearching(true);
	}
	return conf;
}

function submitHiddenSearchForm (searchaction, searchterm) {
   hiddenSearchForm = document.forms["hiddenSearchform"];
   hiddenSearchForm.action = searchaction;
   hiddenSearchForm.elements["hiddenSearchterm"].value=searchterm;
   hiddenSearchForm.submit();
}


function getItemIdToLoadNaviFor (itemID, languageID) {
   var item = new Item (itemID, languageID);
   return item.naviItemID;
}

function getCurrentPageName (itemID, languageID) {
   var item = new Item (itemID, languageID);
   return item.name;
}

function trim (str) {
    return str.replace(/ +/g, ' ').replace(/^\s+/g, '').replace(/\s+$/g, '');
}


function doWebco (menuID) {
   doAsyncAjaxCall ("../../menu/" + menuID + "_eDAEF2-HOMEPAGE_pdoWebco/index.html", null, "doNothing");
}

function printContent (menuID, languageID) {
   window.open ('../../menu/' + menuID + '_pprint_l' + languageID + '/index.html', 'print', 'location=no,menubar=no,scrollbars=yes,toolbar=yes,status=no,resizable=yes,width=782, height=600');  // 20 fuer Scrollbalken, 25 fuer linken Rand
   return false;
}


/**
 * Function Item
 *
 * Represents a pirobase item with all needed attributes:
 *  - name
 *  - ID of the item to load the navigation for
 *  - ID of the item to load the content for
 *  - pagetype
 *  - pagepart to load the content with
 *  - does page need to be loaded via SSL?
 *
 * Parameter:
 *    itemID:     ID of the item to get the info for
 *
 * Example:
 *
 *  var item = new Item (itemID, languageID);
 *  alert(itemInfo.naviItemID);
 */
function Item (itemID, languageID) {
   var itemInfos = getItemInfos (itemID, languageID);

   this.name = getItemInfo(itemInfos, "name", "");
   this.naviItemID = getItemInfo(itemInfos, "naviItemID", itemID);
   this.subnaviItemID = getItemInfo(itemInfos, "subnaviItemID", itemID);
   this.contentItemID = getItemInfo(itemInfos, "contentItemID", itemID);
   this.pagetype = getItemInfo(itemInfos, "pagetype", "");
   this.contentPagePart = getItemInfo(itemInfos, "contentPagePart", "");
   this.ssl = getItemInfo(itemInfos, "ssl", "false");
   this.languageID = getItemInfo(itemInfos, "languageID", 1);
   this.changeContentLinks = getItemInfo(itemInfos, "changeContentLinks", "true");
   this.refreshContent = getItemInfo(itemInfos, "refreshContent", "true");
   this.headerTextID = getItemInfo(itemInfos, "headerTextID", 0);
   this.headerText = getItemInfo(itemInfos, "headerText", "");
   this.headerTextBgColor = getItemInfo(itemInfos, "headerTextBgColor", "");
   this.speechFileHtmlCode = getItemInfo(itemInfos, "speechFileHtmlCode", "");
   this.speechFileName = getItemInfo(itemInfos, "speechFileName", "");
   this.title = getItemInfo(itemInfos, "title", "");
}

function getItemInfos (itemID, languageID) {
   var itemInfos = doSyncAjaxCall ("../../menu/" + itemID + "_eDAEF2-HOMEPAGE_pgetItemInfoWithStoerer_l" + languageID + "_yno/index-1283743949069.html");
   return itemInfos;
}

function getItemInfo(container, id, defaultVal) {
   var searchStr = "<attr id=\"" + id + "\">";
   var ind = container.indexOf (searchStr);
   var tmpStr = container.substring(ind+searchStr.length);
   ind = tmpStr.indexOf ("</attr>");
   if (ind >= 0) {
      tmpStr = tmpStr.substring(0, ind);
   } else {
      tmpStr = defaultVal;
   }

   return tmpStr;
}








/**
 * Function hasClass
 *
 * Checks an given object "el" for class "className"
 *
 * Parameter:
 *    el:            valid html-element object
 *    className:     name of class to look for
 *
 * Example:
 *
 *  var myobj = document.getElementById('myId');
 *  if (hasClass(myobj, 'myClass')) {
 *    alert('has class myClass');
 *  }
 */
function hasClass(el, className) {
   if (!(el && el.className)) {
      return;
   }
   var cls = el.className.split(" ");
   var ar = new Array();
   for (var i = cls.length; i > 0;) {
      if (cls[--i] == className) {
         return true;
      }
   }
   return false;
}


/**
 * Function addClass
 *
 * Adds class "className" to an given object
 *
 * Parameter:
 *    el:            valid html-element object
 *    className:     name of class to add
 *
 * Example:
 *
 *  var myobj = document.getElementById('myId');
 *  addClass(myobj, 'anotherClassToAdd')) {
 */
function addClass(el, className) {
   if (!(el && el.className)) {
      return;
   }
   removeClass(el, className);
   el.className += " " + className;
}

/**
 * Function removeClass
 *
 * Removes class "className" from an given object
 *
 * Parameter:
 *    el:            valid html-element object
 *    className:     name of class to remove
 *
 * Example:
 *
 *  var myobj = document.getElementById('myId');
 *  removeClass(myobj, 'classToRemove')) {
 */
function removeClass(el, className) {
   if (!(el && el.className)) {
      return;
   }
   var cls = el.className.split(" ");
   var ar = new Array();
   for (var i = cls.length; i > 0;) {
      if (cls[--i] != className) {
         ar[ar.length] = cls[i];
      }
   }
   el.className = ar.join(" ");
}

function getCurrentMenuID() {
   return 1100292;
}

function getCurrentLanguageID() {
   return 2;
}

function doRefresh() {
   return true;
}

/*  AXA Redirect POPUP */
function callAXARedirectPopup(url, height, width, toolbar, herkunftID, aktionsCode) {
	if (herkunftID==null)	herkunftID = '-1';
	if (aktionsCode==null)	aktionsCode = '';
	
	var Args = eval("'"+"width="+width+", height="+height+", toolbar="+toolbar+", location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1"+"'");
	m_window = window.open('http://www.axa.de/servlet/PB/menu/-1_eAXAWEB-POPUP-REDIRECT/index.html?ID='+url+'&PARTNER=DAEV', 'm_window', Args);
	m_window.focus;
	if (m_window.opener == null) { 
		m_window.opener = self; 
		m_window.focus;
	}
}





// debug for Loeti
function alertLoeti(text) {

}

