/*
var bV = parseInt(navigator.appVersion);
var NN4 = document.layers ? true : false;
var IE4 = document.all && bV >= 4 ? true : false;
*/

function Browser()
{
	var ua, s, i;
	this.isIE = false;
	this.isNS = false;
	this.isOP = false;
	this.isSF = false;
	ua = navigator.userAgent.toLowerCase();

	s = "opera";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isOP = true;
		return;
	}

	s = "msie";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isIE = true;
		return;
	}

	s = "netscape6/";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		return;
	}

	s = "gecko";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		return;
	}
	
	s = "safari";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isSF = true;
		return;
	}
}

function getOJ(e) //对象的绝对位置
{ 
	var t = [e.offsetLeft,e.offsetTop]; 
	if(e=e.offsetParent)
	{
		var r = getOJ(e);
		t[0] += r[0];
		t[1] += r[1];
	}
	return t;
}


function gid(id)
{
	return document.getElementById?document.getElementById(id):null;
}

function gname(name)
{
	return document.getElementsByTagName?document.getElementsByTagName(name):new Array()
}

document.getElementsByClass = function (needle, tagName) {
	if (!tagName) tagName = '*';
	var my_array = document.getElementsByTagName(tagName);
	var retvalue = new Array();
	var i;	 
	var j;

	for (i = 0, j = 0; i < my_array.length; i++) { 	 
		var c = " " + my_array[i].className + " "; 	 
		if (c.indexOf(" " + needle + " ") != -1) retvalue[j++] = my_array[i]; 	 
   }	
   return retvalue;
}

function StrCode(str)
{
	if(encodeURIComponent) return encodeURIComponent(str);
	if(escape) return escape(str);
}

function UnStrCode(str)
{
	if(decodeURIComponent ) return decodeURIComponent (str);
	if(unescape) return unescape(str);
}