block_zi=false;
retardin='';
retardout='';
chl=1;


function countback(wait,formname,inputname,startval) {

var uvar='undefined';
if (typeof startval==uvar) var startval=120;
//if (typeof cdv==uvar) var cdv=120;
if (typeof wait==uvar) var wait=1000;
if (typeof formname==uvar) var formname='infoline';
if (typeof inputname==uvar) var inputname='inputtext';

var eva='var mycount=document.forms[\"' + formname+ '\"].' + inputname;
eval(eva);
cdv=parseInt(cdv,10)-1;
if(cdv<1) {
   cdv=startval;
   document.location.reload();
   }
var cmins=Math.floor(cdv/60);
var csecs=cdv%60;
csecs=(csecs<10) ? '0' + csecs : csecs;
mycount.value=cmins + ':' + csecs;
var timer = setTimeout('countback(' + wait + ',' + '\"' + formname + '\"' + ',' + '\"' + inputname + '\"' + ',' + startval + ')',wait);

return timer;

}



function reverse(probe) {

var r_probe="";
var l_probe = probe.length;
for (ii=l_probe; ii>0 ;ii--)
   {
   r_probe=r_probe + probe.substring(ii-1,ii);

   }

   return r_probe;
}


function whichbrowser(tellme) {

var br_tcode = 10;
var br_vcode = 0;
var br_string = navigator.appName;
var br_vers = navigator.appVersion;
var br_info = br_string + ' ' + br_vers;

switch (br_string) {

   case "Microsoft Internet Explorer" :
     br_tcode = 10;
     br_vers=parseInt(br_vers.substring(0,1));

     break;

   case "Mozilla" :
     br_tcode = 20;
     break;

   case "Netscape" :
      br_tcode = 30;
      break;

   case "Opera" :
     br_tcode = 40;
     break;

}
br_tcode=parseInt(br_tcode,10) + parseInt(br_vers,10);

var br_code = br_tcode + br_vcode;


return br_code + '|' + br_info;
}


function zoom_img(img_id,from_width,to_width,stepint) {

if (typeof stepint=='undefined') {
   stepint=2
   }

var el=img_id;

from_width=parseInt(from_width,10);
to_width=parseInt(to_width,10);
stepint=parseInt(stepint,10);

if (from_width<to_width)
   {
    var inout='+';
    }
else {
    var inout='-';

}
switch (inout) {
   case "+": {

      zoom_in_img(el,to_width,stepint);
     break;
    }

   case "-": {
       zoom_out_img(el,to_width,stepint);
     break;
    }

  }
}

function zoom_in_img(id_name,to_width,to_step) {


to_step=parseInt(to_step,10);
to_width=parseInt(to_width,10);

if (block_zi==false) window.clearTimeout(retardout);

if (typeof to_step=='undefined') {
   var to_step=2;
   }
   var el=fetch_Element(id_name);
   var iw=el.width;
   if (iw<(to_width - to_step)) {
     el.style.width = iw + to_step;
//     window.status=(iw + '-->' + to_width + ' int: ' + to_step + '   ' + chl);
     retardin = window.setTimeout("zoom_in_img('" + id_name + "','" + to_width  + "','" + to_step + "')",5);
     }
   else  {
   el.style.width = to_width;
   window.clearTimeout(retardin);
   }
}



function zoom_out_img(id_name,to_width,to_step) {

to_step=parseInt(to_step,10);

window.clearTimeout(retardin);
   block_zi=true;

if (typeof to_step=='undefined') {
   var to_step=2;
   }
   var el=fetch_Element(id_name);
   var iw=el.width;
   if (iw>to_width && iw>to_step)  {
     el.style.width = iw - to_step;
     retardout = window.setTimeout("zoom_out_img('" + id_name + "','" + to_width  + "','" + to_step + "')",2);
       }

   else {
   el.style.width = to_width;
   block_zi=false;
   window.clearTimeout(retardout);
   return;
  }
}

function timeroff() {

   window.clearTimeout(retardin);
   window.clearTimeout(retardout);

}

function set_img(img_id,img_src) {
document.images[img_id].src = img_src;

}

function swap_img(img_name,img_path,new_src,new_src_suffix,new_width) {
if (new_src_suffix=='') {
   new_src_suffix='JPG'
   }
if (new_width<10) {
   new_width=80;
   }
document.images[img_name].src = img_path + new_src + "." + new_src_suffix;
document.images[img_name].width = new_width;

}


function img_flip (img_id,img_txt,img_max,diroff) {

var img_label="Bild ";
if(typeof diroff=="undefined") var diroff="";
flip_offset++;
if(flip_offset>=img_max) flip_offset=0;
var pi_new_src=fotosrc[flip_offset];
var pi_alttext=fototxt[flip_offset];
document.images[img_id].src = diroff + pi_new_src;
if(document.images[img_id].height<20) {
   var pi_new_src=diroff + pi_new_src;
   document.images[img_id].src = pi_new_src;
   }

document.images[img_id].alt = pi_alttext;
document.forms[0].titeltext.value=pi_alttext;
}


function img_shift(img_id,img_max,inv_max) {

if (typeof inv_max=='undefined') {
    var inv_max = img_max }

var pp=1;
var pp_seq = 2;
while (document.images[img_id+pp]) {
//Sichern des ersten Labels
  if (pp==1) {
    var sav_alt=document.images[img_id+pp].alt;
  }
  var pi_src=document.images[img_id+pp].src;
//alert(img_id + pp + '=' + pi_src);
  var pi_l=pi_src.length;
  var p_pi_suf = pi_src.search(/\.\w\w\w\b/);
//alert(p_pi_suf);
  var pi_suf = pi_src.substring(p_pi_suf,pi_l);
  var pi_count=parseInt(pi_src.substring(p_pi_suf-2,p_pi_suf),10);
  pi_src=pi_src.substring(0,p_pi_suf-2);
  pi_count=pi_count+1;
  if (pi_count>inv_max) {
     pi_count=pi_count-inv_max;
     }

  pi_count=adjust(pi_count,2);
  pi_new_src=pi_src+ pi_count + pi_suf;
  if(!document.images[img_id+pp_seq]) {
     pp_seq=1;
     pi_alttext = sav_alt;
     }
   else {
  var pi_alttext=document.images[img_id + pp_seq].alt;
     }
//  alert(pp + ') ' + pi_new_src + '  alternativ-Text: ' + pi_alttext);
  document.images[img_id+ pp].src = pi_new_src;
  document.images[img_id+ pp].alt = pi_alttext;

  pp=pp+1;
  pp_seq = pp_seq + 1;
  }


}


function dynfullsize(img_id_src,img_id_targ,fs_label,imgsize) {

if (typeof imgsize=='undefined') {
   imgsize=100 }


var thumb = document.images[img_id_src].src
var thumb_l=thumb.length;
//Position des Suffix mit drei Zeichen und einleitendem Trennzeichen [.] bestimmten
var p_thumb_suf = thumb.search(/\.\w\w\w\b/);
//alert(p_thumb_suf);
var thumb_suf = thumb.substring(p_thumb_suf,thumb_l);
//Falls möglich, Numerierung speichern
var pi_count=parseInt(thumb.substring(p_thumb_suf-2,p_thumb_suf),10);
//Suffix abtrennen, nur Namen der Datei speichern
var thumbn=thumb.substring(0,p_thumb_suf);
//Einflechten des Etiketts für 'Fullsize'-Bilder in den Dateinamen des Thumbnails
fullimg=thumbn + fs_label + thumb_suf;
//alert(fullimg);
document.images[img_id_targ].src = fullimg
document.images[img_id_targ].width = imgsize

}

function fullsize(img_src,img_path,img_suffix,x_wi,y_wi,img_text,log_categ) {

var ud="undefined";

if(typeof img_text == ud) var img_text = 'Vollansicht von / Full size view of : ' + img_src;
if(typeof img_categ == ud) var log_categ = "FW_" + img_src;

//Schalter zwischen expliziter Pfadangabe oder dynamischer Src via <img id>-Tag

var flagsrc = img_src.substring(0,1);
if (flagsrc == '^') {
   var img_id = img_src.substring(1,img_src.length);
   var img_src = document.images[img_id].src;
   }

if (typeof x_wi == ud) {
    x_wi = 680;
    }

var x_iwi = x_wi - Math.floor(x_wi / 10);
if (y_wi<10) {
   y_wi = Math.floor(x_wi * 3/4);
   }

y_wi=y_wi+20;

if (img_suffix) {
   img_suffix= '.' + img_suffix;
   }

var fwname='fullview.php';
var phpcode="require '../php/iptools.php';\n";
var phpcode=phpcode + "whoisit('FVW');\n"

fullwin = window.open(fwname,'FullSizeView','menu=no, scrollbars=yes,toolbar=no,resizable=yes,dependent=no;left=0,width=' + x_wi + ', height=' + y_wi );
fullwin.document.open();

fullwin.document.writeln('<HTML>');
fullwin.document.writeln('<HEAD>');
fullwin.document.writeln('<TITLE>');
fullwin.document.writeln('Vollansicht von / Full size view of : ' + img_src);
fullwin.document.writeln('</TITLE>');
fullwin.document.writeln('</HEAD>');
fullwin.document.writeln('<?php');
fullwin.document.writeln(phpcode);
fullwin.document.writeln('?>');


fullwin.document.writeln('<BODY>');

fullwin.document.writeln('<CENTER>');
fullwin.document.writeln('<p>');
fullwin.document.writeln(img_text);
fullwin.document.writeln('</p>');
fullwin.document.writeln('</CENTER>');
fullwin.document.writeln('<DIV id="fullview" style="filter:Alpha (opacity=100,finishopacitiy=90,style=2);position:relative;top:10px;border:solid 0px">');

fullwin.document.writeln('<CENTER>');
fullwin.document.writeln('<img name="myimage" src="' + img_path + img_src + img_suffix + '" width="' + x_iwi + '">');

fullwin.document.writeln('</BODY>');
fullwin.document.writeln('</CENTER>');
fullwin.document.writeln('</DIV>');
fullwin.document.writeln('</HTML>');
fullwin.document.close();
fullwin.focus();

}

function slideshow(img_form,img_name,img_manual,img_vector,off_max,h_max) {

var eol=String.fromCharCode(13) + String.fromCharCode(10);
var uvar='undefined';


if (!h_max) {
    h_max=960;
    }

if (typeof off_max==uvar) var off_max=1024;
var basename=img_name;
var new_imgsrc = "";
var img_offset = 0;

var img_step = img_vector.substring(1,img_vector.length);
var img_direct = img_vector.substring(0,1);
var choose_img = img_name + '_1';

switch(img_direct)
 {
  case "+" : {

    img_step = parseInt(img_step,10)
    break;
    }
  case "-" : {
    img_step = -1 * parseInt(img_step,10)
    break;
    }

  case "#" : {
    img_offset = img_step;
    if (img_step=="U") {

       eval("var uform = document.forms[\"" + img_form + "\"].[\"" + img_manual + "\".value");
       img_offset = parseInt(uform);
       img_step = img_offset;
    }
    break;
    }
}

eval("fullname=document.images[\"" + img_name + "\"].src");
fullname=reverse(fullname);
base_suffix=fullname.search(/\./);
base_file=fullname.search(/[/]/);
l_full=fullname.length;
img_suffix=reverse(fullname.substring(0,base_suffix));
basename=fullname.substring(base_file,base_suffix+1);
basepath=fullname.substring(base_file,l_full);
basepath=reverse(basepath);
basename=reverse(basename);
base_len = basename.length;
base_number=basename.search(/[0-9]/);

if (base_number==-1) {
   basename=basename + "0";
   base_len = basename.length;
   base_number = basename.search(/[0-9]/);
   }

off_count = basename.substring(base_number,base_len);
off_count = parseInt(off_count,10) + img_step;

if (off_count<1) {
   off_count = 1;
   }


if (off_count>off_max) {
   off_count=1;
   }

if (img_offset>0) {
   off_count = img_step;
   }


//off_count=adjust(off_count,3,"r","0");
var eva="document.forms[\"" + img_form +"\"]." + img_manual +".value = \"" + off_count + " / " + adjust(off_max,3,"r","0") + "\"";
eval(eva);

basename=basename.substring(0,base_number) + off_count;
new_imgsrc=basepath + basename + "." + img_suffix;
//alert("Aktuelles Bildquelle: " + eol + new_imgsrc);
document.images[img_name].src = new_imgsrc;
document.forms[choose_img].which_img.value='';

}


function img_browser(img_start,img_end,gal_frame,img_path,img_base,img_dest,screen,rel_path,credits,u_descriptor,u_date,is_indoc) {

if (!rel_path) {
   var rel_path=''
   }
var infotext = 'Mauszeiger über dem Bild vergrößert die Ansicht, Einfach-Click zeigt Vollbild<br>MouseOver zooms,Click shows fullsize view';
var eol = String.fromCharCode(10) + String.fromCharCode(13);
var squot = String.fromCharCode(39);
var lii_max = img_end;
var z_step_in = 24;
var z_step_out=36;
var lii_from = img_start;
var label='Anlage_';
var id_label = 'i';
var l_item = '';
var n_item = '';
var img_bord=0;
var hueck = new Date();
var g_day = hueck.getDate();
var g_mon = hueck.getMonth()+1;
var g_year = hueck.getYear();
if (g_year <999) {
g_year += 1900;
}
var g_hour = hueck.getHours();
var g_min = hueck.getMinutes();
var g_sec = hueck.getSeconds();
var i_suffix="jpg";
var i_suffixC = "JPG";
var hbr = '<BR>';
var t_open='<TD>';
var t_close = '</TD>';
var a_open = '<a';
var a_close = '</a>';
var cellpad=1;
var cellspace=1;
var cellbord=1;
var yourbrowser = whichbrowser('jepp');
var mybr_code = parseInt(yourbrowser.substring(0,2));
//alert(mybr_code);
var yourbrowser = yourbrowser.substring(3,yourbrowser.length);

if (!is_indoc) {

  document.open();
//  dcoument.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN>"');
  document.writeln('<HTML>');
  document.writeln('<HEAD>');
  document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
  document.writeln('<meta name="language" content="deutsch, de">');
  document.writeln('<TITLE>Automatisch erstellte Bildergallerie vom ' + g_day + '.' + g_mon + '.' + g_year + ' um ' +  adjust(g_hour,2) + ':' + adjust(g_min,2) + '  ');
  document.writeln(' - Eingestellt von / Uploaded by:&nbsp;');
  document.write(credits);
  document.writeln('</title>');
  document.writeln('<script src="' + rel_path + 'javascript/cycles.js" type="text/javascript"></script>');
  document.writeln('<script src="' + rel_path + 'javascript/globals.js" type="text/javascript"></script>');

  document.writeln('<link rel="stylesheet" media="all" href="../styles/screen.css">')
  document.writeln('</HEAD>');

  document.writeln('<BODY>');
}
  document.writeln('<script language="JavaScript">');
  document.writeln('is_w3c = (document.getElementById)  ? true : false');
  document.writeln('is_ie4 = (document.all && !is_w3c) ? true : false');
  document.writeln('is_ie5 = (document.all &&  is_w3c) ? true : false');
  document.writeln('is_ns4 = (document.layers) ? true : false');
  document.writeln('</script>');
  document.writeln('<CENTER><FONT size=-5>' + yourbrowser + '</font></CENTER><br>');
  document.writeln('<h2>' + infotext  + '</h2>');
  document.writeln('<hr>' + eol);
  document.writeln('<TABLE' +' width="' + screen + '" ' + 'cellpadding="' + cellpad + '" cellspacing="' + cellspace + '" border="' + cellbord + '">' + eol);
  document.writeln('<TR>');
  document.writeln('<TD colspan="' + gal_frame + '">');
  document.writeln('<H3>');
  document.writeln('Dokument-Typ:&nbsp;' + u_descriptor);
  document.writeln('<BR>');
  document.writeln('Datum:&nbsp;&nbsp;' + u_date);
  document.writeln('</H3>');
  document.writeln('</TD>');
  document.writeln('</H3>');
  document.writeln('</TR>');

  var gal_dx = gal_frame;
  var gal_dy = (Math.floor(lii_max / gal_frame))+1;
  var td_rest = lii_max % gal_frame;
//  alert(lii_max + '/' + gal_frame + ' -> ' + td_rest);
  var twi = (Math.floor(screen / gal_frame))+ 1;
//Maximale Zoom-Groesse errechnen
  var x_max = Math.floor(screen/gal_dx) - (gal_dx * (cellspace + cellpad)) - cellbord*2;
  var y_max = Math.floor(screen/gal_dx * 4/3);
  var x_thumb=120;
  var z_to = x_max;
  var z_from = x_thumb;

  var thi = y_max + cellpad*2 + cellspace*2 + cellbord + 30;
  var t_hal = 'center';
  var t_val = 'top';


  for (lii=lii_from;lii<=lii_max;lii++) {
  var i_line = (lii-1)%gal_dx;

  if (i_line==0 & lii>1 ) {
      document.write('</TR>' + eol);
      document.writeln('<TR>');
      }


  l_item = adjust(lii,3);
  n_item = adjust(lii,3);

  var i_anker='<a name="' + label + l_item + '"></a>';
  var i_src = '<img id="' + id_label + l_item + '" border="' + img_bord + '" src="' + img_path + img_base + l_item + '.' + i_suffix + '" ' + ' width="' + x_thumb + '">';
  var i_java = 'onMouseOver=swap_img("' +  id_label + n_item + '","' + img_path + '","' + img_dest + n_item + '","' + i_suffixC + '","' + x_max   + '")';
  var i_java2 = 'onMouseOut=swap_img("' +  id_label + n_item + '","' + img_path + '","' + img_base + n_item + '","' + i_suffix  + '","' + x_thumb + '")';
  var i_java3 = 'onMouseOver=zoom_img("' + id_label + n_item + '","' + z_from + '","' + z_to + '","' + z_step_in + '")';
  var i_java4 =  'onMouseOut=zoom_img("' + id_label + n_item + '","' + z_to + '","' + z_from + '","' + z_step_out + '")';
  var i_java5 = 'onClick=timeroff();fullsize("' + img_dest + l_item + '","' + img_path + '","' + i_suffix + '","' + screen + '","' +  '")';
  var i_text = label + l_item;
  var i_targ = '#' + label + l_item;
  var a_href ='javascript:fullsize(' + squot + img_dest + l_item + squot + ',' + squot + img_path + squot +',' + squot + i_suffix + squot + ',' + squot + screen + squot +  ')';
  var a_targ = 'fullview.html';
//  document.write(i_anker + eol);
  document.writeln('<TD nowrap ' + ' width="' + twi + '"' + ' height="' + thi + '" align="' + t_hal + '" valign="' + t_val  + '">');
  document.writeln(i_text + hbr + eol);
  document.writeln(a_open + ' href="' + a_href + '" ' + i_java4 + ' ' + i_java3  + '>');
  document.writeln(i_src + a_close + t_close + eol);


  }
  if (td_rest>0) {
    for (lii=td_rest;lii<gal_frame;lii++) {
      document.write('<TD>&nbsp;</TD>');
     }
  }
  document.writeln('</TR>');
  document.writeln('</TABLE>');

if (!is_indoc)

  document.writeln('</BODY>');
  document.writeln('</HTML>');
  document.close();
  }


function adjust(a_probe,a_cols,a_align,a_item) {

var fills="000000000";
var newval=a_probe;

s_probe=a_probe+"";

var lenval=s_probe.length;
newval=fills.substring(0,a_cols-lenval) + a_probe;

return newval;

}


function user_cal(cal_path) {
var u_year=document.forms.choose_year.choose_year.value;
u_year=parseInt(u_year,10);
if (u_year<1900) {
   u_year=1900;
   }

make_cal_explicit(1,12,u_year,cal_path);

}


function make_cal_triplet(cal_path,go_year,go_mon,view_mode) {

var go_hueck = new Date();
var go_day = go_hueck.getDate();
if (!go_mon) {
   var go_mon = go_hueck.getMonth()+1;
   }
if (!go_year) {
   var go_year = go_hueck.getYear();
   }

var previous = go_mon - 1;
var next = go_mon + 1;

if (!view_mode) {
   view_mode=1
   }

make_cal_explicit(previous,next,go_year,cal_path,view_mode);

}

function make_cal_explicit(go_mon,end_mon,go_year,cal_path,view_mode) {

//alert('Anzeige-Modus: ' + view_mode);

if (typeof view_mode=="undefined") {
   var view_mode=3 }

var go_hueck = new Date();
if (!go_mon) {
  var go_mon = go_hueck.getMonth()+1;
  }


if (!go_year) {
  var go_year = go_hueck.getYear();
}


if (!cal_path) {
  cal_path='cals/';
}


if (view_mode>1) {
   document.writeln('<TABLE border="1" cellpadding="0">');
   document.writeln('<TR valign="top">');
   }


var cc=0;
var go_start = go_mon;
var go_to = end_mon;
  if (go_mon>end_mon) {
    make_cal(cal_path,go_mon,(go_year-1));
    go_start=1;
    }

  if (end_mon<go_mon) {
    go_to=12+go_mon;
    }

for (cc=go_start;cc<=go_to;cc++) {
  if (view_mode>1) {
     document.writeln('<TD width="280" valign="top">');
     }
     if (cc>12) {
        go_mon=cc-12;
        go_year=go_year+1;
        }
     else {
        go_mon = cc
        }
     make_cal(cal_path,go_mon,go_year);

  if (view_mode>1) {
     document.writeln('</TD>');
     }
  }

if (view_mode>1) {
   document.writeln('</TR>');
   document.writeln('</TABLE>');
   }

}

function make_cal(cal_path,go_mon,go_year) {



var go_hueck = new Date();
var go_day = go_hueck.getDate();
var go_doy = go_hueck.getDay();
if (!go_mon) {
  var go_mon = go_hueck.getMonth()+1;
  }


if (!go_year) {
  var go_year = go_hueck.getYear();
}

var go_hour = go_hueck.getHours();
var go_min = go_hueck.getMinutes();
var go_sec = go_hueck.getSeconds();

if (!cal_path) {
cal_path=''
}
else {

var calimg_base = 'monimg_'
var calimg_suffix = "jpg";
var calimg = cal_path + calimg_base + adjust(go_mon,2) + '.' + calimg_suffix;
}

if (go_year<999) {
   go_year += 1900
   }
// alert(go_year + ' ' + go_mon);

var specials = user_list().split("|");
var free_days ='1.1.|1.5.|3.10.|1.11.|25.12.|26.12.|'
var easter_date = get_easter(go_year);
var easter_sun = easter_day;
var edp = easter_date.search(/\./);
var easter_day = easter_date.substring(0,edp);
var easter_mon = easter_date.substring(edp + 1,(easter_date.length)-1);
var easter_doy = tell_doy(go_year,easter_mon,easter_day)
//alert('Ostern: ' + go_year + ':' + easter_mon + ':' + easter_day  + ' = ' + easter_doy);
var easter_fr = doy_to_date(go_year,easter_doy-2);
var easter_mo = doy_to_date(go_year,easter_doy+1);
var pente_mo = doy_to_date(go_year,easter_doy+50);
var christ_beamup = doy_to_date(go_year,easter_doy+40);
//alert('Karfreitag: ' + easter_fr);
//alert('Pfingsten: ' + pente_mo);

free_days = free_days + easter_fr + '|' + easter_mo + '|' + christ_beamup + '|' + pente_mo + '|'
var no_workday = free_days.split("|");

var day_free='';
var day_special='';


   var ii = 0;
   while ((no_workday[ii])) {
//   alert(dom + ' ' + ii + ') ' + no_workday[ii]);

       var pos_month=no_workday[ii].search(/\./) + 1
       var match_month=no_workday[ii].substring(pos_month,no_workday[ii].length);
       if(parseInt(match_month)==go_mon) {
          day_free=day_free + no_workday[ii].substring(0,pos_month-1) + '/';

          }
	ii = ii + 1;
       }

var ii=0
   while((specials[ii])) {
       var pos_month=specials[ii].search(/\./) + 1;
       var pos_info=specials[ii].search(/[:;,]/) + 1;
       var match_month=specials[ii].substring(pos_month,pos_info);
       if(parseInt(match_month)==go_mon) {

       var day_special=day_special + specials[ii].substring(0,pos_month-1) +  ':' +  specials[ii].substring(pos_info,specials[ii].length) + '/';
//       alert(day_special);
       }
       ii=ii+1;

}


calmonth(go_mon,go_year,go_day,go_doy,1,1,1,calimg,day_free,day_special)



}

function calmonth(month_is,year_is,today_is,dow_is,b_attr,s_attr,p_attr,cal_image,list_free,list_special) {
if (month_is < 0) {
   month_is = 0;
   }

var iwi=200;
var squot = String.fromCharCode(39);
var now_is = new Date();
var now_month = now_is.getMonth() + 1;
var is_free=list_free.split("/");
var is_special=list_special.split("/");
var l_week = 7;
var dom_work = '000000';
var dom_free = 'E10000';
var bg_shade = 'EFEFEF';
var bg_today = '9FCFFF';
var bg_standard = 'FFFFFF';
var dom_back = 'FFFFFF';
var dom_status = dom_work;
var mo_names = new Array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
var mo_length = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var we_days_de = new Array('Woche','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag');
var cal_label = new Array(8);
var probe_nowork = '';

for (ii=0;ii<=7;ii++) {
  cal_label[ii] = we_days_de[ii];
  }
//Schalt-Tag im Februar berücksichtigen
  mo_length[1]=mo_length[1] + is_leap(year_is);
var doys = new Array();
var cal_week = 1;
doys[0] = 0;
for (ii=1;ii<=12;ii++) {
doys[ii] = doys[ii - 1] + mo_length[ii - 1];
}
var footer_txt='<h5>' + 'CalenderTool JavaScripted by<br>Frank Scheerer 2006' + '</h5>';
   if (now_month==month_is) {
   showup=true }
   else {
   showup=false;

   }
var month_name = mo_names[month_is - 1];
document.writeln('<TABLE cols="8" border="' + b_attr + " cellspacing=" + s_attr + '" cellpadding="' + p_attr +'">');
document.writeln('<TR>');
document.writeln('<TD align="center" valign="center" colspan="8">');
document.writeln('<h3>' + month_name + ' ' + year_is + '</h3>');
document.writeln('</TD>');
document.writeln('</TR>');
if (!cal_image || cal_image=='')
{
}
else
{
   document.writeln('<TR>');
   document.writeln('<TD colspan="8" align="center">');
   document.writeln('<img name="cal_motiv" src="' + cal_image + '" width="' + iwi + '"' + 'onClick=fullsize(' +squot + '^cal_motiv' + squot +',' + squot +  squot +',' + squot + squot + ',' + squot + '800' + squot + ')'+'>')
   document.writeln('</TD>');
   document.writeln('</TR>');
}
document.writeln('<TR>');

for (ii=0;ii<=7;ii++) {
document.write('<TD width="25">');
document.write(cal_label[ii].substring(0,2));
document.write('</TD>');
}
document.writeln('</TR>');
document.writeln('<TR>');

var dow_first=doweek(year_is,month_is,'01');
var dow_last =doweek(year_is,month_is,mo_length[month_is - 1]);
//alert(dow_first + '|' + dow_last);
cal_week=Math.floor((doys[month_is - 1] + 1)/l_week) + 1;
document.write('<TD>' + cal_week + '</TD>');
// Nicht belegte Felder "ausgrauen"

for (ii=1;ii<=dow_first;ii++) {
document.writeln('<TD bgcolor="' + bg_shade + '"');
document.writeln('>');
document.writeln('</TD>');
}
var dom=0;
//Kalendertage generieren
for (dom=1;dom<=mo_length[month_is - 1];dom++) {

var cal_day = dom + dow_first;

// Zeilenumbruch nach Wochenende
if ((cal_day - 1)%l_week == 0) {
   if (dom>1) {
//   alert(dom + ' ' + (cal_day - 1));
     document.writeln('<TR>');
     document.writeln('<TD width="30">');
     cal_week=Math.floor((doys[month_is - 1] + dom)/l_week) + 1;
     document.writeln(cal_week);
     document.writeln('</TD>');
   }
   }
//Sonntage rot
   if ((dom + dow_first)%l_week == 0) {
   dom_status = dom_free;
   }
else
   {
   probe_nowork = parseInt(dom,10);
   dom_status = dom_work;
   var ii = 0;
   while ((is_free[ii])) {
//   alert(dom + ' ' + ii + ') ' + is_free[ii]);

       if(probe_nowork==is_free[ii]) {
          dom_status=dom_free;
          }
	ii = ii + 1;
       }
}


//Aktuellen Tag markieren
if (dom==today_is & month_is==now_month) {
dom_back=bg_today;
}
else
  {
  dom_back=bg_standard;
  }

document.write('<TD')
document.write(' bgcolor="#' + dom_back +'"');
document.write('>');
document.write('<font color="#' + dom_status + '">');
document.writeln(dom);
document.writeln('</FONT>');
document.writeln('</TD>');
}



//alert(dom + ' ' + mo_length[month_is - 1]);
if ((cal_day - 1 )%l_week == 0 & (dom<mo_length[month_is - 1])) {
  document.writeln('</TR>');
  }

//Rest ausgrauen

for (ii=dow_last + 1;ii<l_week;ii++) {
document.writeln('<TD bgcolor="' + bg_shade + '"');
document.writeln('>');
document.writeln('</TD>');
}
//Cal-Tabelle fertig
document.writeln('</TR>');

//Zusatz-Infos in separate Zeilen


//Spezielle Daten abfragen und ausgeben (Geburtstage/Termine etc.)
if (list_special) {
   document.writeln('<TR>');
   document.writeln('<TD colspan="8" align="left">');
   document.writeln('<H5>');
   ii=0;
//   alert(list_special);
   while (is_special[ii]) {
     var pos_event=is_special[ii].search(/[:;]/);
     var day_special=is_special[ii].substring(0,pos_event);
     var day_event=is_special[ii].substring(pos_event+1,is_special[ii].length);
     document.write(day_special + '.' + day_event + '&nbsp;&nbsp;')
     ii=ii+1;;
   }
   document.writeln('</H5>');
   document.writeln('</TD>');

  document.writeln('</TR>');
}

   if (showup==true) {
     document.writeln('<TD align="center" valign="bottom" colspan="8">');
     document.writeln(footer_txt)
     document.writeln('</TD>');
     }

  document.writeln('</TABLE>');
}


function doweek(i_year,i_month,i_day) {

// alert(i_year + ' ' + i_month + ' ' + i_day);

var opv_year = parseInt(i_year,10);
var opv_month = parseInt(i_month,10);
var offset_leapm = opv_month;
var opv_day = parseInt(i_day,10);
var dow_numb = 0;

if (opv_month<3) {

  offset_leapm = 12+opv_month;
  opv_year = opv_year - 1;
  opv_day=opv_day-1;
}

var opv_4 = parseInt(((offset_leapm+1)*3)/5, 10);
var is_leap_each4 = parseInt(i_year/4,10);
var no_leap100 = parseInt(i_year/100,10);
var is_leap400 = parseInt(i_year/400,10);

var opv_stage1 = opv_day+(offset_leapm*2)+opv_4+opv_year+is_leap_each4-no_leap100+is_leap400+2;
var opv_stage2 = parseInt(opv_stage1/7, 10);
var dow_numb = opv_stage1-(opv_stage2*7);
// alert(dow_numb);
if (dow_numb>1) {
   dow_numb = dow_numb = dow_numb -2;
   }
else
   {
   dow_numb=6 - (1 - dow_numb);
   }
// alert(dow_numb);
return dow_numb;

}

function tell_doy(year_is,month_is,day_is) {



var mo_length = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var doys = new Array();
var cal_week = 1;
doys[0] = 0;
for (ii=1;ii<=12;ii++) {
doys[ii] = doys[ii - 1] + mo_length[ii - 1];
}

if (is_leap(year_is) == 1 ) {

doys[2] = 29;

}

//alert(month_is + ' ' + day_is + '=' + doys[month_is]);
var doy_is = parseInt(doys[month_is],10) + parseInt(day_is);

return doy_is;

}

function doy_to_date(year_is,what_doy) {

waht_doy=parseInt(what_doy);
var mo_length = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var doys = new Array();
var cal_week = 1;
doys[0] = 0;
for (ii=1;ii<=12;ii++) {
doys[ii] = doys[ii - 1] + mo_length[ii - 1];
}

if (is_leap(year_is) == 1 ) {
  doys[2] = 29;
  }

for (ii=1;ii<=12;ii++) {

  if (what_doy>doys[ii]) {
    var month_count=ii;
    var day_count = what_doy - doys[ii];
    }
}
  var date_is = day_count + '.' + month_count + '.';

//alert(what_doy + ': ' + date_is);
return date_is;

}

function countup(wait,formname,inputname) {

var uvar='undefined';

var now_time=new Date();
var elapsed=now_time - starttime;

var ehrs=Math.floor(elapsed/3600000,10);
var erest=elapsed-ehrs*3600000;
var emins=Math.floor(erest/60000,10);
var erest=erest-emins*60000;
var esecs=Math.round(erest/1000);
var eva='document.forms[\"' + formname + '\"].' + inputname + '.value=\"' + ehrs + ':' + emins + ':' + esecs + '\"';

eval(eva);

var timer=setTimeout('countup(' + wait + ',' + '"' + formname + '","' + inputname + '")',wait);

}


function countdown2 (year_to,month_to,day_to,hour_to,min_to,sec_to,use_form) {

var uvar="undefined";

var hueck = new Date();
var bis=new Date(year_to,month_to,day_to,hour_to,min_to,sec_to);
var duurt_noch = bis-hueck;
var duurt_daach=Math.floor(duurt_isecs/86400000);
var duurt_noch=duurt_noch%86400000;
var duurt_stund=Math.floor(duurt_noch/3600);
var duurt_noch=duurt_noch%3600;
var duurt_mins=Math.floor(duurt_noch/60);
var duurt_secs=Math.round(duurt_mins/60);

var et_duurt=duurt_daach + ":" + duurt_stund + ":" + duurt_mins + ":" + duurt_secs;

alert(et_duurt);

return et_duurt;
}


function countdown (year_to,month_to,day_to,hour_to,min_to,sec_to,use_form) {

var count_level=0;

if (hour_to || hour_to == 0) {
   count_level=1;
   }

if (min_to || min_to==0) {
   count_level=2;
   }

if (sec_to || sec_to == 0) {
   count_level=3;
   }

//alert(count_level + ' ' + hour_to + ':' + min_to + ':' + sec_to);
if (!sec_to) sec_to = 0;
if (!min_to) min_to=0;
if (!hour_to) hour_to=0;

var hueck = new Date();
var g_day = hueck.getDate();
var g_mon = hueck.getMonth()+1;
var g_year = hueck.getYear();
if (g_year <999) {
g_year += 1900
}
var g_hour = hueck.getHours();
var g_min = hueck.getMinutes();
var g_sec = hueck.getSeconds();

if (hour_to) {
   var sec_to = hour_to * 3600 + min_to * 60;
   var sec_now = g_hour * 3600 + g_min * 60 + g_sec;
   var sec_24h = 86400 - sec_now;
   var sec_frame = sec_24h + sec_to
   var sec_remain = sec_frame % 86400;
   var hour_dist = parseInt(sec_remain/3600,10);
   var min_dist = parseInt((sec_remain - (hour_dist*3600))/60);
   var sec_dist = parseInt((sec_remain - (hour_dist*3600)) - min_dist * 60);

}

var target_doy=tell_doy(year_to,month_to,day_to);

var year_offset = year_to - g_year;
if (year_offset > 0) {
   if (year_offset==1) {
      target_doy = target_doy + (365 + is_leap(g_year) - tell_doy(g_mon,g_day));
   }
   else

   {
   target_doy = 365 + is_leap(g_year) - tell_doy(g_mon,g_day);
   target_doy=target_doy + 365*year_offset;
   target_doy=target_doy + is_leap(year_to);

   }
}

var now_doy=tell_doy(g_year,g_mon,g_day);
var days_remain = target_doy - now_doy;
//if (sec_frame<=86400) {
//   days_remain -= 1;
//   }

//alert(count_level + '   ' + target_doy + '..>  ' + now_doy + '  =  ' + days_remain + '  ' + hour_dist +':' + min_dist + ':' + sec_dist);

var time_remain = days_remain;
if (count_level>0) {
   time_remain = time_remain + '  ' + adjust(hour_dist,2);
   }
if (count_level>1) {
   time_remain = time_remain + ':' + adjust(min_dist,2);
   }
if (count_level>2) {
   time_remain = time_remain + ':' + adjust(sec_dist,2);
}

if (use_form && use_form!='n') {

}

   return time_remain;

}

function is_leap(is_year) {

var leap4 = is_year%4;
var leap100 = is_year%100;
var leap400 = is_year%400;
var leapday = 0;

if (leap4==0) {
   if (leap100==0) {
      if (leap400==0) {
          leapday = 1;
          }
      else  {
          leapday=0;
          }
    }
   else {
       leapday=1;
   }
}
//alert(is_year + ' has ' + leapday);
return leapday;
}


function get_easter(which_yyyy) {

var easter = '';
var easter_offset=1990;
var easter_index=which_yyyy-easter_offset;
if (easter_index<0) {
   easter_index=0;
   }

var easter_list='15.4.|31.3.|19.4|11.4.|3.4.|16.4.|7.4.|30.3.|12.4.|4.4.|23.4.|15.4.|31.3.|20.4.|11.4.|27.3.|16.4.|8.4.|23.3.|12.4.|4.4.|24.4|8.4.|31.3.|20.4.|5.4.|27.3.|16.4|';

var easters=easter_list.split("|");
var easter_range = easters.length;
easter=easters[easter_index];
//alert(which_yyyy + '  ' + easter);


return easter;

}

function user_list() {

var spec_at= '';

return spec_at;

}
