function getKey()
{
	var key = event.keyCode;
	switch(key)
		{
			// enter
			case 13:
					submitSearch();
					break;
			default:
				return;
		}
}

function trim(str)
{
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function submitSearch()
{	
	var key = trim(document.getElementById("searchKeyword").value);
    if (key == "")
    {
        alert("請輸入欲搜尋的字串");
        document.getElementById("searchKeyword").focus();
        return false;
    }    
    
   
	document.getElementById("fmKeyword").value = key;
	document.getElementById("fmSite").submit();
		
}

function printMenu()
{
	//document.write("<div id='Nav'><h4>站內檢索</h4>");
	document.write("<div id='_form' style='position:absolute;left:0px;top:0px'>"); 
	document.write("<form id='fmSite' name='fmSite' action='http://demo.xms.com.tw/xms/search/search.php' method=POST>");
	document.write("<input type=hidden name='page' value='1'>");
	document.write("<input type=hidden name='charset' value='BIG5'>");
	document.write("<input type=hidden id='_area' name='area' value='0'>"); 
	document.write("<input type=hidden id='fmKeyword' name='fmKeyword' value=''>"); 
	document.write("</form>");
	document.write("</div>"); 
	
	//document.write("<h4>站內搜尋</h4>");
	document.write("<table width=100% cellspacing=3 style='border-collapse: collapse; border-left: 0px solid #ccc;  border-top: 0px solid #ccc;  border-right: 0px solid #ccc; border-bottom: 1px solid #999999'>");
	document.write("<tr><td align=center>");
	document.write("<input type=text id='searchKeyword' name='searchKeyword' size=22 value='請輸入搜尋字串' onclick=\"javascript: this.value =''\" style='height:20px; color=darkred' onkeypress='getKey();'>");
	document.write("&nbsp;<img src='/icon/search.jpg' border='0' align='absmiddle' title='Search' onclick='submitSearch()' style='cursor: hand'></div>");
	document.write("</td></tr>");
	document.write("</table>");
	
	document.write("<div class='line'></div>");

    document.write("<div id='Nav'><h4>產品資訊</h4>");

    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/list.php%3FcourseID%3D22'><p>手冊下載、軟體規格</p></a>");
    document.write("<a href='http://www.powercam.com.tw/doc/'><p>重要文件列表</p></a>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/list.php%3FcourseID%3D61'><p>產品比較</p></a>");
    document.write("<a href='http://www.powercam.com.tw/formosasoft.html'><p>公司簡介</p></a>");
    
    
    document.write("<div class='line'></div>");
    
    
    document.write("<h4>應用與範例展示</h4>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/show.php%3Fid%3D34'><p>教學或研究上的應用</p></a>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/show.php%3Fid%3D498'><p>教學卓越計畫</p></a>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/show.php%3Fid%3D811'><p>從落實 OJT 到推動知識管理</p></a>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=content/show.php%3Fid%3D436'><p>如何產出實用的串流影音課程?</p></a>");
    document.write("<a href='http://xms.cs.nthu.edu.tw/xms/'><p>國中補救教學計畫</p></a>");

        
    document.write("<div class='line'></div>");    
    document.write("<h4>客戶服務</h4>");
    document.write("<a href='http://demo.xms.com.tw/xms/index.php?reload=1&view=forum/list.php%3FcourseID%3D28'><p>線上客服 (Q & A)</p></a>");
    document.write("<a href='http://www.powercam.com.tw/powercam_faq.html'><p>FAQ (常見問題與解答)</p></a>");
    // document.write("<a href='http://www.powercam.com.tw/faq_read.html'><p>閱讀問題與排除方法</p></a>");

    document.write("<a href='http://www.powercam.com.tw/register/login.php'><p>經銷商登入</p></a>");
    document.write("<a href='#' onclick='window_open(\"http://www.powercam.com.tw/getkey.php\",560,500)'><p>註冊序號/Verified Code 查詢</p></a>");
    
    
    /*
    document.write("<div class='line'></div>");


    
    document.write("<h4>ezLMS 學習與知識管理系統</h4>");
    document.write("<a href='http://www.powercam.com.tw/ezlms_v2.html'><p>ezLMS 2 簡介與產品特色</p></a>");
    document.write("<a href='http://www.powercam.com.tw/ezLMS/content_map/list.php?courseID=17'><p>知識管理三部曲</p></a>");
    document.write("<a href='http://www.powercam.com.tw/ezLMS/content_map/list.php?courseID=18'><p>如何有系統地累積知識</p></a>");
    document.write("<a href='http://www.powercam.com.tw/ezLMS/content_map/list.php?courseID=14'><p>撰寫 FAQ 的技巧</p></a>");
    document.write("<a href='http://www.powercam.com.tw/ezLMS/content_map/list.php?courseID=16'><p>使用專案管理</p></a>");
    */
    
    document.write("<div class='line'></div>");

   
    document.write("<h4>其他</h4>");
    document.write("<a href='http://nature.cs.nthu.edu.tw'><p>自然小棧</p></a>");
    document.write("<a href='http://nature.cs.nthu.edu.tw/subject/note_list.php?subject_id=6'><p>分享好文章</p></a>");
    document.write("<a href='http://www.powercam.com.tw'><p>回到首頁</p></a>");
    document.write("</div>");
}

function window_open(_url, _width, _height)
{
    var posX = screen.width / 2 - (_width / 2);
    var posY = screen.height / 2 - (_height / 2);

    window.open(_url, null, "left=" + posX + ",top=" + posY + ",height=" + _height + ",width=" + _width + ",scrollbars=yes,toolbar=no,menubar=no,location=no");
 
}


function play(url)
{
    // url = "documents/" + url + "/" + url + ".ppt.htmls";
    switch (screen.width)
    {
        case 800:
            url = url + "/__fdlcIndex_800x600.html";
            break;
        case 1024:
            url = url + "/__fdlcIndex_1024x768.html";
            break;
        case 1280:
        default:
            url = url + "/__fdlcIndex_1280x1024.html";
            break;
    }
    
    window.open(url, null, "fullscreen=yes");
}

function playPresentation(playurl, baseurl, sp2)
{
    var url = playurl + "?baseurl=" + baseurl;  

    var width = screen.width;
    var height = screen.height;
    
    //--------------------------------------------- added by tcsu, 10/23/2003
    if (sp2 == 1)
    {
        // new window template for XP/SP2
        var left, top;
        
        // 1280x1024
        if (width >= 1280 && height >= 1024)
        {
            left = (width - 1280) / 2;
            top = 0;
            window.open(url, null, "width=1270, height=864, left=" + left + ", top=" + top + ", menubar=no, resizable=no, status=yes, titlebar=no, toolbar=no");
            return;
        }
        
        // 1024x768
        if (width >= 1024 && height >= 768)
        {
            left = (width - 1024) / 2;
            top = 0;
            window.open(url, null, "width=1014, height=675, left=" + left + ", top=" + top + ", menubar=no, resizable=no, status=yes, titlebar=no, toolbar=no");
            return;
        }
        
        // 800x600
        left = top = 0;
        if (width > 800) left = (width - 800) / 2;
        if (height > 600) top = (height - 600) / 2;
        window.open(url, null, "width=790, height=507, left=" + left + ", top=" + top + ", menubar=no, resizable=no, status=yes, titlebar=no, toolbar=no");
        return ;
    }    
    
    //--------------------------------------------- added by tcsu, 10/23/2003
    if (typeof(pptFixedSize) != "undefined")
    if (pptFixedSize == "1")   // fixed play window, 
    {
        // fullscreen mode
        if ((width == 800 && height == 600) || (width == 1024 && height == 768)) { window.open(url + "&fixedSize=1", null, "fullscreen=yes"); return; }

        // window mode
        if  (width > 1024 && height > 768)
            window.open(url + "&fixedSize=1", null, "left=0, top=0, width=1024, height=768");
        else
            window.open(url + "&fixedSize=1", null, "left=0, top=0, width=800, height=600");
        return;
    }
    
    //---------------------------------------------
    var left, top;
    
    /*
    // Windows XP SP2
    if  (window.navigator.userAgent.indexOf("SV1") != -1)  
    {
    	// 1280x1024
	    if (width > 1280 && height > 1024)
	    {
	    	left = (width - 1280) / 2;
	    	top = (height - 1024) / 2;
	    	window.open(url, null, "width=1280, height=1024, left=" + left + ", top=" + top);
	    	return;
	    }
   	    // 1024x768
	    if (width > 1024 && height > 768)
	    {
	    	left = (width - 1024) / 2;
	    	top = (height - 768) / 2;
	    	window.open(url, null, "width=1024, height=768, left=" + left + ", top=" + top);
	    	return;
	    }
	    // 800x600
	    left = top = 0;
	    if (width > 800) left = (width - 800) / 2;
	    if (height > 600) top = (height - 600) / 2;
	    window.open(url, null, "width=800, height=600, left=" + left + ", top=" + top);		
	    return;
    }
    */

    
    // non XP/SP2
    // normal screen size
    if ((width == 800 && height == 600) || (width == 1024 && height == 768) || (width == 1280 && height == 1024))
    {
        window.open(url, null, "fullscreen=yes");
        return;
    }
    
    
    // special screen size
    // 1280x1024

    if (width > 1280 && height > 1024)
    {
        left = (width - 1280) / 2;
        top = (height - 1024) / 2;
        window.open(url, null, "width=1280, height=1024, left=" + left + ", top=" + top);
        return;
    }
    
    // 1024x768
    if (width > 1024 && height > 768)
    {
        left = (width - 1024) / 2;
        top = (height - 768) / 2;
        window.open(url, null, "width=1024, height=768, left=" + left + ", top=" + top);
        return;
    }
    
    // 800x600
    left = top = 0;
    if (width > 800) left = (width - 800) / 2;
    if (height > 600) top = (height - 600) / 2;
    window.open(url, null, "width=800, height=600, left=" + left + ", top=" + top);
}

function closeWindow() {  }