﻿    var bb = ["ie90", "google", "baidu", "yahoo", "sogou", "gougou"];

      var sc = "ie90";

     function search(obj) {
        sc = obj.id;
        var t = null;
        obj.setAttribute("src","images/"+obj.id+"_2.gif");
        for (var i = 0; i < bb.length; i++) {
            if (bb[i] != obj.id) {
                t = document.getElementById(bb[i]);
                t.setAttribute("src", "images/" + bb[i]+ "_1.gif");
            }
        }
    }

    function OpenWindows() {

        var kw = document.getElementById("txtkey").value;

        if (sc.length == 0 || kw.length == 0) {
            return;
        }
        
        window.location.href="search/Default.aspx?kw=" + encodeURIComponent(kw) + "&sc=" + sc;

    }

    function mainLoop() {

        var val = document.getElementById("txtkey").value;

        if ((document.getElementById("ie90").getAttribute("src").indexOf("ie90_2.gif")>0) && (val.length != 0) && (lastVal != val)) {
           $.post("Ajax.aspx", 
                { Action: "post",Name: val},
		        function (data, textStatus){
			        var list = eval(data);
			        showQueryDiv(list);
			        lastVal = val;
		        }, "json");
           
        }
    }
		



function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}



var list = new Array();
function initXml() {
    var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
    xmldoc.async = false;

    xmldoc.load("2.xml");
    var s = xmldoc.parseError.errorCode;
    if (xmldoc.readyState == 4 && xmldoc.parseError.errorCode == 0) {
        var nodes = xmldoc.documentElement.selectNodes("item");
        if (nodes != null && nodes.length > 0) {
            var content = "";
            var item = null;
            for (var i = 0; i < nodes.length; i++) {
                item = new Object();
                item.id = nodes(i).childNodes(0).text;
                item.url = nodes(i).childNodes(1).text;
                item.title = nodes(i).childNodes(2).text;
                list.push(item);
            }
        }
    }

    window.setTimeout(f1, 2000);
    window.setTimeout(f2, 2000);
    window.setTimeout(f3, 2000);
    window.setTimeout(f4, 2000);
    window.setTimeout(f5, 2000);
}

function f1() {
    var s = document.getElementById("sid1");
    var index = Math.floor(Math.random() * list.length);

    if (list[index].id == 1) {
        s.href = list[index].url;

        if (list[index].url == "http://www.ie90.cn/") {
            s.innerHTML = "<span style='color:Red'>" + list[index].title + "</span>";
        } else {
            s.innerText = list[index].title;
        }
    }
    window.setTimeout(f1, 500);
}
function f2() {
    var s = document.getElementById("sid2");
    var index = Math.floor(Math.random() * list.length);
    if (list[index].id == 2) {
        s.href = list[index].url;

        if (list[index].url == "http://www.ie100.cn/") {
            s.innerHTML = "<span style='color:Red'>" + list[index].title + "</span>";
        } else {
            s.innerText = list[index].title;
        }
    }
    window.setTimeout(f2, 500);
}
function f3() {
    var s = document.getElementById("sid3");
    var index = Math.floor(Math.random() * list.length);
    if (list[index].id == 3) {
        s.href = list[index].url;
        if (list[index].url == "http://www.tcc360.cn") {
            s.innerHTML = "<span style='color:Red'>" + list[index].title + "</span>";
        } else {
            s.innerText = list[index].title;
        }
    }
    window.setTimeout(f3, 500);
}
function f4() {
    var s = document.getElementById("sid4");
    var index = Math.floor(Math.random() * list.length);
    if (list[index].id == 4) {
        s.href = list[index].url;
        s.innerText = list[index].title;
    }
    window.setTimeout(f4, 500);
}
function f5() {
    var s = document.getElementById("sid5");
    var index = Math.floor(Math.random() * list.length);
    if (list[index].id == 5) {
        s.href = list[index].url;
        s.innerText = list[index].title;
    }
    window.setTimeout(f5, 500);
}
    