 function SwitchMenu(sType,_new_css){

    if (sType=='1'){
    
            var el = document.getElementById("WucW1_News1_Panel1");
            el.style.display = "block";
            
            var im1= document.getElementById("WucW1_News1_img_1");
            im1.src="images/" + _new_css + "/index_news_01_a.jpg";
             
            var e2 = document.getElementById("WucW1_News1_Panel2");
            e2.style.display = "none";
          
            var im2= document.getElementById("WucW1_News1_img_2");
            im2.src="images/" + _new_css + "/index_news_02.jpg";
            
            var e3 = document.getElementById("WucW1_News1_Panel3");
            e3.style.display = "none";
            
            var im3= document.getElementById("WucW1_News1_img_3");
            im3.src="images/" + _new_css + "/index_news_03.jpg";

    }
    else if(sType=='2'){
    
            var el = document.getElementById("WucW1_News1_Panel1");
            el.style.display = "none";
            
            var im1= document.getElementById("WucW1_News1_img_1");
            im1.src="images/" + _new_css + "/index_news_01.jpg";
            
            
            var e2 = document.getElementById("WucW1_News1_Panel2");
            e2.style.display = "block";
            
            var im2= document.getElementById("WucW1_News1_img_2");
            im2.src="images/" + _new_css + "/index_news_02_a.jpg";
            
            
            var e3 = document.getElementById("WucW1_News1_Panel3");
            e3.style.display = "none";
            
            var im3= document.getElementById("WucW1_News1_img_3");
            im3.src="images/" + _new_css + "/index_news_03.jpg";
            
          
    }
    
    else if(sType=='3'){
            var el = document.getElementById("WucW1_News1_Panel1");
            el.style.display = "none";
            
            var im1= document.getElementById("WucW1_News1_img_1");
            im1.src="images/" + _new_css + "/index_news_01.jpg";
            
            
          
            var e2 = document.getElementById("WucW1_News1_Panel2");
            e2.style.display = "none";
            
            var im2= document.getElementById("WucW1_News1_img_2");
             im2.src="images/" + _new_css + "/index_news_02.jpg";
            
            
            var e3 = document.getElementById("WucW1_News1_Panel3");
            e3.style.display = "block";
            
            var im3= document.getElementById("WucW1_News1_img_3");
            im3.src="images/" + _new_css + "/index_news_03_a.jpg";
            
         
    }    
    }







function createCookie(name,value,days){
	if (days){
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	} else {
			var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; path=/";
}

function get_text_cookie ( cookie_name ){
	  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

	  if ( results ) {
		return ( unescape ( results[1] ) );
	  }
	  else { return null; }
}

//設定字級
function ResetFontSize(size){
	var imgArr = ["13","15","16"];
	var currentTextSize = 13;
	var currentLineHeight = null;
	if(size==""){	//預設載入時判斷
		if(get_text_cookie("RangeSize")) {				
				size = get_text_cookie("RangeSize");
		}else{
			size = "12";
			createCookie("RangeSize","12", 1000);
		}	
	}else{
		createCookie("RangeSize",size, 1000);
	}	

	currentTextSize = parseInt(size);
	currentLineHeight = currentTextSize + 8;

		var docs = document.getElementById('RangeContent');	
		docs.style.fontSize= currentTextSize + 'px';
		docs.style.lineHeight = currentLineHeight +'px';
		for( var ij=0; ij<docs.getElementsByTagName("td").length; ij++){
			docs.getElementsByTagName("td")[ij].style.fontSize = currentTextSize + 'px';
			docs.getElementsByTagName("td")[ij].style.lineHeight = currentLineHeight +'px';
			if(docs.getElementsByTagName("a").length>0)
			{
			if(docs.getElementsByTagName("a")[ij]!=null)
			{
			    docs.getElementsByTagName("a")[ij].style.fontSize = currentTextSize + 'px';
				  docs.getElementsByTagName("a")[ij].style.lineHeight = currentLineHeight +'px';
				  }
			}
		}

			

	//if(document.getElementById("imgpt12")){
		for( var ix=0; ix<imgArr.length; ix++){
			if(imgArr[ix]==size){
				document.getElementById("imgpt" + imgArr[ix]).src="/images/ico_pt"+ imgArr[ix] +"_2.gif";	
				
			}else{
				document.getElementById("imgpt" + imgArr[ix]).src="/images/ico_pt"+ imgArr[ix] +".gif";	
			}
		}
	//}

		
}



function display(obj){	
	if ( obj.style.display=="none") {
	   obj.style.display ="block";  
	   //Window.tree.src="../images/tree_closed.gif";  
	   //window.focus();
	}
	else{
	  obj.style.display ="none";
	  //Window.tree.src="../images/tree_opened.gif";
	 //  window.focus();
	}
   
 }
 
 
 function display_QA(obj,file_id,Type_id,group_id,str_l1_code){	
 	var sID='';
 //	sID =document.getElementById("div001")
 //	sID.style.display ="block";  
	if ( document.getElementById(obj).style.display=="none") {
	   document.getElementById(obj).style.display ="block";  
	   
	   
	      if (window.XMLHttpRequest) { //Mozilla, Safari,...IE7    
         // alert('Mozilla, Safari,...IE7 ');   
		       if(!window.ActiveXObject)// Mozilla, Safari,...   
		       {  // alert('Mozilla, Safari');     
		       }    
		       else  
		       {   
		         var lobj_Server = RSExecute("../main/addFileTimes.asp","QA_LOG",file_id,Type_id,group_id,str_l1_code);
		          // alert('IE7');   
		       }       
		   }   
		   else    // alert('IE6');
		   {var lobj_Server = RSExecute("../main/addFileTimes.asp","QA_LOG",file_id,Type_id,group_id,str_l1_code); }  
		 


	}
	else{
	  document.getElementById(obj).style.display ="none";
	  //Window.tree.src="../images/tree_opened.gif";
	 //  window.focus();
	}
   
 }
 
 
 /*------------------------------------------------*/
 function ChangPic(obj,obj2){
	
	if ( obj.style.display=="none") {
	    obj.style.display ="block";
	    obj2.src="../images/tree_opened.gif"
	    //Window.tree.src="../images/tree_closed.gif";  
	    //window.focus();
	   }
	else{
	   obj.style.display ="none";
	   obj2.src="../images/tree_closed.gif";
	   //alert(obj.src)
	   //window.focus();
	}
	
	
 }
 
 
 
 
 function showmap(str_url){
 	
 	window.open (str_url,'','width=1024,height=768');
 	
 }
 
 
  function actChangePic(pic_name){
   //window.large_pic.src="upload/"+pic_name;
    document.large_pic.src=pic_name;
    window.focus();
 }
 
 
 
 function btnSearch(){
 	//Window.frmSearch.submit();
 }
 	
 	function SearchFocus(sT){
 		
 		if (sT=="1"){document.SrchInput.method="get";document.SrchInput.action="../i/i0400_org.asp?query=" + document.SrchInput.query.value;}
 		if (sT=="2"){document.SrchInput.method="get";document.SrchInput.action="../i/i0400_server.asp?query=" + document.SrchInput.query.value;}
 		if (sT=="3"){document.SrchInput.method="get";document.SrchInput.action="../i/i0400_table.asp?query=" + document.SrchInput.query.value;}
 		//if (sT=="4"){document.SrchInput.method="post";document.SrchInput.action="http://www.bosa.tcg.gov.tw/gaiscgi/query_run.exe?";}
 		if (sT=="4"){document.SrchInput.method="post";document.SrchInput.action="http://www.bosa.taipei.gov.tw/cgi-bin/search/query.cgi";}
 		}
 
  function search(CookieUserID){
     
       var sType="";
       var sKeyWord="";
       
      
       if (document.SrchInput.query.value=="請輸入關鍵字") {
		   alert("請輸入關鍵字");
		   document.SrchInput.query.focus();	
		   return ;
	  };
       
       
       
	 if (document.SrchInput.database1.checked){
	    document.SrchInput.method="get";
	    document.SrchInput.action="../i/i0400_org.asp?query=" + document.SrchInput.query.value;
	    
	    sType="1";
	 }

	else if(document.SrchInput.database2.checked){
	     document.SrchInput.method="get";
	     document.SrchInput.action="../i/i0400_server.asp?query=" + document.SrchInput.query.value;
 
	     sType="2";  
	 }
	 
	 
	 else if(document.SrchInput.database3.checked){
	     document.SrchInput.method="get";
	     document.SrchInput.action="../i/i0400_table.asp?query=" + document.SrchInput.query.value;
	     sType="3";
	    
	 }
	 
	 else if(document.SrchInput.database4.checked){
			//document.SrchInput.method="post";
			//document.SrchInput.action="http://www.bosa.tcg.gov.tw/gaiscgi/query_run.exe?";
			document.SrchInput.method="post";
			document.SrchInput.action="http://www.bosa.taipei.gov.tw/cgi-bin/search/query.cgi" 
			document.SrchInput.q.value=document.SrchInput.query.value;
			
			//alert("111");
			sType="4"; 
		
		
		
		
	 
	 }

     sKeyWord=document.SrchInput.query.value;
         
          //alert(sKeyWord);
       
   if (window.XMLHttpRequest) { //Mozilla, Safari,...IE7    
   // alert('Mozilla, Safari,...IE7 ');   
       if(!window.ActiveXObject)// Mozilla, Safari,...   
       {  // alert('Mozilla, Safari');     
       }    
       else  
       {   
        //alert(CookieUserID);
       // CookieUserID="B33333"
         //var lobj_Server = RSExecute("/main/addFileTimes.asp","RecorderSearch",sType,sKeyWord,CookieUserID);
          // alert('IE7');   
       }       
   }   
   else    // alert('IE6');
   {var lobj_Server = RSExecute("/main/addFileTimes.asp","RecorderSearch",sType,sKeyWord,CookieUserID); }  



         // win=window.open("../main/addFileTimes_search.asp?sType=sType&sKeyWord="+sKeyWord ,"","left=0,top=0,height=0,width=0");
        //  alert(lobj_Server.ok);      
	        document.SrchInput.submit();
	 
}


 

/*最多搜尋*/
function search_auto(sValue){
	//document.SrchInput.method="post";
	document.SrchInput.database4.checked=true;
	//alert(document.SrchInput.database4.checked);
	//document.SrchInput.method="post";		
	//document.SrchInput.action="http://www.bosa.tcg.gov.tw/gaiscgi/query_run.exe?";
	document.SrchInput.method="post";	
	document.SrchInput.action="http://www.bosa.taipei.gov.tw/cgi-bin/search/query.cgi"
	document.SrchInput.query.value=sValue;
	document.SrchInput.q.value=sValue;
	document.SrchInput.submit();
				
	
	/*
  document.SrchInput.action="http://www.bosa.tcg.gov.tw/gaiscgi/query_run.exe?";
  document.SrchInput.query.value=sValue;
  document.SrchInput.submit();
  */
  
}
 	
 function addFileTimes(uid,sFile,sName)
       {
        
        //window.open("../main/addFileTimes_new.asp?sType=att&uid="+uid+"&file="+sFile+"&name="+sName ,"","left=0,top=0,height=0,width=0");
        var win=null;
        
        win=window.open("../main/addFileTimes_new.asp?sType=att&uid="+uid+"&file="+sFile+"&name="+sName ,"","left=0,top=0,height=0,width=0");
        
        
       // window.location.href="../main/addFileTimes_new.asp?sType=att&uid="+uid+"&file="+sFile+"&name="+sName;
        //alert(uid);
        // var lobj_Server = RSExecute("../main/addFileTimes.asp","DeleteNotics",uid);
         //alert(lobj_Server.ok);
         //if(lobj_Server.status != 0)  {
         //  alert("讀出錯誤");
	     //  return;
	     //} 
		
      } 
	

function addWebTimes(l1_code)
       {
        //alert(uid);
        // var lobj_Server = RSExecute("../main/addWebTimes.asp","DeleteNotics",l1_code);
         //alert(lobj_Server.ok);
         //if(lobj_Server.status != 0)  {
         //  alert("讀出錯誤");
	     //  return;
	     //} 
		
      } 
      

	


function search_check()	{
	//alert(document.event.keyCode);
	//alert(event.keyCode);
	if(event.keyCode==13){search('');}
	
	}
function sort(ctype, Desc_Asc_Tmp_3, strUrlString_new){   

    var hdSort = document.getElementById("hfSort");
    hdSort.value=ctype;

    var hdDesc_Asc = document.getElementById("hfDesc_Asc");
    hdDesc_Asc.value=Desc_Asc_Tmp_3;   

    var hfCode= document.getElementById("hfCode");  
    hfCode.value=strUrlString_new;

    var objForm = document.getElementById("frmQuery");
    objForm.method="post";
    
    var str = strUrlString_new;


    objForm.action="i0400.asp?" + str.substr(1,str.length-1);
    objForm.submit(); 
    
   
            
}
