<!--//
      var count = 0;
      var win;
      var timerID;
      var myID;
      var isDetailNotCompare
       function openW( myid, isDetail){      
           
            myID= myid;
            isDetailNotCompare=isDetail;
            
            var mainPg=(isDetailNotCompare)?'stock.htm':'tool20.htm';
            win = window.open('http://www.6016.com.tw/fortune/' + mainPg ,'concords',
                        'width=1020,height=750,resizable=yes,scrollbars=yes,menubar=no,toolbar=yes,status=yes');
	      timerID = setInterval("openDown()" ,30);  
  
      }
      function openDown(){
	      count++;            
            if( win && win.down){
	            if( isDetailNotCompare)
		            win.down.location='http://fortune.6016.com.tw/stock/company/spotlight.cfm?scode='+myID;
		      else 
		     {
                        var list='';
                        var grid= document.getElementById(myID);
                        if(grid )
                        {
                              for( i=1; i<grid.rows.length; i++)
                              {   
                                    var myHTML=grid.rows[i].cells[1].innerHTML;                                     
                                    var scode =myHTML.substr(myHTML.length-8, 4);                                   
                                    if (list.length>0)
                                          list+=',' ; 
                                    list +=scode;
                              } 
                              win.down.location='http://fortune.6016.com.tw/stock/tool/competitors.cfm?scode_list='+ list;
                        } 
		     } 
                  clearInterval(timerID);
	      }
	      
	      if( count>=200 ){
		      clearInterval(timerID);
	      } 
      }
      function showHideHelp(isVisible, thisObj){
            var layer= document.getElementById('LayerHelp'); 
            if( isVisible){
                  layer.style.visibility= 'visible';
                  var x,y;
                  var obj2 = thisObj; //for ie to find the exact position...
                  if(thisObj.x){
                        x = thisObj.x;
                        y = thisObj.y;
                  } 
                  else {	//ie
                        x = thisObj.offsetLeft;
                        y = thisObj.offsetTop;
                          /* ie 的 offset是相對於 offsetParent, 而不是整個 document, 
                          // 所以要加上下面的 while loop
                          */
                        while (obj2 = obj2.offsetParent) {
                              x += obj2.offsetLeft
                              y += obj2.offsetTop
                        }
                  }        
                  if (layer!=null){
		              if (layer.style){	//ie      
			              layer.style.left = (x +20)+ 'px';
			              layer.style.top =(y+5) +'px';
				 
		              } 
                  }
            } 
            else 
                  layer.style.visibility= 'hidden';      
      }//end func
 
      var uDivHo0=199, uDivHi=217, dDivH=210;
      function show_hide_LayerINDCAT(isVisible, thisObj)
      {
           var layer= document.getElementById('LayerINDCAT'); 
           if( isVisible) 
            {
                  layer.style.visibility= 'visible';                  
                  var x,y;
                  var obj2 = thisObj; //for ie to find the exact position...
                  if(thisObj.x){
                        x = thisObj.x;
                        y = thisObj.y;
        //                 alert('thisObj.x有存在!');
	            } 
	            else {	//ie
                        x = thisObj.offsetLeft;
                        y = thisObj.offsetTop;
                          /* ie 的 offset是相對於 offsetParent, 而不是整個 document, 
                          // 所以要加上下面的 while loop
                          */
                        while (obj2 = obj2.offsetParent) {
                              x += obj2.offsetLeft
                              y += obj2.offsetTop
                        }
	            }        
                  if (layer!=null){
			        if (layer.style){	//ie      
				        layer.style.left = (x +170)+ 'px';
				        layer.style.top =(y+20) +'px';
			        } 
                  }
            } 
           else
           { 
              var count=0; 
              for( i=0; i< document.form1.elements.length; i++){
                  var obj= document.form1.elements[i];
                  if( obj.name != null){
                        if(obj.type=='checkbox' && obj.name.indexOf('listINDCAT') !=-1 && 
                              obj.name.indexOf('chkINDs') !=-1 && obj.checked)
                        count++;
                  } 
              }
              if( count<1){
                  layer.style.visibility= 'visible';
                  for( i=0; i< document.form1.elements.length; i++){
                        var obj= document.form1.elements[i];
                        if( obj.name != null){
                              if(obj.type=='checkbox' && obj.name.indexOf('listINDCAT') !=-1 && 
                                    obj.name.indexOf('chkINDs') !=-1)
                              {
                                   obj.checked='checked';
                                   break; 
                              }  
                        }
                  }
              }
              layer.style.visibility= 'hidden';
           }       
      }
  
      var ext=false; 
      function alterResultHeight()
      {
            var tableTop=document.getElementById('tbFANCY');          
            var divBottom=document.getElementById('panelResultGv');            
            var img=document.getElementById('imgExt'); 
            if( img && divBottom && tableTop )
           { 
                  divBottom.style.height=(!ext) ? 600: dDivH;
                  img.src=(!ext) ? 'images/small.gif':  'images/big.gif'
                  tableTop.style.display=(!ext)? 'none': '';  
                  ext =!ext; 
            } 
      }
      function windowSizeChg()
      { 
            var h= ( window.innerHeight)? window.innerHeight: document.body.clientHeight;
            var obj= document.getElementById('panelResultGv');          
            if( obj)
           {    
                  //height                  
                  obj.style.height = ( h > 620 )? dDivH+( h-620): dDivH;
                 // width 
                 if( document.body.clientWidth)  
                 {     
                      if (obj.style.width != document.body.clientWidth-10)
                        obj.style.width = document.body.clientWidth-10;             
                  }              
           }  
      }
      function switchMenuImage(obj ) {
            for(i=11; i<=27; i++){
                  var imgi= document.getElementById ('img'+i); 
                  if( imgi){
                        var srcT= imgi.src.substr( imgi.src.indexOf('images/tag'), imgi.src.length-1 );
                        imgi.src =(imgi ==obj)? srcT.replace('-up.','-on.'): srcT.replace('-on.','-up.');
                  }
            }   
      }
//-->
