<!--
  // sName: Name der Control
  // iHoursStart, End: Start und Ende der Stundenauswahl, falls gleich, dann keine Box
  // 4. Parameter ist sDate, opt. 
  function doCreateTermin(sName, iHoursStart, iHoursEnd, iHoursInc) {
    var sT= new Array("<option", "</option>", "<select size='1' name='", "</select>");
	var i, tDate= new Date; 
    var sM= new Array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");

	if (doCreateTermin.arguments.length > 4) {
	  tDate= doCreateTermin.arguments[4];
	}
	
    document.writeln( sT[2] + sName + "D" + "'>");
    for(i=1; i<=31; i++) {
	  document.writeln(sT[0]);
	  if (tDate.getDate()==i) {
	    document.write(" SELECTED ");
	  } 
	  document.writeln(">" + i + sT[1]);
	};
	document.writeln(sT[3]);	
	
    document.writeln( sT[2] + sName + "M" + "'>");
    for(i=1; i<=12; i++) {
	  document.write(sT[0]);
	  if (tDate.getMonth()==(i-1)) document.write(" SELECTED "); 
	  document.writeln(">" + sM[i-1] + sT[1]);
	};
	document.writeln(sT[3]);	

    document.writeln( sT[2] + sName + "Y" + "'>");
    for(i=tDate.getFullYear(); i<=tDate.getFullYear()+1; i++) {
	  document.write(sT[0]);
	  if (tDate.getFullYear()==i) document.write(" SELECTED "); 
	  document.writeln(">" + i + sT[1]);
	};
	document.writeln(sT[3]);		

    if (iHoursStart!=iHoursEnd) {
	  document.writeln(sT[2] + sName + "H" + "'>");
      for(i= iHoursStart; i<= iHoursEnd; i+=iHoursInc) {        
     	document.writeln(sT[0] + ">" + i + ":00h-" + (i+iHoursInc) +":00h" + sT[1]);
      };
      document.writeln(sT[3]);		
    };
  };
  
  // Checks if a Date is valid
  function bDateIsValid(iD, iM, iY) {
    var aDate= new Date;
    aDate.setFullYear(iY);
    aDate.setMonth(iM);
    aDate.setDate(iD);
    return(aDate.getDate() == iD);
  };


  // Does not work too well with Feb, 29th
  function doDateAdd(iD, iM, iY, theDate) {
	var iSgn;
			
	if (iD != 0) {
    	iD+= theDate.getDate()-1;
    	theDate.setDate(1);
    };
	
	theDate.setFullYear(theDate.getFullYear()+iY);
	
    if (iM != 0) {
	  iSgn= (iM<0)? -1 : 1;
	  theDate.setMonth(theDate.getMonth()+ iSgn * 12 + iM);
	  theDate.setMonth(theDate.getMonth()- iSgn * 12);
	};

	if (iD != 0) {
    	iSgn= (iD<0)? -1 : 1;	    	
    	theDate.setDate(theDate.getDate()+ iSgn * 32 + iD);
    	theDate.setDate(theDate.getDate()- iSgn * 32);
	};
	
  };

//-->
