﻿// JScript 文件
    //Global variables
var timeID;
var isFirefox;
var isIE;
//isIE=false;
//isIE = (navigator.appName == "Microsoft Internet Explorer" ); 
var First;
var End;
First="<font color=red>正在加载，请稍候...</font>";
//Creating and setting the instance of appropriate XMLHTTP Request object to a 揦mlHttp?variable  
function getAjax()
{
	var XmlHttp;
	
	//Creating object of XMLHTTP in IE
	try
	{
	  if (isIE)
	   {
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
//		alert("isIE"+isIE);
		}
		else
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
//			alert("isFirefox="+isFirefox);
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	return XmlHttp;
}

function sniffBrowserType() {
	isFirefox = ( navigator.appName == "Netscape" );
	isIE = (navigator.appName == "Microsoft Internet Explorer" ); 
	return true;
}

// Capture the enter key on the input box and post message
function captureReturn( event )
{
	if(event.which || event.keyCode)
	{
		if ((event.which == 13) || (event.keyCode == 13)) 
		{
			getUserList('MyAjax_Return.aspx', 'userlist');
			FocusWindow();
			return false;
		}
		else {
			return true;
		}
	}	
}
function getUserList(Url,FormID)
{
var obj;
var req;
			obj = getElement(FormID);
			sniffBrowserType() ;
			obj.innerHTML=First;
			req = getAjax();
			req.onreadystatechange = function(){
			   if( req.readyState == 4 && req.status == 200 ) {
			   obj.innerHTML = req.responseText;
			   }
			   else
			   { 
			   obj.innerHTML='<font color=red>信息加载失败，请重试...</font>'
			   }
			}
	req.open( 'GET', Url, true );
	req.send( null );
}
function getElement( id ) 
{
//	if(navigator.appName == "Microsoft Internet Explorer") {
if(isIE){
	
		return document.all[ id ];
	}
	else {
		return document.getElementById( id );
	}
}

function getElementName( name ) 
{
//	if(navigator.appName == "Microsoft Internet Explorer") {
if(isIE){
		return document.all[ name ];
	}
	else {
		return document.getElementsByName(name)[0];
	}
}

function TagShow(){
sniffBrowserType();
if(getElement('TagList').getElementsByTagName("div")[1].innerHTML.length==0)
 {
	getElement('TagList').className='disTag';
 }
}

function FocusWindow()
{
	//TODO: FireFox doesn't work?
	window.focus();

}
