]> code.delx.au - comingnext/blobdiff - comingNextB/index.html
check for backward compatibility before trying to access device object
[comingnext] / comingNextB / index.html
index 58181cec07f806b584a756662e8497e6b7ad2533..965702fb3178b2e39ba1c098ddfeec56e2d2ad58 100644 (file)
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
+\r
 <title>Coming Next</title>\r
+\r
 <style type="text/css">\r
-/* -----------------------------------------------------------------------\r
-here you can customize background color, font color, font size etc...\r
---------------------------------------------------------------------------- */\r
-.background { color:#ffffff; background-color:#000000; font:normal 12pt; } /* Defines the background of the widget. If you want to use a background image, set useBackgroundImage = true below */\r
-.weekDay { }                           /* Defines the appearance of all week day texts */\r
-.date { }                              /* Defines the appearance of all date texts */\r
-.today { color:#ff0000; }              /* Defines the appearance of "Today" text */\r
-.time { }                              /* Defines the appearance of all time texts */\r
-.now { color:#ff00ff; }                        /* Defines the appearance of "Now" text */\r
-.description { }                       /* Defines the appearance of all event descriptions */\r
-.icon { width:15px; height:15px; }     /* Defines size and appearance of icons */\r
+/* The following classes can be modified by widget settings */\r
+.background { }\r
+.backgroundFullscreen { }\r
+.weekDay { }\r
+.date { }\r
+.today { }\r
+.tomorrow { }\r
+.time { }\r
+.now { }\r
+.description { }\r
+.icon { }\r
 </style>\r
+\r
+<script type="text/javascript" src="localizedTextStrings.js" charset="utf-8" />\r
+\r
 <script>\r
-//---------------------------------------------------------------\r
-// The following section contains settings you may want to tweak\r
-//---------------------------------------------------------------\r
-var monthRange = 2;            // number of months to include in the event list\r
-var includeTodos = true;       // disable to remove ToDos from event list\r
-var useBackgroundImage = true; // use background_portrait.png and background_landscape.png to fake transparency. Set to "false" to use a solid background color\r
-var showCombinedDateTime = false;// only show the time for events happening today, otherwise just show the date\r
-var showLocation = true;       // show the location for meeting events\r
-var showTodayAsText = true;    // if enabled, the current date will be shown as "Today" instead of "31.12"\r
-var todayText = 'Today';       // text to display for "Today"\r
-var showNowAsText = true;      // if enabled, the appointment time will be shown as "Now" instead of "12:00"\r
-var nowText = 'Now';           // text to display for "Now"\r
-var dateSeparator = '.';       // separator for dates. e.g. "31.12" or "31/12"\r
-var dateFormat = 'auto'                // how dates will be displayed. 'auto' will autodetect your phone's date format setting. 'MMDD' will write month first, 'DDMM' will write day first\r
-var weekDayLength = 2;         // defines how many characters of the weekday will be shown. E.g. 2 will cut "Friday" to "Fr"\r
-var updateDataInterval = 5;    // how many minutes to wait before updating the displayed data. The higher the number, the less battery is used\r
-var calendarApp = 0x10005901;  // UID of the calendar app to run when clicking the widget. 0x10005901 = buildin calendar, 0x20004ec1 = Epocware Handy Calendar\r
-var eventsPerWidget = 4;       // number of events to show per widget. Default is 4\r
-var showNothingText = true;    // if set to "true", show a text if no events are in the list\r
-var nothingText = 'No further events within '+monthRange+' months';            // text to show when no events are in the list\r
+// valid types for the config object are 'Int', 'Bool', 'String', 'Enum', 'UID'\r
+var config = {\r
+       monthRange: { Type: 'Int', Default: 2, Value: 2,},\r
+       includeTodos: { Type: 'Bool', Default: true, Value: true,},\r
+       useBackgroundImage: { Type: 'Bool', Default: true, Value: true,},\r
+       showCombinedDateTime: { Type: 'Bool', Default: false, Value: false,},\r
+       showLocation: { Type: 'Bool', Default: true, Value: true,},\r
+       showTodayAsText: { Type: 'Bool', Default: true, Value: true,},\r
+       todayText: { Type: 'String', Default: getLocalizedText('settings.default.todayText'), Value: getLocalizedText('settings.default.todayText'),},\r
+       tomorrowText: { Type: 'String', Default: getLocalizedText('settings.default.tomorrowText'), Value: getLocalizedText('settings.default.tomorrowText'),},\r
+       showNowAsText: { Type: 'Bool', Default: true, Value: true,},\r
+       nowText: { Type: 'String', Default: getLocalizedText('settings.default.nowText'), Value: getLocalizedText('settings.default.nowText'),},\r
+       dateSeparator: { Type: 'String', Default: getLocalizedText('settings.default.dateSeparator'), Value: getLocalizedText('settings.default.dateSeparator'),},\r
+       dateFormat: { Type: 'Enum', Default: 'auto', Value: 'auto', ValidValues: ['auto', 'DDMM', 'MMDD'],},\r
+       weekDayLength: { Type: 'Int', Default: 2, Value: 2,},\r
+       updateDataInterval: { Type: 'Int', Default: 5, Value: 5,},\r
+       calendarApp: { Type: 'UID', Default: 0x10005901, Value: 0x10005901,},\r
+       eventsPerWidget: { Type: 'Int', Default: 4, Value: 4,},\r
+       showNothingText: { Type: 'Bool', Default: true, Value: true,},\r
+       nothingText: { Type: 'String', Default: getLocalizedText('settings.default.nothingText'), Value: getLocalizedText('settings.default.nothingText'),},\r
+       enableDaylightSaving: { Type: 'Bool', Default: true, Value: true,},\r
+       hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
+       cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
+       cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
+       cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},\r
+       cssStyle_date: { Type: 'String', Default: '', Value: '',},\r
+       cssStyle_today: { Type: 'String', Default: 'color:#ff0000', Value: 'color:#ff0000',},\r
+       cssStyle_tomorrow: { Type: 'String', Default: 'color:#0000ff', Value: 'color:#0000ff',},\r
+       cssStyle_time: { Type: 'String', Default: '', Value: '',},\r
+       cssStyle_now: { Type: 'String', Default: 'color:#ff00ff', Value: 'color:#ff00ff',},\r
+       cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
+       cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
+}\r
+\r
 \r
 //-------------------------------------------------------\r
 // Nothing of interest from here on...\r
 //-------------------------------------------------------\r
-var panelNum = 1; // use 1 for second panel\r
+var panelNum = 0; // use 1 for second panel\r
+var version = "1.25";\r
 var calendarService = null;\r
 var cacheEntriesHtml = [];\r
 var months_translated = [];\r
 var orientation = '';\r
 var now = new Date();\r
+var mode = 0; // 0 = homescreen, 1 = fullscreen, 2 = settings, 3 = about\r
+\r
+// vars for daylight saving time\r
+var daylightsavingWinter = 0;\r
+var daylightsavingSummer = 0;\r
+var summertime = false;\r
 \r
 window.onload = init;\r
 window.onresize = updateScreen;\r
 window.onshow = updateScreen;\r
 \r
-function error(message){\r
+function isLeapYear( year ) {\r
+       if (( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 )\r
+               return true;\r
+       else\r
+               return false;\r
+}\r
+         \r
+function calcLeapYear(year, days)\r
+{\r
+       if (isLeapYear(year))\r
+               return ++days;\r
+       else\r
+               return days;\r
+}\r
+         \r
+function subToSunday(myDate, year, days, prevMonthDays)\r
+{\r
+       for (i = myDate.getDay(); i > 0 ;i--)\r
+               days--;\r
+       days -= prevMonthDays;\r
+       days = isLeapYear(year) ? --days : days;\r
+       return days;\r
+}\r
+       \r
+function calcDaylightSaving()\r
+{\r
+       var thisYearS = new Date(now.getFullYear(),  3, 0, 0, 0, 0 );\r
+       var thisYearW = new Date(now.getFullYear(), 10, 0, 0, 0, 0 );\r
+       var nextYearS = new Date(now.getFullYear() + 1,  3, 0, 0, 0, 0 );\r
+       var nextYearW = new Date(now.getFullYear() + 1, 10, 0, 0, 0, 0 );\r
+       var summer = false;\r
+       var winter = false;\r
+       \r
+       thisYearSDays = nextYearSDays = 90;\r
+       thisYearWDays = nextYearWDays = 304;\r
+       \r
+       thisYearSDays = calcLeapYear(now.getFullYear(), thisYearSDays);\r
+       thisYearWDays = calcLeapYear(now.getFullYear(), thisYearWDays);\r
+       nextYearSDays = calcLeapYear(now.getFullYear() + 1, nextYearSDays);\r
+       nextYearWDays = calcLeapYear(now.getFullYear() + 1, nextYearWDays);\r
+       \r
+       thisYearSDays = subToSunday(thisYearS, now.getFullYear(), thisYearSDays, 59);\r
+       thisYearWDays = subToSunday(thisYearW, now.getFullYear(), thisYearWDays, 273);\r
+       nextYearSDays = subToSunday(nextYearS, now.getFullYear() + 1, nextYearSDays, 59);\r
+       nextYearWDays = subToSunday(nextYearW, now.getFullYear() + 1, nextYearWDays, 273);\r
+       \r
+       daylightsavingSummer = new Date (now.getFullYear(), 03-1, thisYearSDays, 2, 0, 0);\r
+       daylightsavingWinter = new Date (now.getFullYear(), 10-1, thisYearWDays, 2, 0, 0);\r
+       if (daylightsavingSummer < now) {\r
+               daylightsavingSummer = new Date (now.getFullYear()+1, 03-1, nextYearSDays, 2, 0, 0);\r
+               var summer = true;\r
+       }\r
+       if (daylightsavingWinter < now) {\r
+               daylightsavingWinter = new Date (now.getFullYear()+1, 10-1, nextYearWDays, 2, 0, 0);\r
+               var winter = true;\r
+       }\r
+       if (summer && !winter)\r
+               summertime = true;\r
+       else\r
+               summertime = false;\r
+}\r
+\r
+function error(message)\r
+{\r
        console.info('Error: ' + message);\r
        document.getElementById("calendarList").innerHTML = 'Error: ' + message;\r
 }\r
 \r
-function collectLocales(){\r
-       if (months_translated.length > 0){\r
-               return;\r
-       }\r
+function isToday(date)\r
+{\r
+       if (date.getDate() == now.getDate() && date.getMonth() == now.getMonth())\r
+               return true;\r
+       return false;\r
+}\r
+\r
+function isTomorrow(date)\r
+{\r
+       if ((date.getDate() == now.getDate() + 1 && date.getMonth() == now.getMonth()) ||\r
+           (date.getDate() == 0 && date.getMonth() == now.getMonth() + 1) ||\r
+           (date.getDate() == 0 && date.getMonth() == now.getMonth() + 1 && date.getYear() == now.getYear() + 1))\r
+               return true;\r
+       return false;\r
+}\r
+\r
+function collectLocales()\r
+{\r
        var tmpyear = ((panelNum == 0) ? 2000 : 2001);\r
        var month = 0;\r
-       for(month = 0; month < 12; month++){\r
+\r
+       if (months_translated.length > 0)\r
+               return;\r
+       for (month = 0; month < 12; month++) {\r
                var startDate = new Date(tmpyear, month, 15);\r
+\r
                var item = new Object();\r
                item.Type = "DayEvent";\r
                item.StartTime = startDate;\r
@@ -76,15 +183,13 @@ function collectLocales(){
 \r
                try {\r
                        var result = calendarService.IDataSource.Add(criteria);\r
-                       if (result.ErrorCode){\r
+                       if (result.ErrorCode)\r
                                error(result.ErrorMessage);\r
-                       }\r
-               }\r
-               catch (e) {\r
+               } catch (e) {\r
                        error("collectLocales: " + e + ', line ' + e.line);\r
                }\r
        }\r
-       try{\r
+       try {\r
                var startTime = new Date(tmpyear,0,1);\r
                var endTime = new Date(tmpyear,11,31);\r
                var listFiltering = {\r
@@ -97,75 +202,80 @@ function collectLocales(){
                        }\r
                }\r
                var result = calendarService.IDataSource.GetList(listFiltering);\r
-               if (result.ErrorCode){\r
+               if (result.ErrorCode) {\r
                        error(result.ErrorMessage);\r
                        return;\r
                }\r
                var list = result.ReturnValue;\r
-       }catch(e){ \r
+       } catch(e) {\r
                error(e + ', line ' + e.line);\r
                return;\r
        }\r
        var ids = new Array();\r
-       try{\r
+       try {\r
                var entry;\r
                var counter = 0;\r
                var dateArr = [];\r
-               while( list && (entry = list.getNext()) != undefined ){\r
+\r
+               while (list && (entry = list.getNext()) != undefined) {\r
                        dateArr = entry.StartTime.replace(/,/g,'').replace(/\./g,':').replace(/  /g,' ').split(' ');\r
                        var day = dateArr[1];\r
                        var month = dateArr[2];\r
                        var year = dateArr[3];\r
+\r
                        // make sure month is set properly\r
-                       if (isNaN(parseInt(day))){\r
+                       if (isNaN(parseInt(day))) {\r
                                var tmp = day;\r
                                day = month;\r
                                month = tmp;\r
-                       }\r
-                       else if (isNaN(parseInt(year))){\r
+                       } else if (isNaN(parseInt(year))) {\r
                                var tmp = year;\r
                                year = month;\r
                                month = tmp;\r
                        }\r
+\r
                        console.info(entry.StartTime + ' -> ' + month + ' ' + counter);\r
                        ids[counter] = entry.id;\r
                        months_translated[month] = counter + 1;\r
                        counter++;\r
                }\r
-       }catch(e){\r
+       } catch(e) {\r
                error(e + ', line ' + e.line);\r
                return;\r
        }\r
        console.info(ids);\r
-       try{\r
+       try {\r
                var criteria = new Object();\r
                criteria.Type = "CalendarEntry";\r
                criteria.Data = {\r
                        IdList: ids\r
                }\r
+\r
                var result = calendarService.IDataSource.Delete(criteria);\r
                if (result.ErrorCode)\r
                        error(result.ErrorMessage);\r
-       }catch(e){\r
+       } catch(e) {\r
                error('deleting temp calendar entries:' + e + ', line ' + e.line);\r
                return;\r
        }\r
 }\r
 \r
-function requestNotification(){\r
+function requestNotification()\r
+{\r
        var criteria = new Object();\r
        criteria.Type = "CalendarEntry";\r
+\r
        try {\r
                var result = calendarService.IDataSource.RequestNotification(criteria, callback);\r
                if (result.ErrorCode)\r
                        error('loading Calendar items list');\r
-       }\r
-       catch (e) {\r
+       } catch (e) {\r
                error("requestNotification: " + e + ', line ' + e.line);\r
        }\r
 }\r
 \r
-function callback(transId, eventCode, result){\r
+function callback(transId, eventCode, result)\r
+{\r
        updateData();\r
 }\r
 \r
@@ -180,33 +290,30 @@ function parseDate(dateString)
        Wednesday,  2009 August, 28 8.00.00 pm\r
        Wednesday,  2009 August, 28 08:00:00 PM\r
        */\r
+\r
        if (dateString == "" || dateString == null)\r
                return null;\r
-       \r
        var dateArr = dateString.replace(/,/g,'').replace(/\./g,':').replace(/  /g,' ').split(' ');\r
-       \r
        if (dateArr.length != 5 && dateArr.length != 6)\r
                return null;\r
-       \r
+\r
        // parse date\r
        var weekDay = dateArr[0];\r
        var day = dateArr[1];\r
        var month = dateArr[2];\r
        var year = dateArr[3];\r
        // make sure month is set properly\r
-       if (isNaN(parseInt(day))){\r
+       if (isNaN(parseInt(day))) {\r
                var tmp = day;\r
                day = month;\r
                month = tmp;\r
-       }\r
-       else if (isNaN(parseInt(year))){\r
+       } else if (isNaN(parseInt(year))) {\r
                var tmp = year;\r
                year = month;\r
                month = tmp;\r
        }\r
        // make sure day and year are set properly\r
-       if (Number(day) > Number(year))\r
-       {\r
+       if (Number(day) > Number(year)) {\r
                var tmp = year;\r
                year = day;\r
                day = tmp;\r
@@ -224,9 +331,18 @@ function parseDate(dateString)
                hours += 12;\r
        if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12)\r
                hours = 0;\r
-       \r
+\r
        console.info('year=' + year + ' month=' + month + ' day=' + day + ' hours=' + hours + ' minutes=' + minutes+ ' seconds=' + seconds);\r
-       \r
+\r
+       // take care of daylight saving time\r
+       if (config['enableDaylightSaving'].Value) {\r
+               var date = new Date(year, month - 1, day, hours, minutes, seconds);\r
+               if (summertime && date > daylightsavingWinter && date < daylightsavingSummer)\r
+                       hours -= 1;\r
+               else if (!summertime && date > daylightsavingSummer && date < daylightsavingWinter)\r
+                       hours += 1;\r
+       }\r
+\r
        return new Date(year, month - 1, day, hours, minutes, seconds);\r
 }\r
 \r
@@ -238,37 +354,38 @@ function formatDate(date, format)
        while (day.length < 2) { day = '0' + day; }\r
        while (month.length < 2) { month = '0' + month; }\r
 \r
-       if (showTodayAsText && now.getDate() == date.getDate() && now.getMonth() == date.getMonth())\r
-               return '<span class="today">' + todayText + '</span>';\r
-       \r
+       if (config['showTodayAsText'].Value && isToday(date))\r
+               return '<span class="today">' + config['todayText'].Value + '</span>';\r
+       if (config['showTodayAsText'].Value && isTomorrow(date))\r
+               return '<span class="tomorrow">' + config['tomorrowText'].Value + '</span>';\r
+\r
        var dateArr = format.replace(/,/g,'').replace(/\./g,':').replace(/  /g,' ').split(' ');\r
-       \r
-       if (dateArr.length != 5 && dateArr.length != 6){\r
+       if (dateArr.length != 5 && dateArr.length != 6) {\r
                // we don't know how to format this\r
-               if (dateFormat == 'auto' || dateFormat == 'DDMM')\r
-                       return day + dateSeparator + month;\r
-               else \r
-                       return month + dateSeparator + day;\r
+               if (config['dateFormat'].Value == 'auto' || config['dateFormat'].Value == 'DDMM')\r
+                       return day + config['dateSeparator'].Value + month;\r
+               else\r
+                       return month + config['dateSeparator'].Value + day;\r
        }\r
-       \r
+\r
        var dayFirst = true;\r
-       if (dateFormat == 'MMDD')\r
+       if (config['dateFormat'].Value == 'MMDD')\r
                dayFirst = false;\r
-       else if (dateFormat == 'DDMM')\r
+       else if (config['dateFormat'].Value == 'DDMM')\r
                dayFirst = true;\r
-       else { // dateFormat == 'auto', try to detect system setting\r
+       else {\r
+               // config['dateFormat'].Value == 'auto', try to detect system setting\r
                // parse date\r
                var day_ = dateArr[1];\r
                var month_ = dateArr[2];\r
                var year_ = dateArr[3];\r
                // make sure month is set properly\r
-               if (isNaN(parseInt(day_))){\r
+               if (isNaN(parseInt(day_))) {\r
                        var tmp = day_;\r
                        day_ = month_;\r
                        month_ = tmp;\r
                        dayFirst = false;\r
-               }\r
-               else if (isNaN(parseInt(year_))){\r
+               } else if (isNaN(parseInt(year_))) {\r
                        var tmp = year_;\r
                        year_ = month_;\r
                        month_ = tmp;\r
@@ -278,11 +395,11 @@ function formatDate(date, format)
                if (Number(day_) > Number(year_))\r
                        dayFirst = false;\r
        }\r
-       \r
+\r
        if (dayFirst)\r
-               return day + dateSeparator + month;\r
+               return day + config['dateSeparator'].Value + month;\r
        else\r
-               return month + dateSeparator + day;\r
+               return month + config['dateSeparator'].Value + day;\r
 }\r
 \r
 function formatTime(date)\r
@@ -292,30 +409,36 @@ function formatTime(date)
        var time = date.toLocaleTimeString().replace(/[\.:]00/, ''); // remove seconds from string\r
        if (time.replace(/\./, ':').split(':')[0].length < 2)\r
                time = '0' + time;\r
-       if (showNowAsText && date.getTime() == now.getTime())\r
-               time = '<span class="now">' + nowText + '</span>';\r
+       if (config['showNowAsText'].Value && date.getTime() == now.getTime())\r
+               time = '<span class="now">' + config['nowText'].Value + '</span>';\r
        return time;\r
 }\r
 \r
-function updateData(){\r
-       try{\r
+function updateData()\r
+{\r
+       console.info('updateData()');\r
+       calcDaylightSaving();\r
+       try {\r
                // meetings have time\r
                // note: anniveraries have a start time of 12:00am. So since we want to include them, we have to query the whole day and check if events have passed later\r
                now = new Date();\r
                var meetingListFiltering = {\r
-                       Type:'CalendarEntry', \r
+                       Type:'CalendarEntry',\r
                        Filter:{\r
-                               StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)), \r
-                               EndRange: (new Date(now.getFullYear(), now.getMonth() + monthRange, now.getDate(), 0, 0, 0))\r
+                               StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)),\r
+                               EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0))\r
                        }\r
                }\r
                var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering);\r
+               if (meetingResult.ErrorCode != 0)\r
+                       throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage);\r
                var meetingList = meetingResult.ReturnValue;\r
+\r
                // todos don't, they start on 00:00 hrs., but should be visible anyway\r
                // this will generate a list of passed todos. We have to check if they have been marked as "done" yet\r
-               if (includeTodos){\r
+               if (config['includeTodos'].Value) {\r
                        var todayTodoListFiltering = {\r
-                               Type:'CalendarEntry', \r
+                               Type:'CalendarEntry',\r
                                Filter:{\r
                                        Type: 'ToDo',\r
                                        StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)),\r
@@ -328,24 +451,29 @@ function updateData(){
                } else {\r
                        var entryLists = [meetingList];\r
                }\r
-       }catch(e){ \r
+       } catch(e) {\r
                error('loading Calendar items list:' + e + ', line ' + e.line);\r
                return;\r
        }\r
-       \r
-       try{\r
+\r
+       try {\r
                var entry;\r
                var counter = 0;\r
                var entryDate = '';\r
                var dateArr = [];\r
                var entriesHtml = '<table>';\r
                var eventIds = [];\r
-               var max = ((panelNum == 0) ? eventsPerWidget : 2 * eventsPerWidget);\r
+               var max;\r
+               if (mode == 0)\r
+                       max = ((panelNum == 0) ? config['eventsPerWidget'].Value : 2 * config['eventsPerWidget'].Value);\r
+               else\r
+                       max = 30; // we can display a lot more events in fullscreen mode\r
+\r
                // the first outer loop iteration is for passed ToDos, the second loop is for all upcomming events (may also include ToDos)\r
-               for(var i=0; counter < max && i < entryLists.length; i++){\r
-                       while( counter < max && (entry = entryLists[i].getNext()) != undefined ){\r
+               for (var i=0; counter < max && i < entryLists.length; i++) {\r
+                       while (counter < max && (entry = entryLists[i].getNext()) != undefined) {\r
                                counter++;\r
-                               \r
+\r
                                // output event info for debugging\r
                                console.info(\r
                                        'event: Id=' + entry.id + \r
@@ -358,16 +486,16 @@ function updateData(){
                                        ',InstanceStartTime=' + entry.InstanceStartTime +\r
                                        ',InstanceEndTime=' + entry.InstanceEndTime\r
                                );\r
-                               \r
+\r
                                // we don't want ToDos when includeTodos == false or when they are completed\r
-                               if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !includeTodos)){\r
+                               if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !config['includeTodos'].Value)) {\r
                                        console.info('skipping ' + entry.id );\r
                                        counter--;\r
                                        continue;\r
                                }\r
 \r
                                // make sure that we don't include an event twice (useful for ToDos that might come up twice)\r
-                               if (eventIds[entry.id] == 1){\r
+                               if (eventIds[entry.id] == 1 && entry.Type == 'ToDo') {\r
                                        console.info('skipped (already included) ' + entry.id);\r
                                        counter--;\r
                                        continue;\r
@@ -376,53 +504,52 @@ function updateData(){
 \r
                                // summary can be undefined!\r
                                var Summary = ((entry.Summary == null) ? '' : entry.Summary);\r
-                               if (entry.Type == 'Meeting' && entry.Location != '' && showLocation){\r
+                               if (entry.Type == 'Meeting' && entry.Location != '' && config['showLocation'].Value)\r
                                        Summary += ', ' + entry.Location;\r
-                               }\r
                                \r
                                // fix by yves: determine start and end dates/times\r
                                entryStartTime = ((entry.InstanceStartTime == null) ? entry.StartTime : entry.InstanceStartTime);\r
                                entryEndTime = ((entry.InstanceEndTime == null) ? entry.EndTime : entry.InstanceEndTime);\r
-                               \r
+\r
                                // there can be ToDos that have no date at all!\r
                                if (entry.Type == 'ToDo' && entry.EndTime == null)\r
                                        entryDate = ""; // this will cause parseDate(entryDate) to return null;\r
                                else\r
                                        entryDate = ((entry.Type == 'ToDo') ? entryEndTime : entryStartTime); // ToDo's use their EndTime, the rest use StartTime\r
-                               \r
+\r
                                // Convert date/time string to Date object\r
                                var date = parseDate(entryDate);\r
                                console.info('date: ' + date);\r
                                var endDate = ((entryEndTime == null) ? null : parseDate(entryEndTime));\r
                                console.info('endDate: ' + endDate);\r
-                               \r
+\r
                                // check if meeting event has already passed\r
-                               if (entry.Type == 'Meeting'){\r
+                               if (entry.Type == 'Meeting') {\r
                                        var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
-                                       if (now.getTime() > compareTime){\r
+                                       if (now.getTime() > compareTime) {\r
                                                console.info('skipping Meeting (already passed) ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
                                                continue;\r
                                        }\r
                                }\r
-                               \r
+\r
                                // check if anniversary passed (not sure why they are in the list, the query was only for today - nokia?)\r
-                               if (entry.Type == 'Anniversary'){\r
+                               if (entry.Type == 'Anniversary') {\r
                                        var tmp = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);\r
-                                       if ( date.getTime() < tmp.getTime() ){\r
+                                       if (date.getTime() < tmp.getTime()) {\r
                                                console.info('skipping Anniversary (already passed) ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
                                                continue;\r
                                        }\r
                                }\r
-                               \r
+\r
                                // fix DayEvents end time. End times are off by 1 Second. It's possible that the event has already passed\r
-                               if (entry.Type == 'DayEvent' && endDate != null){\r
+                               if (entry.Type == 'DayEvent' && endDate != null) {\r
                                        endDate.setMinutes(endDate.getMinutes() - 1);\r
                                        console.info('fixing DayEvent endDate: ' + endDate);\r
-                                       if (now.getTime() > endDate.getTime()){\r
+                                       if (now.getTime() > endDate.getTime()) {\r
                                                console.info('event already passed ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
@@ -431,132 +558,420 @@ function updateData(){
                                }\r
 \r
                                // check if the event is currently taking place\r
-                               if (entryStartTime != null && entryEndTime != null && date != null && endDate != null)\r
-                               {\r
+                               if (entryStartTime != null && entryEndTime != null && date != null && endDate != null) {\r
                                        // check if we are between start and endtime\r
                                        if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) {\r
                                                date = now; // change appointment date/time to now\r
                                                console.info('event is currently taking place: ' + date);\r
                                        }\r
                                }\r
-                               \r
-                               // skip events for the first panel in case this is the second one\r
-                               if (panelNum == 1 && counter < eventsPerWidget + 1){\r
+\r
+                               // skip events for the first panel in case this is the second one and we're not in fullscreen mode\r
+                               if (mode == 0 && panelNum == 1 && counter < config['eventsPerWidget'].Value + 1) {\r
                                        console.info('skipping (already in first widget) ' + entry.id);\r
                                        continue;\r
                                }\r
-                               \r
+\r
                                // generate html output\r
                                entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
-                               if(date == null){ // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
+                               if(date == null) {\r
+                                       // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
                                        entriesHtml += '<td colspan="4"><span class="date">' + entryDate + '</span> ';\r
-                               }else{\r
-                                       var weekDay = date.toLocaleDateString().substr(0,weekDayLength);\r
+                               } else {\r
+                                       var weekDay = date.toLocaleDateString().substr(0,config['weekDayLength'].Value);\r
                                        var time = formatTime(date);\r
                                        var dateStr = formatDate(date, entryDate);\r
-                                       if( entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder' ){\r
-                                               // decide if we want to leave off the weekday\r
-                                               if (dateStr.search(/Today/) != -1)\r
-                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
+                                       if (entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder') {\r
+                                               if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value) // show weekday if the date string is not text. looks odd otherwise\r
+                                                       entriesHtml += '<td colspan="4" width="1px"><span class="date">' + dateStr + '</span> ';\r
                                                else\r
-                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
-                                       }else if( entry.Type == 'Meeting' ){\r
-                                               if (showCombinedDateTime) {\r
-                                                       if (now.getDate() == date.getDate() && now.getMonth() == date.getMonth())\r
-                                                               entriesHtml += '<td colspan="4"><span class="today">'+ time +'</span> ';\r
-                                                       else {\r
-                                                               // decide if we want to leave off the weekday\r
-                                                               if (dateStr.search(/Today/) != -1)\r
-                                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
-                                                               else\r
-                                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
-                                                       }\r
+                                                       entriesHtml += '<td class="weekDay" width="1px">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td colspan="2">';\r
+                                       } else if (entry.Type == 'Meeting') {\r
+                                               if (config['showCombinedDateTime'].Value) {\r
+                                                       if (isToday(date))\r
+                                                               entriesHtml += '<td width="1px" colspan="4"><span class="today">' + time + '</span> ';\r
+                                                       else if (isTomorrow(date))\r
+                                                               entriesHtml += '<td width="1px" colspan="4"><span class="tomorrow">' + dateStr + '</span> <span class="time">' + time + '</span> ';\r
+                                                       else\r
+                                                               entriesHtml += '<td width="1px" class="weekDay">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td colspan="2">';\r
                                                } else {\r
-                                                       // decide if we want to leave off the weekday\r
-                                                       if (dateStr.search(/Today/) != -1)\r
-                                                               entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> <span class="time">'+ time +'</span> ';\r
+                                                       if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value)\r
+                                                               entriesHtml += '<td colspan="4" width="1px"><span class="today">' + dateStr + '</span> <span class="time">' + time + '</span> ';\r
                                                        else\r
-                                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td width="1px"><span class="time">'+ time +'</span></td><td>';\r
+                                                               entriesHtml += '<td width="1px" class="weekDay">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td width="1px" class="time">' + time + '</td><td>';\r
                                                }\r
                                        }\r
                                }\r
-                               entriesHtml += '<span class="description">' + Summary +'</span></td></tr>';\r
+                               entriesHtml += '<span class="description">' + Summary + '</span></td></tr>';\r
                        }\r
                }\r
                entriesHtml += '</table>';\r
-               if (showNothingText && entriesHtml == '<table></table>')\r
-                       entriesHtml = '<div style="width:295px; height:75px; text-align:center; line-height:75px; overflow:visible;">' + nothingText + '</div>';\r
-               if( cacheEntriesHtml != entriesHtml ){\r
-                       document.getElementById('calendarList').innerHTML = entriesHtml;\r
+               if (config['showNothingText'].Value && entriesHtml == '<table></table>') {\r
+                       var text = config['nothingText'].Value.replace(/%d/, config['monthRange'].Value);\r
+                       entriesHtml = '<div style="width:295px; height:75px; text-align:center; line-height:75px; overflow:visible;">' + text + '</div>';\r
+               }\r
+               if (cacheEntriesHtml != entriesHtml) {\r
+                       if (mode == 0)\r
+                               document.getElementById('calendarList').innerHTML = entriesHtml;\r
+                       else\r
+                               document.getElementById('fullscreenCalendarList').innerHTML = entriesHtml;\r
                        cacheEntriesHtml = entriesHtml;\r
                }\r
-       }catch(e){\r
+       } catch(e) {\r
                error('displaying list:' + e + ', line ' + e.line);\r
                return;\r
        }\r
 }\r
 \r
-function updateScreen(){\r
-       // Check if opening fullscreen\r
-       if( window.innerHeight > 91){\r
-               launchCalendar();\r
+function updateScreen()\r
+{\r
+       // check if opening fullscreen\r
+       if( window.innerHeight > 91 && mode == 0) {\r
+               mode = 1;\r
+               cacheEntriesHtml = '';\r
+               document.getElementById('body').style.backgroundImage = "";\r
+               showFullscreen();\r
        }\r
+       else if (window.innerHeight <= 91 && mode != 0) {\r
+               mode = 0;\r
+               cacheEntriesHtml = '';\r
+               showHomescreen();\r
+       }\r
+       \r
+       if (mode == 0)\r
+               updateHomescreen();\r
+       else if (mode == 1)\r
+               updateFullscreen();\r
+}\r
+\r
+function launchCalendar()\r
+{\r
+       try {\r
+               widget.openApplication(config['calendarApp'].Value, "");\r
+               if (config['hideWidgetOnCalendarOpen'].Value)\r
+                       window.close();\r
+       } catch(e) {\r
+               error('starting Calendar App');\r
+               return;\r
+       }\r
+}\r
+\r
+function init()\r
+{\r
+       console.info('New widget instance starting up...');\r
+       \r
+       try {\r
+               // call calendar service\r
+               if (device != "undefined")\r
+                       calendarService = device.getServiceObject("Service.Calendar", "IDataSource");\r
+               else\r
+                       throw('device object does not exist');\r
+       } catch(e) {\r
+               error('loading Calendar service: ' + e + ', line ' + e.line);\r
+               return;\r
+       }\r
+\r
+       loadSettings();\r
+       updateCssClasses();\r
+       collectLocales();\r
+       //updateData();\r
+       requestNotification();\r
+       window.setInterval('updateData()', 1000 * 60 * config['updateDataInterval'].Value);\r
+\r
+       mode = 0;\r
+       showHomescreen();\r
+       updateScreen();\r
+       if (config['useBackgroundImage'].Value)\r
+               // check for screen rotation every 1 secs\r
+               window.setInterval('updateScreen()', 1000 * 1);\r
+}\r
+\r
+function createMenu()\r
+{\r
+       window.menu.setLeftSoftkeyLabel("",null);\r
+       window.menu.setRightSoftkeyLabel("",null);\r
+       var id = 0;\r
+       var menuSettings = new MenuItem(getLocalizedText('menu.settings'), id++);\r
+       var menuCallApp = new MenuItem(getLocalizedText('menu.openCalendarApp'), id++);\r
+       var menuAbout = new MenuItem(getLocalizedText('menu.about'), id++);\r
+       menuSettings.onSelect = showSettings;\r
+       menuAbout.onSelect = showAbout;\r
+       menuCallApp.onSelect = launchCalendar;\r
+       window.menu.clear();\r
+       window.menu.append(menuCallApp);\r
+       window.menu.append(menuSettings);\r
+       window.menu.append(menuAbout);  \r
+}\r
+\r
+function showSettings()\r
+{\r
+       mode = 2;\r
+       document.getElementById("homescreenView").style.display = "none";\r
+       document.getElementById("fullscreenView").style.display = "none";\r
+       document.getElementById("aboutView").style.display = "none";\r
+       document.getElementById("settingsView").style.display = "block";\r
+       document.onclick = null;\r
+       \r
+       window.menu.setLeftSoftkeyLabel(getLocalizedText('settings.save'), function()\r
+       {\r
+               for (var key in config) {\r
+                       if (config[key].Type == 'String')\r
+                               config[key].Value = document.forms[0].elements["settings." + key].value;\r
+                       else if (config[key].Type == 'Int') {\r
+                               config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);\r
+                               if (config[key].Value < 0)\r
+                                       config[key].Value = config[key].Default;\r
+                       }\r
+                       else if (config[key].Type == 'Bool')\r
+                               config[key].Value = document.forms[0].elements["settings." + key].checked;\r
+                       else if (config[key].Type == 'UID')\r
+                               config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);\r
+                       else if (config[key].Type == 'Enum') {\r
+                               config[key].Value = document.forms[0].elements["settings." + key].value;\r
+                               if (config[key].ValidValues.indexOf(config[key].Value) == -1)\r
+                                       config[key].Value = config[key].Default;\r
+                       }\r
+               }\r
+                               \r
+               updateCssClasses();\r
+               \r
+               saveSettings();\r
+               \r
+               mode = 1;\r
+               showFullscreen();\r
+       });\r
+       window.menu.setRightSoftkeyLabel(getLocalizedText('settings.cancel'), function()\r
+       {\r
+               mode = 1;\r
+               showFullscreen();\r
+       });\r
+       \r
+       var settingsHtml = '<form>';\r
+       for (var key in config) {\r
+               if (config[key].Type == 'String')\r
+                       settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="' + config[key].Value + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+               else if (config[key].Type == 'Int')\r
+                       settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="' + config[key].Value + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+               else if (config[key].Type == 'Bool')\r
+                       settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input name="settings.' + key + '" type="checkbox" value="true" ' + (config[key].Value ? 'checked="checked"' : '') + '/></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+               else if (config[key].Type == 'UID')\r
+                       settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="0x' + config[key].Value.toString(16) + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+               else if (config[key].Type == 'Enum') {\r
+                       settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><select name="settings.' + key + '" size="1">';\r
+                       for(var i = 0; i < config[key].ValidValues.length; i++)\r
+                               settingsHtml += '<option label="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + config[key].ValidValues[i] + '</option>';\r
+                       settingsHtml += '</select></div></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+               }\r
+       }\r
+       settingsHtml += '<input name="reset" type="button" value="' + getLocalizedText('settings.restoreDefaults') + '" onclick="javascript:restoreDefaultSettings();showSettings();" />';\r
+       settingsHtml += '</form>';\r
+       document.getElementById("settingsList").innerHTML = settingsHtml;\r
+}\r
+\r
+function changeCssClass(classname, properties)\r
+{\r
+       for(var i = 0; i < document.styleSheets[0]['cssRules'].length; i++)\r
+       {\r
+               if (document.styleSheets[0]['cssRules'][i].selectorText == classname) {\r
+                       document.styleSheets[0].deleteRule(i);\r
+                       document.styleSheets[0].insertRule(classname + ' { ' + properties + ' }', document.styleSheets[0]['cssRules'].length);\r
+                       break;\r
+               }\r
+       }\r
+}\r
+\r
+function updateCssClasses()\r
+{\r
+       for(var key in config) {\r
+               changeCssClass(getLocalizedText('settings.name.' + key), config[key].Value);\r
+       }\r
+}\r
+\r
+function restoreDefaultSettings()\r
+{\r
+       for (var key in config)\r
+               config[key].Value = config[key].Default;\r
+}\r
+\r
+function loadSettings()\r
+{\r
+       for (var key in config) {\r
+               if (widget.preferenceForKey(key)) {\r
+                       if (config[key].Type == 'Int')\r
+                               config[key].Value = Number(widget.preferenceForKey(key));\r
+                       else if (config[key].Type == 'String')\r
+                               config[key].Value = widget.preferenceForKey(key);\r
+                       else if (config[key].Type == 'Bool')\r
+                               config[key].Value = (widget.preferenceForKey(key) == 'true')\r
+                       else if (config[key].Type == 'Enum')\r
+                               config[key].Value = widget.preferenceForKey(key);\r
+                       else if (config[key].Type == 'UID')\r
+                               config[key].Value = Number(widget.preferenceForKey(key));\r
+               }\r
+               else\r
+                       config[key].Value = config[key].Default;\r
+               console.info('Settings: ' + key + '=\'' + config[key].Value + '\'');\r
+       }\r
+}\r
+\r
+function saveSettings()\r
+{\r
+       for (var key in config) {\r
+               if (config[key].Type == 'Int')\r
+                       widget.setPreferenceForKey(config[key].Value.toString(), key);\r
+               else if (config[key].Type == 'String')\r
+                       widget.setPreferenceForKey(config[key].Value, key);\r
+               else if (config[key].Type == 'Bool')\r
+                       widget.setPreferenceForKey(config[key].Value ? 'true' : 'false', key);\r
+               else if (config[key].Type == 'Enum')\r
+                       widget.setPreferenceForKey(config[key].Value, key);\r
+               else if (config[key].Type == 'UID')\r
+                       widget.setPreferenceForKey(config[key].Value.toString(), key);\r
+       }\r
+}\r
+\r
+function toggleVisibility(elementId)\r
+{\r
+       if (document.getElementById(elementId).style.display == "none")\r
+               document.getElementById(elementId).style.display = "block";\r
+       else\r
+               document.getElementById(elementId).style.display = "none";\r
+}\r
+\r
+var uniqueId = 0;\r
+function printHintBox(text)\r
+{\r
+       uniqueId++;\r
+       return '<td width="1%" align="right" onclick="javascript:toggleVisibility(\'info' + uniqueId + '\')">' + getLocalizedText('settings.help') + '</td></tr></table>'+\r
+              '<div class="settingsInfo" id="info' + uniqueId + '">' + text + '</div>';\r
+}\r
+\r
+function showAbout()\r
+{\r
+       mode = 3;\r
+       document.getElementById("homescreenView").style.display = "none";\r
+       document.getElementById("fullscreenView").style.display = "none";\r
+       document.getElementById("aboutView").style.display = "block";\r
+       document.getElementById("settingsView").style.display = "none";\r
+       document.onclick = null;\r
+       \r
+       window.menu.setLeftSoftkeyLabel(" ", function(){});\r
+       window.menu.setRightSoftkeyLabel("Back", function()\r
+       {\r
+               mode = 1;\r
+               showFullscreen();\r
+       });\r
        \r
-       if (useBackgroundImage){\r
+       //document.getElementById("aboutView").innerHTML = 'aboutView';\r
+       document.getElementById("name").innerHTML = "Coming Next " + version;\r
+}\r
+\r
+function updateFullscreen()\r
+{\r
+}\r
+\r
+function showFullscreen()\r
+{\r
+       document.getElementById("homescreenView").style.display = "none";\r
+       document.getElementById("fullscreenView").style.display = "block";\r
+       document.getElementById("aboutView").style.display = "none";\r
+       document.getElementById("settingsView").style.display = "none";\r
+       document.getElementById('body').className = "backgroundFullscreen";\r
+       document.onclick = launchCalendar;\r
+       createMenu();\r
+       updateData();\r
+}\r
+\r
+function updateHomescreen()\r
+{\r
+       if (config['useBackgroundImage'].Value) {\r
                // check for screen rotation\r
-               if (orientation != 'portrait' && screen.width == 360 && screen.height == 640){\r
+               if (orientation != 'portrait' && screen.width == 360 && screen.height == 640) {\r
                        window.widget.prepareForTransition("fade");\r
                        orientation = 'portrait';\r
                        document.getElementById('body').style.backgroundImage = 'url(background_' + orientation + '.png)';\r
                        document.getElementById('body').style.backgroundColor = 'none';\r
                        window.widget.performTransition();\r
-               }else if (orientation != 'landscape' && screen.width == 640 && screen.height == 360){\r
+               } else if (orientation != 'landscape' && screen.width == 640 && screen.height == 360) {\r
                        window.widget.prepareForTransition("fade");\r
                        orientation = 'landscape';\r
                        document.getElementById('body').style.backgroundImage = 'url(background_' + orientation + '.png)';\r
                        document.getElementById('body').style.backgroundColor = 'none';\r
                        window.widget.performTransition();\r
                }\r
+               else if (document.getElementById('body').style.backgroundImage == "")\r
+               {\r
+                       document.getElementById('body').style.backgroundImage = 'url(background_' + orientation + '.png)';\r
+               }\r
        }\r
 }\r
 \r
-function launchCalendar(){\r
-   try{\r
-               widget.openApplication(calendarApp, "");\r
-               window.close();\r
-   }catch(e){\r
-               error('starting Calendar App');\r
-               return;\r
-   }\r
-}\r
-\r
-function init(){\r
-       try{\r
-               calendarService = device.getServiceObject("Service.Calendar", "IDataSource"); // call calendar service\r
-       }catch(e){\r
-               error('loading Calendar service');\r
-               return;\r
-       }\r
-       collectLocales();\r
+function showHomescreen()\r
+{\r
+       document.getElementById("homescreenView").style.display = "block";\r
+       document.getElementById("fullscreenView").style.display = "none";\r
+       document.getElementById("aboutView").style.display = "none";\r
+       document.getElementById("settingsView").style.display = "none";\r
+       document.getElementById('body').className = "background";\r
+       document.onclick = null;\r
        updateData();\r
-       requestNotification();\r
-       window.setInterval('updateData()', 1000 * 60 * updateDataInterval); // start update interval every 5 minutes\r
+}\r
 \r
-       updateScreen();\r
-       if (useBackgroundImage)\r
-               window.setInterval('updateScreen()', 1000 * 3); // check for screen rotation every 3 secs\r
+function getLocalizedText(p_Txt)\r
+{\r
+       if (localizedText[p_Txt])\r
+               return localizedText[p_Txt];\r
+       else \r
+               return 'ERROR: missing translation for ' + p_Txt;\r
 }\r
 </script>\r
+\r
 <style type="text/css">\r
-table{ margin:0px; padding:0px; border-spacing:0px; }\r
-td{ padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }\r
-#homescreenView{ width: 315px; height:91px; overflow:hidden; }\r
-#calendarList{ position:absolute; left:10px; top:4px; width:295px; height:75px; overflow:hidden; }\r
+table { margin:0px; padding:0px; border-spacing:0px; }\r
+td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }\r
+hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; border-style:none; }\r
+.settingsInfo { display:none; font-style:italic; }\r
+.title { font-weight:bold; font-size:14pt; }\r
+.textInput { width:90%; }\r
+.credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }\r
+#homescreenView { width: 315px; height:91px; overflow:hidden; }\r
+#calendarList { position:absolute; left:10px; top:4px; width:295px; height:75px; overflow:hidden; }\r
+#name { text-align:center; }\r
+#appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
+#smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r
 </style>\r
+\r
 </head>\r
+\r
 <body id="body" class="background">\r
 <div id="homescreenView">\r
        <div id="calendarList"></div>\r
 </div>\r
+<div id="fullscreenView" style="display:none;">\r
+       <img src="Icon.png" id="smallappicon">\r
+       <h1 class="title">Coming Next</h1>\r
+       <hr />\r
+       <div id="fullscreenCalendarList">loading...</div>\r
+</div>\r
+<div id="settingsView" style="display:none">\r
+       <img src="Icon.png" id="smallappicon">\r
+       <h1 class="title">Settings</h1>\r
+       <hr />\r
+       <div id="settingsList"></div>\r
+</div>\r
+<div id="aboutView" style="display:none">\r
+       <img src="Icon.png" id="appicon">\r
+       <h1 id="name">Coming Next</h1>\r
+       <hr />\r
+       <p>Created by Dr. Cochambre and Michael Prager.</p>\r
+       <p>Contributions:</p>\r
+               <p class="credits">Paul Moore (bug fixes, new features and code cleanup)</p>\r
+               <p class="credits">Manfred Hanselmann (DST support)</p>\r
+               <p class="credits">Christophe Milsent (translation support & french translation</p>\r
+       <p>This software is open source and licensed under the GPLv3.</p>\r
+       <p>Visit sourceforge.net/projects/comingnext for free updates.</p>\r
+       <hr />\r
+</div>\r
 </body>\r
-</html>
\ No newline at end of file
+\r
+</html>\r