function Ncdatetime(){today=new Date();function initArray(){this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i]}var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");document.write("<font color=#111111 style='font-size:9pt;font-family: 宋体'> ",today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日","</font>","<font color=#ff0000 style='font-size:9pt;font-family: 宋体'> ",d[today.getDay()+1],"</font>");}var currentpos,timer;function initialize(){timer=setInterval("scrollwindow()",10);}function sc(){clearInterval(timer);}function scrollwindow(){currentpos=document.body.scrollTop;window.scroll(0,++currentpos);if(currentpos!=document.body.scrollTop)sc();}document.onmousedown=sc
document.ondblclick=initialize
function openScript(url,width,height){var Win=window.open(url,"openScript",'width='+width+',height='+height+',resizable=1,scrollbars=yes,menubar=no,status=no');}tPopWait=50;tPopShow=5000;showPopStep=20;popOpacity=99;sPop=null;curShow=null;tFadeOut=null;tFadeIn=null;tFadeWaiting=null;document.write("<style type='text/css'id='defaultPopStyle'>");document.write(".cPopText {  background-color: #ffffff; border: 1px #555555 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");document.write("</style>");document.write("<div id='ncpopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");function showPopupText(){var o=event.srcElement;MouseX=event.x;MouseY=event.y;if(o.alt!=null&&o.alt!=""){o.ncpop=o.alt;o.alt=""};if(o.title!=null&&o.title!=""){o.ncpop=o.title;o.title=""};if(o.ncpop!=sPop){sPop=o.ncpop;clearTimeout(curShow);clearTimeout(tFadeOut);clearTimeout(tFadeIn);clearTimeout(tFadeWaiting);if(sPop==null||sPop==""){ncpopLayer.innerHTML="";ncpopLayer.style.filter="Alpha()";ncpopLayer.filters.Alpha.opacity=0;}else{if(o.dyclass!=null)popStyle=o.dyclass
else popStyle="cPopText";curShow=setTimeout("showIt()",tPopWait);}}}function showIt(){ncpopLayer.className=popStyle;ncpopLayer.innerHTML=sPop;popWidth=ncpopLayer.clientWidth;popHeight=ncpopLayer.clientHeight;if(MouseX+12+popWidth>document.body.clientWidth)popLeftAdjust=-popWidth-24
else popLeftAdjust=0;if(MouseY+12+popHeight>document.body.clientHeight)popTopAdjust=-popHeight-24
else popTopAdjust=0;ncpopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;ncpopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;ncpopLayer.style.filter="Alpha(Opacity=0)";fadeOut();}function fadeOut(){if(ncpopLayer.filters.Alpha.opacity<popOpacity){ncpopLayer.filters.Alpha.opacity+=showPopStep;tFadeOut=setTimeout("fadeOut()",1);}else{ncpopLayer.filters.Alpha.opacity=popOpacity;tFadeWaiting=setTimeout("fadeIn()",tPopShow);}}function fadeIn(){if(ncpopLayer.filters.Alpha.opacity>0){ncpopLayer.filters.Alpha.opacity-=1;tFadeIn=setTimeout("fadeIn()",1);}}document.onmouseover=showPopupText;window.onerror=function(){return true;}

function show_div(b,d,s,n){
	for(i=1;i<=s;i++){
			var div=document.getElementById(d+i);
			var bg=document.getElementById(b+i);
			if(i==n){
				div.style.display="block";
				bg.className="now";
			}else{
			div.style.display="none";
			bg.className="not";
			}
	  }
}

function setInitSearch() {
    var obj = $("keyword");
    var dt = "";
    if (obj) {
        obj.value = dt;
        obj.style.color = "#aaa";

        obj.onfocus = function (e) {
            if (obj.value == dt) obj.value = "";
            obj.style.color = "#000";
        }
        obj.onblur = function (e) {
            if (obj.value == "") obj.value = dt;
            obj.style.color = "#aaa";
        }
        obj.setAttribute("AutoComplete", "off");
    }
    initQSearch("keyword", "qsresult");
}

var _resultObj = null;
var _resultid = "d__qsearch_res";
var _searchtype = "soft";
var _searchTextBox = null;
var _searchServer = "";
var _resultfocus = false;

function initQSearch(textid, css) {
    _searchTextBox = $(textid);
    if (_searchTextBox) {
        addEvent(_searchTextBox, "keyup", QuickSearch);
        addEvent(_searchTextBox, "mousedown", QuickSearch);
    }

    _searchServer =location.href ;//

    var i = _searchServer.indexOf("/", 7);
    if (i > 0) _searchServer = _searchServer.substr(0, i);

    _resultObj = $(_resultid);
    if (!_resultObj) { _resultObj = document.createElement("DIV"); document.body.appendChild(_resultObj); }

    _resultObj.className = css;

    if (_searchTextBox) {
        var p = GetObjPos(_searchTextBox);
        _resultObj.style.left = p.x + "px";
        _resultObj.style.top = (p.y + _searchTextBox.offsetHeight + 17) + "px";
    }
}

function QuickSearch() {
     if (!_searchTextBox) return;
    var key = _searchTextBox.value;
     if (!key) { _resultObj.innerHTML = ""; _resultObj.style.display = "none"; return; }
	var url;
	url="/gettextbox.asp?a=quicksearch&k=" + escape(key) + "&c=" + _searchtype + "&t=" + Math.random();
	ajax.get( 
		url,
		function(obj) {
			GetResult(obj.responseText)	
		}
	); 
}

function addEvent(el, eventType, fn) {
    if (el.addEventListener) {
        el.addEventListener(eventType, fn, false);
    } else if (el.attachEvent) {
        el.attachEvent("on" + eventType, fn);
    } else {
        el["on" + eventType] = fn;
    }
}
function CPos(x, y) {
    this.x = x;
    this.y = y;
}
function GetObjPos(ATarget) {
    var target = ATarget;
    var pos = new CPos(target.offsetLeft, target.offsetTop);

    var target = target.offsetParent;
    while (target) {
        pos.x += target.offsetLeft;
        pos.y += target.offsetTop;

        target = target.offsetParent
    }

    return pos;
}

function GetResult(a) {
    if (!_resultObj) return;
       if (_resultObj == null || _resultObj == "") return;	
    try {
        var res = eval(a);
        if (res.length == 0)
        { _resultObj.style.display = "none"; return; }
        else
        { _resultObj.style.display = "block" }
        var html = "<ul>";
        for (var i = 0; i < res.length; i++) {
            var sp = "<li><a href='" + res[i].url + "' title='" + res[i].name + "'>" + res[i].name + "</a></li>";
            html += sp;
        }
        html += "</ul>";
        _resultObj.innerHTML = html;       
    } catch (E) {        
    }
}
