function bwInfo(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera 
  this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera   
  this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
  this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
  this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
  this.ie = (this.ie4 || this.ie5 || this.ie6)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
  this.usedom= this.ns6
  this.reuse = this.ie||this.usedom
	return this
}

function trim(strValue) {
    return ltrim(rtrim(strValue));
}

function ltrim(strValue) {
	var LTRIMrgExp = /^\s */;
	return strValue.replace(LTRIMrgExp, '');
}

function rtrim(strValue) {
	var RTRIMrgExp = /\s *$/;
	return strValue.replace(RTRIMrgExp, '');
}

function HTMLSafe(str) {
	str = replaceString("&", "&amp;", str);
	str = replaceString("<", "&lt;", str);
	str = replaceString(">", "&lt;", str);
	str = replaceString("\"", "&quot;", str);
	str = replaceString("'", "&apos;", str);
	return str;
}

function HTMLTagSafe(str) {
	str = replaceString("<", "&lt;", str);
	str = replaceString(">", "&lt;", str);
	str = replaceString("\"", "&quot;", str);
	return str;
}

function popWin(iurl, itarget, w, h, setting) {
	var newPopWin; 
	var l = Math.floor((screen.availWidth - w) / 2);
	var t = Math.floor((screen.availHeight - h) / 2);
	if (newPopWin = window.open(iurl,itarget,"left=" + l + ",top=" + t + ",width=" + w + ",height=" + h + "," + setting)) {
		newPopWin.focus();
	}
}

function popWinClose() {
	if (opener) opener.focus();
	top.close();
}

function isEmail(str) {		
	var iregexp = new RegExp('^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,4}$');
	return !str.search(iregexp);
}

function isDate(str) {
	var iregexp = new RegExp('^([0-9]{1,4})[\-/]{1}([0-9]{1,4})[\-/]{1}([0-9]{1,4})$');
	return !str.search(iregexp);
}

function isDateTime(str) {
	var iregexp = new RegExp('^([0-9]{1,4})[\-/]{1}([0-9]{1,4})[\-/]{1}([0-9]{1,4})[ ]{1}([0-9]{1,2})[:]{1}([0-9]{1,2})[:]{1}([0-9]{1,2})$');
	return !str.search(iregexp);
}

function isEmpty(str) {
	return trim(str) == "";
}

function uriseed() {
	var now = new Date();
	return "" + now.getYear() + "" + now.getMonth() + "" + now.getDate() + "" + now.getHours() + "" + now.getMinutes() + "" + now.getSeconds();
}

function charInStr(str, chars) {
	result = false;
	for (i = 0; i < chars.length; i++)
		if (str.indexOf(chars.substr(i, 1)) >= 0) {
			result = true;
			break;
		}
	return result;
}

function replaceString(oldS,newS,fullS) {
	for (var i=0; i<fullS.length; i++) {
		if (fullS.toUpperCase().substring(i,i+oldS.length) == oldS.toUpperCase()) {
			fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length);
		}
	}
	return fullS;
}

var doc = document;
