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");
//$using("/module/create.asp?io=tianqi&rnd="+Math.random);
var params = {menu:'false',wmode:'opaque'};
var attributes = {name: 'header'};
swfobject.embedSWF("/files/index.swf", "header", "960", "245", "9.0.0", "/scripts/swfobject/expressInstall.swf", "", params, attributes);