﻿function checkkeyword() {
    var keyword = document.getElementById("txtKeyword").value;
    if (keyword.length <= 0) {
        alert("请输入关键字!");
        document.getElementById("txtKeyword").focus();
    }
    else {
        window.location.href = 'SearchNews.aspx?Keyword=' + escape(keyword);
    }

}

function userlogin() {
    var user = document.getElementById("username").value;
    var pwd = document.getElementById("pwd").value;
    if (user.length <= 0 || pwd.length <= 0) {
        alert("用户名和密码不能为空");
        return;
    }

    var curUrl = location.href;
    if (typeof curUrl == 'undefined' || curUrl == '')
        curUrl = '/index.aspx';

    $.post('/ajax.aspx', { 'action': 'login', 'user': user, 'pwd': pwd }, function(res) {
        if (res == 'FAILED') {
            alert('登录失败, 请检查你的用户名和密码');
        }
        else {
            alert('登陆成功!');
            location.href = curUrl;
        }
    });
}

function addfavourite()
{
if (document.all)
{ window.external.addFavorite('http://www.51caic.com', '中国汽车产业咨询网'); }
else if (window.sidebar)
{ window.sidebar.addPanel('中国汽车产业咨询网', 'http://www.51caic.com', ""); }
}

function readtxt(txt) {
    document.write(txt);
}
