﻿// 頁籤切換效果
function switchTab(tab_title, pst, tab_cnt)
{
	//alert(tab_title);
	
	for(var i=0 ; i<tab_cnt ; i++)
	{
		if (i == pst)
		{		    
		   document.getElementById(tab_title+'_tab_'+i).className = 'current';
		}
		else
		{
		   document.getElementById(tab_title+'_tab_'+i).className = '';
		}
		
		if (i == pst)
		{		    
		    document.getElementById(tab_title+'_'+i).className = 'disyshow';
		}
		else
		{
		   document.getElementById(tab_title+'_'+i).className = 'disyhidn';
	    }
	}
}

function Stock_Chart_Switch(tab_title, pst, tab_cnt)
{
	for(var i=0 ; i<tab_cnt ; i++)
	{
	   
	    //Stock_Chart_Switch('instabs', 0, 2)
	
		if (i == pst)
			document.getElementById(tab_title+'_tab_'+i).className = 'current';
		else
			document.getElementById(tab_title+'_tab_'+i).className = '';
			
		if (i == pst)		
		{
			document.getElementById(tab_title+'_'+i).className = 'disyshow';
		    //document.getElementById(tab_title+'_'+'Photo_'+i).className = 'disyhidn';
			//document.getElementById(tab_title+'_'+'Photo_'+i).className = 'disyshow';
			document.getElementById(tab_title+'_'+'Photo_'+i).style.display = 'block';

			//alert(tab_title+'_'+'Photo_'+i+".className=disyshow");
		}
		else 
		{ 
			document.getElementById(tab_title+'_'+i).className = 'disyhidn';
			//document.getElementById(tab_title+'_'+'Photo_'+i).className = 'disyshow';
			//document.getElementById(tab_title+'_'+'Photo_'+i).className = 'disyhidn';
			document.getElementById(tab_title+'_'+'Photo_'+i).style.display = 'none'; 
			
		}	
	}
	
}



//圖片點擊時的動作
function ClickChangeData(Values,checkV)
{
    for(var i=1 ; i<16 ; i++)
 {
    if(checkV==11)
    {
   if (i != Values)  
     document.getElementById("DataShowT"+i).style.display="none";
   else
     document.getElementById("DataShowT"+i).style.display="";
    }
    else if(checkV==12)
    {
      if(i != Values)  
     document.getElementById("DataShowC"+i).style.display="none";
   else
     document.getElementById("DataShowC"+i).style.display="";
    }
     else if(checkV==31)
    {
      if(i != Values)  
     document.getElementById("DataShowI"+i).style.display="none";
   else
     document.getElementById("DataShowI"+i).style.display="";
    }
    else if(checkV==32)
    {
      if(i != Values)  
     document.getElementById("DataShowR"+i).style.display="none";
   else
     document.getElementById("DataShowR"+i).style.display="";
    }    
    else if(checkV==21)
    {
      if(i != Values)  
     document.getElementById("DataShowM"+i).style.display="none";
   else
     document.getElementById("DataShowM"+i).style.display="";
    }
    else if(checkV==22)
    {
      if(i != Values)  
     document.getElementById("DataShowV"+i).style.display="none";
   else
     document.getElementById("DataShowV"+i).style.display="";
    }
   
    }
}



//function Stock_Chart_Switch(tab_title, pst, tab_cnt)
//{
// for(var i=0 ; i<tab_cnt ; i++)
// {
//  if (i == pst)
//   document.getElementById(tab_title+'_tab_'+i).className = 'current';
//  else
//   document.getElementById(tab_title+'_tab_'+i).className = '';
//  
//  if (i == pst)  
//  {
//   document.getElementById(tab_title+'_'+i).className = 'disyshow';
//   document.getElementById('Photo_'+i).className = 'disyshow';
//  }
//  else 
//  {
//   document.getElementById(tab_title+'_'+i).className = 'disyhidn';
//   document.getElementById('Photo_'+i).className = 'disyhidn';
//  }
// }
//}

function CheckData()
{
   var myForm = document.frmEdit.choice;
   var tmp = false;
   if (myForm){  
       for(var i=0; i<myForm.length; i++)
       {
         if(myForm[i].checked)
         {
         
            tmp = true;
            break;
         
         }
       }                     
       if (tmp == false) 
       {
           alert("您尚未作答!");           
           return false;
       }
       document.frmEdit.submit();   
   }      
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindowU(theURL,winName,features,namestr) { //v2.0
  window.open(theURL + escape(namestr),winName,features);
}

function goSearch(key)
{
    q = "http://so.cnyes.com/Default.aspx?q=" + encodeURI( key ) + "&l=LB3&p=1&k=0"
 	MM_openBrWindow(q,'','width=992,height=710,scrollbars=yes,status=yes,menubar=yes,toolbar=yes,directories=1,location=1,');
}


function divclose(tab_title2, pst2, tab_cnt2)
{
	if (document.getElementById("cyadsclose").className == "disyhidn")
	{   document.getElementById("cyadsclose").className="disyshow"
	    for(var i=0 ; i<tab_cnt2 ; i++)
	    {
		    if (i == pst2)
			    document.getElementById(tab_title2+'_tab_'+i).className = 'current';
		    else
			    document.getElementById(tab_title2+'_tab_'+i).className = '';
		    if (i == pst2)
			    document.getElementById(tab_title2+'_'+i).className = 'disyshow';
		    else
			    document.getElementById(tab_title2+'_'+i).className = 'disyhidn';
	    }	
	}
	else
	{
        document.getElementById("cyadsclose").className = "disyhidn"
	    for(var i=0 ; i<tab_cnt2 ; i++)
	    {
   	     document.getElementById(tab_title2+'_tab_'+i).className = '';

	    }	        
	}
	
}
