/* DATEI: *.js */


/* Javascript Datei BLUEPAGE CMS 07 -2004 */
/* Copyright by ISS-Oberlausitz */
/* Author: T.Hojenski */

function flash_view() {
   url = './flash_modulsampler.php';
   opt = 'location=no,scrollbars=no,toolbar=no,resizable=no,left=' + ((screen.availWidth-760)/2) + ',top=' + (((screen.availHeight-600)/2)-20) + ',width=760,height=600';
   galwindow = window.open(url,'_blank',opt);
   galwindow.moveTo(((screen.availWidth-760)/2),((screen.availHeight-600)/2)-20)
}

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)
}
function NavViewOn(tdf,lg,obj,awhl,txt) {
   if (!tdf.src) {
      if(document.all) tdf = document.all(tdf);
      else if(document.getElementById) tdf = document.getElementById(tdf);
   }
   tdf.src = lg + '/menu/' + awhl + obj;
   window.status = txt;
   setTimeout("window.status=''",25000);
}

function Navchange(nimg,view){
   if (view == 'visible') {
      document.images['p'+nimg].src = document.images['p'+nimg].src.replace(/\/a\./,"\/b.");
   } else {
      document.images['p'+nimg].src = document.images['p'+nimg].src.replace(/\/b\./,"\/a.");
   }
}

function btnchange(obj,whl,zst){
   if(!obj.src) {
      if(document.all) obj = document.all(obj);
      else if(document.getElementById) obj = document.getElementById(obj);
   }
   if(zst == true)  obj.src = 'images/sys/' + whl + '2.gif';
   if(zst == false) obj.src = 'images/sys/' + whl + '.gif';
}

function setline(theRow,linecolor) {
   if (linecolor == '' || typeof(theRow.style) == 'undefined') {
      return false;
   }
   if (typeof(document.getElementsByTagName) != 'undefined') {
      var theCells = theRow.getElementsByTagName('td');
   } else if (typeof(theRow.cells) != 'undefined') {
      var theCells = theRow.cells;
   } else {
      return false;
   }
   var rowCellsCnt  = theCells.length;
//      theCells[0].style.backgroundColor = stopcolor;
   for (var c = 0; c < rowCellsCnt; c++) {
      theCells[c].style.backgroundColor = linecolor;
   }
   return true;
}

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 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 view_rpic(tid,zst) {
   if (zst == true) zst = 'visible';
   else             zst = 'hidden';
   
   if (document.all) {
      document.all('rpic2_'+tid).style.visibility =zst;
      document.all('rtxt_box_'+tid).style.visibility =zst;
   } else if (document.getElementById) {
      document.getElementById('rpic2_'+tid).style.visibility =zst;
      document.getElementById('rtxt_box_'+tid).style.visibility =zst;
   }
   zst = '';
}

function changeDate(days,id,set,frml) {
   var wDayArray     = document.forms[frml]['wDayArray['+id+']'].value;
   var wday = '';
   if (set == 0) {
      var getdstring = document.forms[frml]['frml['+id+'][2]'].value;
      var reg     = eval("/^ *("+wDayArray+")\, */");
      var dstring = getdstring.replace(reg,"");
      var tag     = parseInt(1*(dstring.substring(0,dstring.indexOf("."))),10);
      var monat   = parseInt(1*(dstring.substring((dstring.indexOf(".")+1),dstring.lastIndexOf("."))),10)-1;
      var jahr    = parseInt((dstring.substring((dstring.lastIndexOf(".")+1),dstring.length)),10);
   } else {
      var set     = parseInt(set);
      var tag     = parseInt(document.forms[frml]['frml['+id+']['+set+']'].value,10);
      var monat   = parseInt(document.forms[frml]['frml['+id+']['+(set+1)+']'].value,10) - 1;
      var jahr    = parseInt(document.forms[frml]['frml['+id+']['+(set+2)+']'].value,10);
   }

   if (jahr >= 0 && jahr <= 75)      { jahr = 2000 + jahr; }
   else if (jahr > 75 && jahr <= 99) { jahr = 1900 + jahr; }

   var timestamp = new Date(jahr, monat, tag);
   var msec      = timestamp.getTime();

   if (days == '+1')      { msec = msec + (24*60*60*1000); }
   else if (days == '-1') { msec = msec - (24*60*60*1000); }

   timestamp.setTime(msec);

   tag = timestamp.getDate();
   if (tag > 0 && tag < 10) { tag = "0"+tag; }

   monat = timestamp.getMonth() + 1;
   if (monat > 0 && monat < 10) { monat = "0"+monat; }

   jahr = "" + timestamp.getFullYear();
   jahr = jahr.substr(2,2);

   if (wDayArray != '-') {
      var datum = new Date(jahr,(monat-2),tag);
      wday = datum.getDay();
      wday = (wDayArray.substr(3*((1*wday%7)),2));
      wday = wday+", ";
   }
   if (set == 0) {
      document.forms[frml]['frml['+id+'][2]'].value = wday + tag + "." + monat + "." + jahr;
   } else {
      if (set != 5 && wDayArray != '-') document.forms[frml]['frml['+id+'][1]'].value = wday;
      document.forms[frml]['frml['+id+']['+set+']'].value     = tag;
      document.forms[frml]['frml['+id+']['+(set+1)+']'].value = monat;
      document.forms[frml]['frml['+id+']['+(set+2)+']'].value = jahr;
   }
}

function checkIntg (frmlelement) {
   var datelement = '';
   for (var Pos = 0; Pos < frmlelement.value.length; Pos++) {
      if (isNaN(frmlelement.value.charAt(Pos)) == false) {
         datelement += frmlelement.value.charAt(Pos);
      }
   }
   frmlelement.value = datelement;
   frmlelement.focus();
}
