/*
// ####################################################################################################
// # Datei inc.js V 2.5.13
// ####################################################################################################
// # Copyright © 2004-2011 ISS-Oberlausitz
// # Author: T.Hojenski
// # Email: info@iss-ol.de
// # URL:   http://www.bluepage-cms.com
// # Diese Datei gehört zu dem kommerziellen bluepage - CMS der ISS-Oberlausitz
// # Bitte beachten Sie die Lizenzbedingungen.
// # Unberechtigte Nutzung, Änderung oder Weitergabe über die Lizenzbedingungen hinaus
// # sind strafbar.
// # Eine unberechtigte Verwendung auch von Teilen des CMS-Systems kann zu Schadensersatz-
// # und/oder Unterlassungsansprüchen führen.
// # Das Entfernen der Copyrighthinweise ist untersagt.
// ####################################################################################################
*/

var sBaseHref = document.getElementsByTagName("base")[0].getAttribute("href");

/* Browsercheck-Cookie */
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	if (document.getElementById('checkbrowser')) document.getElementById('checkbrowser').style.display = 'none'; 
}


var ie  = document.all;
var dom = document.getElementById;


function getElementByClassName(class_name,id) {
   var obj,ret_obj,teststr;
   obj=document.getElementById(id);
   if(obj.className.indexOf(class_name)!=-1) {
      teststr=","+obj.className.split(" ").join(",")+",";
      if(teststr.indexOf(","+class_name+",")!=-1) ret_obj=obj;
   }
   return ret_obj;
}


function popup(typ,lg,pf,id,InhId) {
   if (pf == '../' || !document.getElementById('popup_content')) {
      url = wwwUrl+'/media_view.php?typ=' + typ + '&lg=' + lg + '&pf=' + pf + '&id=' + id + '&InhId=' + InhId;
      opt = 'location=no,scrollbars=auto,toolbar=no,resizable=yes,left=' + ((screen.availWidth-855)/2) + ',top=' + (((screen.availHeight-600)/2)-20) + ',width=860,height=600';
      galwindow = window.open(url,'_blank',opt);
      galwindow.moveTo(((screen.availWidth-855)/2),((screen.availHeight-600)/2)-20)
   } else {
      if ((document.getElementById && !document.all) || (navigator.userAgent.indexOf('Opera') > -1)) {
         if ((window.pageXOffset + (window.innerHeight/2)-300) > 0) {
            document.getElementById('popup_content').style.top           = window.pageXOffset + (window.innerHeight/2);
         } else {
            document.getElementById('popup_content').style.top           = '300px';
         }
         document.getElementById('popup_content').style.position      = 'fixed';
         document.getElementById('popup_content').style.display       = 'block';
         if (document.getElementById('popup_background')) document.getElementById('popup_background').style.display    = 'block';
      } else if (document.all) {
         document.all('bluepage_body').style.overflowY                = 'hidden';
         document.all('bluepage').style.marginRight                   = '17px';
         if ((document.body.scrollTop + ((document.body.clientHeight)/2)-200) >0) {
            document.all('popup_content').style.top                      = document.body.scrollTop + ((document.body.clientHeight)/2);
         } else {
            document.all('popup_content').style.top                      = '300px';
         }
         document.all('popup_content').style.display                  = 'block';
         if (document.all('popup_background')) document.all('popup_background').style.display               = 'block';
      }
      if (typ == 'rdb' || typ == 'gal' || typ == 'fgal') {
         makeRequest(typ,lg,pf,id,InhId); 
      } else if (typ == 'dormino') {
         makeRequest(typ,lg,pf,id,InhId);
      } else if (typ == 'flv') {
         makeRequest(typ,lg,pf,id,InhId);
      } else {
         makeRequest(typ,lg,pf,id,InhId);
      }
   }
}

function popup_close() {
   if ((document.getElementById && !document.all) || (navigator.userAgent.indexOf('Opera') > -1)) {
      document.getElementById('popup_content').style.display       = 'none';
      document.getElementById('popup_content').innerHTML           = '';
      if (document.getElementById('popup_background')) document.getElementById('popup_background').style.display    = 'none';
   } else if (document.all) {
      document.all('popup_content').style.display                  = 'none';
      document.all('popup_content').innerHTML                      = '';
      if (document.all('popup_background')) {
         document.all('popup_background').style.display               = 'none';
         document.all('bluepage_body').style.overflowY                = 'scroll';
         document.all('bluepage').style.marginRight                   = '0';
      }
   }
}

function img_view(ds,lg,pf,inhId) {
   url = pf + './img_view.php?ds=' + ds + '&lg=' + lg + '&inhId=' + inhId;
   opt = 'location=no,scrollbars=auto,toolbar=no,resizable=yes,left=' + ((screen.availWidth-720)/2) + ',top=' + (((screen.availHeight-650)/2)-20) + ',width=665,height=650';
   galwindow = window.open(url,'_blank',opt);
   galwindow.moveTo(((screen.availWidth-720)/2),((screen.availHeight-650)/2)-20)
}


var http_request = false;

function makeRequest(typ,lg,pf,id,InhId) {
   if (typ == 'dormino') {
      var url = wwwUrl+'/incl/dormino.ajax.php?InhId='+InhId+'&lg='+lg+'&pfad='+pf+'&typ='+typ+'&zh='+Math.random();
   } else {
      var url = wwwUrl+'/incl/request.ajax.php?InhId='+InhId+'&id='+id+'&lg='+lg+'&pfad='+pf+'&typ='+typ+'&zh='+Math.random();
   }
   http_request = false;
   http_request.responseText = '';
   if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
      if (http_request.overrideMimeType) {
         http_request.overrideMimeType('text/xml');
      }
   } else if (window.ActiveXObject) { // IE
      try {
         http_request = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
         try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (e) {}
      }
   }
   if (!http_request) {
      alert('Giving up :( Cannot create an XMLHTTP instance');
      return false;
   }
   http_request.onreadystatechange = requestContents;
   http_request.open('GET', url, true);
   http_request.send(null);
}

function requestContents() {
   if (http_request.readyState == 4) {
      if (http_request.status == 200) {
         
         if (http_request.getResponseHeader("Content-Type").substr(0,9) == 'text/html') {
            document.getElementById('popup_content').innerHTML = http_request.responseText;
         } else {
            var xmldoc = http_request.responseXML;
            var r_typ = xmldoc.getElementsByTagName('typ').item(0).firstChild.data;
            if (r_typ == 'gal')         { // Galerie
               var r_html = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = r_html;                                   
            } else if (r_typ == 'pgal')         { // Produkt-Galerie
               var r_html = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = r_html;
            } else if (r_typ == 'dormino')         { // Dormino - Gastgeber
               var r_html = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = r_html;
             //  parent.dorminog.document.getElementById('body').style.width = '560px';
            } else if (r_typ == 'fgal') { // FTP-Galerie
               var r_html = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = r_html;
            } else if (r_typ == 'vk_gal') { // Veranstaltungskalender
               var r_html = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = r_html;
            } else if (r_typ == 'flv' || r_typ == 'vk_flv' || r_typ == 'youtube')  { // Flashmovie
               var flv_html       = xmldoc.getElementsByTagName('htmlcode').item(0).firstChild.data;
               var flv_file       = xmldoc.getElementsByTagName('file').item(0).firstChild.data;
               var flv_player     = xmldoc.getElementsByTagName('player').item(0).firstChild.data;
               var flv_img        = xmldoc.getElementsByTagName('img').item(0).firstChild.data;
               var flv_win        = xmldoc.getElementsByTagName('win').item(0).firstChild.data;
               var flv_w          = xmldoc.getElementsByTagName('width').item(0).firstChild.data;
               var flv_h          = xmldoc.getElementsByTagName('height').item(0).firstChild.data;
               var flv_auto       = xmldoc.getElementsByTagName('autostart').item(0).firstChild.data;
               var flv_repeat     = xmldoc.getElementsByTagName('repeat').item(0).firstChild.data;
               var flv_controlbar = xmldoc.getElementsByTagName('controlbar').item(0).firstChild.data;
               var flv_stretching = xmldoc.getElementsByTagName('stretching').item(0).firstChild.data;
               document.getElementById('popup_content').innerHTML = flv_html;

               var flashvars = {};
                  flashvars.backcolor = "0x000000";
                  flashvars.frontcolor = "0xDEE1DF";
                  flashvars.lightcolor = "0xC7CCC9";
                  flashvars.midroll = "0";
                  flashvars.overstretch = "true";
                  flashvars.smoothing = "true";
                  if (flv_auto) flashvars.autostart = flv_auto;
                  flashvars.volume = "100";
                  if (flv_stretching) flashvars.stretching = flv_stretching;
                  flashvars.width = flv_w;
                  flashvars.height = flv_h;
                  if (flv_controlbar) flashvars.controlbar = flv_controlbar;
                  if (flv_repeat) flashvars.repeat = flv_repeat;
                  if (flv_img) flashvars.image = flv_img;
                  if (r_typ == 'youtube') flashvars.type = "youtube";
                  flashvars.file = flv_file;
                  //flashvars.skin = "incl/Kleur.swf"
               var params = {};
                  params.scale = "noscale";
                  params.salign = "TL";
                  params.quality = "high";
                  params.menu = "false";
                  params.wmode = "transparent";
                  params.allowfullscreen = "true";
                  params.allowscriptaccess = "always";
               var attributes = {};
               swfobject.embedSWF("incl/"+flv_player,flv_win,flv_w,flv_h, "8.0.0","incl/expressInstall.swf", flashvars, params, attributes);
            }
         }
      } else {
         //makeRequest(typ,lg,pf,id,InhId);
         location.reload();
         //alert('Bei dem Request ist ein Problem aufgetreten.');
      }
   }
}

function hover_li(sel,w,h) {
   if (h == 'H') classZusatz = ' li_sitenav_h'; else classZusatz = '';
   if (w == true) {
      sel.parentNode.parentNode.className = 'li_sitenav2' + classZusatz;
   } else {
      sel.parentNode.parentNode.className = 'li_sitenav' + classZusatz;
   }
}

function addbookmark() {   // IE
   if (document.all && navigator.userAgent.indexOf('Opera') <= -1) {
      var bookmarkurl   = document.URL
      var bookmarktitle = document.title;
      window.external.AddFavorite(bookmarkurl,bookmarktitle)
   } else {
      alert("Dieser Link funktioniert nur bei Benutzern des Internet-Explorers.\n\nBenutzen Sie bitte die Tastenkombination fÃ¼r\nNetscape/Mozilla:\t\tSTRG+D,\nOpera:\t\t\tSTRG+T.")
   }
}

function newhomepage(site) {   // IE
   if (document.all && navigator.userAgent.indexOf('Opera') <= -1) {
      site.style.behavior='url(#default#homepage)';
      site.setHomePage(location.href);
   } else {
      alert("Dieser Link funktioniert nur bei Benutzern des Internet-Explorers.\n\nBenutzen Sie bitte die Tastenkombination fÃ¼r\nNetscape/Mozilla:\t\tSTRG+D,\nOpera:\t\t\tSTRG+T.")
   }
}


function open_extern(url,att,w,h) {
   posh = parseFloat(((screen.availHeight-h)/2)-20);
   posw = parseFloat((screen.availWidth-w)/2);
   opt = att + ',left=' + posw + ',top=' + posh + ',width='+w+',height='+h;
   extWindow = window.open(url,'_blank',opt);
   extWindow.focus();
}


function frml_checked(box) {
   if (box[0].checked == true) {
      for(i=1;i<box.length; i++) box[i].checked = true;
   }
}

function pbnzFrml(tabId) {
   if (document.all) {
      linkObj = document.all['pbnzFrml_link_'+tabId];
      if (document.all('tab_'+tabId).style.display != 'block') {  //'Formular schließen';
         document.all('tab_'+tabId).style.display = 'block';
         if (document.all('divStatus_'+tabId)) document.all('divStatus_'+tabId).style.display = 'none';
         linkObj.style.display = 'none'; 
      } else {      //'Aktualisierung Kontodaten Link';
         document.all('tab_'+tabId).style.display = 'none';
         linkObj.style.display = 'inline'; 
      }
   } else if (document.getElementById) {
      linkObj = document.getElementById('pbnzFrml_link_'+tabId);
      if (document.getElementById('tab_'+tabId).style.display != 'block') { //'Formular schließen';
         document.getElementById('tab_'+tabId).style.display = 'block';
         if (document.getElementById('divStatus_'+tabId)) document.getElementById('divStatus_'+tabId).style.display = 'none';
         linkObj.style.display = 'none';          
      } else {  //'Aktualisierung Kontodaten Link';
         document.getElementById('tab_'+tabId).style.display = 'none';
         linkObj.style.display = 'inline'; 
      }
   }
  return false;
}
function ppwFrml(tabId) {
   if (document.all) {
      if (document.all['tab_'+tabId].style.display != 'none') {
         document.all['tab_login_'+tabId].style.display = 'block';
         document.all['tab_'+tabId].style.display = 'none';
      } else {
         document.all['tab_login_'+tabId].style.display = 'none';
         document.all['tab_'+tabId].style.display = 'block';
      }
      
   } else if (document.getElementById) {
      if (document.getElementById('tab_'+tabId).style.display != 'none') {
         document.getElementById('tab_login_'+tabId).style.display = 'table';
         document.getElementById('tab_'+tabId).style.display = 'none';
      } else {
         document.getElementById('tab_login_'+tabId).style.display = 'none';
         document.getElementById('tab_'+tabId).style.display = 'table';
      }
   }
   return false;
}

function printSite() {
  if (window.print != null) {
     window.print();
  } else {
     alert('<?php echo "Ihr Browser unterstützt keinen automatischen Ausdruck!\\nBitte benutzen Sie deshalb die Druckfunktion Ihres Browsers!"; ?>');
  }
}

function captchaReload(templ) {
   document.getElementById('cp_'+templ).src = wwwUrl + '/incl/captcha.php?t='+templ+'&new='+Math.random();
}


