﻿// JScript 檔


function fStyleSetting()
{
     var tables = document.getElementById('aspnetform').getElementsByTagName('table');

     for(icount=0;icount<tables.length;icount++)
      {
          if(tables[icount].id.substr(0,3).toUpperCase() == "STB")
           {
                tables[icount].className = 'sysTable';
                fChildTDStyle(tables[icount]);
           } 
      }
      var btns =  document.getElementById('aspnetform').getElementsByTagName('input');
      
      
      for(icount=0;icount<btns.length;icount++)
      {
          var btnObj = btns[icount];
         
          // 有設定class的button不處理 
          if(btnObj.className != '')
             continue;  
             
         switch(btnObj.type)
         { 
          case "button":
          case "submit":
          
              if(btnObj.value.length <=2 )
              {
                  
                  btnObj.className = "btnS";
                  
                  btnObj.onmouseover =function(){this.className='btnSHover';}
                  btnObj.onmouseout = function(){this.className='btnS';}
              }  
              else if(btnObj.value.length <= 4)
              {
                  btnObj.className = "btnM"; 
                  btnObj.onmouseover = function(){this.className='btnMHover';} 
                  btnObj.onmouseout = function(){this.className='btnM';}          
              } 
              else 
              {
                  btnObj.className = "btnL"; 
                  btnObj.onmouseover = function(){this.className='btnLHover';}
                  btnObj.onmouseout = function(){this.className='btnL';}                                  
              }    
              break; 
          case "image":
             if(btnObj.id.toLowerCase().indexOf("ibpick") > -1)
              {
                  alert(btnObj.id);
                  btnObj.src="../SysStyle/Images/PickOff.gif";
                  btnObj.style.pixelWidth=16;
                  btnObj.style.pixelHeight=16;
                  btnObj.onmouseover =  function(){this.src='../SysStyle/Images/PickOver.gif';this.style.cursor='pointer';} 
                  btnObj.onmouseout = function(){this.src='../SysStyle/Images/PickOff.gif';}                  
              }  
              break;        
          default:
          break; 
         }     
      }

}


function fChildTDStyle(parentObj)
{
    var tdObjs = parentObj.getElementsByTagName('td');
    for(itd=0;itd<tdObjs.length;itd++)
     {
         if(tdObjs[itd].className == '')
            tdObjs[itd].className = 'tdHead'; 
     }  
}