
function getBrowserInfo(){ 
	this.majorver = parseInt(navigator.appVersion) ;
	this.agent = navigator.userAgent.toLowerCase() ;
	this.platform = navigator.platform.toLowerCase() ;
	this.mac = ( this.platform.indexOf('mac') != -1 ) ? 1 : 0 ;
	this.win = ( this.platform.indexOf('win') != -1 ) ? 1 : 0 ;

	this.dom1 = ( document.getElementById ) ? 1 : 0 ;
	this.dom2event = ( document.addEventListener && document.removeEventListener ) ? 1 : 0 ;

	this.opera = ( ( this.agent.indexOf('opera') != -1 ) || window.opera ) ? 1 : 0 ; ;
	if ( this.opera ) {
		this.opera5 = this.agent.indexOf('opera 5') ? 1 : 0 ;
		this.opera6 = this.agent.indexOf('opera 6') ? 1 : 0 ;
		return this ;
	}
	this.ie = ( ( this.agent.indexOf('msie') != -1 ) && !this.opera ) ? 1 : 0 ;;
	if ( this.ie ) {
		this.ie4 = ( ( this.agent.indexOf('msie 4') != -1 ) && !this.dom1 ) ? 1 :0 ;
		this.ie5 = ( ( this.agent.indexOf('msie 5') != -1 ) && this.dom1 ) ? 1 : 0 ;
		this.ie55 = ( this.ie5 && window.createPopup ) ? 1 : 0 ;
		this.ie6 = ( ( this.agent.indexOf('msie 6') != -1 ) && this.dom1 ) ? 1 : 0 ;
		this.ie6s = ( this.ie6 && ( document.compatMode == "CSS1Compat" ) ) ? 1 : 0 ;
		this.ie4up = ( this.majorver >= 4 ) ? 1 : 0 ;
		this.ie5up = ( ( this.majorver >= 4 ) && !this.ie4 ) ? 1 : 0 ;
		this.ie55up = ( ( this.majorver >= 4 ) && !this.ie4 && !this.ie5 ) ? 1 : 0 ;
		this.ie6up = ( ( this.majorver >= 4 ) && !this.ie4 && !this.ie55 ) ? 1 : 0 ;
		return this ;
	}
	this.net = 	( ( ( this.agent.indexOf('netscape') != -1 ) || 
		( this.agent.indexOf('mozilla') != -1 ) ) && !this.opera ) ? 1 : 0 ;
	if ( this.net ) {
		this.net4 = ( document.layers && !this.dom1 ) ? 1 : 0 ;
		this.net6 = ( ( this.majorver >= 5 ) && this.dom2event ) ? 1 : 0 ;
		this.net4up = ( this.majorver >= 4 ) ? 1 : 0 ;
		this.net6up = ( ( this.majorver >= 5 ) && !this.net4 ) ? 1 : 0 ;
		return this ;
	}
	return this ;
}	// Call getBrowserInfo function and set prop in _bw 
	var _bw = new getBrowserInfo ;

// get window width / height
function getWindowWidth() {
	if( _bw.net4up || _bw.opera ) { return window.innerWidth }
	if( _bw.ie6s ) { return document.documentElement.clientWidth }
	if( _bw.ie4up ) { return document.body.clientWidth }
	return 0 ;
}
function getWindowHeight() {
	if( _bw.net4up || _bw.opera ) { return window.innerHeight }
	if( _bw.ie6s ) { return document.documentElement.clientHeight }
	if( _bw.ie4up ) { return document.body.clientHeight }
	return 0 ;
}

// get scroll x/y
function getScrollX() {
	if( _bw.net4up || _bw.opera ) { return window.pageXOffset }
	if( _bw.ie6s ) { return document.documentElement.scrollLeft }
	if( _bw.ie4up ) { return document.body.scrollLeft }
	return 0 ;
}
function getScrollY() {
	if( _bw.net4up || _bw.opera ) { return window.pageYOffset }
	if( _bw.ie6s ) { return document.documentElement.scrollTop }
	if( _bw.ie4up ) { return document.body.scrollTop }
	return 0 ;
}

// get html obj.
function getObjectById(id) {
	if( _bw.net4 ) { var net4s = '' ;
		for ( var i = 1 ; i < arguments.length ; i++ ) 
			{ net4s += 'document.' + arguments[i] + '.' }
		net4s += 'document.' + id ; return eval( net4s ) ;
	}
	if( _bw.ie6up || _bw.net6up || _bw.opera6 ) 
		{ return document.getElementById(id) }
	if( _bw.ie4up || _bw.opera ) { return document.all(id) }
}
function getObjectsByClassName(className,tagName,parentName) {
	var classEls = new Array() ; var allEls = new Array() ; var pal = document ;
	var parEls = ( parentName ) ? ( document.all ) ? 
		document.all.tags(parentName) : document.getElementsByTagName(parentName) : document ;

	if( tagName ) { 
		allEls = ( pal.all ) ? pal.all.tags(tagName) : pal.getElementsByTagName(tagName) ;
	} else { allEls = ( pal.all ) ? pal.all : pal.getElementsByTagName('*')  }

	for( var i = 0 ; i < allEls.length ; i++ ) {
		if( parentName ) {
			if ( ( ( allEls[i].parentNode == parEls[i] ) || 
				( allEls[i].parentElement == parEls[i] ) ) && ( allEls[i].className == className ) )
				{ classEls[classEls.length] = allEls[i] } 
		} else { 
			if( allEls[i].className == className ) { classEls[classEls.length] = allEls[i] }
		}
	} return classEls ;
}
function getObjectsByTagName(tagName,parentName) {
	var tagEls = new Array() ; var allEls = new Array() ; var pal = document ;
	var parEls = ( parentName ) ? ( document.all ) ? 
		document.all.tags(parentName) : document.getElementsByTagName(parentName) : document ;
	allEls = ( pal.all ) ? pal.all.tags(tagName) : pal.getElementsByTagName(tagName) ;

	for( var i = 0 ; i < allEls.length ; i++ ) {
		if( parentName ) {
			if ( ( allEls[i].parentNode == parEls[i] ) || ( allEls[i].parentElement == parEls[i] ) )
				{ tagEls[tagEls.length] = allEls[i] } 
		} else { tagEls[tagEls.length] = allEls[i] }
	} return tagEls ;
}

// get / ctrl html obj. width / height
function getObjectWidth(id) {
	if( _bw.net4 ) { return id.document.width }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) { return id.offsetWidth }
	if( _bw.ie4up || _bw.opera ) { return id.style.pixelWidth }
	return 0 ;
}
function getObjectHeight(id) {
	if( _bw.net4 ) { return id.document.height }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) { return id.offsetHeight }
	if( _bw.ie4up || _bw.opera ) { return id.style.pixelHeight }
	return 0 ;
}
function setObjectSizeTo(id,width,height) {
	if( _bw.net4 ) { id.resizeTo(width,height) }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) { 
		id.style.width = width + 'px' ; id.style.height = height + 'px' }
	if( _bw.ie4up || _bw.opera ) { 
		id.style.pixelWidth = width ; id.style.pixelLeft = height }
}
function setObjectSizeBy(id,width,height) {
	var tempW = getObjectWidth(id) ; var tempH = getObjectHeight(id) ;
	if( _bw.net4 ) { id.resizeBy(width,height) }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) {
		id.style.width = tempW + width + 'px' ; id.style.height = tempH + height + 'px' }
	if( _bw.ie4up || _bw.opera ) { 
		id.style.pixelWidth = tempW + width ; id.style.pixelLeft = tempH + height }
}

// get / ctrl html obj. top / left
function getObjectX(id) {
	if( _bw.net4 ) { return id.left }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) { return id.offsetLeft }
	if( _bw.ie4up || _bw.opera ) { return id.style.pixelLeft }
	return 0 ;
}
function getObjectY(id) {
	if( _bw.net4 ) { return id.top }
	if( _bw.ie5up || _bw.net6 || _bw.opera6 ) { return id.offsetTop }
	if( _bw.ie4up || _bw.opera ) { return id.style.pixelTop }
	return 0 ;
}
function setObjectTo(id,x,y) {
	if( _bw.net4 ) { id.moveTo(x,y) }
	if( _bw.ie6 || _bw.net6 || _bw.opera6 ) 
		{ id.style.top = y + 'px' ; id.style.left = x + 'px' }
	if( _bw.ie4up || _bw.opera5 ) 
		{ id.style.pixelTop = y ; id.style.pixelLeft = x }
}
function setObjectBy(id,x,y) {
	var tempX = getObjectX(id) ; var tempY = getObjectY(id) ;
	if( _bw.net4 ) { id.moveBy(x,y) }
	if( _bw.ie6 || _bw.net6 || _bw.opera6 ) { 
		id.style.top = tempY + y + 'px' ; id.style.left = tempX + x + 'px' }
	if( _bw.ie4up || _bw.opera5 ) { 
		id.style.pixelTop = tempY + y ; id.style.pixelLeft = tempX + x }
}
function setObjectX(id,x) {
	var tempX = x ? x : getObjectX(id) ;
	if( _bw.net4 ) { var tempY = getObjectY(id) ; id.moveTo(x,tempY) }
	if( _bw.ie6 || _bw.net6 || _bw.opera6 ) { id.style.left = tempX + 'px' }
	if( _bw.ie4up || _bw.opera5 ) { id.style.pixelLeft = tempX }
}
function setObjectY(id,y) {
	var tempY = y ? y : getObjectY(id) ;
	if( _bw.net4 ) { var tempX = getObjectX(id) ; id.moveTo(tempX,y) }
	if( _bw.ie6 || _bw.net6 || _bw.opera6 ) { id.style.top = tempY + 'px' }
	if( _bw.ie4up || _bw.opera5 ) { id.style.pixelTop = tempY }
}

// get / ctrl html obj. visibility
function getObjectVisibility(id) { var temp = 0 ;
	if( _bw.net4 ) { temp = ( id.visibility == 'show' ) ? 1 : 0 }
	if( _bw.ie4up || _bw.net6up || _bw.opera ) 
		{ temp = ( id.style.visibility == 'visible' ) ? 1 : 0 }
	return temp ;
}
function setObjectVisibility(id,flag) {
	if( flag == 1 ) { var vis = ( _bw.net4 ) ? 'show' : 'visible' }
	if( flag == 0 ) { var vis = ( _bw.net4 ) ? 'hide' : 'hidden' }
	if( _bw.net4 ) { id.visibility = vis }
	else { id.style.visibility = vis }
}

// ctrl html obj. clip * not work with opera
function setClipTo(id,top,right,bottom,left) {
	if( _bw.net4 ) { 
		id.clip.top = top ; id.clip.right = right ; id.clip.bottom = bottom ; id.clip.left = left ;
	} else { id.style.clip = "rect(" + top + "px " + right + "px " + bottom + "px " + left + "px )" }
}

// write string to html obj.
function setStringToObj(id,string) {
	if( _bw.net4  ) { with( id.document ) { open() ; write( string ) ; close() } }
	if( _bw.ie4up || _bw.net6 ) { id.innerHTML = string }
}


