﻿String.prototype.trim = function()
 {
    return this.replace(/(^\s*)|(\s*$)/g, "");

}
function $(val)
 {
    return document.getElementById(val);

}
function WinOpen(url, n, w, h)
 {
    var left = (screen.width - w) / 2;
    var top = (screen.height - h) / 2;
    var f = "width=" + w + ",height=" + h + ",top=" + top + ",left=" + left;
    var c = window.open(url, n, f);
    return c;

}
function WinOpenDialog(url, w, h)
 {
    var feature = "dialogWidth:" + w + "px;dialogHeight:" + h + "px;center:yes;status:no;help:no";
    showModalDialog(url, window, feature);

}
function showlist(path, chId, fieldName, fieldValue, _target)
 {
    var encodeValue = escape(fieldValue);
    if (_target.toLowerCase() == 'blank')
    window.open(path + '/list.aspx?chid=' + chId + '&fieldname=' + fieldName + '&keyword=' + encodeValue);
    else
    location.href(path + '/list.aspx?chid=' + chId + '&fieldname=' + fieldName + '&keyword=' + encodeValue);

}
function ReviewPadding(appPath, modelType, id, pageSize, pageIndex)
 {
    var data = XmlHttpGetMethodText(appPath + "/sys_template/MoreReviewList.aspx?ModelType=" + modelType + "&Id=" + id + "&PageSize=" + pageSize + "&P=" + pageIndex);
    document.getElementById('review_morelist_' + modelType + '_' + id).innerHTML = data

}

function SetSearchField(appPath, val)
 {
    if (val.value != 0)
    {
        document.getElementById("src_field_list").src = appPath + "/common/getsearchform.aspx?id=" + val.value + "&flag=1"

    }
    else
    {
        document.getElementById("src_field_list").src = appPath + "/common/getsearchform.aspx?id=" + val.value + "&flag=0"

    }

}
function GoSearch(appPath)
 {
    var chid = document.getElementById("search_channel_list").value;
    var fieldName = document.getElementById("search_field_list").value;
    var keyword = document.getElementById("search_txt_keyword").value.trim();
    if (keyword.length == 0)
    {
        alert('搜索内容必须填写');
        return;

    }
    if (chid != 0 && fieldName != 0)
    {
        window.open(appPath + "/List.aspx?chid=" + chid + "&fieldname=" + fieldName + "&keyword=" + escape(keyword) + "&Search=1");

    }
    else
    {
        alert("频道和字段必须选择");

    }

}
function CheckNumber(val)
 {
    var patt = /^\d+$/;
    return patt.test(val);

}
function go(f_url, pc, colid)
 {
    var pi = $("txtPageNav" + colid).value;
    if (!CheckNumber(pi))
    {
        alert('页索引只能是数字');
        return;

    }
    if (pi < 1 || pi > pc)
    {
        alert("页索引超出范围");
        return;

    }
    if (pi == 1)
    {
        location.href(f_url);
        return;

    }
    var charindex = f_url.lastIndexOf(".")
    var preStr = f_url.substr(0, charindex);
    var ext = f_url.substr(charindex, f_url.length - charindex);
    var patt = /.*(\..*?)\?.*/i
    if (f_url.replace(patt, "$1").toLowerCase() != ".aspx")
    {
        location.href(preStr + "_" + pi + ext);

    }
    else
    {
        location.href(f_url.setQuery("p", pi));

    }

}
String.prototype.setQuery = function(name, value)
 {
    var reg = new RegExp("(^|&|\\?)(" + name + "=)([^&]*)(&|$)");
    var r = this.substr(this.indexOf("?") + 1).match(reg);
    if (r != null) return this.replace(reg, "$1$2" + value + "$4");
    else return this + (this.indexOf("?") > -1 ? "&": "?") + name + "=" + value

}
function SetDig(appPath, modelid, id)
 {

    if ($("dig_" + modelid + "_" + id) != null && $("click_dig_" + modelid + "_" + id) != null)
    {
        var loadstr = '<img src="' + appPath + '/images/dig_loading.gif">'

        $("click_dig_" + modelid + "_" + id).innerHTML = loadstr;

        var data = XmlHttpGetMethodText(appPath + "/common/dig.aspx?type=set&modelid=" + modelid + "&id=" + id);
        if (data != "-1")
        {
            $("dig_" + modelid + "_" + id).innerHTML = data;

        }
        $("click_dig_" + modelid + "_" + id).innerHTML = "成&nbsp;&nbsp;功";
        $("click_dig_" + modelid + "_" + id).style.removeAttribute("cursor");
        $("click_dig_" + modelid + "_" + id).removeAttribute("onclick");

    }
    return false;

}



function SuperLabelPage(PagePath, CaseId)
 {
    var data = XmlHttpGetMethodText(PagePath);
    document.getElementById(CaseId).innerHTML = data;

}
function SuperLabelPages(PagePath,paramStr, CaseId)
 {
    var data = XmlHttpPostMethodText(PagePath,paramStr);
	document.getElementById("ListQifu").innerHTML = "";
    document.getElementById(CaseId).innerHTML = data;

}

function GetAjaxLabel(url, paramStr, currId, type)
 {

    var data = XmlHttpPostMethodText(url, "paramStr=" + paramStr + "&currId=" + currId + "&type=" + type)
    document.write(data);

}

function GetHiddenContent(url, paramStr, infoId, pageIndex, pageCount, tableName)
 {
    var data = XmlHttpPostMethodText(url, "paramstr=" + paramStr + "&id=" + infoId + "&pageindex=" + pageIndex + "&pagecount=" + pageCount + "&tablename=" + tableName);
    document.write(data);

}


// 相对尺寸
function GetOffsetTop(el, p) {
    var _t = el.offsetTop;
    var _p = el.offsetParent;

    while (_p) {
        if (_p == p) break;
        _t += _p.offsetTop;
        _p = _p.offsetParent;

    }

    return _t;

};
function GetOffsetLeft(el, p) {
    var _l = el.offsetLeft;
    var _p = el.offsetParent;

    while (_p) {
        if (_p == p) break;
        _l += _p.offsetLeft;
        _p = _p.offsetParent;

    }

    return _l;

};

function fod(obj, name)
 {
    var p = obj.parentNode.getElementsByTagName("div");
    var p1 = document.getElementById(name).getElementsByTagName("div");
    for (i = 0; i < p1.length; i++)
    {
        if (obj == p[i])
        {
            p[i].className = "s1";
            p1[i].className = "up";

        }
        else
        {
            p[i].className = "d1";
            p1[i].className = "block";

        }

    }

}

var DDSPEED = 10;
var DDTIMER = 15;

// main function to handle the mouse events //
function ddmenu(id, d) {
    var h = document.getElementById('idstr' + id);
    var c = document.getElementById(id + '-ddcontent');
    var l;
    l = GetOffsetLeft(h);
    clearInterval(c.timer);
    if (d == 1) {
        clearTimeout(h.timer);
        if (c.maxh && c.maxh <= c.offsetHeight) {
            return
        }
        else if (!c.maxh) {
            c.style.display = 'block';
            c.style.height = 'auto';
            c.maxh = c.offsetHeight;
            c.style.height = '0px';
            c.style.left = l + 'px';

        }
        c.timer = setInterval(function() {
            ddSlide(c, 1)
        },
        DDTIMER);

    } else {

        h.timer = setTimeout(function() {
            ddCollapse(c)
        },
        50);

    }

}

// collapse the menu //
function ddCollapse(c) {
    c.timer = setInterval(function() {
        ddSlide(c, -1)
    },
    DDTIMER);

}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id) {
    var h = document.getElementById('idstr' + id);
    var c = document.getElementById(id + '-ddcontent');
    clearTimeout(h.timer);
    clearInterval(c.timer);
    if (c.offsetHeight < c.maxh) {
        c.timer = setInterval(function() {
            ddSlide(c, 1)
        },
        DDTIMER);

    }

}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c, d) {
    var currh = c.offsetHeight;
    var dist;
    if (d == 1) {
        c.style.display = 'block'
        dist = (Math.round((c.maxh - currh) / DDSPEED));

    } else {
        c.style.display = 'none'
        dist = (Math.round(currh / DDSPEED));

    }
    if (dist <= 1 && d == 1) {
        dist = 1;

    }
    c.style.height = currh + (dist * d) + 'px';
    c.style.opacity = currh / c.maxh;
    c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
    if ((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)) {
        clearInterval(c.timer);

    }

}

function request(paras) {
    var url = location.href;
    var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
    var paraObj = {}
    for (i = 0; j = paraString[i]; i++) {
        paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf
        ("=") + 1, j.length);

    }
    var returnValue = paraObj[paras.toLowerCase()];
    if (typeof(returnValue) == "undefined") {
        return "";

    } else {
        return returnValue;

    }

}
var theurl
 theurl = request("url");
if (theurl != '') {
    location = theurl

}


var Site = new Object();
Site.Browser = {
    ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
    moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),
    opera: /opera/.test(window.navigator.userAgent.toLowerCase()),
    safari: /safari/.test(window.navigator.userAgent.toLowerCase())
};
Site.$ = function(a) {
    return (typeof a == "object") ? a: document.getElementById(a)
};
Site.Cookie = {
    set: function(b, d, a, e, c) {
        if (typeof a == "undefined") {
            a = new Date(new Date().getTime() + 24 * 3600 * 100)
        }
        document.cookie = b + "=" + escape(d) + ((a) ? "; expires=" + a.toGMTString() : "") + ((e) ? "; path=" + e: "; path=/") + ((c) ? ";domain=" + c: "")
    },
    get: function(b) {
        var a = document.cookie.match(new RegExp("(^| )" + b + "=([^;]*)(;|$)"));
        if (a != null) {
            return unescape(a[2])
        }
        return null
    },
    clear: function(a, c, b) {
        if (this.get(a)) {
            document.cookie = a + "=" + ((c) ? "; path=" + c: "; path=/") + ((b) ? "; domain=" + b: "") + ";expires=Fri, 02-Jan-1970 00:00:00 GMT"
        }
    }
};
function $(a) {
    return (typeof a == "object") ? a: document.getElementById(a)
}
function loadJS(a, c) {
    var b = document.createElement("script");
    b.setAttribute("type", "text/javascript");
    b.setAttribute("src", a);
    document.getElementsByTagName("head")[0].appendChild(b);
    if (!c) {
        return
    }
    if (document.all) {
        b.onreadystatechange = function() {
            if (this.readyState == "loaded" || this.readyState == "complete") {
                c()
            }
        }
    } else {
        b.onload = function() {
            c()
        }
    }
}
Site.JsLoader = {
    load: function(b, c) {
        var a = document.createElement("script");
        a.setAttribute("charset", "gb2312");
        a.setAttribute("type", "text/javascript");
        a.setAttribute("src", b);
        document.getElementsByTagName("head")[0].appendChild(a);
        if (Site.Browser.ie) {
            a.onreadystatechange = function() {
                if (this.readyState == "loaded" || this.readyState == "complete") {
                    c()
                }
            }
        } else {
            if (Site.Browser.moz) {
                a.onload = function() {
                    c()
                }
            } else {
                c()
            }
        }
    }
};
function doZoom(a) {
    document.getElementById("ftcg").style.fontSize = a + "px"
};



function loadPng(a) {
    if (Site.Browser.ie) {
        try {
            var d = a;
            var j = a.src.toUpperCase();
            if (j.substring(j.length - 3, j.length) == "PNG") {
                var f = (d.id) ? "id='" + d.id + "' ": "";
                var k = (d.className) ? "class='" + d.className + "' ": "";
                var c = (d.title) ? "title='" + d.title + "' ": "title='" + d.alt + "' ";
                var h = "display:inline-block;" + d.style.cssText;
                if (d.align == "left") {
                    h = "float:left;" + h

                }
                if (d.align == "right") {
                    h = "float:right;" + h

                }
                if (d.parentElement.href) {
                    h = "cursor:hand;" + h

                }
                var b = "<span " + f + k + c + ' style="width:' + d.width + "px; height:" + d.height + "px;" + h + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + d.src + "', sizingMethod='image');\"></span>";
                d.outerHTML = b

            }

        } catch(g) {}

    }

}
function setTab(a, d) {
    var c = document.getElementById("p" + a).getElementsByTagName("li");
    var b = document.getElementById("showdiv" + a).getElementsByTagName("ul");
    for (i = 0; i < c.length; i++) {
        c[i].className = i == d ? "hover": "";
        b[i].style.display = i == d ? "block": "none"

    }

}
function olImg() {
    var g = document;
    if (g.images) {
        if (!g.MM_p) {
            g.MM_p = new Array()

        }
        var f,
        c = g.MM_p.length,
        b = olImg.arguments;
        for (f = 0; f < b.length; f++) {
            if (b[f].indexOf("#") != 0) {
                g.MM_p[c] = new Image;
                g.MM_p[c++].src = b[f]

            }

        }

    }

}
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf("opera") != -1 && opera.version();
var is_moz = (navigator.product == "Gecko") && userAgent.substr(userAgent.indexOf("firefox") + 8, 3);
var is_ie = (userAgent.indexOf("msie") != -1 && !is_opera) && userAgent.substr(userAgent.indexOf("msie") + 5, 3);
function $(a) {
    return document.getElementById(a)

}
function doane(a) {
    e = a ? a: window.event;
    if (is_ie) {
        e.returnValue = false;
        e.cancelBubble = true

    } else {
        if (e) {
            e.stopPropagation();
            e.preventDefault()

        }

    }

}
function isUndefined(a) {
    return typeof a == "undefined" ? true: false

}
function _attachEvent(c, a, b) {
    if (c.addEventListener) {
        c.addEventListener(a, b, false)

    } else {
        if (c.attachEvent) {
            c.attachEvent("on" + a, b)

        }

    }

}
var jsmenu = new Array();
var ctrlobjclassName;
jsmenu.active = new Array();
jsmenu.timer = new Array();
jsmenu.iframe = new Array();
function initCtrl(c, b, f, d, a) {
    if (c && !c.initialized) {
        c.initialized = true;
        c.unselectable = true;
        c.outfunc = typeof c.onmouseout == "function" ? c.onmouseout: null;
        c.onmouseout = function() {
            if (this.outfunc) {
                this.outfunc()

            }
            if (f < 3) {
                jsmenu.timer[c.id] = setTimeout("hideMenu(" + a + ")", d)

            }

        };
        c.overfunc = typeof c.onmouseover == "function" ? c.onmouseover: null;
        c.onmouseover = function(g) {
            doane(g);
            if (this.overfunc) {
                this.overfunc()

            }
            if (b) {
                clearTimeout(jsmenu.timer[this.id])

            } else {
                for (var h in jsmenu.timer) {
                    if (jsmenu.timer[h]) {
                        clearTimeout(jsmenu.timer[h])

                    }

                }

            }

        }

    }

}
function initMenu(a, g, f, d, b, c) {
    if (g && !g.initialized) {
        g.initialized = true;
        g.ctrlkey = a;
        g.onclick = ebygum;
        g.style.position = "absolute";
        if (f < 3) {
            if (f > 1) {
                g.onmouseover = function() {
                    clearTimeout(jsmenu.timer[a])

                }

            }
            if (f != 1) {
                g.onmouseout = function() {
                    jsmenu.timer[a] = setTimeout("hideMenu(" + b + ")", d)

                }

            }

        }
        if (c) {
            g.onmousedown = function(h) {
                try {
                    menudrag(g, h, 1)

                } catch(j) {}

            };
            g.onmousemove = function(h) {
                try {
                    menudrag(g, h, 2)

                } catch(j) {}

            };
            g.onmouseup = function(h) {
                try {
                    menudrag(g, h, 3)

                } catch(j) {}

            }

        }

    }

}
function showMenu(a, n, d, c, l, j, b, f, h) {
    var k = $(a);
    if (!k) {
        return

    }
    if (isUndefined(n)) {
        n = false

    }
    if (isUndefined(d)) {
        d = 0

    }
    if (isUndefined(c)) {
        c = 2

    }
    if (isUndefined(l)) {
        l = 500

    }
    if (isUndefined(j)) {
        j = 0

    }
    if (isUndefined(b)) {
        b = a

    }
    var m = $(b);
    var g = $(b + "_menu");
    if (!m || !g) {
        return

    }
    if (isUndefined(f)) {
        f = 400

    }
    if (isUndefined(h)) {
        h = false

    }
    if (n && jsmenu.active[j] == g) {
        hideMenu(j);
        return

    } else {
        hideMenu(j)

    }
    initCtrl(k, n, c, l, j);
    ctrlobjclassName = k.className;
    k.className += " hover";
    initMenu(a, g, c, l, j, h);
    g.style.display = "";
    if (!is_opera) {
        g.style.clip = "rect(auto, auto, auto, auto)"

    }
    setMenuPosition(b, d);
    if (!c) {
        setTimeout("hideMenu(" + j + ")", l)

    }
    jsmenu.active[j] = g

}
function setMenuPosition(d, c) {
    var a = $(d);
    var b = $(d + "_menu");
    if (isUndefined(c)) {
        c = 0

    }
    if (a) {
        a.pos = fetchOffset(a);
        a.X = a.pos.left;
        a.Y = a.pos.top;
        a.w = a.offsetWidth;
        a.h = a.offsetHeight;
        b.w = b.offsetWidth;
        b.h = b.offsetHeight;
        if (c < 3) {
            b.style.left = (a.X + b.w > document.body.clientWidth) && (a.X + a.w - b.w >= 0) ? a.X + a.w - b.w + "px": a.X + "px";
            b.style.top = c == 1 ? a.Y + "px": (c == 2 || ((a.Y + a.h + b.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (a.Y - b.h >= 0)) ? (a.Y - b.h) + "px": a.Y + a.h + "px")

        } else {
            if (c == 3) {
                b.style.left = (document.body.clientWidth - b.clientWidth) / 2 + document.body.scrollLeft + "px";
                b.style.top = (document.body.clientHeight - b.clientHeight) / 2 + document.body.scrollTop + "px"

            }

        }
        if (b.style.clip && !is_opera) {
            b.style.clip = "rect(auto, auto, auto, auto)"

        }

    }

}
function hideMenu(a) {
    if (isUndefined(a)) {
        a = 0

    }
    if (jsmenu.active[a]) {
        try {
            $(jsmenu.active[a].ctrlkey).className = ctrlobjclassName

        } catch(b) {}
        clearTimeout(jsmenu.timer[jsmenu.active[a].ctrlkey]);
        jsmenu.active[a].style.display = "none";
        if (is_ie && is_ie < 7 && jsmenu.iframe[a]) {
            jsmenu.iframe[a].style.display = "none"

        }
        jsmenu.active[a] = null

    }

}
function fetchOffset(c) {
    var b = c.offsetLeft;
    var a = c.offsetTop;
    while ((c = c.offsetParent) != null) {
        b += c.offsetLeft;
        a += c.offsetTop

    }
    return {
        left: b,
        top: a

    }

}
function ebygum(a) {
    if (!a || is_ie) {
        window.event.cancelBubble = true;
        return window.event

    } else {
        if (a.target.type == "submit") {
            a.target.form.submit()

        }
        a.stopPropagation();
        return a

    }

}
var num;
num = 1;
function chimg() {
    setTimeout('change_img()', 5000);

}
function change_img() {
    if (num > 4) {
        num = 1

    }
    setTimeout("showFocus(" + num + ")", 5000);
    num++;
    tt = setTimeout("change_img()", 5000)

}
function showFocus(a) {
    selectLayer(a)

}
function selectLayer(d) {
    var b = [null, document.getElementById("focusPic1"), document.getElementById("focusPic2"), document.getElementById("focusPic3"), document.getElementById("focusPic4")];
    var c = [null, document.getElementById("focusnav1"), document.getElementById("focusnav2"), document.getElementById("focusnav3"), document.getElementById("focusnav4")];
    for (var a = 1; a < b.length; a++) {
        if (a == d) {
            c[a].className = "active";
            b[a].style.display = "block"

        } else {
            c[a].className = "";
            b[a].style.display = "none"

        }

    }

}
var ifsearch = true;
SetPageinIt();
function SetPageinIt() {
    window.setTimeout("SetPageinIt()", "100")

}
function searchWord() {
    var a = "";
    var b = escape(document.getElementById("keyword").value);
    a = "/search/?key=" + b + "&dbids=all";
    window.open(a)

}
function processForm(a) {
    window.open(a, "popup", "")

}
function showurl(b) {
    var a = "";
    if (b == "" || b == null) {
        b = escape(document.form1.anyword2.value)

    } else {
        b = escape(b)

    }
    a = "/search/?key=" + b + "&dbids=all";
    window.open(a)

}
function scrollBanner(timer, moveNumber) {
    function move(o) {
        var st = document.documentElement.scrollTop + o.t;
        var sl = document.documentElement.scrollLeft + (o.c == 0 ? o.a: document.documentElement.clientWidth - o.a - o.offsetWidth);
        var tc = st - o.offsetTop,
        lc = sl - o.offsetLeft;
        with(o.style) {
            top = o.offsetTop + (tc != 0 ? tc / Math.abs(tc) : 0) * Math.min(Math.abs(tc), moveNumber) + "px";
            left = o.offsetLeft + (lc != 0 ? lc / Math.abs(lc) : 0) * Math.min(Math.abs(lc), moveNumber) + "px"

        }
        if (o.person) {
            with(o.person.style) {
                top = o.offsetTop + "px";
                left = o.offsetLeft + o.offsetWidth - o.person.offsetWidth + "px"

            }

        }

    }
    var hidden = function() {
        var o = this.parent;
        window.clearInterval(o.interval);
        o.parentNode.removeChild(o);
        this.parentNode.removeChild(this)

    };
    this.add = function(to, t, a, c, lo) {
        var div,
        exec = function() {
            move(to)

        };
        to.person = lo;
        to.t = t;
        to.a = a;
        to.c = c;
        with(to.style) {
            position = "absolute";
            display = "block";
            top = document.documentElement.scrollTop + t;
            left = document.documentElement.scrollLeft + (c == 0 ? a: document.documentElement.clientWidth - a - to.offsetWidth)

        }
        if ("undefined" != typeof lo) {
            with(lo.style) {
                position = "absolute";
                display = "block"

            }
            lo.onmousedown = hidden;
            lo.parent = to

        }
        exec();
        to.interval = window.setInterval(exec, timer)

    }

}
function SetHome(c, d) {
    try {
        c.style.behavior = "url(#default#homepage)";
        c.setHomePage(d)

    } catch(b) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")

            } catch(b) {
                alert("抱歉！您的浏览器不支持直接设为首页。请在浏览器地址栏输入'about:config'并回车然后将[signed.applets.codebase_principal_support]设置为'true'，点击'加入收藏'后忽略安全提示，即可设置成功。")

            }
            var a = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            a.setCharPref("browser.startup.homepage", d)

        }

    }



};
function delHtmlTag(str) {
    return str.replace(/<[^>]+>/g, "");

}
window.onload = tabEffect;
function tabEffect()
{
	var allElements = document.getElementsByTagName('*');
	for (var i=0; i<allElements.length; i++)
	{
		if (allElements[i].className.indexOf('tabOption') >= 0)
		{
			allElements[i].onmouseover = mouseOver;
		}
	}
}
function mouseOver()
{
    tabList = this.parentNode;
    tabOptions = document.getElementsByTagName("span");
	for (var i=0; i<tabOptions.length; i++)
	{
	    if (tabOptions[i].className.indexOf('tabOption') >= 0)
		{
		    tabOptions[i].className = "tabOption";
		}
	}
	this.className += " tabOn";
}


function ScrollText(content,btnPrevious,btnNext,autoStart,timeout,isSmoothScroll)
{
    this.Speed = 10;
    this.Timeout = timeout;
	this.stopscroll =false;//是否停止滚动的标志位
	this.isSmoothScroll= isSmoothScroll;//是否平滑连续滚动
    this.LineHeight = 22;//默认高度。可以在外部根据需要设置
    this.NextButton = this.$(btnNext);
    this.PreviousButton = this.$(btnPrevious);
    this.ScrollContent = this.$(content);
    this.ScrollContent.innerHTML += this.ScrollContent.innerHTML;//为了平滑滚动再加一遍

	if(this.PreviousButton)

	{
		this.PreviousButton.onclick = this.GetFunction(this,"Previous"); 
		this.PreviousButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.PreviousButton.onmouseout = this.GetFunction(this,"MouseOut");
	}
	if(this.NextButton){
		this.NextButton.onclick = this.GetFunction(this,"Next");
		this.NextButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.NextButton.onmouseout = this.GetFunction(this,"MouseOut");
    }
    this.ScrollContent.onmouseover = this.GetFunction(this,"MouseOver");
    this.ScrollContent.onmouseout = this.GetFunction(this,"MouseOut");

    if(autoStart)
    {
        this.Start();
    }
}

ScrollText.prototype = {

	$:function(element)
	{
		return document.getElementById(element);
	},
	Previous:function()
	{
		this.stopscroll = true;
		this.Scroll("up");
	},
	Next:function()
	{
		this.stopscroll = true;
		this.Scroll("down");
	},
	Start:function()
	{
		if(this.isSmoothScroll)
		{
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"SmoothScroll"), this.Timeout);
		}
		else
		{		
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	Stop:function()
	{
		clearTimeout(this.AutoScrollTimer);
		this.DelayTimerStop = 0;
	},
	MouseOver:function()
	{	
		this.stopscroll = true;
	},
	MouseOut:function()
	{
		this.stopscroll = false;
	},
	AutoScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Speed);
		}
		else
		{
			if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
			{
				this.ScrollContent.scrollTop = 0;
			}
			clearTimeout(this.ScrollTimer);
			//this.AutoScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	SmoothScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
	},
	Scroll:function(direction)
	{

		if(direction=="up")
		{


			this.ScrollContent.scrollTop--;
		}
		else
		{
			this.ScrollContent.scrollTop++;
		}

		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
		else if(parseInt(this.ScrollContent.scrollTop)<=0)
		{
			this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2;
		}
		
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"Scroll",direction), this.Speed);
		}
	},
	GetFunction:function(variable,method,param)
	{
		return function()
		{
			variable[method](param);
		}
	}
}
var   flag=false;   
  function   DrawImage(ImgD,w,h){   
        var   image=new   Image();   
        image.src=ImgD.src;   
        if(image.width>0   &&   image.height>0){   
          flag=true;   
          if(image.width/image.height>=   w/h){   
            if(image.width>w){       
            ImgD.width=w; 
            ImgD.height=(image.height*w)/image.width;   
            }else{   
            ImgD.width=image.width;
            ImgD.height=image.height;   
            }   
            //ImgD.alt=image.width+"×"+image.height;   
            }   
          else{   
            if(image.height>h){       
            ImgD.height=h;   
            ImgD.width=(image.width*h)/image.height;             
            }else{   
            ImgD.width=image.width;
            ImgD.height=image.height;   
            }   
            //ImgD.alt=image.width+"×"+image.height;   
            }   
          }   
  } 
  
