//<html>
//<head><!-- PageID 1583 - generated by RedDot 5.0 - 5.0.1.33 - t-6Hd -->
//<title>special_voith_???_export_sys_js_voith_lib_en.js</title>
//<head>
//<body>

//<!-- template="con_901_js" title="special_voith_???_export_sys_js_voith_lib_en.js" ownID="1583" ownURL="/sys/js/voith_lib_en.js" -->
// Konstanten
   var satellitWidth=436;
   var satellitHeight=462; 
// Parameter fuer window.open
     arrSatParams = new Array();
     arrSatParams["newwindow"]     = "";          
     arrSatParams["sat_standard"]     = "width=436,height=462,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0 ";          
     arrSatParams["sat_wide"]         = "width=740,height=500,resizable=1,status=1,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0 ";
     arrSatParams["sat_wide_toolbar"] = "width=740,height=500,resizable=1,status=1,scrollbars=1,toolbar=1,location=0,directories=0,menubar=0 ";
     arrSatParams["sat_wide_menue"]   = "width=740,height=500,resizable=1,status=1,scrollbars=1,toolbar=0,location=0,directories=0,menubar=1 ";     
     arrSatParams["sat_size_510"]   = "width=510,height=420,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0 ";    
// Aufruf im C2, Links werden im Texteditor angelegt, 
// arrHandleLink[] wird in C2 definiert:
function handleLink( iLinkNum ) {
     
     iLinkNum = iLinkNum + "";
     
     // Open download file from docdb
     if( arrHandleLink[iLinkNum]["mode"] == "litdb_download") {
        if(openDocDbFile) {
            openDocDbFile(arrHandleLink[iLinkNum]["url"], ownID);
        }
     }else{
     
         // Open page in his window
         if( arrHandleLink[iLinkNum]["mode"] == "self" || arrHandleLink[iLinkNum]["mode"] == "" ) {
              self.location = arrHandleLink[iLinkNum]["url"];  
         }
       
         // Open page in popup window
         else {
              sParams = arrSatParams[ arrHandleLink[iLinkNum]["mode"] ];
              sUrl = arrHandleLink[iLinkNum]["url"];
              newwin = window.open( sUrl, "sat", sParams)               
              if(window.focus) newwin.focus();
         }
     
     }
     
}
function lib_zoom_click(sImageTag){
  SRC = "";
  src = "";
  WIDTH = 0;
  HEIGHT = 0;
  sImageTag = sImageTag.replace(/  /," ");
  sImageTag = sImageTag.substr(4,sImageTag.length-5);
  var arr = sImageTag.split(' ');
  for(i=0;i<arr.length;i++){
    if (arr[i] != ""){
      eval(arr[i]);
    }
  }
  if( arr[0]!="" ) SRC=arr[2];
  if (WIDTH  == 0 && arr[3]!="" )  {
        arr[3]=arr[3].substr(7,arr[3].length-2);
        WIDTH = parseInt(arr[3]);
  }
  if (HEIGHT == 0 && arr[4]!="") {
         arr[4]=arr[4].substr(8,arr[4].length-2);
        HEIGHT = parseInt(arr[4]);}
  if (WIDTH == 0) {WIDTH = 400;}
  if (HEIGHT == 0) {HEIGHT = 400;}
  WIDTH += 40;
  HEIGHT += 20;
  if (WIDTH>790) WIDTH=790;
  if (HEIGHT>580) HEIGHT=580;
  params = "width="+WIDTH+",height="+HEIGHT+
  ",resizable=1,status=0,toolbar=0,location=0,directories=0,menubar=1,scrollbars=1";
  //ns ist js casesesitiv bei ie nicht
  if (SRC != ""){
    newwin = window.open( SRC, "ZOOM" , params)
  } else if (src != ""){
    newwin = window.open( src, "ZOOM" , params)
  }
  
  if( window.focus ) newwin.focus();
}
//
function lib_zoom_flash_click(sImageTag, movienumber){
  if (movienumber) {
    loadAni("movie"+movienumber)
  } else {
    lib_zoom_click(sImageTag)
  }
}
// Satellit oeffnen
  function popup( myfile){
    winname = "PopUp"
    params = "width="+satellitWidth+",height="+satellitHeight+
                            ",resizable=0,status=0,toolbar=0,location=0,directories=0,menubar=0,scrollbars=1";
    if (myfile.substr(0,6) == "/http:"){
      myfile = myfile.substr(1);
    }
    newwin = window.open( myfile, winname , params)
    if (window.focus) newwin.focus();
  }
// Satellit fuer Wegbeschreibung oeffnen
  function routing(myfile){
    winname = "routing"
    params = "width=600,height="+satellitHeight+
  ",resizable=1,status=0,toolbar=0,location=0,directories=0,menubar=1,scrollbars=1";
    newwin = window.open( myfile, winname , params)
    if (window.focus) newwin.focus();
  }
function openURLinPopup(surl){
  if (surl.substr(0,5) != "http:" ){
    surl = "http://"+window.location.host+surl;
  }
  if (window.opener){
    window.opener.location.href = surl;
    window.close();
  } else {
    location.href = surl;
  }
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n);  // flori
  return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
       document.MM_sr[j++]=x;
    if(!x.oSrc) x.oSrc=x.src;
    x.src=a[i+2];
  }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) {
    x.src=x.oSrc;
  }
}
function MM_swapMenue() { //hald 16.07.2001
  var i,j=0,x,a=MM_swapMenue.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
       document.MM_sr[j++]=x;
    if(!x.oSrc) x.oSrc=a[i+2];
    x.src=a[i+2];
  }
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
// Dynamic Layer Object
// sophisticated layer/element targeting and animation object which provides the core functionality needed in most DHTML applications
// 19990604
// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/
function DynLayer(id,nestref,frame) {
 if (!is.ns5 && !DynLayer.set && !frame) DynLayerInit()
 this.frame = frame || self
 if (is.ns) {
  if (is.ns4) {
   if (!frame) {
    if (!nestref) var nestref = DynLayer.nestRefArray[id]
    if (!DynLayerTest(id,nestref)) return
    this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
   }
   else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
   this.elm = this.event = this.css
   this.doc = this.css.document
  }
  else if (is.ns5) {
   this.elm = document.getElementById(id)
   this.css = this.elm.style
   this.doc = document
  }
  this.x = this.css.left
  this.y = this.css.top
  this.w = this.css.clip.width
  this.h = this.css.clip.height
 }
 else if (is.ie) {
  this.elm = this.event = this.frame.document.all[id]
  this.css = this.frame.document.all[id].style
  this.doc = document
  this.x = this.elm.offsetLeft
  this.y = this.elm.offsetTop
  this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
  this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
 }
 this.id = id
 this.nestref = nestref
 this.obj = id + "DynLayer"
 eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
 if (x!=null) {
  this.x = x
  if (is.ns) this.css.left = this.x
  else this.css.pixelLeft = this.x
 }
 if (y!=null) {
  this.y = y
  if (is.ns) this.css.top = this.y
  else this.css.pixelTop = this.y
 }
}
function DynLayerMoveBy(x,y) {
 this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
 this.css.visibility = (is.ns4)? "show" : "visible"
}
function DynLayerHide() {
 this.css.visibility = (is.ns4)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')
// DynLayerInit Function
function DynLayerInit(nestref) {
 if (!DynLayer.set) DynLayer.set = true
 if (is.ns) {
  if (nestref) ref = eval('document.'+nestref+'.document')
  else {nestref = ''; ref = document;}
  for (var i=0; i<ref.layers.length; i++) {
   var divname = ref.layers[i].name
   DynLayer.nestRefArray[divname] = nestref
   var index = divname.indexOf("Div")
   if (index > 0) {
    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
   }
   if (ref.layers[i].document.layers.length > 0) {
    DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
   }
  }
  if (DynLayer.refArray.i < DynLayer.refArray.length) {
   DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
  }
 }
 else if (is.ie) {
  for (var i=0; i<document.all.tags("DIV").length; i++) {
   var divname = document.all.tags("DIV")[i].id
   var index = divname.indexOf("Div")
   if (index > 0) {
    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
   }
  }
 }
 return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
// Slide Methods
function DynLayerSlideTo(endx,endy,inc,speed,fn) {
 if (endx==null) endx = this.x
 if (endy==null) endy = this.y
 var distx = endx-this.x
 var disty = endy-this.y
 this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
 var endx = this.x + distx
 var endy = this.y + disty
 this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
 if (this.slideActive) return
 if (!inc) inc = 10
 if (!speed) speed = 20
 var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
 if (num==0) return
 var dx = distx/num
 var dy = disty/num
 if (!fn) fn = null
 this.slideActive = true
 this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
 if (!this.slideActive) return
 if (i++ < num) {
  this.moveBy(dx,dy)
  this.onSlide()
  if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
  else this.onSlideEnd()
 }
 else {
  this.slideActive = false
  this.moveTo(endx,endy)
  this.onSlide()
  this.onSlideEnd()
  eval(fn)
 }
}
function DynLayerSlideInit() {}
DynLayer.prototype.slideInit = DynLayerSlideInit
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()
// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
 if (is.ie) {
  if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
  else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
 }
}
function DynLayerClipTo(t,r,b,l) {
 if (t==null) t = this.clipValues('t')
 if (r==null) r = this.clipValues('r')
 if (b==null) b = this.clipValues('b')
 if (l==null) l = this.clipValues('l')
 if (is.ns) {
  this.css.clip.top = t
  this.css.clip.right = r
  this.css.clip.bottom = b
  this.css.clip.left = l
 }
 else if (is.ie) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function DynLayerClipBy(t,r,b,l) {
 this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function DynLayerClipValues(which) {
 if (is.ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
 if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0])
 if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1])
 if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2])
 if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3])
}
DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues
// Write Method
function DynLayerWrite(html) {
 if (is.ns) {
  this.doc.open()
  this.doc.write(html)
  this.doc.close()
 }
 else if (is.ie) {
  this.event.innerHTML = html
 }
}
DynLayer.prototype.write = DynLayerWrite
// BrowserCheck Object
function BrowserCheck() {
 var b = navigator.appName
 if (b=="Netscape") this.b = "ns"
 else if (b=="Microsoft Internet Explorer") this.b = "ie"
 else this.b = b
 this.version = navigator.appVersion
 this.v = parseInt(this.version)
 this.ns = (this.b=="ns" && this.v>=4)
 this.ns4 = (this.b=="ns" && this.v==4)
 this.ns5 = (this.b=="ns" && this.v==5)
 this.ie = (this.b=="ie" && this.v>=4)
 this.ie4 = (this.version.indexOf('MSIE 4')>0)
 this.ie5 = (this.version.indexOf('MSIE 5')>0)
 this.min = (this.ns||this.ie)
}
is = new BrowserCheck()
// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
 if (id=="START") return '<STYLE TYPE="text/css">\n'
 else if (id=="END") return '</STYLE>'
 var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
 if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
 if (arguments.length>=5 && height!=null) {
  str += ' height:'+height+'px;'
  if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
 }
 if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
 if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
 if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
 if (arguments.length==9 && other!=null) str += ' '+other
 str += '}\n'
 return str
}
function writeCSS(str,showAlert) {
 str = css('START')+str+css('END')
 document.write(str)
 if (showAlert) alert(str)
}
 function switchLang3(){
   if( sUrlLangbutton3 != "" ) window.open(sUrlLangbutton3,"lang3","");
 }
 function switchLang4(){
   if( sUrlLangbutton4 != "" ) window.open(sUrlLangbutton4,"lang4","");
 }
 function switchLang5(){
   if( sUrlLangbutton5 != "" ) window.open(sUrlLangbutton5,"lang5","");
 }
/********************************************************************
   eTracker Erweiterung fuer das Tracking von Downloads
   Hald online
   Version: 2004-11-19
   Aufruf: onClick="trackDownload('/media/test4.pdf',123456);return false;"
********************************************************************/
// Oeffnet Pupup mit Download
function openWinDownload(strUrl){
  params = "";
  var now=new Date();  winname="a" + now.getTime();
  newwin = window.open( strUrl, winname , params)
  if( window.focus ) newwin.focus();
}
// extractFileName
function extractFileName(fullPath) {
  var lastSlash // the position of the last slash in the path
  var fileName  // the name of the file
  lastSlash = fullPath.lastIndexOf("/")
  fileName = fullPath.substring(lastSlash+1,fullPath.length)
  return fileName
}
 
// Erzeugt Hit aus DruckschriftenDB in eTracker
function trackDownloadLitDB(strFile,strMb,strPg) {
   
   var strArea = '';
   if(strMb != '') strArea = strArea + strMb + '/';
   if(strPg != '') strArea = strArea + strPg + '/';
   
   strThisFile = extractFileName(strFile);
   streTrackerName = etracker_trim_pagename("Download: " + strMb + " " + strPg + " " + strThisFile);
   streTrackerHitUrl = "http://www.etracker.de/cnt.php?" +
                       "et=" + strEtrackercode + 
                       "&java=n"+
                       "&et_easy=0"+
                       "&et_pagename="+streTrackerName+
                       "&et_areas=all/downloads/LitDB/"+strArea
                       "&et_ilevel=0"+
                       "&et_target=,,,0&et_lpage=&et_trig=";
    document.eTrackerLoadTarget.src = streTrackerHitUrl;
    openWinDownload(strFile);
}
// Erzeugt Hit in eTracker
function trackDownload(strFile,strID,strArea,strMode) {
    if(!strMode) strMode = "";
    if( typeof strEtrackercode != 'undefined') {
        if( strEtrackercode != "" ) {
      if(typeof strArea == 'undefined') {
      var strAddArea = '';
   }else{
      var strAddArea = strArea;
   }
   strThisFile = extractFileName(strFile);
   if(strArea != "") {
      strID += ", " + strArea;
   }
   streTrackerName = etracker_trim_pagename("Download: " + strThisFile + " (" + strID + ")");
            streTrackerHitUrl = "http://www.etracker.de/cnt.php?" +
                                "et=" + strEtrackercode + 
                                "&java=n"+
                                "&et_easy=0"+
                                "&et_pagename="+streTrackerName+
                                "&et_areas=all/downloads/"+strAddArea+
                                "&et_ilevel=0"+
                                "&et_target=,,,0&et_lpage=&et_trig=";
            document.eTrackerLoadTarget.src = streTrackerHitUrl;
        }
    }
    if(strMode=="") {
        openWinDownload(strFile);
    }else{
        self.location.replace(strMode+strFile);
    }
}
// eTracker Funktion fuer den Bereich
function etracker_get_pagearea(arrNavText, strLanguage) {
 strResult = strLanguage + "/";
 
 if( typeof arrNavText != 'undefined' ) {
  if(arrNavText.length > 0) {
   strResult += arrNavText.join("/");
  }
 }
 
 return etracker_trim_pagearea(strResult);
}
// eTracker Funktion fuer den Seitennamen
function etracker_get_pagename(arrNavText, intPageID) {
 
 if( typeof arrNavText != 'undefined' ) {
  if(arrNavText.length > 0) {
   strResult  = arrNavText[arrNavText.length-1];
  }else{
   strResult  = 'NN';
  }
 
  strResult += ' (' + intPageID;
 
  if(arrNavText.length > 2) {
   strResult += ', ';
   strResult += arrNavText[arrNavText.length-3];
   strResult += ' - ';
  }
 
  if(arrNavText.length > 1) {
   if(arrNavText.length == 2) {
    strResult += ', ';
   }
   strResult += arrNavText[arrNavText.length-2];
  }
 
  strResult += ')';
 
 }else{
   strResult  = 'NN (' + intPageID + ')';
 }
 
 return etracker_trim_pagename(strResult);
}
// eTracker Funktion fuer den Seitennamen aus dem Satelliten
function etracker_get_sat_pagename(strTitle, intPageID) {
 strResult = strTitle.replace(/\//," ") + ' (' + intPageID;
 
 if(window.opener) {
 
  if(window.opener.arrNavText) {
   
   arrNavText = window.opener.arrNavText;
   if(arrNavText.length > 1) {
    strResult += ', ';
    strResult += arrNavText[arrNavText.length-2];
    strResult += ' - ';
   }
 
   if(arrNavText.length > 0) {
    if(arrNavText.length == 1) {
     strResult += ', ';
    }
    strResult += arrNavText[arrNavText.length-1];
   }
   
  }
  
  
 }
 
 strResult += ')';
 
 return etracker_trim_pagename(strResult);
}
// eTracker Funktion fuer den Seitennamen aus dem Satelliten
function etracker_get_sat_pagearea(strTitle) {
 strResult = '';
 
 if(window.opener) {
  if(window.opener.et_areas) {
   strResult += window.opener.et_areas;
  }
 }
 
 if(strResult != '') strResult += '/';
 
 strResult += 'sat';
 
 // HTML Titel der Seite wird vorlaeufig nicht genutzt
 // if(strTitle != '') strResult += '/' + strTitle;
 
 return etracker_trim_pagearea(strResult);
}
// eTracker Funktion fuer die Kuerzung des Seitennamens
function etracker_trim_pagename(strTitle) {
 if(strTitle.length > 60) {
  // Testen, ob ein Umlaut in den letzten 7 Zeichen vorhanden ist, wenn ja, dann davor abschneiden
  intUndPos = strTitle.lastIndexOf("&");
  intSpacePos = strTitle.lastIndexOf(" ");
  if(intUndPos > 53 && intUndPos > intSpacePos) {
    strTitle = strTitle.substr(0, intUndPos);
  }
  strTitle = strTitle.substr(0, 59);
  strTitle += ')';
 }
 return strTitle;
}
// eTracker Funktion fuer die korrekte Schreibweise des Bereichs
function etracker_trim_pagearea(strText) {
 strText = strText.replace(/\&amp;/,"");
 strText = strText.replace(/,/," ");
 strText = strText.replace(/  /," ");
 strText = strText.replace(/\+/,"");
 return strText;
}

//</body>
//</html>
//io need this
//


//***************************************
//        KALENDER
//***************************************

function openCalender(strField) {
	if(document.getElementById(strField)) {
		objField = document.getElementById(strField);
	    show_calendar(strField, objField.value);
		//alert('Kalender für ' + objField.id + ' öffnen.');
	}else{
		alert('Feld [' + strField + '] nicht gefunden.');	
	}	
}

// Title: Timestamp picker
// Description: See the demo at url
// URL: http://us.geocities.com/tspicker/
// Script featured on: http://javascriptkit.com/script/script2/timestamp.shtml
// Version: 1.0
// Date: 12-05-2001 (mm-dd-yyyy)
// Author: Denis Gritcyuk <denis@softcomplex.com>; <tspicker@yahoo.com>
// Notes: Permission given to use this script in any kind of applications if
//    header lines are left unchanged. Feel free to contact the author
//    for feature requests and/or donations

function show_calendar(str_target, str_datetime) {
	var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
	var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)

	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
	var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>Calendar</title>\n"+
    "<style>A{text-decoration:none;}</style>"+
		"</head>\n"+
		"<body bgcolor=\"#FFFFFF\">\n"+
		"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#000099\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#003399\"><a href=\"javascript:window.opener.show_calendar('"+
		str_target+"', '"+ dt2dtstr(dt_prev_month)+"');\">"+
		"<img src=\"sys/images/kalender_prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"\"></a></td>\n"+
		"	<td bgcolor=\"#003399\" colspan=\"5\">"+
		"<font color=\"#FFCC66\" face=\"tahoma, verdana\" size=\"2\"><b>"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</b></font></td>\n"+
		"	<td bgcolor=\"#003399\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
		+str_target+"', '"+dt2dtstr(dt_next_month)+"');\">"+
		"<img src=\"sys/images/kalender_next.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"\"></a></td>\n</tr>\n"
	);
  
	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#C3D9F8\">"+
		"<font color=\"#000000\" face=\"tahoma, verdana\" size=\"2\">"+
		week_days[(n_weekstart+n)%7]+"</font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#B3C2E1\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"#ffffff\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener.document.getElementById('"+str_target+
					"').value='"+dt2dtstr(dt_current_day)+"'; if(window.opener.document.getElementById('"+str_target+
					"').focus) window.opener.document.getElementById('"+str_target+
					"').focus(); window.close();\">"+
					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener.document.getElementById("+str_target+
					").value='"+dt2dtstr(dt_current_day)+"'; if(window.opener.document.getElementById('"+str_target+
					"').focus) window.opener.document.getElementById('"+str_target+
					"').focus(); window.close();\">"+
					"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		"<form name=\"cal\"></form>"+
		/*
		"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
		"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
		"Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
		"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
		*/
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	var vWinCal = window.open("", "Calendar", 
		"width=200,height=212,status=no,resizable=yes,top=200,left=200");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
//	var re_date = /^(\d+)\.(\d+)\.(\d+)\s+$/;
	var re_date = /^(\d+)\.(\d+)\.(\d+)\s*$/;
	if (!re_date.exec(str_datetime))
		return alert("Ungültiges Datumsformat: "+ str_datetime);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1));
}
function createTwoDigit(intNumber){
  return (intNumber < 10) ? '0'+intNumber : intNumber;
}
function dt2dtstr (dt_datetime) {
	return (new String (
			createTwoDigit(dt_datetime.getDate())+"."+createTwoDigit((dt_datetime.getMonth()+1))+"."+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
	return (new String (
			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}
