// ------------[+]-- DynamicHTML Common Codes 
// ------------[+]-- Copyright (C) 2002- HP-DESIGN.NET. 
// ------------[+]-- Takeru [ http://hp-design.net/ ] 
// No reproduction , no republication without written permission of HP-DESIGN.NET 
// Must not delete this copyright in order to use this script 

// [ 1.90 , 2003 02/07 , add ] [ getMouseX(e) , getMouseY(e)			] 
// [ 1.81 , 2003 01/30 , chg ] [ getBrowserInfo()						] [ use : opera 7 ]
// [ 1.80 , 2003 01/23 , add ] [ getObjectByIdF()						] [ use : targetframe ]
// [ 1.71 , 2003 01/20 , chg ] [ getBrowserInfo()						] [ use : gecko/ ]
// [ 1.70 , 2002 04/10 , add ] [ getObjectsByTagName()		 			] 
// [ 1.60 , 2002 04/09 , add ] [ getObjectsByClassName()	 			] 
// [ 1.51 , 2002 04/04 , chg ] [ setObjectX() , setObjectY() 			] [ app : net.4 ]
// [ 1.50 , 2002 04/04 , add ] [ setObjectSizeTo() , setObjectSizeBy()	] 
// [ 1.40 , 2002 04/03 , add ] [ setObjectBy() 							] 
// [ 1.31 , 2002 03/31 , chg ] [ getObjectWidth() , getObjectHeight() 	] [ app : net.4 ]
// [ 1.30 , 2002 03/30 , add ] [ setClipTo() 							] 
// [ 1.20 , 2002 03/29 , add ] [ setObjectX() , setObjectY() 			] 
// [ 1.20 , 2002 03/29 , add ] [ getScrollX() , getScrollY() 			] 
// [ 1.10 , 2002 03/28 , chg ] [ getBrowserInfo() 						] [ use : window.opera ]


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 ;
		this.opera7 = this.agent.indexOf('opera 7') ? 1 : 0 ;
		this.opera6up = ( this.opera6 || this.opera7 ) ? 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.agent.indexOf('gecko/') != -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 ;
}	var _bw = new getBrowserInfo ;


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 ;
}


function getMouseX(e) { var temp ;
	if( _bw.ie4up || _bw.opera ) { 
		temp = window.event.clientX + getScrollX() ; return temp }
	if( _bw.net6up ) { temp = e.clientX + getScrollX() ; return temp }
	if( _bw.net4 ) { return e.x }
}
function getMouseY(e) { var temp ;
	if( _bw.ie4up || _bw.opera ) { 
		temp = window.event.clientY + getScrollY() ; return temp }
	if( _bw.net6up ) { temp = e.clientY + getScrollY() ; return temp }
	if( _bw.net4 ) { return e.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 ;
}


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 getObjectByIdF(id,target) {
	var tempdata = '' ;
	if( _bw.net4 ) { tempdata = target + '.document.' + id ; return eval(tempdata) }
	if( _bw.ie6up || _bw.net6up || _bw.opera6 ) 
		{ tempdata = target+".document.getElementById('"+id+"')" ; return eval(tempdata) ; }
	if( _bw.ie4up || _bw.opera ) 
		{ tempdata = target+".document.all('"+id+"')" ; return eval(tempdata) ; }
}

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 ;
}


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 }
}


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 }
}


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 }
}


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 )" }
}


function setStringToObj(id,string) {
	if( _bw.net4  ) { with( id.document ) { open() ; write( string ) ; close() } }
	if( _bw.ie4up || _bw.net6 || _bw.opera7 ) { id.innerHTML = string }
}



