// function.js (c) 2000-2001 IPRO 網際家數位科技 All Rights Reserved. 
//                 http://www.iprodigi.com  service@iprodigi.com.tw
//
// 軟體使用授權:
//
// 此程式僅授權 中小企業升級轉型資訊網(Technology Enhancement Project for Small & Medium Enterprises) 使用於該公司企業網站上，
// 未經網際家數位科技正式授權，請勿任意複製作為其它用途。
// 
//
StyleName = "chi";      // chi 一般; Dragon_Boat 端午節; mid_autumny    ;xmas
codePath = "/chi/js/";
StyleFlashName = "banner_chi.swf";
/*
	一般 banner_chi.swf
	端午 Dragon_Boat.swf	
	中秋 mid_autumny.swf
	聖誕 xmas.swf
	新年 newyear.swf
*/
//document.write("<Scr" + "ipt Language='JavaScript' src='" + codePath + "technomart.js'><\/Scr" + "ipt>");
//document.write("<Scr" + "ipt Language='JavaScript' src='" + codePath + "loader.js'><\/Scr" + "ipt>");

//document.write("<script language='JavaScript1.2' src='" + codePath + "fw_menu.js' TYPE='text/javascript'></script>");

function fwLoadMenus() {
  if (window.fw_menu_0) return;
  window.fw_menu_0 = new Menu("root",132,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  fw_menu_0.addMenuItem("最新消息","window.location='/chi/news/index.php';");
  fw_menu_0.addMenuItem("服務廠商專題報導","window.location='/chi/news/rptnews.php';");
  fw_menu_0.addMenuItem("產業動態","window.location='/chi/news/business.php';");
  fw_menu_0.addMenuItem("活動訊息","window.location='/chi/news/ab_index.php';");
  fw_menu_0.addMenuItem("產業資訊","window.open('http://www.itis.org.tw/','itis');");
  fw_menu_0.addMenuItem("商情資訊","window.location='/chi/news/opportunity.php';");
  fw_menu_0.hideOnMouseOut=true;
  
  /*window.fw_menu_1 = new Menu("root",78,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  fw_menu_1.addMenuItem("緣　　起","window.location='/chi/about/index.php';");
  fw_menu_1.addMenuItem("目　　的","window.location='/chi/about/object.php';");
  fw_menu_1.addMenuItem("服務內容","window.location='/chi/about/service.php';");
  fw_menu_1.addMenuItem("成果分享","window.location='/chi/about/fruition.php';");
  fw_menu_1.hideOnMouseOut=true;*/
  
  window.fw_menu_2 = new Menu("root",118,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  fw_menu_2.addMenuItem("技術供給資料庫","window.location='/chi/techs/ts_index.php';");
//  fw_menu_2.addMenuItem("可行性評估報告","window.location='/chi/techs/estimate.php';");
  fw_menu_2.addMenuItem("政府補助計畫","window.location='/chi/techs/subsidy.php';");
  fw_menu_2.addMenuItem("科技專案","window.location='/chi/techs/project.php';");
  fw_menu_2.addMenuItem("可移轉技術","window.location='/chi/techs/transfer.php';");
  fw_menu_2.hideOnMouseOut=true;
  
  //window.fw_menu_3 = new Menu("root",118,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  //fw_menu_3.addMenuItem("近期博覽會介紹","window.location='/chi/exposition/new/';");
  //fw_menu_3.addMenuItem("各期博覽會回顧","window.location='/chi/exposition/old/';");
  //fw_menu_3.hideOnMouseOut=true;
  
  window.fw_menu_3 = new Menu("root",104,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  fw_menu_3.addMenuItem("登　　入","window.location='/chi/member/login.php';");
  fw_menu_3.addMenuItem("聯絡窗口","window.location='/chi/member/index.php';");
  fw_menu_3.addMenuItem("編修基本資料","window.location='/chi/member/member.php';");
  fw_menu_3.addMenuItem("技術供給","window.location='/chi/member/ts_index.php';");
  fw_menu_3.addMenuItem("服務需求","window.location='/chi/member/td_index.php';");
  //fw_menu_3.addMenuItem("媒合預約","window.location='/chi/member/tech_meeting.php';");
  fw_menu_3.addMenuItem("登　　出","window.location='/chi/member/logout.php';");
  fw_menu_3.hideOnMouseOut=true;
  
  window.fw_menu_4 = new Menu("root",104,22,"新細明體, Verdana, Arial, Helvetica, sans-serif",13,"#FFFFFF","#4E85A6","#4E85A6","#C0EDEF");
  fw_menu_4.addMenuItem("國內相關網站","window.location='/chi/web/index.php';");
  fw_menu_4.addMenuItem("國外相關網站","window.location='/chi/web/other.php';");
  fw_menu_4.hideOnMouseOut=true;
  
  fw_menu_4.writeMenus();
} // fwLoadMenus()

/*Start 雙擊左鍵至頁首*/
function dblclick() {
window.scrollTo(0,0)
}
if (document.layers) {
document.captureEvents(Event.ONDBLCLICK);
}
document.ondblclick=dblclick;
/*End 雙擊左鍵至頁首*/


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) {
      x.src=x.oSrc;
      //x.width=x.width+2;
      //x.height=x.height+2;
      //x.border=0;
  }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;
  if(!d) d=document;
  if( (p=n.indexOf("?"))>0 && parent.frames.length ) {
      d=parent.frames[n.substring(p+1)].document;
      n=n.substring(0,p);
  }
  
  if( !(x=d[n]) && d.all ) x=d.all[n];
  
  for (i=0;!x&&i<d.forms.length;i++)
      x=d.forms[i][n];
  
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
      x=MM_findObj(n,d.layers[i].document);
  
  if(!x && d.getElementById) x=d.getElementById(n);
  
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments;
  document.MM_sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
      if ( (x=MM_findObj(a[i]))!=null ){
          document.MM_sr[j++]=x;
          if(!x.oSrc) x.oSrc=x.src;
          x.src=a[i+2];
          //x.width=x.width-2;
          //x.height=x.height-2;
          //x.border=1;
      }
}

PageNames = new Array(
"news",        //0
"about",       //1
"techs",        //2    
//"exposition",  //3
"member",      //4
"web",         //5
//"phpbb",       //6
"qa",          //7
"download",    //8
"sitemap",     //9
"contact",     //10
"search",     //11
"epaper");    //12

OutputNames = new Array(
"新聞動態",
"關於我們",
"技術&機會",
//"線上博覽會",
"會員專區",
"相關網站",
//"互動交流",
"常見問答集",
"下載專區",
"網站導覽",
"聯絡我們",
"全文檢索",
"電子報");

PageNames_news = new Array(
"index.php",
"rptnews.php",
"business.php",
"ab_index.php",
"itis",
"opportunity.php");

OutputNames_news = new Array(
"最新消息",
"專題報導",
"產業動態",
"活動訊息",
"ITIS產業資訊",
"商情資訊");  

PageNames_about = new Array(
//"index.php",
//"object.php",
//"service.php",
//"fruition.php");
"index.php");

OutputNames_about = new Array(
//"緣起",
//"目的",
//"服務內容",
//"成果分享"); 
"計畫簡介"); 

PageNames_techs = new Array(
"ts_index.php",
//"estimate.php",
"subsidy.php",
"project.php",
"transfer.php");

OutputNames_techs = new Array(
"技術供給資料庫",
//"可行性評估報告",
"政府輔助計畫",
"科技專案",
"可移轉技術");

PageNames_exposition = new Array(
"new",
"old");

OutputNames_exposition = new Array(
"近期博覽會介紹",
"各期博覽會回顧");

PageNames_exposition_new = new Array(
"index.php",
"ets_add.php",
"my_index.php",
"join.php",
"ets_index.php",
"ec_index.php",
"mo_index.php");

OutputNames_exposition_new = new Array(
"博覽會簡介",
"線上徵展",
"我的參與記錄",
"活動報名",
"技術一覽",
"博覽會活動介紹",
"商談預約");

PageNames_exposition_old = new Array(
"index.php");

OutputNames_exposition_old = new Array(
"各期博覽會回顧");

PageNames_member = new Array(
"login.php",
"index.php",
"member.php",
"ts_index.php",
"td_index.php",
//"index.php",
//"tech_meeting.php",
"logout.php");

OutputNames_member = new Array(
"登入",
"聯絡窗口",
"編修基本資料",
"技術供給",
"服務需求",
//"其他需求",
//"媒合預約",
"登出");

PageNames_web = new Array(
"index.php",
"other.php");

OutputNames_web = new Array(
"國內相關網站",
"國外相關網站");

PageNames_phpbb = new Array(
"index.html");

OutputNames_phpbb = new Array(
"互動交流");

PageNames_qa = new Array(
"index.php");

OutputNames_qa = new Array(
"常見問答集");

PageNames_download = new Array(
"index.php");

OutputNames_download = new Array(
"下載專區");

PageNames_sitemap = new Array(
"index.php");

OutputNames_sitemap = new Array(
"網站導覽");

PageNames_contact = new Array(
"index.php");

OutputNames_contact = new Array(
"聯絡我們");

PageNames_search = new Array(
"index.php");

OutputNames_search = new Array(
"全文檢索");

PageNames_epaper = new Array(
"index.php");

OutputNames_epaper = new Array(
"電子報");

// find index # in array
function ItemID(name,nameArray){	
  
  if( name==null || name=='' ) return(0);
    
  for(var i=0; i < nameArray.length; i++) {
    if( name == nameArray[i] ) return(i);
  }

  return(0);  
}

// Display CatPic Function
function ShowCatPic(){
   var arrayOfpath = location.pathname.split("/");
 
   var SectionName=arrayOfpath[2];
   document.write('<td>\n');    
   document.write('<img src="/chi/images/title_'+SectionName+'.gif" vspace=15>\n');
   if (SectionName=="news"){
   //document.write('<a href="http://www.technomart.org.tw/chi/exposition/new/ets_index.php?Eb_id=1" title="博覽會 台北場 「商談預約」"><img src="/chi/images/btn_link_1.gif" border=0></a>\n');
   //document.write('<a href="http://www.technomart.org.tw/chi/exposition/new/ets_index.php?Eb_id=2" title="博覽會 台南場 「商談預約」"><img src="/chi/images/btn_link_2.gif" border=0></a>\n');
/*
      document.write('<table border="0" cellspacing="0" cellpadding="0">\n');
      document.write('<tr><td rowspan=2 width=210>\n');
      document.write('<img src="/chi/images/title_'+SectionName+'.gif" vspace=15>\n');
      document.write('</td>\n');      
      document.write('<td>\n');
      document.write('<a href="http://www.technomart.org.tw/chi/exposition/new/ets_index.php?Eb_id=1" title="博覽會 台北場 「商談預約」"><img src="/chi/images/btn_link_1.gif" border=0></a>\n');
      document.write('</td></tr>\n');
      document.write('<tr><td>\n');
      document.write('<a href="http://www.technomart.org.tw/chi/exposition/new/ets_index.php?Eb_id=2" title="博覽會 台南場 「商談預約」"><img src="/chi/images/btn_link_2.gif" border=0></a>\n');
      document.write('</td></tr>\n');
      document.write('</table>\n');
*/      
   }
   document.write('</td>\n');   
}

// Display Flash Function
function ShowFlash(){
   var arrayOfpath = location.pathname.split("/");
 
   var SectionName=arrayOfpath[2];
   document.write('<td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="141" height="97">\n');
   document.write('<param name="movie" value="/'+StyleName+'/images/flash/fla_'+SectionName+'.swf">\n');
   document.write('<param name="quality" value="high">\n');
   document.write('<embed src="/'+StyleName+'/images/flash/fla_'+SectionName+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="141" height="97"></embed></object></td>\n');
}

// Display Menu Function
function showFuncMenu(){
   var arrayOfpath = location.pathname.split("/");
 
   var SectionName=arrayOfpath[2];
   var ix=180;
   
   //===2006/09/20 Before Azure Change(Start)===
   //var ItemSizeW=new Array(ix,76,74,86,91,74,76);
   //===2006/09/20 Before Azure Change(End)===
   
   //===2006/09/20 After Azure Change(Start)===
   var ItemSizeW=new Array(ix,76,74,86,74,74,76);
   //===2006/09/20 After Azure Change(End)===
   
   ItemSizeW[1]=ItemSizeW[0]+ItemSizeW[1];
   ItemSizeW[2]=ItemSizeW[1]+ItemSizeW[2];
   ItemSizeW[3]=ItemSizeW[2]+ItemSizeW[3];
   ItemSizeW[4]=ItemSizeW[3]+ItemSizeW[4];
   ItemSizeW[5]=ItemSizeW[4]+ItemSizeW[5];
   ItemSizeW[6]=ItemSizeW[5]+ItemSizeW[6];
   
   for(var itemNum=0; itemNum < 5; itemNum++) {
      if( PageNames[itemNum]!='sitemap' && PageNames[itemNum]!='search' && PageNames[itemNum]!='epaper') 	
      {
    	  if( PageNames[itemNum]==SectionName ) {
          document.write('<td><a href="/chi/' + PageNames[itemNum] + '/" ');
          if ( itemNum == 1 ){
          document.write('onMouseOut="" onMouseOver="">');
        	}else{
        	document.write('onMouseOut="FW_startTimeout();" onMouseOver="window.FW_showMenu(window.fw_menu_' + itemNum + ','+ItemSizeW[itemNum]+',90);">');
        	}
          document.write('<img src="/chi/images/menu_' + PageNames[itemNum] + '_on.gif" border=0 name="' + PageNames[itemNum] + '" alt="' + OutputNames[itemNum] + '" title="' + OutputNames[itemNum] + '">');
          document.write('</a></td>');
      	}else{
	        document.write('<td><a href="/chi/' + PageNames[itemNum] + '/" ');
	        if ( itemNum == 1 ){
		      document.write('onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\''+ PageNames[itemNum] + '\',\'\',\'/chi/images/menu_'+ PageNames[itemNum] + '_on.gif\',1)">');
        	}else{
        	document.write('onMouseOut="FW_startTimeout();MM_swapImgRestore()" onMouseOver="window.FW_showMenu(window.fw_menu_' + itemNum + ','+ItemSizeW[itemNum]+',90);MM_swapImage(\''+ PageNames[itemNum] + '\',\'\',\'/chi/images/menu_'+ PageNames[itemNum] + '_on.gif\',1)">');
        	}
         	document.write('<img src="/chi/images/menu_' + PageNames[itemNum] + '.gif" border=0 name="' + PageNames[itemNum] + '" alt="' + OutputNames[itemNum] + '" title="' + OutputNames[itemNum] + '">');
         	document.write('</a></td>');
        }
      }
  }
}

// Display Menu Function2
function showFuncMenu2(){
   var arrayOfpath = location.pathname.split("/");
   var SectionName=arrayOfpath[2];

   for(var itemNum=5; itemNum < PageNames.length-2; itemNum++) {
      if( PageNames[itemNum]=='phpbb' ) 	
      {
            document.write('<td><a href="/chi/' + PageNames[itemNum] + '/" target="phpbb"');
            document.write('onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\''+ PageNames[itemNum] + '\',\'\',\'/'+StyleName+'/images/icon_'+ PageNames[itemNum] + '_on.gif\',1)">');
            document.write('<img src="/'+StyleName+'/images/icon_' + PageNames[itemNum] + '.gif" border=0 name="' + PageNames[itemNum] + '" alt="' + OutputNames[itemNum] + '" title="' + OutputNames[itemNum] + '">');
            document.write('</a></td>');
      }else{
	    if( PageNames[itemNum]==SectionName ) 	
        	document.write('<td><img src="/'+StyleName+'/images/icon_' + PageNames[itemNum] + '_on.gif" border=0></td>');
      	else {
            document.write('<td><a href="/chi/' + PageNames[itemNum] + '/" ');
            document.write('onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\''+ PageNames[itemNum] + '\',\'\',\'/'+StyleName+'/images/icon_'+ PageNames[itemNum] + '_on.gif\',1)">');
            document.write('<img src="/'+StyleName+'/images/icon_' + PageNames[itemNum] + '.gif" border=0 name="' + PageNames[itemNum] + '" alt="' + OutputNames[itemNum] + '" title="' + OutputNames[itemNum] + '">');
            document.write('</a></td>');
        }      
      }
  }  
  document.write('<td><a href="/chi/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'imghome\',\'\',\'/'+StyleName+'/images/icon_home_on.gif\',1)"><img src="/'+StyleName+'/images/icon_home.gif" alt="回首頁" title="回首頁" name="imghome" width="27" height="31" border="0"></a></td>\n');
  document.write('<td><a href="/eng/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'imgeng\',\'\',\'/'+StyleName+'/images/icon_eng_on.gif\',1)"><img src="/'+StyleName+'/images/icon_eng.gif" alt="English" title="English" name="imgeng" width="34" height="31" border="0"></a></td>\n');  
}

// show sub_Page links on current subdirectory  
function ShowSubMenu(){

   var arrayOfpath = location.pathname.split("/");
   var arrayOfpage = arrayOfpath[arrayOfpath.length-1].split(".");

   var PageNamesArray="PageNames";
   var SectionName=arrayOfpath[2];
    
   PageNamesArray += "_" + SectionName;

   var PageNA = eval(PageNamesArray);
   //var id=ItemID(arrayOfpath[arrayOfpath.length-1], PageNA); 
   var id=ItemID(arrayOfpath[3], PageNA); 

   for( var i=0; i < (PageNA.length) ; i++) {
    if ((PageNA.length)>1){
      if( i==id ){
        document.write('<tr><td >\n');
  	    document.write('<a href="/chi/'+arrayOfpath[2]+'/' + PageNA[i] + '"><img name="' + SectionName + '_' + (i+1) + '" src="/chi/images/btn_' + SectionName + '_0' + (i+1) + '_on.gif" border=0></a>');
  	    document.write('</td></tr>\n');
      }else {
	    document.write('<tr><td>\n');
	    if (PageNA[i]=="itis"){
	        document.write('<a href="http://www.itis.org.tw/" target="itis" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'' + SectionName + '_' + (i+1) + '\',\'\',\'/chi/images/btn_' + SectionName + '_0' + (i+1) + '_on.gif\',1)"><img name="' + SectionName + '_' + (i+1) + '" src="/chi/images/btn_' + SectionName + '_0' + (i+1) + '.gif" border=0></a>');
	    }else{
            document.write('<a href="/chi/'+arrayOfpath[2]+'/' + PageNA[i] + '" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'' + SectionName + '_' + (i+1) + '\',\'\',\'/chi/images/btn_' + SectionName + '_0' + (i+1) + '_on.gif\',1)"><img name="' + SectionName + '_' + (i+1) + '" src="/chi/images/btn_' + SectionName + '_0' + (i+1) + '.gif" border=0></a>');
        }
        document.write('</td></tr>\n');
      }
    }
   }
}  

// show Page flow structure
function ShowPageIndex(){

   var arrayOfpath = location.pathname.split("/");
   var arrayOfpage = arrayOfpath[arrayOfpath.length-1].split(".");
   var pagename = arrayOfpath[arrayOfpath.length-1];
   var urlstr="/"+arrayOfpath[1]+"/";
   var OutputNamesArray="OutputNames";
   var PageNamesArray="PageNames";

   document.write('<a href="/chi/" class="pageindex">首頁</a>'); 

   for(var i=2; arrayOfpath[i] && i < arrayOfpath.length-1; i++) {

      document.write(' > ');
      urlstr += arrayOfpath[i] + "/" ;
      
      var PageNA = eval(PageNamesArray);
      var id=ItemID(arrayOfpath[i], PageNA);

      document.write('<a href="' + urlstr + '" class="pageindex">');
      document.write( eval(OutputNamesArray + '[' + id + ']' ) );
      document.write('</a>');

      OutputNamesArray += "_" + arrayOfpath[i];
      PageNamesArray += "_" + arrayOfpath[i];
   }
   
   PageNA = eval(PageNamesArray);
   id = ItemID(pagename, PageNA);
      
   if( PageNA.length> 1 ) {
      document.write(' > ');
      document.write( eval(OutputNamesArray + '[' + id + ']' )+'&nbsp;&nbsp;' );
   }   
}  

function HeaderMenu(){
	document.write('<ul class="navigation">');
	document.write('<li><a href="/chi/news/business.php">新聞動態</a>');
	document.write('<ul><li><a href="/chi/news/business.php">產業動態</a></li>');
	document.write('<li><a href="/chi/news/ab_index.php">活動訊息</a></li>');
	document.write('<li><a href="/chi/news/rptnews.php">廠商專題報導</a></li>');
	//document.write('<li><a href="http://www.itis.org.tw/" target="itis">產業資訊</a></li>');
	document.write('<li><a href="/chi/news/opportunity.php">活動花絮</a></li></ul></li>');
	
	document.write('<li><a href="/chi/about/index.php">關於我們</a>');
	document.write('<ul><li><a href="/chi/about/index.php">計畫簡介</a></li>');
	document.write('<li><a href="/chi/contact/index.php">聯絡我們</a></li></ul></li>');	
	
	document.write('<li><a href="/chi/techs/ts_index.php">技術＆機會</a>');
	document.write('<ul><li><a href="/chi/techs/ts_index.php">技術供給資料庫</a></li>');
	document.write('<li><a href="/chi/techs/subsidy.php">政府補助計畫</a></li>');
	document.write('<li><a href="/chi/techs/transfer.php">可移轉技術</a></li></ul></li>');
	
	document.write('<li><a href="/chi/member/index.php">會員專區</a>');
	document.write('<ul><li><a href="/chi/member/login.php">登　　入</a></li>');
	document.write('<li><a href="/chi/member/index.php">聯絡窗口</a></li>');
	document.write('<li><a href="/chi/member/member.php">編修基本資料</a></li>');
	document.write('<li><a href="/chi/member/ts_index.php">技術供給</a></li>');
	document.write('<li><a href="/chi/member/td_index.php">服務需求</a></li>');
	document.write('<li><a href="/chi/member/logout.php">登　　出</a></li></ul></li>');
	document.write('<li><a href="/chi/web/index.php">相關網站</a>');
	document.write('<ul><li><a href="/chi/web/index.php">國內相關網站</a></li>');
	document.write('<li><a href="/chi/web/other.php">國外相關網站</a></li></ul></li>');
	document.write('</ul>');
}

function HeaderLoad(title){
	var wwwroot = window.location.protocol + '//' + window.location.host ;
	var head_title = '';
	if (title != '')
		head_title = '--' + title;
	document.write('<title>中小企業商機媒合整合服務網' + head_title +'</title>');
	document.write('<link href="'+wwwroot+'/css/layout.css" rel="stylesheet" type="text/css" />');
	document.write('<link href="'+wwwroot+'/css/master.css" rel="stylesheet" type="text/css" />');
	document.write('<link rel="stylesheet" type="text/css" href="'+wwwroot+'/js/superfish.css" media="screen">');
	document.write('<!--[if lte IE 7]>');
	document.write('<link rel="stylesheet" href="'+wwwroot+'/css/ie7.css" type="text/css" />');
	document.write('<![endif]-->');
	document.write('<!--[if lte IE 6]>');
	document.write('<link rel="stylesheet" href="'+wwwroot+'/css/ie6.css" type="text/css" />');
	document.write('<![endif]-->');
	document.write('<script type="text/javascript" src="'+wwwroot+'/js/jquery-1.2.6.min.js"></script>');
	document.write('<script type="text/javascript" src="'+wwwroot+'/js/hoverIntent.js"></script>');
	document.write('<script type="text/javascript" src="'+wwwroot+'/js/superfish.js"></script>');
	/*document.write('<script type="text/javascript">');
	document.write('jQuery(function(){');
	document.write('jQuery(\'ul.navigation\').superfish();');
	document.write('});');
	doument.write('</script>');*/
}

function showFlashHeader(img_root){
	document.write('<object width="560" height="130" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="FlashID" style="visibility: visible;">');
	document.write('<param value="'+img_root+'/'+StyleFlashName+'" name="movie">');
	document.write('<param value="high" name="quality">');
	document.write('<param value="opaque" name="wmode">');
	document.write('<param value="6.0.65.0" name="swfversion">');
	document.write('<!-- 此 param 標籤會提示使用 Flash Player 6.0 r65 和更新版本的使用者下載最新版本的 Flash Player。如果您不想讓使用者看到這項提示，請將其刪除。 -->');
	document.write('<param value="../Scripts/expressInstall.swf" name="expressinstall">');
	document.write('<!-- 下一個物件標籤僅供非 IE 瀏覽器使用。因此，請使用 IECC 將其自 IE 隱藏。 -->');
	document.write('<!--[if !IE]>-->');
	document.write('<object width="560" height="130" data="'+img_root+'/'+StyleFlashName+'" type="application/x-shockwave-flash">');
	document.write('<!--<![endif]-->');
	document.write('<param value="high" name="quality">');
	document.write('<param value="opaque" name="wmode">');
	document.write('<param value="6.0.65.0" name="swfversion">');
	document.write('<param value="../Scripts/expressInstall.swf" name="expressinstall">');
	document.write('<!-- 瀏覽器會為使用 Flash Player 6.0 和更早版本的使用者顯示下列替代內容。 -->');
	document.write('<div>');
	document.write('<h4>這個頁面上的內容需要較新版本的 Adobe Flash Player。</h4>');
	document.write('<p><a href="http://www.adobe.com/go/getflashplayer"><img width="112" height="33" alt="取得 Adobe Flash Player" src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"></a></p>');
	document.write('</div>');
	document.write('<!--[if !IE]>-->');
	document.write('</object>');
	document.write('<!--<![endif]-->');
	document.write('</object>');
}

function showBodyHeader(img_root){
	//header
	document.write('<body>');
	document.write('<a name="gotop"></a>');
	document.write('<div id="wrapper">');
	document.write('<div id="container">');
    document.write('<div id="header">');
	document.write('<div id="flash_banner">');
	showFlashHeader(img_root);
	document.write('</div>');
    document.write('<div id="logo"> <a href="/index.php" target="_parent" title="中小企業商機媒合整合服務網">中小企業商機媒合整合服務網</a></div>');
	/*--MENU--*/
	document.write('<div id="navigation">');
	HeaderMenu();
	document.write('</div>');
	/*-- MENU END --*/
	/*-- 語系切換 --*/
	document.write('<div class="lan_chen"><img border="0" usemap="#Map" alt="語言切換" src="'+img_root+'/ch_en.png">');
	document.write('<map id="Map" name="Map">');
	document.write('<area href="/chi/" coords="3,5,44,30" shape="rect">');
	document.write('<area href="/eng/" coords="54,2,95,27" shape="rect">');
	document.write('</map>');
	document.write('</div>');
	/*-- 語系切換 END --*/
	document.write('<div class="search">');
	document.write('<form action="/chi/search/result.php" onsubmit="searchgo(1);" name="S">');
    document.write('<label for="search">');
    document.write('<input type="text" id="search" name="keyword" size="20" class="topSearch" title="請輸入關鍵字" value="全站搜尋" onblur="WatermarkBlur(this,\'全站搜尋\');" onfocus="WatermarkFocus(this,\'全站搜尋\');">');
    document.write('</label>');
    document.write('<input type="button" name="Submit" value="GO" onclick="searchgo(1);">');
    document.write('</form>');
	document.write('</div>');
    document.write('</div>');
	document.write('<div id="maincontent">');
    
	
}


function showBodyFooter(img_root){
document.write('</div>');
document.write('<div class="clr"></div>');
document.write('</div>');
document.write('</div>');
document.write('<div id="footer">');
document.write('<div id="container2"> <a href="/index.php">新聞動態</a> | <a href="/chi/about/">關於我們</a> | <a href="/chi/techs/">技術&amp;機會</a> | <a href="/chi/member/">會員專區</a> | <a href="/chi/web/">相關網站</a> | <a href="/chi/sitemap/">網站導覽</a> | <a href="/chi/contact/">聯絡我們</a><br />');
document.write('<strong>主辦單位：</strong> <a href="http://www.moeasmea.gov.tw/"><img src="'+img_root+'/footer_logo_01.gif" width="20" height="14" alt="經濟部中小企業處" /></a>經濟部中小企業處 <strong>承辦單位：</strong><a href="http://www.itri.org.tw/"><img src="'+img_root+'/footer_logo_02.gif" width="16" height="15" alt="工業技術研究院" /></a>工業技術研究院 Copyright &copy; 2011 中小企業商機媒合整合服務網 All rights reserved.</div>');
document.write('<div class="f_gotop"><a href="#gotop"><img width="35" height="15" alt="go top" src="'+img_root+'/footer_gotop.gif"></a></div>');
document.write('</div>');
document.write('</body>');
}


function showHeader(space_w) {
  if (isNaN(space_w)) space_w=20;
  //menusGo();
  fwLoadMenus();
  document.write('<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onLoad="MM_preloadImages(\'/chi/images/icon_phpbb_on.gif\',\'/chi/images/icon_qa_on.gif\',\'/chi/images/icon_download_on.gif\',\'/chi/images/icon_sitemap_on.gif\',\'/chi/images/icon_contact_on.gif\',\'/chi/images/icon_home_on.gif\',\'/chi/images/icon_eng_on.gif\',\'/chi/images/menu_news_on.gif\',\'/chi/images/menu_about_on.gif\',\'/chi/images/menu_techs_on.gif\',\'/chi/images/menu_exposition_on.gif\',\'/chi/images/menu_member_on.gif\',\'/chi/images/menu_web_on.gif\',\'/chi/images/icon_ep_online_on.gif\',\'/chi/images/icon_ep_vote_on.gif\',\'/chi/images/btn_news_03_on.gif\',\'/chi/images/btn_news_01_on.gif\',\'/chi/images/btn_news_04_on.gif\',\'/chi/images/btn_news_02_on.gif\')">\n');
  document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='/acount.txt' TYPE='text/javascript'><\/SCRIPT>");
  document.write("<link rel=\"stylesheet\" href=\"/chi/js/popmenu.css\">");
  document.write("<script src=\"/chi/js/popmenu.js\"></script>");
  document.write("<div id=\"popmenu\" class=\"menuskin\" onMouseover=\"clearhidemenu();highlightmenu(event,'on')\" onMouseout=\"highlightmenu(event,'off');dynamichide(event)\"></div>  ");
  document.write('<a name="top"></a><table height="100%" border="0" align="center" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td width="973" height="45" valign="top" background="/chi/images/main_bg.gif"> \n');
if ( StyleName=='chi' ){  
  document.write('<table width="973" height="90" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td rowspan="3"><a href="/index.php"><img src="/chi/images/main_01.gif" width=141 height=90 border="0"></a></td>\n');

  document.write('<td><img src="/chi/images/main_02.gif" width=184 height=59></td>\n');
  document.write('<td><IMG SRC="/chi/images/main_03.jpg" WIDTH=186 HEIGHT=59></td>\n');
  document.write('<td><IMG SRC="/chi/images/main_04.jpg" WIDTH=270 HEIGHT=59></td>\n');
  document.write('<td><IMG SRC="/chi/images/main_05.jpg" WIDTH=192 HEIGHT=59></td>\n');

  document.write('</tr>\n');
  document.write('<tr>\n');

  document.write('<td colspan="3"><img src="/chi/images/main_07.jpg" width=640 height=10></td>\n');
  document.write('<td rowspan="2">\n');
  document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n');
  
document.write('<td><img src="/'+StyleName+'/images/icon_phpbb1.gif" border=0 ></td>');
document.write('</a>');

  showFuncMenu2();
  
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');

  document.write('<tr>\n');
  document.write('<td colspan="3" background="/chi/images/main_21.gif">\n');
  document.write('<table border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr><td>\n');
  
  showFuncMenu();

  document.write('</td></tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
}else{

  document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr>\n');
  document.write('<td width="141"><a href="/index.php"><img src="/'+StyleName+'/images/main_01.gif" width="141" height="90" border="0"></a></td>\n');
  document.write('<td valign="top">\n');
  document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr><td valign="top">\n');
  document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr>\n');
  document.write('<td width="184"><img src="/'+StyleName+'/images/main_02.gif" width="184" height="59"></td><td>\n');
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="649" height="59">\n');
  document.write('<param name="movie" value="/'+StyleName+'/'+StyleName+'.swf">\n');
  document.write('<param name="quality" value="high">\n');
  document.write('<embed src="/'+StyleName+'/'+StyleName+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="649" height="59"></embed>\n');
  document.write('</object>\n');
  document.write('</td></tr></table></td></tr><tr><td valign="top">\n');
  document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr><td width="640" valign="top">\n');
  document.write('<table width="100%"  border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr><td height="10"><img src="/'+StyleName+'/images/main_04.jpg" width="640" height="10"></td></tr>\n');
  document.write('<tr><td valign="top"  align=left><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr>\n');

    showFuncMenu();
  document.write('<td background="/'+StyleName+'/images/main_21.gif" width="100%"></td>\n');
  document.write('</tr></table></td></tr></table></td><td valign="top">\n');
  document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>\n');

  document.write('<td><img src="/'+StyleName+'/images/icon_phpbb1.gif" border=0 ></td>');
  showFuncMenu2();
  document.write('<td background="/'+StyleName+'/images/main_21.gif" width="100%"></td>\n');
  document.write('</tr></table></td></tr></table></td></tr></table></td></tr></table>\n');

}   
  
  document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td width="141" valign="top">\n');
  
  document.write('<table width="141" border="0" cellpadding="0" cellspacing="0" background="/chi/images/main_btn_bg.gif">\n');
  document.write('<tr>\n');

  ShowFlash();  

  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><img src="/chi/images/main_26.gif" width="141" height="16"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td>\n');
  document.write('<table width="140" border="0" cellspacing="0" cellpadding="0" >\n');
  
  ShowSubMenu();  
  
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><img src="/chi/images/main_30.gif" width="141" height="13"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><p align="center"><img src="/chi/images/main_btn_bgline.gif" width="127" height="2" vspace="8"></p></td>\n');
  document.write('</tr>\n');

//Login Info
  document.write('<tr>\n');
  document.write('<td><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  showLoginInfo();
  document.write('</td></table>\n');
  document.write('</tr>\n');

  document.write('<tr>\n');
  document.write('<td><p align="center"><img src="/chi/images/main_btn_bgline.gif" width="127" height="2" vspace="8"></p></td>\n');
  document.write('</tr>\n');
    
  document.write('<tr>\n');
  document.write('<td><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  
  
//Search Engine  
  document.write('<tr>\n');
  document.write('<td colspan="2"><img src="/'+StyleName+'/images/main_search.gif" width="77" height="24" hspace="1" vspace="2"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><div align="right"><form name=S onsubmit="searchgo(1);" action="/chi/search/result.php"><input type=hidden name=type value=1>\n');
  document.write('<input name="keyword" type="text" size="16" class="inputText" onBlur=\"this.style.backgroundColor=\'#D4EEF3\'\" onMouseOver=\"this.focus()\" onFocus=\"this.style.backgroundColor=\'#FFffde\'\">\n');
  document.write('</div></td>\n');
  document.write('<td width=30><a href="#"><img src="/chi/images/icon_search.gif" width="28" height="20" hspace="5" border=0 onclick="searchgo(1)"></a></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('<td width=30><a href="#"><img src="/chi/images/icon_searchmore.gif" width="28" height="21" hspace="5" border=0 onclick="searchgo(2)"></a></td>\n');
  document.write('</form></tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><div align="center"><img src="/chi/images/main_btn_bgline.gif" width="127" height="2" vspace="10"></div></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n');
  document.write('<td colspan="2"><img src="/'+StyleName+'/images/main_epaper.gif" width="66" height="24" hspace="1" vspace="2"></td>\n');
  document.write('</tr>\n');
//epaper
  document.write('<tr>\n');
  document.write('<td><div align="right"><form name=EpaperForm action="#" method=post onsubmit="return checkEpaper();">\n');
  document.write('<input name="email" type="text" value=" 請輸入e-mail" size="16" class="inputText" onBlur=\"this.style.backgroundColor=\'#D4EEF3\'\" onMouseOver=\"this.focus()\" onFocus=\"this.style.backgroundColor=\'#FFffde\'\" >\n');
  document.write('</div></td>\n');
  document.write('<td width=30><a href="#" title="訂閱電子報"><img src="/chi/images/icon_epaper_oder.gif" width="28" height="21" hspace="5" border="0" alt="訂閱電子報" onClick="CheckTopEmail1()"></a></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><table border="0" align="right" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td><a href="/chi/epaper/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image33\',\'\',\'/chi/images/icon_ep_online_on.gif\',1)"><img src="/chi/images/icon_ep_online.gif" name="Image33" width="48" height="21" border="0"></a></td>\n');
  document.write('<td><a href="mailto:312637@itri.org.tw" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image34\',\'\',\'/chi/images/icon_ep_vote_on.gif\',1)"><img src="/chi/images/icon_ep_vote.gif" name="Image34" width="36" height="21" border="0"></a></td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('<td width=30><a href="#" title="取消訂閱電子報"><img src="/chi/images/icon_epaper_cel.gif" width="28" height="21" hspace="5" border="0" alt="取消訂閱電子報" onClick="CheckTopEmail2()"></a></td>\n');
  document.write('</form></tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  
  document.write('<tr>\n');
  document.write('<td valign="top"> <div align="center"> <img src="/chi/images/main_btn_bgline.gif" width="127" height="2" vspace="10"> \n');
  document.write('</div></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  //document.write('<td valign="top"> <div align="center"><a href="http://www.technomart.org.tw/chi/download/20040524台瑞技術商業化合作_尋求台灣合作廠商.doc" target="_blank" title="20040524台瑞技術商業化合作_尋求台灣合作廠"><img src="/chi/images/year.gif" vspace="10" border=0></a></td>\n');
  //document.write('<td valign="top" align="center"><img src="/chi/images/year.gif" width="120" border=0></td>\n');
  document.write('</tr>\n');
  
  document.write('</table></td>\n');
  document.write('<td width="832" valign="top">\n');
  document.write('<table width="832" border="0" cellpadding="0" cellspacing="0" background="/chi/images/main_23.gif">\n');
  document.write('<tr>\n');
  document.write('<td width="798" align="right" class="pageindex">\n');
  
  ShowPageIndex();
  
  document.write('</td>\n');
  
  document.write('<td width="1" align="right"><a href="#" onclick="history.back();" ><img src="/chi/images/main_24.gif" width="34" height="33" alt="回上一頁" title="回上一頁" border=0></a></td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('<table width="832" border="0" cellspacing="0" cellpadding="0">\n');
  document.write('<tr>\n');
  document.write('<td width="1"><img src="/chi/images/spacer.gif" width="'+space_w+'" height="8"></td>\n');

  ShowCatPic();
  
  document.write('<td width="1"><img src="/chi/images/spacer.gif" width="'+space_w+'" height="8"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('<td>\n');
}


function showFooter() {
  
  document.write('</td>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('</tr>\n');
  document.write('</table></td>\n');
  document.write('<td rowspan="2" background="/chi/images/main_line.gif"><img src="/chi/images/spacer.gif" width="1" height="1"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td width="973" height="20" valign="bottom" background="/chi/images/main_bg.gif">\n');
  document.write('<table width="973" height="20" border="0" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td width="141" rowspan="3" valign="bottom">\n');
  document.write('<table border="0" align="center" cellpadding="0" cellspacing="0">\n');
  document.write('<tr>\n');
  document.write('<td><img src="/chi/images/count_line.gif" width="8" height="13"></td>\n');
  document.write('<td align=center colspan=5>'+counter+'</td>\n');
  document.write('<td><img src="/chi/images/count_line.gif" width="8" height="13"></td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td colspan="7" class="count"><div align="center">since 2002.07.01</div></td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('<td width="832"><p>&nbsp;</p><div align="center">\n');
  document.write('<p class="footermenu"><a href="/chi/news/" class="footermenu">新聞動態</a> | <a href="/chi/about/" class="footermenu">關於我們</a> | <a href="/chi/techs/" class="footermenu">技術&amp;機會</a> | <a href="/chi/member/" class="footermenu">會員專區</a> | <a href="/chi/web/" class="footermenu">相關網站</a><br>\n');
  document.write('<a href="/chi/contact/" class="footermenu">互動交流</a> | <a href="/chi/qa/" class="footermenu">常見問答集</a> | <a href="/chi/download/" class="footermenu">下載專區</a> | <a href="/chi/sitemap/" class="footermenu">網站導覽</a> | <a href="/chi/contact/" class="footermenu">聯絡我們</a> | <a href="/chi/news/" class="footermenu">首頁</a></p></div>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td>&nbsp;</td>\n');
  document.write('</tr>\n');
  document.write('<tr>\n');
  document.write('<td><div align="center" class="footer">主辦單位：<img src="/chi/images/s_logo_01.gif" width="20" height="14" vspace="4" align="absmiddle">經濟部中小企業處 承辦單位：<img src="/chi/images/s_logo_02.gif" width="20" height="15" align="absmiddle">工業技術研究院  Copyright &copy;2002 中小企業升級轉型資訊網. All rights reserved.</div></td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  document.write('</td>\n');
  document.write('</tr>\n');
  document.write('</table>\n');
  
  //document.write('<script type="text/javascript">\n');
  //document.write('var _gaq = _gaq || [];\n');
  //document.write('_gaq.push(["_setAccount", "UA-20957819-1"]);\n');
  //document.write('_gaq.push(["_trackPageview"]);\n');
  //document.write('(function() {\n');
  //document.write('var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;\n');
  //document.write('ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";\n');
  //document.write('var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);\n');
  //document.write('})();\n');
  //document.write('</script>\n');

  document.write('</BODY>\n');
  document.write('</HTML>\n');
}

function isDate(aobj,caption,display) {
  var sdate,sYY,sMM,sDD;
  var allValid = true;
  sdate = aobj.value;
  sdate = sdate.replace("/","-");
  sdate = sdate.replace("/","-");
  sYY=sdate.substring(0,sdate.indexOf("-"));
  sdate=sdate.substring(sdate.indexOf("-")+1,sdate.length);
  sMM=sdate.substring(0,sdate.indexOf("-"));
  sDD=sdate.substring(sdate.indexOf("-")+1,sdate.length);
  
  if ( !isNumber("S",sYY,"",false) ){
      allValid=false;
  }else{
      if (sYY.length!=4) allValid=false;
  }
  
  if ( !isNumber("S",sMM,"",false) ){
      allValid=false;
  }else{
      if (sMM.length!=2) {
        allValid=false;
      }else{
         sMM = parseInt(sMM);
         if ( (sMM < 1) || (sMM > 12) ) allValid = false;
      }
  }
  if ( !isNumber("S",sDD,"",false) ){
      allValid=false;
  }else{
      if (sDD.length!=2) {
          allValid=false;
      }else{
          sDD = parseInt(sDD);
          switch (String(sMM)) {
          case '1' :
          case '3' :
          case '5' :
          case '7' :
          case '8' :
          case '10':
          case '12':
              if ( (sDD < 1) || (sDD > 31) ) allValid = false;
              break;
          case '4' :
          case '6' :
          case '9' :
          case '11':
              if ( (sDD < 1) || (sDD > 30) ) allValid = false;
              break;
          case '2':
              if ( (sDD < 1) || (sDD > 29) ) allValid = false;
              break;
          default :
              allValid = false;
              break;
          }
      }
  }

  if ( !allValid ){
      if (display) alert("\"" + caption + "\"輸入錯誤, 不是合法的日期格式!");
  }
  return allValid;
}

// stype   : 要進行判斷數值的形態, "F":Float "I":Integer "S":Single
// elm     : 要進行判斷的數值
// caption : 欄位的名稱,顯示錯誤訊息時使用
// display : true/false, 決定是否要顯示錯誤訊息
function isNumber(stype,elm,caption,display){
  var checkOK = "0123456789";
  var checkStr = elm;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  
  switch (stype) {
  case 'F':checkOK = "0123456789-.";
           break;
  case 'I':checkOK = "0123456789-";
           break;
  case 'S':checkOK = "0123456789";
           break;
  }
   
  for ( i=0; i<checkStr.length; i++ ) {
      ch = checkStr.charAt(i);
      for ( j=0; j<checkOK.length; j++ )
          if ( ch==checkOK.charAt(j) ) break;
      
      if ( j==checkOK.length ) {
          allValid = false;
          break;
      }
      allNum += ch;
  }
  if ( allValid ) {
  	  return true;
  }else{
      if (display) alert("\"" + caption + "\"輸入錯誤, 不是合法的數字格式!");
  	  return false;
  }
}

// IdObj     : 要回傳id 的物件
// NameObj   : 要回傳name 的物件
// type      : 要啟動的表單種類
function getIdName(IdObj, NameObj, type) {
    window.IdObj=IdObj;
    window.NameObj=NameObj;
    switch (type) {
    case 'Me':
        MeWindow=window.open('/chi/lib/getMeIdName.php','會員名單','HEIGHT=250,resizable=yes,WIDTH=460')
        break;
    case 'Fe':
        alert
        MeWindow=window.open('../lib/getFeIdName.php','可行性評估','HEIGHT=250,resizable=yes,WIDTH=460,TOP=50,LEFT=100')
        break;
    }
}

// IdObj     : 要回傳id 的物件
// Eb_id     : 博覽會id
function getEtsId(IdObj,Eb_id) {
    window.IdObj=IdObj;

    MeWindow=window.open('/chi/lib/getEtsIdName.php?Eb_id='+Eb_id,'技術名單','HEIGHT=250,resizable=yes,WIDTH=460')

}

// Idc_1Obj     : 要回傳id 的物件
// Idc_2Obj     : 要回傳id 的物件
function getTsId(Idc_1Obj,Idc_2Obj) {
  window.Idc_1Obj=Idc_1Obj;
  window.Idc_2Obj=Idc_2Obj;
  
  MeWindow=window.open('/chi/lib/getTsIdName.php','供給技術','HEIGHT=250,resizable=yes,WIDTH=460')
}

// Idc_1Obj     : 要回傳id 的物件
// Idc_2Obj     : 要回傳id 的物件
function getTdId(Idc_1Obj,Idc_2Obj) {
  window.Idc_1Obj=Idc_1Obj;
  window.Idc_2Obj=Idc_2Obj;
  
  MeWindow=window.open('/chi/lib/getTdIdName.php','需求技術','HEIGHT=250,resizable=yes,WIDTH=460')
}

function getBkdate(Obj_date,Obj_time) {
  window.Obj_date=Obj_date;
  window.Obj_time=Obj_time;
  
  MeWindow=window.open('/chi/lib/getBkDate.php','預約時間表','HEIGHT=550,scrollbars=yes,resizable=yes,WIDTH=750')
}

//去空白
function trim(elm) {
  while ((elm.length>0) && (elm.indexOf(" ")==0)) {
      elm=elm.substring(1,elm.length);
  }
  while ((elm.length>0) && (elm.lastIndexOf(" ")==(elm.length-1))) {
      elm=elm.substring(0,elm.length-1);
  }
  return elm;
}

function searchgo(type) {
    if (type==1){
    	window.location.href='/chi/search/result.php?keyword='+document.S.keyword.value+'&type=1';
    }else{
        window.location.href='/chi/search/index.php?keyword='+document.S.keyword.value;
    }

}

function test() {
    document.write(counter);
}

// 檢查是否有輸入電子報的email
function checkEpaper() {
  alert('請點選 "訂閱" 或 "取消" 電子報!!');
  return false;
}

function CheckTopEmail1() {
  if (! isTopEmail(document.EpaperForm.email, "") ) {
     return false;
  }else{
     window.open('/chi/epaper/order.php?email='+document.EpaperForm.email.value,'','width=400,height=150');
  }
}

function CheckTopEmail2() {
  if (! isTopEmail(document.EpaperForm.email, "") ) {
     return false;
  } else {
     window.open('/chi/epaper/cancel.php?email='+document.EpaperForm.email.value,'','width=400,height=150');
  }
}

//檢查email的function
function isTopEmail(elm, prompt_str) {
  var i;
  if (elm.value == prompt_str) {
    alert('請輸入"電子郵件"!!');
    elm.focus();
    return false;
  } 
  if (elm.value.indexOf("@.") != "-1" ||
      elm.value.indexOf(".@") != "-1") {
    alert ('"電子郵件"位址錯誤!!');
    elm.focus();
    return false;
  }
  if (elm.value.indexOf("@") == "-1" ||
      elm.value.indexOf(".") == "-1") {
    alert ('"電子郵件"位址應該包含"@"和"."!!');
    elm.focus();
    return false;
  }
  if (elm.value.indexOf(" ") != "-1") {
    alert ('"電子郵件"位址不可含有空白!!');
    elm.focus();
    return false;
  }
  if (elm.value.indexOf("\"") != "-1") {
    alert ('"電子郵件"位址不可含有 \"!!');
    elm.focus();
    return false;
  }
  for (i = 0;i < elm.value.length; i ++) {
    
    var count=0; //計算@出現的次數
  
    if (elm.value.charCodeAt(i) >= 128) {
      alert ('"電子郵件"位址不可含有中文字!!');
      elm.focus();
      return false;
    }
    if (i == elm.value.length-1 &&
        elm.value.charAt(i) == ".") {
      alert ('"電子郵件"位址錯誤!!');
      elm.focus();
      return false;
    }
    if (i == 0 &&
        elm.value.charAt(i) == ".") {
      alert ('"電子郵件"位址錯誤!!');
      elm.focus();
      return false;
    }
    if (i == elm.value.length-1 &&
        elm.value.charAt(i) == "@") {
      alert ('"電子郵件"位址錯誤!!');
      elm.focus();
      return false;
    }
    if (i == 0 &&
        elm.value.charAt(i) == "@") {
      alert ('"電子郵件"位址錯誤!!');
      elm.focus();
      return false;
    }
    if (elm.value.charAt(i) == "@") 
      count = count + 1;
  }
  
  if (count > 1)
    return false;
  
  return true;
}

function LoginInfoUrl(type) {
    switch ( type ){
        case 1 :
            window.location.href='/chi/member/member.php?mode=forg';
            break;
        case 2 :
            window.location.href='/chi/member/member.php?mode=type';
            break;
        case 3 :
            window.location.href='/chi/member/logout.php';
            break;
        case 4 :
            window.location.href='/chi/member/member.php';
            break;
        default :
            break;
    }

}

function HomeLogin() {
    if (checkLogin()){
        document.L.submit();
    }    
}
function checkLogin() {
  if ((document.L.Idc.value=trim(document.L.Idc.value)) == "") { 
      alert('請輸入"帳號"!!\n\n公司會員：請輸入統一編號 \n個人會員：請輸入身份證字號');
      document.L.Idc.focus();
      return false;
  }
  if ((document.L.password.value=trim(document.L.password.value)) == "") { 
      alert('請輸入"密碼 "!!');
      document.L.password.focus();
      return false;
  }

  return true;
}

function WatermarkBlur(obj, mark_string){
	if (jQuery(obj).val() == ''){
		jQuery(obj).val(mark_string)
	}
}

function WatermarkFocus(obj,mark_string){
	if (jQuery(obj).val() == mark_string)
		jQuery(obj).val('');
}

function HoverImg(obj,img_src){
	jQuery(obj).attr('src',img_src);
}

function PageClick(TargetForm,TargetPage){
	eval('document.' + TargetForm + '.page.value = ' + TargetPage);
	eval('document.' + TargetForm +'.submit()');
}

function ShowTechImg(obj,img_root,notEmpty){
	var img_url = $(obj).attr('src');
	if (notEmpty === true){
		$('#main_img').attr('src',img_url);
		$('#prodimg_url').attr('href',img_url);
	}else{
		$('#main_img').attr('src', img_root+'/b_pic.jpg');
		$('#prodimg_url').attr('href','#');
	}
}

function ZoomOutImg(){
	var open_url = $('#prodimg_url').attr('href');
	window.open(open_url, 'prodimg');
}

