﻿function GetObj(strkj) {
    try {
        if (GetObj) {
            return eval('document.getElementById("' + strkj + '")');
        }
        else {
            return eval('document.all.' + strkj);
        }
    }
    catch (e)
	{ }
}

function EnterKey() {
    if (event.keyCode == 13) GetObj("seBtn").focus();
}
function toSearch() {
    var mWord = GetObj("ctl00_words").value;
    var nowType = GetObj("ctl00_seType").options[GetObj("ctl00_seType").selectedIndex].value;
    var searchUrl = '';
    if (mWord == "") alert("please enter keywords");
    else{
        if (nowType == 0) searchUrl = "/Stock/" + mWord + "-p1.html";
        else if (nowType == 1) searchUrl = "/Picture/" + mWord + "-p1.html";
        else if (nowType == 2) searchUrl = "/File/se_" + mWord + "-p1.html";
        else if (nowType == 3) searchUrl = "/News/se_" + mWord + "-p1.html";
        window.location.href = searchUrl;
    }
}

<!--
    //图片按比例缩放
    var flag = false;
    function DrawImage(ImgD, iwidth, iheight) {
        //参数(图片,允许的宽度,允许的高度)
        var image = new Image();
        image.src = ImgD.src;
        if (image.width > 0 && image.height > 0) {
            flag = true;
            if (image.width / image.height >= iwidth / iheight) {
                if (image.width > iwidth) {
                    ImgD.width = iwidth;
                    ImgD.height = (image.height * iwidth) / image.width;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
                ImgD.alt = image.width + "×" + image.height;
            }
            else {
                if (image.height > iheight) {
                    ImgD.height = iheight;
                    ImgD.width = (image.width * iheight) / image.height;
                } else {
                    ImgD.width = image.width;
                    ImgD.height = image.height;
                }
                ImgD.alt = image.width + "×" + image.height;
            }
        }
    } 
//-->

function Login() {    
        iAjax = new SanKeLaAjax();
        iAjax.OnComplete = iAjax_Complete;
        iAjax.OnError = iAjax_OnError;
        var myId = GetObj("myId").value;
        var myPwd = GetObj("myPwd").value;
        var PostUrlString = "/Master/Singin.aspx";
        var PostValue = "myId=" + myId + "&myPwd=" + myPwd;
        iAjax.DoCallBack(PostUrlString, PostValue, null);
}
function iAjax_Complete(responseText, responseXML) {
    if(responseText=="1") window.location.href = "SignIn/Success.aspx";
    else alert("登陆失败");
}
function iAjax_OnError(status, statusText, responseText) {
    //Do nothing
}

