<!--
	  var currentDate = new Date();
	  var currentMonth= eval(currentDate.getMonth()+1);
	  var currentDay = currentDate.getDate();
	  var currentYear = currentDate.getFullYear();
	  var InventoryMonth= 18;

	  var InventoryDate = new Date(currentYear, (currentMonth + InventoryMonth -1), currentDay);
//-->
var Labels = new Array();
Labels[0]	= "Next Year";
Labels[1]	= "Previous Year";
Labels[2]	= "Previous Month";
Labels[3]	= "Next Month";
Labels[4]	= "Sun";
Labels[5]	= "Mon";
Labels[6]	= "Tue";
Labels[7]	= "Wed";
Labels[8]	= "Thu";
Labels[9]	= "Fri";
Labels[10]	= "Sat";
Labels[11]	= "Januar";
Labels[12]	= "Februar";
Labels[13]	= "MŠrz";
Labels[14]	= "April";
Labels[15]	= "Mai";
Labels[16]	= "Juni";
Labels[17]	= "Juli";
Labels[18]	= "August";
Labels[19]	= "September";
Labels[20]	= "Oktober";
Labels[21]	= "November";
Labels[22]	= "Dezember";
Labels[23]	= "So";
Labels[24]	= "Mo";
Labels[25]	= "Di";
Labels[26]	= "Mi";
Labels[27]	= "Do";
Labels[28]	= "Fr";
Labels[29]	= "Sa";
Labels[30]	= "";
Labels[31]	= "Close";
Labels[32]	= "Jan";
Labels[33]	= "Feb";
Labels[34]	= "Mar";
Labels[35]	= "Apr";
Labels[36]	= "May";
Labels[37]	= "Jun";
Labels[38]	= "Jul";
Labels[39]	= "Aug";
Labels[40]	= "Sep";
Labels[41]	= "Oct";
Labels[42]	= "Nov";
Labels[43]	= "Dec";
Labels[44]	= "Sonntag";
Labels[45]	= "Montag";
Labels[46]	= "Dienstag";
Labels[47]	= "Mittwoch";
Labels[48]	= "Donnerstag";
Labels[49]	= "Freitag";
Labels[50]	= "Samstag";
<!--
  var monthName = new Array (Labels[11], Labels[12], Labels[13], Labels[14],Labels[15], Labels[16], Labels[17],Labels[18], Labels[19], Labels[20], Labels[21], Labels[22]);
  var dayName = new Array (Labels[44], Labels[45], Labels[46], Labels[47], Labels[48], Labels[49], Labels[50]);
  var calendarCtrlStrings = new Array ("","",Labels[31]);

//************************************************************************
         // Global variables
         //************************************************************************

         var calendarWindow;

         //************************************************************************
      // Function:  getCalendarCtrlString
      // Purpose:   Return the appropriate localized calendar control string.
      //            (eg: prev, cancel, next).
      // Input:     stringID - Control string to return.
      //            language - language used by the WEB page.
      //            locale - locale used by the WEB page.
      // Output:    String containing the Calendar Control string.
         //************************************************************************

         var CALCTRLSTR_NEXT = 0;
         var CALCTRLSTR_PREV = 1;
         var CALCTRLSTR_CNCL = 2;
		 var dateSelectedYear;
		 var InventoryDate ;

         function getCalendarCtrlString (stringID, language, locale)
         {
//          var enCalendarCtrlStrings = new Array ("Next", "Prev", "Close");
//          var esCalendarCtrlStrings = new Array ("Despu&#233s", "Anterior", "Cancelan");

            return (calendarCtrlStrings [stringID]);

         }

      //************************************************************************
      // Function:  parseYear
      // Purpose:   Find the index of the year in a HTML SELECT control.
      // Input:     year - year to locate in the control.
      //            inY - the control to search.
      // Output:    Index into the SELECT control.
         //************************************************************************

         function parseYear(year, yearCtrlStr)
         {
			dateSelectedYear=year;
            var retval=0;
            var i=0;
            var formyear=0;
            for (i=0; i<=5; i++)
            {
               eval ("formyear = document.getElementById('" + yearCtrlStr + "').options[" + i + "].text;");
               if (year == formyear)
               {
                  retval=i;
                  break;
               }
         }
            return retval;
         }

         //************************************************************************
      // Function:  nextMonth
      // Purpose:   Increment the month.
      // Input:     month
      // Output:    month + 1
         //************************************************************************

         function nextMonth (month)
         {
            if (month==12)
            {
               return 1;
            }
            else
            {
               return (month+1);
            }
         }

         //************************************************************************
      // Function:  prevMonth
      // Purpose:   Previous month.
      // Input:     month
      // Output:    month - 1
         //************************************************************************

         function prevMonth (month)
         {
            var prevMonth = (month - 1)
            if (month==1)
            {
               prevMonth = 12;
            }
            return prevMonth
         }

         //************************************************************************
      // Function:  changeYear
      // Purpose:   Updates the year if incrementing or decrementing into the
      //            previous or following year.
      // Input:     direction - incrementing or decrementing
      //            month - month that is being updated.
      //            year - current year value.
      // Output:    Updated year.
         //************************************************************************

         function changeYear (direction, month, year)
         {
            // increments or decrements month when it goes past Jan or Dec
            var theYear = year
            if (direction=='next')
            {
               if (month == 12)
               {
                  theYear = (year + 1)
               }
            }
            if (direction=='prev')
            {
               if (month == 1)
               {
                  theYear = (year - 1)
               }
            }
            return theYear
         }

         //************************************************************************
      // Function:  createCalendar
      // Purpose:   Create the calendar popup.
      // Input:     formStr - HTML name of the form that contains the date controls.
      //            dayCtrlStr - HTML name of the day drop down.
      //            monthCtrlStr - HTML name of the month drop down.
      //            yearCtrlStr - HTML name of the year drop down.
      //            dowCtrlStr - HTML name of the day of week control.
      //            language - language used by the WEB page.
      //            locale - locale used by the WEB page.
      //            callBackFn - JavaScript function to call when closing the calendar.
      // Output:    none
         //************************************************************************

         function createCalendar (val,formStr, dayCtrlStr, monthCtrlStr, yearCtrlStr, dowCtrlStr, language, locale, callBackFn)
         {
			InventoryDate = val;
            calendarWindow = window.open ('', 'Calendar', 'width=220,height=180,resizable=yes,scrollbars=no');

            var mthVal = eval ("parseInt(document.getElementById('" + monthCtrlStr + "').options [document.getElementById('" + monthCtrlStr + "').selectedIndex].value, 10)");
            var yearVal = eval ("document.getElementById('" + yearCtrlStr + "').options [document.getElementById('" + yearCtrlStr + "').selectedIndex].value");
            generateCalendar (calendarWindow, mthVal, yearVal, formStr, dayCtrlStr, monthCtrlStr, yearCtrlStr, dowCtrlStr, language, locale, callBackFn)
         }


         //************************************************************************
      // Function:  generateCalendar
      // Purpose:   Emit the HTML into the calendar popup window.
      // Input:     target - Target browser window for the calendar.
      //            month - Month of the calendar top create.
      //            year - Year of the calendar to create.
      //            formStr - HTML name of the form that contains the date controls.
      //            dayCtrlStr - HTML name of the day drop down.
      //            monthCtrlStr - HTML name of the month drop down.
      //            yearCtrlStr - HTML name of the year drop down.
      //            dowCtrlStr - HTML name of the day of week control.
      //            language - language used by the WEB page.
      //            locale - locale used by the WEB page.
      //            callBackFn - JavaScript function to call when closing the calendar.
      // Output:    none
         //************************************************************************

         function generateCalendar(target, month, year, formStr, dayCtrlStr, monthCtrlStr, yearCtrlStr, dowCtrlStr, language, locale, callBackFn)
         {
			var today = new Date();
            target.document.open()
            calendar = "<html><head><title>Calendar</title>"
            calendar +="<link rel=\"stylesheet\" href=\"css/calender_booking.css\" type=\"text/css\">\n"
            calendar +="</head><body>\n"
            calendar +=" <table border=0 cellspacing=0 cellpadding=2 width=200>"
            calendar +="<tr valign=top>"
            var mthIdx = month;
			//alert("hi" + dayCtrlStr);
            var endday = getDaysInMonth(mthIdx, year)
			var changingmonth=mthIdx;
            var index = (mthIdx-1)
            var goPrevMonth = prevMonth(mthIdx)
            var goNextMonth = nextMonth(mthIdx)
            var nextYear = changeYear ('next', parseInt (month, 10), parseInt (year, 10))
            var prevYear = changeYear ('prev', parseInt (month, 10), parseInt (year, 10))
			
			// Create the calendar header
			var inventoryYr = new Date().getFullYear();
			if (InventoryDate.getFullYear() != null)
			{
			   inventoryYr = InventoryDate.getFullYear();
			}

			if (prevYear >= today.getFullYear())
			{
				 calendar +=" <td colspan=1 align=left class=\"calend34\">"
				 calendar +=" <a href='javascript:opener.generateCalendar(self," + goPrevMonth + "," + prevYear + ",\"" + formStr + "\",\"" + dayCtrlStr + "\",\"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\""
				 calendar +=  dowCtrlStr + "\", \"" + language + "\",\" " + locale + "\",\" " + callBackFn + "\")'>&laquo;</a>"
				 calendar +=" </td>"
			}
			else
			{
				 calendar +=" <td colspan=1 align=left class=\"calend34\">"
				 calendar +=" <a style='text-decoration: none' 'javascript:opener.generateCalendar(self," + goPrevMonth + "," + prevYear + ",\"" + formStr + "\",\"" + dayCtrlStr + "\",\"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\""
				 calendar +=  dowCtrlStr + "\", \"" + language + "\",\" " + locale + "\",\" " + callBackFn + "\")'>&laquo;</a>"
				 calendar +=" </td>"

			}
				calendar +=" <td colspan=5 align=center class=\"calend34\">"
				calendar +=  getMonth (mthIdx) + " " + year
				calendar +=" </td>"


			if (nextYear <= inventoryYr)
			{
			
				calendar +=" <td colspan=1 align=right class=\"calend34\">"
				calendar +="<a href='javascript:opener.generateCalendar(self," + goNextMonth + "," + nextYear + ",\"" + formStr + "\",\"" + dayCtrlStr + "\",\"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\""
				calendar +=  dowCtrlStr  + "\", \"" + language + "\",\" " + locale + "\",\" " + callBackFn + "\")'>&raquo;</a></td></tr>"
			}else
			{
				calendar +=" <td colspan=1 align=right class=\"calend34\">"
				calendar +="<a style='text-decoration: none' 'javascript:opener.generateCalendar(self," + goNextMonth + "," + nextYear + ",\"" + formStr + "\",\"" + dayCtrlStr + "\",\"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\""
				calendar +=  dowCtrlStr  + "\", \"" + language + "\",\" " + locale + "\",\" " + callBackFn + "\")'>&raquo;</a></td></tr>"
			}

			calendar +=" </tr><tr class=\"bgdaytitle\">"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[23]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[24]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[25]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[26]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[27]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[28]+"</td>"
            calendar +=" <td align=center width=\"14%\" class=\"daytitle\">"+Labels[29]+"</td>"
            calendar +=" </tr>"

       // Create the days.
            wholeDate = month + "/01/" + year
            thedate = new Date(wholeDate)
            firstDay = thedate.getDay()
            selectedmonth = mthIdx;
			 var today = new Date();

			var month=today.getMonth();
			// added later
			var presentMonth=eval(today.getMonth()+1);
			//var presentMonth=eval(today.getMonth()+1);
			//var presentDay = today.getDay();
			var presentDay= today.getDate();

			var presentYear = today.getFullYear();
			//alert("presentYear" + presentYear);
			var presentDate =new Date(presentMonth + "/" + presentDay + "/" + presentYear);

			//alert("present date" + presentDate);


			var currentYear=today.getYear();
			var nextYear=currentYear + 1;
            var thisyear = today.getYear() + 1900;
            selectedyear = year
            var lastDay = (endday + firstDay+1)
            var iRows =0
            calendar +=" <tr>"
            for (var i = 1; i < lastDay; i++)
            {
				var changeingDay =(i-firstDay);
				var changigDate =new Date(changingmonth + "/" + (i-firstDay) + "/" + year)
				if ( changigDate == presentDate )
				{
					changeingDay = "<span class='calend33'>" + changeingDay + "</span>" ;
				}
               if (i <= firstDay)
               {
                  calendar +=" <td class='calend31'>&nbsp;</td>"
               }
               else
               {
				   // var changigDate =new Date(changingmonth + "/" + (i-firstDay) + "/" + year)

			if(changigDate <= InventoryDate)
			 {

				   if( changigDate >= presentDate)
				   {
					    var changingTime = changigDate.getTime();
					    var presentTime= presentDate.getTime();
						if(changingTime==presentTime)
					   {
							changeingDay = "<span class='calend33'>" + changeingDay + "</span>" ;
					   }

					   calendar +=" <td class='calend31' align=center><span class='calend32'><a href='JavaScript:opener.closeCalendar(" + (i-firstDay) + ", \"" + formStr + "\", \"" + dayCtrlStr + "\", \"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\"" + dowCtrlStr
					   calendar += "\", \"" +  language + "\", \"" + locale + "\",\"" + callBackFn + "\");self.close();'>"+ changeingDay +"</a></span></td>"
				   }

				     else
				  {
					  calendar +=" <td align=center><span class='calend32'><a 'JavaScript:opener.closeCalendar(" + (i-firstDay) + ", \"" + formStr + "\", \"" + dayCtrlStr + "\", \"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\"" + dowCtrlStr
					  calendar += "\", \"" +  language + "\", \"" + locale + "\",\"" + callBackFn + "\");self.close();'>"+(i-firstDay) +"</a></span></td>"

				   }
			 }

			else
			 {
					calendar +=" <td align=center><div align=center><span class='calend32'><a 'JavaScript:opener.closeCalendar(" + (i-firstDay) + ", \"" + formStr + "\", \"" + dayCtrlStr + "\", \"" + monthCtrlStr + "\",\"" + yearCtrlStr + "\",\"" + dowCtrlStr
				    calendar += "\", \"" +  language + "\", \"" + locale + "\",\"" + callBackFn + "\");self.close();'>"+(i-firstDay) +"</a></span></font></font></div></td>"

			 }


               }
               if (i % 7 == 0 )
               {
                  if (i != lastDay-1)
                  {
                     calendar +=" </tr><tr>"
                     iRows = iRows + 1
                  }
                  else
                  {
                     iRows = iRows
                  }
               }
            }
            calendar +=" </tr>"

        // Create the calendar footer
           // iRows = iRows + 1
            //for (var icounter = 1; icounter <= 6-iRows; icounter++)
            //{
              // calendar +=" <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>"
           // }

            
			calendar +=" <tr><td colspan=7>"
			calendar +=" <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"200\">"
			calendar +=" <tr><td class=\"bglinea_footer\"><img src=\"images/clear.gif\" width=\"10\" height=\"1\"></td></tr>"
			calendar +=" <tr><td align=right class=\"text\"><a href='javascript:self.close()'>" + getCalendarCtrlString (CALCTRLSTR_CNCL, language, locale) + "</a></td>"

			
			calendar +="</table></td></tr></table></td></tr><table></td></tr></table></body></html>"
			calendar +="</table></body></html>"
            target.document.write(calendar);
            target.document.close();
         }

         //************************************************************************
      // Function:  closeCalendar
      // Purpose:   Close the calendar and update the parent forms date controls.
      // Input:     day - selected day.
      //            formStr - HTML name of the form that contains the date controls.
      //            dayCtrlStr - HTML name of the day drop down.
      //            monthCtrlStr - HTML name of the month drop down.
      //            yearCtrlStr - HTML name of the year drop down.
      //            dowCtrlStr - HTML name of the day of week control.
      //            language - language used by the WEB page.
      //            locale - locale used by the WEB page.
      //            callBackFn - JavaScript function to call when closing the calendar.
      // Output:    none
         //************************************************************************

         function closeCalendar (day, formStr, dayCtrlStr, monthCtrlStr, yearCtrlStr, dowCtrlStr, language, locale, callBackFn)
         {
              // Update the controls.
            var toDay= new Date();

            var today = new Date();
            var presentMonth=eval(today.getMonth() + 1);
            var presentDay = today.getDate();
            var Presentyear = today.getYear();
            var presentDate =new Date(presentMonth + "/" + presentDay + "/" + Presentyear);
            var selected =new Date(selectedmonth + "/" + day + "/" + selectedyear);
            try
            {
                if(selected >= presentDate)
                 {
                      var yrIdx = parseYear (selectedyear, yearCtrlStr);
                      eval ("document.getElementById('" + dayCtrlStr + "').selectedIndex = " + parseInt(day-1, 10));
                      eval ("document.getElementById('" + monthCtrlStr + "').selectedIndex = "  + selectedmonth + "-1");
                      eval ("document.getElementById('" + yearCtrlStr + "').selectedIndex = " + yrIdx);
                      //selectedday=parseInt(day,10);
                      eval ("document.getElementById('" + dowCtrlStr + "').value = '"
                                     + getDayOfWeek (buildCRSDate (selectedyear,
                                                                   selectedmonth,
                                                                   day)) + "'");

                        selectedday=day;
                      // Call the callback function.
                      eval (callBackFn);
                      if(dayCtrlStr == "DATERANGESTART_DAY")
                      {
                          updateSTART_DATE('','','');
                          updateDATES('','','',-1);
                      }
                      else
                      {
                        updateDATES('','','',-1);
                      }
                  }
             }catch(errorObject)
             {
                return false;
             }
     }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function Validate(TheForm){
	fin=window.open("","fin","toolbar=yes,scrollbars=yes,resizable=yes,width=850,height=650");
}
//-->