home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / vbasic / Data / Utils / WME71SDK.exe / RCDATA / CABINET / newsgroups.js < prev    next >
Text File  |  2001-03-15  |  4KB  |  176 lines

  1.     // 
  2.     // FORM VALIDATION CODE
  3.     // 
  4.  
  5.     function ValidateForm()
  6.     {
  7.     
  8.         if ("" == document.Form1.NGName.value || "" == document.Form1.startdate.value ){
  9.         
  10.             if("" == document.Form1.NGName.value){
  11.                 window.alert("Please enter NewsgroupName");
  12.                 document.Form1.NGName.focus();
  13.                 document.Form1.NGName.select();
  14.             }
  15.             else{
  16.                 window.alert("Please enter Date");
  17.             }            
  18.             return false;
  19.  
  20.             
  21.         }else{
  22.             return DateValidate();
  23.         }
  24.     }
  25.     
  26.     function DateValidate(){
  27.         
  28.         var dateStr = document.Form1.startdate.value
  29.         var mm,dd,yyyy
  30.         var dateArray
  31.         var today
  32.         today = new Date()
  33.         
  34.         dateArray = dateStr.split("/");
  35.             
  36.         mm = dateArray[0]
  37.         dd = dateArray[1]
  38.         yyyy = dateArray[2]
  39.         
  40.         if (isNaN(dateArray[0])){
  41.             alert ("Not a valide date format : please enter 'mm/dd/yyyy'")
  42.             return false;
  43.         }
  44.         if ( mm == "" || mm >12 || mm < 1 )    {
  45.             window.alert("Please correct Month");
  46.             return false;
  47.         }else{
  48.             if(dd =="" || dd >31 || dd< 1){
  49.                 window.alert("Please correct Day");
  50.                 return false;
  51.             }else{
  52.             
  53.                 if(yyyy == "" || yyyy < 1999 || yyyy > today.getYear()){
  54.                     window.alert("Please correct year");
  55.                     return false;
  56.                 }else{
  57.                     return true;
  58.                 }
  59.             }
  60.         }
  61.         
  62.     }
  63.  
  64.     function fnTabClick( nTab )
  65.     {
  66.  
  67.         nTab = parseInt(nTab);
  68.         var oTab;
  69.         var prevTab = nTab-1;
  70.         var nextTab = nTab+1;
  71.         
  72.         document.Form1.tabIndex.value = nTab;
  73.         
  74.         event.cancelBubble = true;
  75.         el = event.srcElement;
  76.  
  77.         for (var i = 0; i < newsContent.length; i++)
  78.         {
  79.             oTab = tabs[i];
  80.             oTab.className = "clsTab";
  81.             oTab.style.borderLeftStyle = "";
  82.             oTab.style.borderRightStyle = "";
  83.             newsContent[i].style.display = "none";
  84.         }
  85.         newsContent[nTab].style.display = "block";
  86.         tabs[nTab].className = "clsTabSelected";
  87.         oTab = tabs[nextTab];
  88.         if (oTab) oTab.style.borderLeftStyle = "none";
  89.         oTab = tabs[prevTab];
  90.         if (oTab) oTab.style.borderRightStyle = "none";
  91.         event.returnValue = false;
  92.     }
  93.  
  94.     function RedirectASC( SortCal , Period ){
  95.         event.cancelBubble = true
  96.         
  97.         var StartsWith;
  98.         if(document.Form1.mode[0].checked){
  99.             StartsWith = "0";
  100.         }
  101.         else{
  102.             StartsWith = "1";
  103.         }
  104.         
  105.         UrlStr = "default.asp?NGName="+document.Form1.NGName.value+"&mode="+StartsWith+"&period="+Period+"&startdate="+document.Form1.startdate.value+"&sortcolumn="+SortCal+"&sort="+"ASC"+"&tabIndex="+ document.Form1.tabIndex.value;
  106.         window.location.href = UrlStr ;
  107.         return false ;
  108.     }
  109.     
  110.     function RedirectDESC( SortCal , Period ){
  111.         event.cancelBubble = true
  112.         
  113.         var StartsWith;
  114.     
  115.         if(document.Form1.mode[0].checked){
  116.             StartsWith = "0";
  117.         }
  118.         else{
  119.             StartsWith = "1";
  120.         }
  121.  
  122.         UrlStr = "default.asp?NGName="+document.Form1.NGName.value+"&mode="+StartsWith+"&period="+Period+"&startdate="+document.Form1.startdate.value+"&sortcolumn="+SortCal+"&sort="+"DESC"+"&tabIndex="+ document.Form1.tabIndex.value;
  123.         window.location.href = UrlStr ;
  124.         return false ;
  125.     }
  126.     
  127.     function fnTabClickTT( nTab )
  128.     {
  129.         nTab = parseInt(nTab);
  130.         var oTab;
  131.         var prevTab = nTab-1;
  132.         var nextTab = nTab+1;
  133.         event.cancelBubble = true;
  134.         el = event.srcElement;
  135.             for (var i = 0; i < 3; i++)
  136.             {
  137.                 oTab = tabs[i];
  138.                 oTab.className = "clsTab";
  139.                 oTab.style.borderLeftStyle = "";
  140.                 oTab.style.borderRightStyle = "";
  141.                 NGReport[i].style.display = "none";
  142.             }
  143.             NGReport[nTab].style.display = "block";
  144.             tabs[nTab].className = "clsNgHead";
  145.             oTab = tabs[nextTab];
  146.             if (oTab) oTab.style.borderLeftStyle = "none";
  147.             oTab = tabs[prevTab];
  148.             if (oTab) oTab.style.borderRightStyle = "none";
  149.             event.returnValue = false;
  150.     }
  151.     
  152.     function fnTabClickTTSub( nTab )
  153.     {
  154.         nTab = parseInt(nTab);
  155.         var oTab;
  156.         var prevTab = nTab-1;
  157.         var nextTab = nTab+1;
  158.         event.cancelBubble = true;
  159.         el = event.srcElement;
  160.             for (var i = 0; i < 3; i++)
  161.             {
  162.                 oTab = tabs[i];
  163.                 oTab.className = "clsTab";
  164.                 oTab.style.borderLeftStyle = "";
  165.                 oTab.style.borderRightStyle = "";
  166.                 NGReportTTSub[i].style.display = "none";
  167.             }
  168.                 NGReportTTSub[nTab].style.display = "block";
  169.             tabs[nTab].className = "clsNgHead";
  170.             oTab = tabs[nextTab];
  171.             if (oTab) oTab.style.borderLeftStyle = "none";
  172.             oTab = tabs[prevTab];
  173.             if (oTab) oTab.style.borderRightStyle = "none";
  174.             event.returnValue = false;
  175.     }
  176.