* Fixes for ScrollBar
[lichviet] / qml / LichViet / CacNgayLeTrongNam.js
index 8717ede..06db5ab 100644 (file)
@@ -3,7 +3,7 @@ Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+the Free Software Foundation, either version 2 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
@@ -88,17 +88,17 @@ var Loi_Hay_Y_Dep = new Array(
         "Hãy yêu mến lời khuyên can,<br>đừng yêu mếm lời tâng nịnh.<br><i>(Ngạn ngữ Nga)</i>"
         );
 
         "Hãy yêu mến lời khuyên can,<br>đừng yêu mếm lời tâng nịnh.<br><i>(Ngạn ngữ Nga)</i>"
         );
 
-function get(obj) {
+function get(curDay, curMonth,lunarDay, lunarMonth) {
     var day_info = "";
 
     for (var i=0;i<AmLich.length;i++)
     var day_info = "";
 
     for (var i=0;i<AmLich.length;i++)
-        if (AmLich[i][0] == obj.lunarDay && AmLich[i][1] == obj.lunarMonth){
+        if (AmLich[i][0] == lunarDay && AmLich[i][1] == lunarMonth){
             day_info+=AmLich[i][2];
             break;
          }
 
     for(i=0;i<DuongLich.length;i++)
             day_info+=AmLich[i][2];
             break;
          }
 
     for(i=0;i<DuongLich.length;i++)
-        if (DuongLich[i][0] == obj.curDay && DuongLich[i][1] == obj.curMonth){
+        if (DuongLich[i][0] == curDay && DuongLich[i][1] == curMonth){
             if (!day_info)
                 day_info=DuongLich[i][2];
             else
             if (!day_info)
                 day_info=DuongLich[i][2];
             else
@@ -111,10 +111,15 @@ function get(obj) {
         var rannum=Math.floor(Math.random()*Loi_Hay_Y_Dep.length)
         day_info =  Loi_Hay_Y_Dep[rannum];
     }
         var rannum=Math.floor(Math.random()*Loi_Hay_Y_Dep.length)
         day_info =  Loi_Hay_Y_Dep[rannum];
     }
+
     return  day_info;
 }
 
 function is_holiday(day, month, lunar_day, lunar_month){
     return  day_info;
 }
 
 function is_holiday(day, month, lunar_day, lunar_month){
+
+    if (day === 0 || month === 0)
+        return false;
+
     for(var i=0;i<DuongLich.length;i++)
         if (DuongLich[i][0] == day && DuongLich[i][1] ==month)
             return true;
     for(var i=0;i<DuongLich.length;i++)
         if (DuongLich[i][0] == day && DuongLich[i][1] ==month)
             return true;