﻿function h(obj,url){obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);}

function ceowen_gonews(URL)
{
	window.location.href=URL;
}


function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function ajax(wd) {
    http.open('get','/s/wd.asp?wd='+wd);
    http.send(null);
    //window.open(path);
}


//搜索面板
function SearchForm(no)
{
	//CEOWEN
	if(no==0)
	{
		ceowen.style.display = "block";
		google.style.display = "none";
		powerbygoogle.style.display = "none";
		googlehotlink.style.display = "none";
		ceowenhotlink.style.display = "block";
	}
	
	//Google
	if(no==1)
	{
		google.style.display = "block";
		ceowen.style.display = "none";
		powerbygoogle.style.display = "block";
		googlehotlink.style.display = "block";
		ceowenhotlink.style.display = "none";
	}
	
}


//搜索面板
function SearchForm2(no)
{

	//CEOWEN
	if(no==0)
	{
		ceowen.style.display = "block";
		google.style.display = "none";
		powerbygoogle.style.display = "none";
		plus2.style.display = "none";
		plus1.style.display = "block";
		check1.checked = "true";
		check2.checked = "false";
	}
	
	//Google
	if(no==1)
	{
		google.style.display = "block";
		ceowen.style.display = "none";
		powerbygoogle.style.display = "block";
		plus1.style.display = "none";
		plus2.style.display = "block";
		check2.checked = "true";
		check1.checked = "false";
	}
	
}


function googlesearch()
{
	//http://www.google.cn/search?q=%E6%B7%A1%E6%B7%A1%E7%9A%84&sa=%E5%9C%A8Google%E6%90%9C%E7%B4%A2&client=pub-6280917852466543&forid=1&prog=aff&ie=UTF-8&oe=UTF-8&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23E6E6E6%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A666666%3BLC%3A666666%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A50%3BLW%3A147%3BL%3Ahttp%3A%2F%2Fwww.ceowen.com%2Flogo%2Fceowen_logo_small.gif%3BS%3Ahttp%3A%2F%2F%3BFORID%3A1&hl=zh-CN
	var q = document.f1.wd.value
	q = encodeURIComponent(q)
	window.open("http://www.google.cn/search?q=" + q + "&client=pub-6280917852466543&forid=1&prog=aff&ie=utf-8&oe=utf-8&hl=zh-CN");
}


function googlesearch2()
{
	var q = document.f2.wd.value
	q = encodeURIComponent(q)
	window.open("http://www.google.cn/search?q=" + q + "&client=pub-6280917852466543&forid=1&prog=aff&ie=utf-8&oe=utf-8&hl=zh-CN");
	//http://www.google.cn/search?q=d&sa=%E6%90%9C%E7%B4%A2&client=pub-6280917852466543&forid=1&prog=aff&ie=GB2312&oe=GB2312&hl=zh-CN
}





/* innerhtml.js
 * Copyright CEOWEN Corporation
 */

var global_html_pool = [];
var global_script_pool = [];
var global_script_src_pool = [];
var global_lock_pool = [];
var innerhtml_lock = null;
var document_buffer = "";

function set_innerHTML(obj_id, html, time) {
    if (innerhtml_lock == null) {
        innerhtml_lock = obj_id;
    }
    else if (typeof(time) == "undefined") {
        global_lock_pool[obj_id + "_html"] = html;
        window.setTimeout("set_innerHTML('" + obj_id + "', global_lock_pool['" + obj_id + "_html']);", 10);
        return;
    }
    else if (innerhtml_lock != obj_id) {
        global_lock_pool[obj_id + "_html"] = html;
        window.setTimeout("set_innerHTML('" + obj_id + "', global_lock_pool['" + obj_id + "_html'], " + time + ");", 10);
        return;
    }

    function get_script_id() {
        return "script_" + (new Date()).getTime().toString(36)
          + Math.floor(Math.random() * 100000000).toString(36);
    }

    document_buffer = "";

    document.write = function (str) {
        document_buffer += str;
    }
    document.writeln = function (str) {
        document_buffer += str + "\n";
    }

    global_html_pool = [];

    var scripts = [];
    html = html.split(/<\/script>/i);
    for (var i = 0; i < html.length; i++) {
        global_html_pool[i] = html[i].replace(/<script[\s\S]*$/ig, "");
        scripts[i] = {text: '', src: '' };
        scripts[i].text = html[i].substr(global_html_pool[i].length);
        scripts[i].src = scripts[i].text.substr(0, scripts[i].text.indexOf('>') + 1);
        scripts[i].src = scripts[i].src.match(/src\s*=\s*(\"([^\"]*)\"|\'([^\']*)\'|([^\s]*)[\s>])/i);
        if (scripts[i].src) {
            if (scripts[i].src[2]) {
                scripts[i].src = scripts[i].src[2];
            }
            else if (scripts[i].src[3]) {
                scripts[i].src = scripts[i].src[3];
            }
            else if (scripts[i].src[4]) {
                scripts[i].src = scripts[i].src[4];
            }
            else {
                scripts[i].src = "";
            }
            scripts[i].text = "";
        }
        else {
            scripts[i].src = "";
            scripts[i].text = scripts[i].text.substr(scripts[i].text.indexOf('>') + 1);
            scripts[i].text = scripts[i].text.replace(/^\s*<\!--\s*/g, "");
        }
    }

    var s;
    if (typeof(time) == "undefined") {
        s = 0;
    }
    else {
        s = time;
    }

    var script, add_script, remove_script;

    for (var i = 0; i < scripts.length; i++) {
        var add_html = "document_buffer += global_html_pool[" + i + "];\n";
        add_html += "document.getElementById('" + obj_id + "').innerHTML = document_buffer;\n";
        script = document.createElement("script");
        if (scripts[i].src) {
            script.src = scripts[i].src;
            if (typeof(global_script_src_pool[script.src]) == "undefined") {
                global_script_src_pool[script.src] = true;
                s += 2000;
            }
            else {
                s += 10;
            }
        }
        else {
            script.text = scripts[i].text;
            s += 10;
        }
        script.defer = true;
        script.type =  "text/javascript";
        script.id = get_script_id();
        global_script_pool[script.id] = script;
        add_script = add_html;
        add_script += "document.getElementsByTagName('head').item(0)";
        add_script += ".appendChild(global_script_pool['" + script.id + "']);\n";
        window.setTimeout(add_script, s);
        remove_script = "document.getElementsByTagName('head').item(0)";
        remove_script += ".removeChild(document.getElementById('" + script.id + "'));\n";
        remove_script += "delete global_script_pool['" + script.id + "'];\n";
        window.setTimeout(remove_script, s + 10000);
    }

    var end_script = "if (document_buffer.match(/<\\/script>/i)) {\n";
    end_script += "set_innerHTML('" + obj_id + "', document_buffer, " + s + ");\n";
    end_script += "}\n";
    end_script += "else {\n";
    end_script += "document.getElementById('" + obj_id + "').innerHTML = document_buffer;\n";
    end_script += "innerhtml_lock = null;\n";
    end_script += "}";
    window.setTimeout(end_script, s);
}



//显示用时
function showdt()
{
	document.getElementById("show").innerHTML = document.getElementById("datetime").innerHTML;
}
