// JavaScript Document
//只能輸入數字跟刪除鍵
function CheckNum(e){
    var key = window.event ? e.keyCode : e.which;
	var keychar = String.fromCharCode(key);
	reg = /\d/;
	return reg.test(keychar);
}

// 開啟檔案管理視窗
function upload_window(action_file,return_id){   
    var new_width  = 720;
    var new_height = 500;
    //var scr_width  = screen.availWidth;
    //var scr_height = screen.availHeight;
    //var old_width  = scr_width - new_width;
    //var old_height = scr_height;
    //var space = 0 - window.screenLeft ;
    //window.resizeTo(old_width,old_height);
    //window.moveBy(space,0);
    window.open(action_file + '&return_id=' + return_id ,'','width='+new_width+',height='+new_height+',scrollbars=yes,status=yes');
}

function resize_opener(){
    var scr_width  = screen.availWidth;
    var scr_height = screen.availHeight;
    window.opener.resizeTo(scr_width,scr_height);
}

function ConfirmMSG(msg,url){
    var conf = confirm(msg);
    if(conf){
        location.href= url;
        return true;
    }else{
        return false;
    }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}
function popinquiry(txt){
    var url="cart.php?func=s_inquiry&p_id=" + txt;
    wo=window.open(url,"Inquiry","toolbar=no,top=200,left=400,width=600,height=420");
    wo.focus();
}

//加入我的最愛
function addBookmarkForBrowser(sTitle, sUrl) {
    if (window.external && navigator.appName == "Microsoft Internet Explorer") {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.external.AddFavorite(sUrl, sTitle);
        }
    } else if (window.sidebar && window.sidebar.addPanel) {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.sidebar.addPanel(sTitle, sUrl, "");
        }
    } else {
        addBookmarkForBrowser = function() {
            alert("do it yourself");
        }
    }

    return addBookmarkForBrowser(sTitle, sUrl);
}

