﻿var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
Browser.isIE = window.ActiveXObject &&navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&(document.all&&!Browser.isOpera)? true : false;
if (Browser.isFirefox) { // entend Event Mod for FireFox
    extendEventObject();
}
if(!Browser.isIE){ //firefox innerText define
   HTMLElement.prototype.__defineGetter__(     "innerText",
    function(){
     var anyString = "";
     var childS = this.childNodes;
     for(var i=0; i<childS.length; i++) {
      if(childS[i].nodeType==1)
       anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
      else if(childS[i].nodeType==3)
       anyString += childS[i].nodeValue;
     }
     return anyString;
    }
   );
   HTMLElement.prototype.__defineSetter__(     "innerText",
    function(sText){
     this.textContent=sText;
    }
   );
	 HTMLElement.prototype.__defineGetter__("children", 
     function () { 
         var returnValue = new Object(); 
         var number = 0; 
         for (var i=0; i<this.childNodes.length; i++) { 
             if (this.childNodes[i].nodeType == 1) { 
                 returnValue[number] = this.childNodes[i]; 
                 number++; 
             } 
         } 
         returnValue.length = number; 
         return returnValue; 
     } 
 ); 
}
function extendEventObject() {
    Event.prototype.__defineGetter__("srcElement", function () {
        var node = this.target;
        while (node.nodeType != 1) node = node.parentNode;
        return node;
    });

    Event.prototype.__defineGetter__("fromElement", function () {
        var node;
        if (this.type == "mouseover")
        node = this.relatedTarget;
        else if (this.type == "mouseout")
        node = this.target;
        if (!node) return;
        while (node.nodeType != 1) node = node.parentNode;
        return node;
    });

    Event.prototype.__defineGetter__("toElement", function () {
        var node;
        if (this.type == "mouseout")
        node = this.relatedTarget;
        else if (this.type == "mouseover")
        node = this.target;
        if (!node) return;
        while (node.nodeType != 1) node = node.parentNode;
        return node;
    });
}

function getXmlhttp()//定义xmlhttp
{
    var http_request;

    if(window.XMLHttpRequest) {
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType("text/xml");
        }
    }
    else if (window.ActiveXObject) {
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        window.alert("can't create XMLHttpRequest object.");
        return null;
    }
    return http_request;
}

function $using(package)
{
	var xmlhttp=getXmlhttp();           
 	xmlhttp.open("get",package,false);
	xmlhttp.send(null);
	var code = xmlhttp.responseText;
	if (Browser.isIE)
		window.execScript(code,"JavaScript");//ie
	else
	  window.eval(code,"JavaScript"); //firefox
}
//设为首页
function setHomePage()
{
if(document.all)
{
   var obj = document.links(0);
   if (obj)
   {
    obj.style.behavior = 'url(#default#homepage)';
    obj.setHomePage(window.location.href);
   }
}
else
{
   if(window.netscape)
   {
    try
    {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    }
    catch (e)
    {
     alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
    }
   }
   var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
   prefs.setCharPref('browser.startup.homepage', window.location.href);
   }
}

//加入收藏
function addFavorite()
{
var url   = document.location.href;
var title = document.title;
if (document.all)
{
   window.external.addFavorite(url,title);
}
else if (window.sidebar)
{
   window.sidebar.addPanel(title, url,"");
}
}

$using("/scripts/common.js");
$using("/scripts/ajaxfunction.js");
$using("/scripts/jquery/jquery.js");
$using("/scripts/thickbox/thickbox.js");
$using("/scripts/swfobject/swfobject.js");
var params = {menu:'false',wmode:'opaque'};
var attributes = {name: 'banner'};
swfobject.embedSWF("/files/banner.swf", "banner_box", "920", "333", "9.0.0", "/scripts/swfobject/expressInstall.swf", "", params, attributes);
$(function () {
        $('.bubbleInfo').each(function () {
            var distance = 3;
            var time = 250;
            var hideDelay = 500;
 
            var hideDelayTimer = null;
 
            var beingShown = false;
            var shown = false;
            var trigger = $('.trigger', this);
            var info = $('.popup', this).css('opacity', 0);
 
 
            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;
 
                    info.css({
                        top: -50,
                        left: 20,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }
 
                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });
 
                }, hideDelay);
 
                return false;
            });
        });
    });
//$using("/module/create.asp?io=tianqi&rnd="+Math.random);
function AutoScroll(obj){
        $(obj).find("ul:first").animate({
                marginTop:"-25px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}
$(document).ready(function(){
setInterval('AutoScroll(".scrollDiv")',4000)
});
$using("/scripts/jquery/interface/onlypressnum.js");
$using("/scripts/filter/base.js");
$using("/scripts/filter/ra.js");

$(document).ready(function(){
						   loadpage("/module/user/welcome.asp?rnd="+Math.random(),"login_area");
						   });
