﻿function getOs(){
if(navigator.userAgent.indexOf("MSIE")>0)return 1;
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;
if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4;
if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5;
return 0;}
var isIE=!!document.all;
function addFavorate(url,title){
if((typeof window.sidebar=='object')&&(typeof window.sidebar.addPanel=='function')){
window.sidebar.addPanel(title,url,"");
return true;}
else{
window.external.addFavorite(url,title);
return true;}}
function __firefox(){
HTMLElement.prototype.__defineGetter__("runtimeStyle",__element_style);
window.constructor.prototype.__defineGetter__("event",__window_event);
Event.prototype.__defineGetter__("srcElement",__event_srcElement);}
function __element_style(){
return this.style;}
function __window_event(){
return __window_event_constructor();}
function __event_srcElement(){
return this.target;}
function __window_event_constructor(){
if(document.all){
return window.event;}
var _caller=__window_event_constructor.caller;
while(_caller!=null){
var _argument=_caller.arguments[0];
if(_argument){
var _temp=_argument.constructor;
if(_temp.toString().indexOf("Event")!=-1){
return _argument;}}
_caller=_caller.caller;}
return null;}
if(!isIE&&getOs()==2&&window.addEventListener){
__firefox();}
if(!isIE){
var ex;
XMLDocument.prototype.__proto__.__defineGetter__("xml",function(){
try{
return new XMLSerializer().serializeToString(this);}
catch(ex){
var d=document.createElement("div");
d.appendChild(this.cloneNode(true));
return d.innerHTML;}});
Element.prototype.__proto__.__defineGetter__("xml",function(){
try{
return new XMLSerializer().serializeToString(this);}
catch(ex){
var d=document.createElement("div");
d.appendChild(this.cloneNode(true));
return d.innerHTML;}});
XMLDocument.prototype.__proto__.__defineGetter__("text",function(){
return this.firstChild.textContent});
Element.prototype.__proto__.__defineGetter__("text",function(){
return this.textContent});
XMLDocument.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(xpath){
var x=this.selectNodes(xpath)
if(!x||x.length<1)return null;
return x[0];}
XMLDocument.prototype.selectNodes=Element.prototype.selectNodes=function(xpath){
var xpe=new XPathEvaluator();
var nsResolver=xpe.createNSResolver(this.ownerDocument==null?this.documentElement:this.ownerDocument.documentElement);
var result=xpe.evaluate(xpath,this,nsResolver,0,null);
var found=[];
var res;
while(res=result.iterateNext())
found.push(res);
return found;}}
