function BAEnvironment() {

	var d  = document;

	var di = d.implementation;

	var de = d.documentElement;

	var ua = navigator.userAgent;

	var lp = location.protocol;

	var lh = location.hostname;



	this.url = {}; this.ns = {}; this.prefix = {}; this.ua = {}; this.env = {}; this.css = {}; this.geom = {};



	this.url.commonDir   = BAGetCommonDir('shared');

	this.url.cssDir      = this.url.commonDir + 'css/';

	this.url.scriptDir   = this.url.commonDir + 'js/';



	this.ns.defaultNS    = (de && de.namespaceURI) ? de.namespaceURI : (de && de.tagUrn) ? de.tagUrn : null;

	this.ns.xhtml1       = 'http://www.w3.org/1999/xhtml';

	this.ns.xhtml2       = 'http://www.w3.org/2002/06/xhtml2';

	this.ns.bAattrs      = 'urn:bA.attrs';



	this.prefix.bAattrs  = 'bAattrs:';



	this.ua.productSub   = navigator.productSub;

	this.ua.isGecko      = ua.match(/Gecko\//);

	this.ua.isSafari     = ua.match(/AppleWebKit/);

	this.ua.isOpera      = window.opera;

	this.ua.isOpera6     = (this.ua.isOpera && ua.match(/Opera\.6/));   // Opera 6.x

	this.ua.isIE         = (d.all && !this.ua.isGecko && !this.ua.isSafari && !this.ua.isOpera);

	this.ua.isIE40       = (this.ua.isIE && ua.match(/MSIE 4\.0/));     // IE 4.0x

	this.ua.isIE45       = (this.ua.isIE && ua.match(/MSIE 4\.5/));     // IE 4.5x

	this.ua.isIE50       = (this.ua.isIE && ua.match(/MSIE 5\.0/));     // IE 5.0x

	this.ua.isIE55       = (this.ua.isIE && ua.match(/MSIE 5\.5/));     // IE 5.5x

	this.ua.isNN4        = d.layers;                                    // NN 4.x

	this.ua.isMac        = ua.match(/Mac/);

	this.ua.isWin        = ua.match(/Win/);

	this.ua.isWinIE      = this.ua.isWin && this.ua.isIE;

	this.ua.isMacIE      = this.ua.isMac && this.ua.isIE;

	this.ua.DOMok        = (di) ? di.hasFeature('HTML','1.0') : (this.ua.isIE && de);



	this.env.online      = (lp == 'http:' && !lh.match(/.local\.?$/));

	this.env.referer     = (typeof document.referrer == 'string') ? document.referrer : '';



	this.css.revise      = {



	};

	this.css.reviseTitle = '';



	this.debugMode       = false;

}





window.onerror = function() {

	if (BA.debugMode) {

		var msg = 'Error: ' + arguments[0] + '\n' +

		          'File: '  + arguments[1] + '\n' + 

		          'Line: '  + arguments[2];

		alert(msg);

	}

	return true;

}







if (!Array.prototype.push) {

	Array.prototype.push = function() {

		for (var i = 0, n = arguments.length; i < n; i++) {

			this[this.length] = arguments[i];

		}

	}

}



if (!Array.prototype.indexOf) {

	Array.prototype.indexOf = function(value){

		var i = 0;

		while(i < this.length){

			if(this[i] == value) return i;

			i++;

		}

		return -1;

	}

}







String.prototype.BAGetAfter = function(word) {

	var offset = this.indexOf(word);

	return (offset == -1) ? '' : this.substring(offset + word.length, this.length);

}







function BAElement() { }



BAElement.prototype = {







	addEventListenerBA : function(type, listener, useCapture) {

		function _Event_IE(_node) {

			var e  = window.event;

			var de = document.documentElement;

			var db = document.body;

			this.currentTarget   = _node;

			if (!e) return;

			this.type            = e.type;

			this.target          = e.srcElement;

			this.relatedTarget   = (e.srcElement == e.toElement) ? e.fromElement : e.toElement;

			this.clientX         = e.clientX;

			this.clientY         = e.clientY;

			this.pageX           = (de.scrollLeft ? de.scrollLeft : db.scrollLeft) + e.clientX;

			this.pageY           = (de.scrollTop  ? de.scrollTop  : db.scrollTop ) + e.clientY;

			this.stopPropagation = function() { e.cancelBubble = true  };

			this.preventDefault  = function() { e.returnValue  = false };

		}



		function _Event_Safari(_e) {

			for (var i in _e) this[i] = _e[i];

			try {this.target = (_e.target.nodeType == 3) ? _e.target.parentNode : _e.target } catch (err) { }

			this.preventDefault  = function() { _e.currentTarget['on' + type] = function() { return false } };

			this.stopPropagation = function() { window.event_safari_cancelBubble[_e.type] = true };

		}



		if (this.addEventListener) {

			if (!BA.ua.isSafari) {

				this.addEventListener(type, listener, useCapture);

			} else {

				this.addEventListener(type, function(e) {

					if (typeof window.event_safari_cancelBubble != 'object') {

						window.event_safari_cancelBubble = {};

					} else if (typeof window.event_safari_cancelBubble[e.type] != 'boolean') {

						document.addEventListener(e.type, function(_e) {

							window.event_safari_cancelBubble[_e.type] = false;

						}, false);

					}

					if (!window.event_safari_cancelBubble[e.type]) {

						listener(new _Event_Safari(e));

					}

				}, useCapture);

			}



		} else {

			var _this  = (this.window) ? this.window : this; // measure for WinIE

			var exists = _this['on' + type];

			_this['on' + type] = (exists) ?

				function() { exists(); listener(new _Event_IE(_this)) } :

				function() {           listener(new _Event_IE(_this)) } ;

		}

	},





	createElementBA : function(tagName) {

		var node = (BA.ns.defaultNS && document.createElementNS && tagName.match(/:/)) ?

		           	document.createElementNS(BA.ns[tagName.split(':')[0]], tagName.split(':')[1]) :

		           	(BA.ns.defaultNS && document.createElementNS) ?

		           		document.createElementNS(BA.ns.defaultNS, tagName) : 

		           		document.createElement(tagName) ;

		return BARegisterDOMMethodsTo(node);

	},







	getElementsByTagNameBA : function(tagName) {

		if (tagName == '*') {

			var nodes = this.getElementsByTagName(tagName);

			if (nodes.length > 0) {

				return nodes;

			} else {

				var ret   = [];

				var nodes = (document.all && this.nodeType != 1) ?

					document.all :

					(function (_node) {

						var _nodes = _node.childNodes;

						var _ret   = [];

						for (var i = 0, n = _nodes.length; i < n; i++) {

							_ret.push(_nodes[i]);

							_ret = _ret.concat(arguments.callee(_nodes[i]));

						}

						return _ret;

					})(this);

				for (var i = 0, n = nodes.length; i < n; i++) {

					if (nodes[i].nodeType == 1 && !nodes[i].nodeName.match(/^[!\?]/)) {

						ret.push(nodes[i]);

					}

				}

				return ret;

			}

		} else if (tagName.match(/:/)) {

			var prfx  = tagName.split(':')[0];

			var name  = tagName.split(':')[1];

			var nodes = (BA.ns.defaultNS && this.getElementsByTagNameNS) ?

			            	this.getElementsByTagNameNS(BA.ns[prfx], name) :

			            	this.getElementsByTagName(tagName) ;

			if (nodes.length == 0) {

				var nodes = (name == '*') ? this.getElementsByTagNameBA(name) : this.getElementsByTagName(name);

				for (var nodes_ = [], i = 0, n = nodes.length; i < n; i++){

					if (BA.ns.defaultNS && nodes[i].namespaceURI == BA.ns[prfx] || nodes[i].tagUrn == BA.ns[prfx]) {

						nodes_.push(nodes[i]);

					}

				}

				if (nodes_.length == 0) {

					var nodes = (name == '*') ? nodes : this.getElementsByTagNameBA('*');

					for (var nodes_ = [], i = 0, n = nodes.length; i < n; i++) {

						var prfx_ = nodes[i].nodeName.split(':')[0];

						var name_ = nodes[i].nodeName.split(':')[1];

						if (name_ && prfx_ == prfx && (name == '*' || name_.toLowerCase() == name.toLowerCase())) {

							nodes_.push(nodes[i]);

						}

					}

				}

				nodes = nodes_;

			}

			return nodes;

		} else {

			var nodes = (BA.ns.defaultNS && this.getElementsByTagNameNS) ?

			            	this.getElementsByTagNameNS(BA.ns.defaultNS, tagName) :

			            	(tagName.match(/^body$/i) && document.body) ?

			            		/* measure for Netscape7.1 */ [document.body] :

			            		this.getElementsByTagName(tagName) ;

			if (typeof document.documentElement.tagUrn == 'string') {

				for (var nodes_ = [], i = 0, n = nodes.length; i < n; i++){

					if (!nodes[i].tagUrn || nodes[i].tagUrn == BA.ns.defaultNS) {

						nodes_.push(nodes[i]);

					}

				}

				nodes = nodes_;

			}

			return nodes;

		}

	},







	getElementsByClassNameBA : function(className, tagName) {

		if (!className) return undefined;

		if (!tagName)   tagName = '*';

		var nodes = this.getElementsByTagNameBA(tagName);

		var ret   = [];

		for (var i = 0, n = nodes.length; i < n; i++) {

			if (nodes[i].hasClassNameBA(className)) {

				ret.push(nodes[i]);

			}

		}

		return ret;

	},







	appendTextNodeBA : function(str) {

		if (BA.ua.isMac && BA.ua.isIE50) {

			this.innerHTML += str;

		} else {

			this.appendChild(document.createTextNode(str));

		}

	},



	getInnerTextBA : function() {

		var nodes = this.childNodes;

		var ret   = [];

		for (var i = 0, n = nodes.length; i < n; i++) {

			if (nodes[i].hasChildNodes()) {

				ret.push(nodes[i].getInnerTextBA());

			} else if (nodes[i].nodeType == 3) {

				ret.push(nodes[i].nodeValue);

			} else if (nodes[i].alt) {

				ret.push(nodes[i].alt);

			}

		}

		return ret.join('').replace(/\s+/g, ' ');

	},



	getAttributeBA : function(attr) {

		if (BA.ua.isIE && attr == 'class') {

			attr += 'Name';

		}

		var ret = this.getAttribute(attr);

		if (!ret && this.getAttributeNS && attr.match(/:/)) {

			var prfx = attr.split(':')[0];

			var attr = attr.split(':')[1];

			return this.getAttributeNS(BA.ns[prfx], attr)

		}

		return ret;

	},



	setAttributeBA : function(attr, value) {

		if (attr.match(/:/)) {

			var prfx = attr.split(':')[0];

			var attr = attr.split(':')[1];

			if (this.setAttributeNS && this.namespaceURI || BA.ua.isSafari) {

				this.setAttributeNS(BA.ns[prfx], attr, value);

			} else {

				this.setAttribute('xmlns:' + prfx, BA.ns[prfx]);

				this.setAttribute(prfx + ':' + attr, value);

			}

		} else {

			if (BA.ua.isIE && attr == 'class') attr += 'Name';

			this.setAttribute(attr, value);

		}

	},



	hasClassNameBA : function(className) {

		var flag  = false;

		var cname = this.getAttributeBA('class');

		if (cname) {

			cname = cname.split(' ');

			for (var i = 0; i < cname.length && !flag; i++) flag = (cname[i] == className);

		}

		return flag;

	},



	appendClassNameBA : function(className) {

		if (className && !this.hasClassNameBA(className)) {

			var cnames = this.getAttributeBA('class');

			this.setAttributeBA('class', ((cnames) ? cnames + ' ' + className : className));

		}

	},



	/* ----- Node.removeClassNameBA() ----- */



	removeClassNameBA : function(className) {

		if (className && this.hasClassNameBA(className)) {

			var cname = this.getAttributeBA('class');

			var cntmp = [];

			if (cname) {

				cname = cname.split(' ');

				for (var i = 0; i < cname.length; i++) if (cname[i] != className) cntmp.push(cname[i]);

			}

			this.setAttributeBA('class', cntmp.join(' '));

		}

	},



	normalizeTextNodeBA : function (deep) {

		(function (curNode) {

			for (var i = 0; i < curNode.childNodes.length; i++) {

				var node = curNode.childNodes[i];

				if (node.nodeType == 3) {

					node.nodeValue = node.nodeValue.replace(/^\s+/, '');

					node.nodeValue = node.nodeValue.replace(/\s+$/, '');

					if (node.nodeValue.match(/^\s*$/))  {

						node.parentNode.removeChild(node);

						i--;

					}

				} else if (deep && node.nodeType == 1 && node.hasChildNodes()) {

					arguments.callee(node);

				}

			}

		})(this);

	},



	getAbsoluteOffsetBA : function() {

		var offset = { X : this.offsetLeft, Y : this.offsetTop };

		if (this.offsetParent) {

			offset.X += this.offsetParent.getAbsoluteOffsetBA().X;

			offset.Y += this.offsetParent.getAbsoluteOffsetBA().Y;

		}

		return offset;

	},



	getCurrentStyleBA : function(property, pseudo) {

		return (window.getComputedStyle) ?

			window.getComputedStyle(this, pseudo)[property] : (this.currentStyle) ?

				this.currentStyle[property] : 0;

	},



	setPositionFixedBA : function() {

		if (this.__setPositionFixedBAisApplied__) return;

		this.__setPositionFixedBAisApplied__ = true;

		var left   = parseInt(this.getCurrentStyleBA('left'  )); if (isNaN(left)) left = 0;

		var top    = parseInt(this.getCurrentStyleBA('top'   )); if (isNaN(top))  top  = 0;

		var right  = parseInt(this.getCurrentStyleBA('right' ));

		var bottom = parseInt(this.getCurrentStyleBA('bottom'));

		var offset = this.getAbsoluteOffsetBA();

		var node   = this;

		window.addEventListenerBA('scroll', function() {

			BAGetGeometry();

			node.style.left = (left + BA.geom.scrollX) + 'px';

			node.style.top  = (top  + BA.geom.scrollY) + 'px';

			if (!isNaN(right)) {

				node.style.left   = (offset.X + BA.geom.scrollX) + 'px';

				node.style.right  = 'auto';

			}

			if (!isNaN(bottom)) {

				node.style.top    = (offset.Y + BA.geom.scrollY) + 'px';

				node.style.bottom = 'auto';

			}

		});

	}

}





function BARegisterDOMMethods() {

	window.addEventListenerBA = BAElement.prototype.addEventListenerBA;

	if (typeof Node == 'object' && Node.prototype) {

		for (var i in BAElement.prototype) {

			Node.prototype[i] = BAElement.prototype[i];

		}

	}

	BARegisterDOMMethodsTo(document);

}



function BARegisterDOMMethodsTo(node) {

	for (var i in BAElement.prototype) {

		if (!node[i]) {

			node[i] = BAElement.prototype[i];

		}

	}

	return node;

}



function BAAddOnload(func) {

	window.addEventListenerBA('load', func);

}



function BAAddDuringLoad(func, wait) {

	if (!window.BAAddDuringLoadFunc) window.BAAddDuringLoadFunc = [];

	if (!wait) wait = 500;

	func();

	window.BAAddDuringLoadFunc.push(setInterval(func, wait));

	BAAddOnload(func);

	BAAddOnload(function() {

		for (var i = 0; i < window.BAAddDuringLoadFunc.length; i++) {

			clearInterval(window.BAAddDuringLoadFunc[i]);

		}

	});

}





function BAGetCommonDir(dirName) {

	var sheets = document.styleSheets;

	var ptn    = new RegExp('(.*\\/?' + dirName + '\\/).+$');

	return (sheets && sheets.length && sheets[0].href && sheets[0].href.match(ptn)) ? RegExp.$1 : '';

}



function BASingleton(_constructor) {

	return _constructor.__BASingleInstance__ || (_constructor.__BASingleInstance__ = new _constructor());

}



function BAAlreadyApplied(func) {

	if (!BA.ua.DOMok || func.__BAAlreadyApplied__) return true;

	func.__BAAlreadyApplied__ = true;

	return false;

}



function BAConcatNodeList() {

	var nodes = [];

	(function(list) {

		for (var i = 0, n = list.length; i < n; i++) {

			if (list[i].nodeType == 1) {

				nodes.push(list[i]);

			} else if (list[i].length > 0) {

				arguments.callee(list[i]);

			}

		}

	})(arguments);

	return nodes;

}



function BASetTimeout(func, ms, from) {

	this.storePointName   = 'BATimeout';

	this.storePointPrefix = 'store';

	this.storeFuncProp    = 'func';

	this.storeFromProp    = 'from';

	if (arguments.length > 0) {

		this.createStorePoint();

		this.storeFunc(func);

		this.storeFrom(from);

		this.setTimer(ms);

	}

}



BASetTimeout.prototype = {

	createStorePoint : function() {

		if (!window[this.storePointName]) window[this.storePointName] = {};

		if (!this.storeName) {

			var i = 1;

			for (var prop in window[this.storePointName]) i++;

			this.storeName = this.storePointPrefix + i;

			this.store     = window[this.storePointName][this.storeName] = {};

		}

	},



	storeFunc : function(func) {

		this.store[this.storeFuncProp] = func;

		this.storedFuncName = this.storePointName + '.' + this.storeName + '.' + this.storeFuncProp;

	},

	

	storeFrom : function(from) {

		this.store[this.storeFromProp] = from;

		this.storedFromName = this.storePointName + '.' + this.storeName + '.' + this.storeFromProp;

	},

	

	setTimer : function(ms) {

		if (typeof ms != 'number' || ms < 0) ms = 0;

		this.timeout = setTimeout(this.storedFuncName + '("' + this.storedFromName + '")', ms);

	},



	clearTimeout : function() {

		clearTimeout(this.timeout);

	}

}



function BASetInterval(func, ms, from) {

	this.storePointName   = 'BAInterval';

	if (arguments.length > 0) {

		this.createStorePoint();

		this.storeFunc(func);

		this.storeFrom(from);

		this.setTimer(ms);

	}

}



BASetInterval.prototype = new BASetTimeout;



BASetInterval.prototype.setTimer = function(ms) {

	if (typeof ms != 'number' || ms < 0) ms = 0;

	this.interval = setInterval(this.storedFuncName + '("' + this.storedFromName + '")', ms);

}



BASetInterval.prototype.clearInterval = function() {

	clearInterval(this.interval);

}



function BAStatusMsg_() {

	this.defaultStatus = window.defaultStatus || '';

}



BAStatusMsg_.prototype = {

	set : function(msg, delay, sustain) {

		this.msg     = (typeof msg     != 'undefined' && msg        ) ? msg     : '';

		this.delay   = (typeof delay   == 'number'    && delay   > 0) ? delay   :  0;

		this.sustain = (typeof sustain == 'number'    && sustain > 0) ? sustain :  0;

		if (this.delay > 0) {

			this.delayTimer = new BASetTimeout(this.setMsg, this.delay, this);

		} else {

			this.setMsg();

		}

	},



	unset : function() {

		var _this = eval(arguments[0]) || this;

		_this.clearTimer();

		window.status = _this.defaultStatus;

	},



	setMsg : function() {

		var _this = eval(arguments[0]) || this;

		_this.clearTimer();

		if (_this.msg) {

			window.status = _this.msg;

			if (_this.sustain > 0) {

				_this.sustainTimer = new BASetTimeout(_this.unset, _this.sustain, _this);

			}

		} else {

			_this.unset();

		}

	},

	

	clearTimer : function() {

		if (this.delayTimer  ) this.delayTimer.clearTimeout();

		if (this.sustainTimer) this.sustainTimer.clearTimeout();

	}

}

var BAStatusMsg = BASingleton(BAStatusMsg_);



function BATimer() { 

	this.reset();

}



BATimer.prototype = {

	reset : function() {

		this.startTime = (new Date()).getTime();

	},

	

	getTime : function() {

		return (new Date()).getTime() - this.startTime;

	},

	

	getSecond : function() {

		return this.getTime() / 1000;

	}

}



function BATag(tagName, attrs) {

	this.tagName    = tagName;

	this.attributes = attrs || {};

	this.childNodes = [];

}



BATag.prototype = {

	setAttribute : function(attrName, value) {

		this.attributes[attrName] = value;

	},



	appendChild : function(arg) {

		this.childNodes.push(arg);

	},



	toString : function(debug) {

		var tagOpen    = (debug) ? '&lt;' : '<';

		var tagClose   = (debug) ? '&gt;' : '>';

		var tag        = tagOpen + this.tagName;

		var content    = (this.childNodes.length) ? '' : null;

		for (var i = 0, n = this.childNodes.length; i < n; i++) {

			content += this.childNodes[i].toString(debug);

		}

		for (var attr in this.attributes) {

			tag += ' ' + attr + '="' + this.attributes[attr] + '"';

		}

		tag += (content != null) ?

		       	tagClose + content + tagOpen + '/' + this.tagName + tagClose :

		       	' /' + tagClose;

		return tag;

	}

}



function BAPreloadImage(src) {

	var img = new Image();

	img.src = src;

	return img;

}







/* -------------------- Function : BAOpenWindow -------------------- */



function BAOpenWindow(url, target, width, height, options, moveFlag) {

	if (!target) target = '_blank';

	var optVariations = {

		'zoomview'  : 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes',

		'slideshow' : 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no',

		'helpwin'   : 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes',

		'mailsend'  : 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no',

		'guestbook' : 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no'

	}

	options = options || optVariations[target] || '';

	width  += (options.match('scrollbars=yes')) ? 16 : 0;

	if (width && height) options = 'width=' + width + ',height=' + height + ((options) ? ',' + options : '');

	var newWin = window.open(url, target, options);

	newWin.focus();

	if (moveFlag) newWin.moveTo(0, 0);

	if (window.event) window.event.returnValue = false;

	return newWin;

}



function BAOpenFullscreenWindow(url, target, options) {

	options = options || 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';

	return BAOpenWindow(url, target, screen.availWidth, screen.availHeight, options, true);

}



function BAAppendJS(src) {

	var E = new BATag('script');

	E.setAttribute('type', 'text/javascript');

	E.setAttribute('src' , src.replace(/~/g, '%7E'));

	E.appendChild('');

	document.write(E.toString());

}



function BAAppendCSS(href, title) {

	var act   = BAGetActiveCSSTitle();

	var rel   = (!title || !act || title == act) ? 'stylesheet' : 'alternate stylesheet';

	var type  = 'text/css';

	var href  = href.replace(/~/g, '%7E');

	var media = (!BA.ua.isNN4) ? 'screen, tv' : 'screen';

	var E     = new BATag('link', { rel : rel, type : type, media : media, href : href, title : title });

	document.write(E.toString());

}



function BAGetActiveCSSTitle() {

	var sheets = document.styleSheets;

	if (sheets) {

		for (var i = 0, n = sheets.length; i < n; i++) {

			if (!sheets[i].disabled && sheets[i].title) {

				return sheets[i].title;

			}

		}

	}

	if (BA.ua.DOMok) {

		// measure for Safari's lack of implement of document.styleSheets!

		var nodes = document.getElementsByTagNameBA('link');

		for (var i = 0, n = nodes.length; i < n; i++) {

			if (nodes[i].rel.match(/^stylesheet$/i)) {

				return nodes[i].title

			}

		}

	}

	return null;

}





function BAGetGeometry(e) {

	if (!document.getElementsByTagNameBA) BARegisterDOMMethodsTo(document); // measure for safari



	var w = window;

	var d = document.documentElement;

	var b = document.getElementsByTagNameBA('body')[0];

	var isWinIEqm = BA.ua.isWinIE && (!document.compatMode || document.compatMode == 'BackCompat');

	var isMacIE   = BA.ua.isMacIE;

	var isSafari  = BA.ua.isSafari;



	BA.geom.scrollX  = w.scrollX     || d.scrollLeft || b.scrollLeft || 0;

	BA.geom.scrollY  = w.scrollY     || d.scrollTop  || b.scrollTop  || 0;

	BA.geom.windowW  = w.innerWidth  || (isMacIE ? b.scrollWidth  : d.offsetWidth );

	BA.geom.windowH  = w.innerHeight || (isMacIE ? b.scrollHeight : d.offsetHeight);

	BA.geom.pageW    = (isMacIE) ? d.offsetWidth  : (isWinIEqm) ? b.scrollWidth  : d.scrollWidth ;

	BA.geom.pageH    = (isMacIE) ? d.offsetHeight : (isWinIEqm) ? b.scrollHeight : d.scrollHeight;

	BA.geom.windowX  = (!e) ? (BA.geom.windowX  ||  0) : e.clientX - ( isSafari ? BA.geom.scrollX : 0);

	BA.geom.windowY  = (!e) ? (BA.geom.windowY  ||  0) : e.clientY - ( isSafari ? BA.geom.scrollY : 0);

	BA.geom.mouseX   = (!e) ? (BA.geom.mouseX   ||  0) : e.clientX + (!isSafari ? BA.geom.scrollX : 0);

	BA.geom.mouseY   = (!e) ? (BA.geom.mouseY   ||  0) : e.clientY + (!isSafari ? BA.geom.scrollY : 0);

	BA.geom.nodeName = (!e) ? (BA.geom.nodeName || '') : e.target.nodeName;



	if (BA.debugMode) {

		BAStatusMsg.set(   'pageW: '   + BA.geom.pageW   + ' | pageH: '   + BA.geom.pageH   +

		                ' | windowX: ' + BA.geom.windowX + ' | windowY: ' + BA.geom.windowY +

		                ' | scrollX: ' + BA.geom.scrollX + ' | scrollY: ' + BA.geom.scrollY +

		                ' | left: '    + BA.geom.mouseX  + ' | top: '     + BA.geom.mouseY  +

		                ' | node: '    + BA.geom.nodeName);

	}

}



function BAAppendReviseCSS() {

	for (var i in BA.css.revise) {

		var ua = i.split('.')[0];

		var os = i.split('.')[1];

		if (os && BA.ua['is' + os] && BA.ua['is' + ua] || !os && BA.ua['is' + ua]) {

			BAAppendCSS(BA.url.cssDir + BA.css.revise[i], BA.css.reviseTitle);

			break;

		}

	}

}



function BARegisterDOMMethodsToEveryNode() {

	if (typeof Node == 'object' && Node.prototype) return;

	if (BAAlreadyApplied(arguments.callee))        return;



	var nodes = document.getElementsByTagNameBA('*');

	for (var i = 0, n = nodes.length; i < n; i++) {

		BARegisterDOMMethodsTo(nodes[i]);

	}

}



function BAStartGeometryMeasure() {

	if (BAAlreadyApplied(arguments.callee)) return;

	document.addEventListenerBA('mousemove' , BAGetGeometry);

	document.addEventListenerBA('mousewheel', BAGetGeometry);

}



function BALoadJS() {

	for(var i=0;i<arguments.length;i++){

		document.write('<script type="text/javascript" src="' + 'js/' + arguments[i] + '"><\/script>');

	}

}



var BA = BASingleton(BAEnvironment);



BARegisterDOMMethods();

BAAppendReviseCSS();



BAAddOnload(function() {

	BARegisterDOMMethodsToEveryNode();

	BAStartGeometryMeasure();

});







var BASMOOTHSCROLL_AUTOSETUP_ENABLED      = true;

var BASMOOTHSCROLL_DEFAULT_SCROLLUNIT     = 5;

var BASMOOTHSCROLL_DEFAULT_SCROLLWAIT     = 10;

var BASMOOTHSCROLL_DEFAULT_USEPOSTPROCESS = false;



function BASmoothScroll_() {

	this.offsetX = 0;

	this.offsetY = 0;



	this.unit = BASMOOTHSCROLL_DEFAULT_SCROLLUNIT ||  5;

	this.wait = BASMOOTHSCROLL_DEFAULT_SCROLLWAIT || 10;

	this.usePostProcess = BASMOOTHSCROLL_DEFAULT_USEPOSTPROCESS;

}

BASmoothScroll_.prototype = {

	setTargetNode : function(node) {

		this.targetNode = node;

		this.timer      = null;

	},

	

	setFromNode : function(node) {

		this.fromNode = node;

	},

	

	startScroll : function(_this) {

		BAGetGeometry();

		_this = eval(_this) || this;

		if (!_this.timer) {

			var maxX   = (BA.geom.pageW > BA.geom.windowW) ? BA.geom.pageW - BA.geom.windowW : 0;

			var maxY   = (BA.geom.pageH > BA.geom.windowH) ? BA.geom.pageH - BA.geom.windowH : 0;

			var posX   = _this.targetNode.getAbsoluteOffsetBA().X + _this.offsetX;

			var posY   = _this.targetNode.getAbsoluteOffsetBA().Y + _this.offsetY;

			_this.cuX   = BA.geom.scrollX;

			_this.cuY   = BA.geom.scrollY;

			_this.toX   = (posX < 0) ? 0 : (posX > maxX) ? maxX : posX;

			_this.toY   = (posY < 0) ? 0 : (posY > maxY) ? maxY : posY;

			_this.timer = new BASetInterval(arguments.callee, _this.wait, _this);

		}



		_this.cuX += (_this.toX - BA.geom.scrollX) / _this.unit; if (_this.cuX < 0) _this.cuX = 0;

		_this.cuY += (_this.toY - BA.geom.scrollY) / _this.unit; if (_this.cuY < 0) _this.cuY = 0;

		var newX = Math.floor(_this.cuX);

		var newY = Math.floor(_this.cuY);

		window.scrollTo(newX, newY);

		if (newX == _this.toX && newY == _this.toY) _this.stopScroll();

	},

	

	stopScroll : function() {

		if (this.timer) {

			this.timer.clearInterval();

			this.timer = null;

			this.postProcess();

		}

	},

	

	postProcess : function() {

		if (this.usePostProcess && this.fromNode && (BA.ua.isGecko || BA.ua.isWinIE)) {

			var href = this.fromNode.getAttributeBA('href');

			if (href) location.href = href;

		}

	}

}

var BASmoothScroll = BASingleton(BASmoothScroll_);





function BASmoothScrollAutoSetup() {

	var oHTML = document.getElementsByTagNameBA('html')[0];

	var oBODY = document.getElementsByTagNameBA('body')[0];

	var cDIV  = document.createElementBA('div');



	if (!document.getElementById('top'))    oHTML.setAttributeBA('id', 'top');

	if (!document.getElementById('bottom')) cDIV.setAttributeBA('id', 'bottom');

	cDIV.style.margin = cDIV.style.padding = 0;

	oBODY.appendChild(cDIV);



	var nodes = document.getElementsByTagNameBA('a');

	for (var i = 0, n = nodes.length; i < n; i++) {

		var ident = _getInternalLinkFragmentIdentifier(nodes[i]);

		if (ident) {

			var target = document.getElementById(ident) || document.getElementsByName(ident)[0];

			if (target) {

				nodes[i].__BASmoothScrollAutoSetup_targetNode__ = target;

				nodes[i].addEventListenerBA('click', function(e) {

					e.preventDefault();

					e.stopPropagation();

					BASmoothScroll.setTargetNode(e.currentTarget.__BASmoothScrollAutoSetup_targetNode__);

					BASmoothScroll.setFromNode(e.currentTarget);

					BASmoothScroll.startScroll();

				});

			}

		}

	}



	function _getInternalLinkFragmentIdentifier(node) {

		var ret      = '';

		var linkHref = node.getAttributeBA('href');

		if (linkHref && linkHref.match(/#/)) {

			linkHref = linkHref.split('#');

			if (!linkHref[0] || linkHref[0] == location.href.split('#')[0]) {

				ret = linkHref[1];

			}

		}

		return ret;

	}

}





if (typeof BA == 'object' && BA.ua.DOMok && BASMOOTHSCROLL_AUTOSETUP_ENABLED) {

	BAAddOnload(function() {

		BASmoothScrollAutoSetup();

		document.addEventListenerBA('click'     , function(e) { BASmoothScroll.stopScroll() });

		document.addEventListenerBA('mousewheel', function(e) { BASmoothScroll.stopScroll() });

	});

}



if (typeof BA == 'object' && BA.ua.DOMok) {

    BAAddOnload(function() {

        var node = document.getElementById('index');

        if (node) {

            node.addEventListenerBA('click', function(e) {

                e.preventDefault();

                e.stopPropagation();   // <-- イベントバブリング停止

                BAJumpToFlashTop();

            });

        }

    })

}





function BAJumpToFlashTop() {

    if (typeof BA == 'object' && BA.ua.DOMok) {

        var targetNode = document.getElementById('ct');

        if (targetNode) {

            BASmoothScroll.setTargetNode(targetNode);

            BASmoothScroll.startScroll();

        }

    }

}



function BAJumpToFlashTop_isNeeded(){

    if (typeof BA == 'object' && BA.ua.DOMok) {

        var targetNode = document.getElementById('ct');

        if (targetNode) {

            BAGetGeometry();

            return (BA.geom.scrollY > targetNode.getAbsoluteOffsetBA().Y);

        }

    }

    return false;

}



var Mac = navigator.userAgent.indexOf("Mac") != -1 ? true : false 





if (document.getElementById) { 

if(Mac) cssurl = "mac.css" // Mac W3C対応ブラウザ用CSS 





} else if (document.all) { 



if(Mac) cssurl = "mac.css" // Mac IE用CSS 



} 



//CSS読み込みタグlinkの書き出し 

document.write('<link rel="stylesheet" ') 

document.write(' type="text/css" ') 

document.write(' href="'+cssurl+'"') 

document.write('>') 
