// <SCRIPT TYPE="text/javascript" SRC="dhtml/link.js"></SCRIPT>

var done_width = 350, done_height = 175 ;
// ===============================================
function newscreen(dest,width,height)
{                                      
    
    window.open(dest, 'floater', 'history=no,location=no,scrollbars=yes,width=770,height=540');
}

function smallscreen(dest)
{
    window.open(dest, 'floater', 'history=no,location=no,scrollbars=no,width=350,height=150,top=180,left=200');
    
} 


//=====================================================================
//	index.php -> logout used
//=====================================================================
function logout_confirm()
{
    var msg = "Are you sure to logout ?";
    if ( confirm(msg) )
    {
        window.location = "account/logout.php";
    }
        
}

//=====================================================================
//	index.php -> xxxxx used
//=====================================================================
function mod_data(ini_value,mode,goal,desc,nullmode)
{
    var url_str; 
    url_str = "mod_data.php?cgi_data="+ini_value+"&cgi_mode="+mode+"&cgi_goal="+goal+"&cgi_desc="+desc+"&cgi_nullmode="+nullmode;
    return smallscreen(url_str);
        
}    

function mod_ip_data(ini_value,mode,goal,desc,nullmode)
{
    var msg = "此 IP 為 Meta Search Server IP，當 IP 改變後將牽動多個設定檔及網頁，\r\n在更新 Server IP 之後，須重新再執行多主機設定檔同步工程程式，系\r\n統會自動將IP值重新套用。\r\n\r\n你確定要執行嗎 ?";
    if ( confirm(msg) )
    {
        var url_str; 
        url_str = "mod_data.php?cgi_data="+ini_value+"&cgi_mode="+mode+"&cgi_goal="+goal+"&cgi_desc="+desc+"&cgi_nullmode="+nullmode;
        return smallscreen(url_str);
    }
        
}
 

function exe_php()
{
    var msg = "多主機設定檔同步工程程式使用時機為：\r\n\r\n1. 當管理者重新設定Meta Search Server群組後(如:更新左側樹狀目錄群組之個別指定網頁)，需要執行此程式做重新套用。\r\n\r\n2. 不同主機上(如:Notes,PDM)之tornado.ini有變動時，需要執行此程式做重新套用。\r\n\r\n3. 改變Meta Search Server IP ，需要執行此程式做重新套用。\r\n\r\n你確定要執行嗎 ?";
    if ( confirm(msg) )
    {
        var url_str;
        url_str = "system_done.php";
        return smallscreen(url_str);
    }    
}  

function mod_fetch_data(ini_value,mode,goal,desc,nullmode)
{
    var msg = "資料源擷取最大筆數可向上或向下調整，但設定過大將導致系統花費較多時間做網路擷取資料的動作，另外所設定值最好為每次抓取筆數的倍數。\r\n\r\n你確定要執行嗎 ?";
    if ( confirm(msg) )
    {
        var url_str; 
        url_str = "mod_data.php?cgi_data="+ini_value+"&cgi_mode="+mode+"&cgi_goal="+goal+"&cgi_desc="+desc+"&cgi_nullmode="+nullmode;
        return smallscreen(url_str);
    }          
}   

//=====================================================================
//	
//=====================================================================
function open_url(link_url, width, height)
{
    window.returnValue = window.showModelessDialog(link_url, "","dialogHeight: "+height+"px; dialogWidth: "+width+"px; center: Yes; help: No; resizable: Yes; status: No;dialogHide: yes");
    return window.returnValue
}

//=====================================================================
//	pop out  new window                          
// opendialog(link_url, x, y, message, [scroll], [winname]);
//=====================================================================
function opendialog(link_url, width, height, message)
{
    var retval;
    var args;
    args = new Array(3);
    args[0] = link_url;
    args[1] = width;
    args[2] = height;
    //showModelessDialog ,showModalDialog
    retval = window.showModelessDialog("main/wait.php&cgi_message="+message, args,"dialogHeight: 20px; dialogWidth: 200px; center: Yes; help: No; resizable: No; status: No;") ;
    return retval;
}    



 //=====================================================================
//	開啟另外一個視窗                         2003.11
// openlink(link_url, x, y, message, [scroll], [winname], [win_y]);
//=====================================================================
function openlink(link_url,width,height, message)
    {
      
      win_x=(screen.width - width)/2;
      win_y=(screen.height - height)/2 - 20;
      linkWin=window.open('','urllink',"width="+width+",height="+height+",top="+win_y+",left="+win_x+",scrollbars=no");
      linkWin.document.write("<center><br>"+message+"</center>");linkWin.document.close();
      linkWin.location=link_url;
      linkWin.focus();
    }
    
    
//=====================================================================
//	開啟另外一個視窗                         2004.01
// openlink(link_url, x, y, message, [scroll], [winname], [win_y]);
//=====================================================================
function openlink2(link_url,width,height, message)
    {
      
      win_x=(screen.width - width)/2;
      win_y=(screen.height - height)/2 - 20;
      linkWin=window.open('','urllink',"width="+width+",height="+height+",top="+win_y+",left="+win_x+",scrollbars=yes");
      linkWin.document.write("<center><br>"+message+"</center>");linkWin.document.close();
      linkWin.location=link_url;
      linkWin.focus();
    }


//=====================================================================
//	link and change the size of window                            
//=====================================================================
function gotolink(link_url,width,height, message)
{
    var scroll = "no", wname;
    if (arguments.length == 5)
        scroll = arguments[4];
    if (arguments.length == 6)
    {
        scroll = arguments[4];
        wname = arguments[5];
    }
    win_x=(screen.width - width)/2;
    win_y=(screen.height - height)/2 - 20;

    window.moveTo(win_x, win_y) ;
    window.resizeTo(width, height) ;
    window.location = link_url ;

    document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=big5">');
    document.write('<link rel="stylesheet" href="/cpc_main/style.css"></head><body>');
    document.write('<center><br>'+message+'</center></body></html>');
    document.close();
}     

   

