/*@cc_on _d=document;eval('var document=_d')@*/

var snippets = {
	entities   : ['&',     '<',    '>',    "'",      '"'     ],
	sanitaries : ['&amp;', '&lt;', '&gt;', '&apos;', '&quot;'],

//多分不要なので削除：sakai
/*	attachEventMethods : function(tgt, event, method) {
		eval('var te = tgt.'+event);
		if(te != null) { 
			var f = te.toString();
			if(clientEnvironment.isIE) {
				var r1 = "/^[^{]*{/g";
				var r2 = "/}$/g";
				eval('r1 = '+r1);
				eval('r2 = '+r2);
				f = f.replace(r1, '');
				f = f.replace(r2, '');
				fnc = new Function(f.toString()+method);
			} else {
				f = f.replace('function anonymous() {', '');
				f = f.replace('}', '');
				fnc = new Function(f.toString()+method);
			}
		} else {
			var f = '';
			fnc = new Function(f.toString()+method);
		}
		eval('tgt.'+event+'= fnc');
	},*/
	attachGetQuery : function(href, vars) {
		var qstr = '';
		for(var i in vars) {
			qstr += '&'+escape(i)+'='+escape(vars[i]);
		}
		qstr = href.indexOf('?') != -1 ? href+qstr : href+'?'+qstr.substring(1);
		return qstr;
	},
	checkSubWindow : function(win) {
		if (!!win) {
			if (isIE != -1 && isWindows ) {
				return win.closed;
			} else {
				return typeof win.document != 'object';
			}
		} else {
			return true;
		}
	},
	getCSSProp : function(elem, prop) {
		if(elem.style && elem.style[prop]) {
			return elem.style[prop];
		} else if(elem.currentStyle) {
			return elem.currentStyle[prop];
		} else if(document.defaultView && document.defaultView.getComputedStyle) {
			prop = prop.replace(/([A-Z])/g, function(match) { return '-'+match.toLowerCase() });
			return document.defaultView.getComputedStyle(elem, '').getPropertyValue(prop);
		} else {
			return null;
		}
	},
	getElement : function(name, nest) {
		nest = nest ? 'document.'+nest+'.' : '';
		var el = clientEnvironment.isW3C ? document.getElementById(name) : clientEnvironment.isIE ? document.all[name] : false;
		el.css = el.style;
		el.getTop = function() { return parseInt(el.css.top) || 0 };
		el.setTop = function(y) { el.css.top =  y+'px' };
		el.getHeight = function() { return el.offsetHeight };
		el.getClipHeight = function() { return el.offsetHeight };
		return el;
	},
	getScrollLeft : function(paneName) {
		if(paneName) {
			return document.getElementById(paneName).scrollLeft ? document.getElementById(paneName).scrollLeft : 0 ;
		} else {
			return document.getElementsByTagName('body')[0].scrollLeft ? document.getElementsByTagName('body')[0].scrollLeft : 0 ;
		}
	},
	getScrollTop : function(paneName) {
		if(paneName) {
			return document.getElementById(paneName).scrollTop ? document.getElementById(paneName).scrollTop : 0 ;
		} else {
			return document.getElementsByTagName('body')[0].scrollTop ? document.getElementsByTagName('body')[0].scrollTop : 0 ;
		}
	},
	getElementXpos : function(el) {
		var x = 0;
		while(el.offsetParent) {
			x += el.offsetLeft;
			el = el.offsetParent;
		}
		return x;
	},
	getElementYpos : function(el) {
		var y = 0;
		while(el.offsetParent) {
			y += el.offsetTop;
			el = el.offsetParent;
		}
		return y;
	},
	getWindowWidth : function() {
		if(clientEnvironment.isIE) return (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
		else return window.innerWidth;
	},
	getWindowHeight : function() {
		if(clientEnvironment.isIE) return (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
		else return window.innerHeight;
	},
	htmlEntities : function(str) {
		var r = String(str);
		var e = this.entities;
		var s = this.sanitaries;
		for(var i=0; i<e.length; i++) {
			r = r.split(e[i]).join(s[i]);
		}
		return r;
	},
	htmlEntitiesDecode : function(str) {
		var r = String(str);
		var e = this.entities;
		var s = this.sanitaries;
		for(var i=0; i<e.length; i++) {
			r = r.split(s[i]).join(e[i]);
		}
		return r;
	},
	removeAlpha : function(str) {
		var re = "/[a-zA-Z]/g";
		if(clientEnvironment.isIE) {
			eval('re = '+re);
		}
		if(str.search(re) != -1) {
			result = str.replace(re, '');
		}
		return parseInt(result);
	},
	addEventListener : function(target, type, func){
		if(target.attachEvent){
			target.attachEvent("on" + type, func);
		}else if(target.addEventListener){
			target.addEventListener(type, func, true);
		}else {
			target["on" + type] = func;
		}
	}
}

var clientEnvironment = {
	isW3C : document.getElementById,
	isIE : document.all,
	isNS4 : document.layers,
	isNS6 : (document.getElementById && window.navigator.appName.indexOf('Netscape') != -1),
	isOpera : (navigator.userAgent.indexOf('Opera') != -1),
	isWindows : (window.navigator.userAgent.indexOf('Windows 95') != -1) || (window.navigator.userAgent.indexOf('Windows 98') != -1) || (window.navigator.userAgent.indexOf('Windows NT') != -1),
	isUNIX : (window.navigator.appVersion.indexOf('X11') != -1) || (window.navigator.appVersion.indexOf('Linux') != -1) || (window.navigator.appVersion.indexOf('SunOS') != -1) || (window.navigator.appVersion.indexOf('IRIX') != -1) || (window.navigator.appVersion.indexOf('HP-UX') != -1),
	isMac : (window.navigator.appVersion.indexOf('Mac') != -1),
	isMacIE : (document.all && window.navigator.appVersion.indexOf('Mac') != -1),
	isLowSpec : (window.navigator.userAgent.indexOf('Windows 95') != -1) || (window.navigator.userAgent.indexOf('Windows 98') != -1) || (window.navigator.appVersion.indexOf('Mac') != -1),
	Flash : {

		isIE  : (navigator.appVersion.indexOf("MSIE") != -1) ? true : false,
		isWin : (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false,
		isOpera : (navigator.userAgent.indexOf("Opera") != -1) ? true : false,


		ControlVersion : function ()
		{
			var version;
			var axo;
			var e;

			// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

			try {
				// version will be set for 7.X or greater players
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
				version = axo.GetVariable("$version");
			} catch (e) {
			}

			if (!version)
			{
				try {
					// version will be set for 6.X players only
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					
					// installed player is some revision of 6.0
					// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
					// so we have to be careful. 
					
					// default to the first public version
					version = "WIN 6,0,21,0";

					// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
					axo.AllowScriptAccess = "always";

					// safe to call for 6.0r47 or greater
					version = axo.GetVariable("$version");

				} catch (e) {
				}
			}

			if (!version)
			{
				try {
					// version will be set for 4.X or 5.X player
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
					version = axo.GetVariable("$version");
				} catch (e) {
				}
			}

			if (!version)
			{
				try {
					// version will be set for 3.X player
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
					version = "WIN 3,0,18,0";
				} catch (e) {
				}
			}

			if (!version)
			{
				try {
					// version will be set for 2.X player
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
					version = "WIN 2,0,0,11";
				} catch (e) {
					version = -1;
				}
			}
			
			return version;
		},
		GetSwfVer : function (){
			// NS/Opera version >= 3 check for Flash plugin in plugin array
			var flashVer = -1;
			
			if (navigator.plugins != null && navigator.plugins.length > 0) {
				if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
					var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
					var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
					var descArray = flashDescription.split(" ");
					var tempArrayMajor = descArray[2].split(".");			
					var versionMajor = tempArrayMajor[0];
					var versionMinor = tempArrayMajor[1];
					var versionRevision = descArray[3];
					if (versionRevision == "") {
						versionRevision = descArray[4];
					}
					if (versionRevision[0] == "d") {
						versionRevision = versionRevision.substring(1);
					} else if (versionRevision[0] == "r") {
						versionRevision = versionRevision.substring(1);
						if (versionRevision.indexOf("d") > 0) {
							versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
						}
					}
					var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
				}
			}
			// MSN/WebTV 2.6 supports Flash 4
			else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
			// WebTV 2.5 supports Flash 3
			else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
			// older WebTV supports Flash 2
			else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
			else if ( this.isIE && this.isWin && !this.isOpera ) {
				flashVer = this.ControlVersion();
			}	
			return flashVer;
		},

		DetectFlashVer : function (reqMajorVer, reqMinorVer, reqRevision)
		{
			var versionArray;
			var versionStr = this.GetSwfVer();
			if (versionStr == -1 ) {
				return false;
			} else if (versionStr != 0) {
				if(this.isIE && this.isWin && !this.isOpera) {
					// Given "WIN 2,0,0,11"
					tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
					tempString        = tempArray[1];			// "2,0,0,11"
					versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
				} else {
					versionArray      = versionStr.split(".");
				}
				var versionMajor      = versionArray[0];
				var versionMinor      = versionArray[1];
				var versionRevision   = versionArray[2];
		        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
				if (versionMajor > parseFloat(reqMajorVer)) {
					return true;
				} else if (versionMajor == parseFloat(reqMajorVer)) {
					if (versionMinor > parseFloat(reqMinorVer))
						return true;
					else if (versionMinor == parseFloat(reqMinorVer)) {
						if (versionRevision >= parseFloat(reqRevision))
							return true;
					}
				}
				return false;
			}
		},

		hasVersion : function(requiredVersion) {
			var requiredVersion = parseInt(requiredVersion);

			return this.DetectFlashVer(requiredVersion, 0, 0);


			return (version >= requiredVersion);
			return null;
		},
		redirect : function(requiredVersion, noFlashPage) {
			if(document.referrer.indexOf(noFlashPage) != -1) return;
			if(!this.hasVersion(requiredVersion)) window.location.href = noFlashPage;
		},
		write : function(id, file, version, width, height, align, hspace, vspace, showMenu, wmode, varsObj, urlOnly, style) {
			if(!this.hasVersion(version)) {
				document.write('<a href="http://www.macromedia.com/jp/shockwave/download/?P1_Prod_Version=ShockwaveFlash&Lang=Japanese">このコンテンツを表示するには、Macromedia Flash Player バージョン8以上がインストールされている必要があります。</a>');
			} else {
				var http = (location.protocol.indexOf('https') == -1) ? "http" : "https";
				var fvars = '';
				var vars = '';
				if(varsObj) {
					for(var i in varsObj) fvars += i+'='+varsObj[i]+'&';
					vars = '?'+fvars;
				}
				var swf = '<object';
				swf += ' id="'+id+'"';
				swf += ' width="'+width+'"';
				swf += ' height="'+height+'"';
				if(align) swf += ' align="'+align+'"';
				if(hspace) swf += ' hspace="'+hspace+'"';
				if(vspace) swf += ' vspace="'+vspace+'"';
				swf += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
				swf += ' style="' + style + '"';
				swf += ' codebase="'+http+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+',0,0,0">';
				swf += '<param name="movie" value="'+file+vars+'" />';
				if(varsObj && !urlOnly) swf += '<param name="FlashVars" value="'+fvars+'" />';
				if(wmode) swf += '<param name="wmode" value="'+wmode+'" />';
				if(!showMenu) swf += '<param name="menu" value="false" />';
				swf += '<param name="allowScriptAccess" value="always" />';
				swf += '<param name="salign" value="lt" />';

				swf += '<embed src="'+file+vars+'"';
				swf += ' id="'+id+'"';
				swf += ' name="'+id+'"';
				swf += ' width="'+width+'"';
				swf += ' height="'+height+'"';
				if(varsObj && !urlOnly) swf += ' FlashVars="'+fvars+'"';
				if(wmode) swf += ' wmode="'+wmode+'"';
				if(!showMenu) swf += ' menu="false"';
				swf += ' swLiveConnect=true';
				swf += ' allowScriptAccess="always"';
				swf += ' type="application/x-shockwave-flash"';
				swf += ' pluginspage="'+http+'://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
				swf += '<\/embed>';
				swf += '<\/object>';

				document.write(swf);
			}
		}
	},
	WMP : {
		write : function(wmpID, wmpTop, wmpLeft, wmpWidth, wmpHeight, wmpUiMode, wmpStyle){
			var WMPlayer = '<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="position:absolute; top:' + wmpTop + '; left:' + wmpLeft + ';"'
				+ 'id="' + wmpID + '"'
				+ 'height="' + wmpHeight + '"'
				+ 'width="' + wmpWidth + '"'
				+ 'style="' + wmpStyle + '"'
				+ 'align="center">'
				+ '<param name="AutoSize" value="false" />'
				+ '<param name="displaySize" value="2" />'
				+ '<param name="uiMode" value="' + wmpUiMode + '" />'
				+ '<param name="EnableContextMenu" value="false" />'
				+ '<EMBED type="type=video/x-ms-asf-plugin"'
				+ 'height="' + wmpHeight + '"'
				+ 'width="' + wmpWidth + '"'
				+ 'AutoSize="true" displaySize="2"></EMBED>'
				+ '</object>';
			document.write(WMPlayer);
		}
	}
};

var pageQuery = {
	vars : {},
	getValues : function() {
		if(location.search.length > 0) {
			var pairs = location.search.substring(1).split('&');
			for(var i = 0; i < pairs.length; i++) {
				pairs[i] = pairs[i].split('=');
				this.vars[pairs[i][0]] = unescape(pairs[i][1]);
			}
		}
	}
};
pageQuery.getValues();

var pageCookie = {
	vars : {},
	set : function(name, value, days) {
		var days = (days) ? days : 365 ;
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = '; expires='+date.toGMTString();
		var host   = location.hostname.split('.')[0];
		var domain = cookieDomain;
		document.cookie = name+'='+escape(value)+'; '+expires+'; domain='+escape(domain)+'; path=/';
	},
	get : function(name) {
		name += '=';
		var pairs = document.cookie.split('; ');
		for(var i=0; i<pairs.length; i++){
			var ck = pairs[i];
			if(ck.indexOf(name) == 0){
				return unescape(ck.substring(name.length, ck.length));
			}
		}
		return null;
	},
	getAll : function() {
		var pairs = document.cookie.split('; ');
		for(var i=0; i<pairs.length; i++) {
			pairs[i] = pairs[i].split('=');
			this.vars[pairs[i][0]] = unescape(pairs[i][1]);
		}
	},
	erase : function(name) {
		this.set(name, '', -1);
	},
	enabled : function() {
		this.set('cookieCheck', 'ok');
		return this.get('cookieCheck') != null;
	},
	input : function(tgt) {
		for(i=0; i<tgt.elements.length; i++) {
			if (this.vars[tgt.elements[i].name]) {
				tgt.elements[i].value = this.vars[tgt.elements[i].name];
			}
		}
	}
};
pageCookie.getAll();

var pageReference = {
	scrollLoop : false, scrollInterval : null,
	scrollPaneName : '', scrollTargetName : '', pageTopName : '',
	scrollValueContainerLeft : '', scrollValueContainerTop : '', scrollValueContainerFocus : '',
	scrollTo : function(id) {
		if(!clientEnvironment.isW3C) { location.href = '#'+targetID; return; }
		if(this.scrollLoop) { clearInterval(this.scrollInterval); this.scrollLoop = false; this.scrollInterval = null; }
		this.scrollPane = this.scrollPaneName ? document.getElementById(this.scrollPaneName) : document.getElementsByTagName('body')[0];
		var scrollPaneHeight = this.scrollPane.offsetHeight;
		var doc = document.getElementById(this.scrollTargetName);
		var documentHeight = snippets.getElementYpos(document.getElementById(this.scrollPaneName))+doc.offsetHeight;
		var ypos = snippets.getElementYpos(document.getElementById(id));
		if(ypos > documentHeight-scrollPaneHeight) ypos = documentHeight-scrollPaneHeight;
		this.scroll(0, ypos);
	},
	scroll : function(x, y) {
		if(this.scrollLoop) {
			var left = snippets.getScrollLeft(this.scrollPaneName);
			var top = snippets.getScrollTop(this.scrollPaneName);
			if(Math.abs(left-x) <= 1 && Math.abs(top-y) <= 1) {
				this.scrollPane.scrollLeft = x;
				this.scrollPane.scrollTop = y;
				clearInterval(this.scrollInterval); this.scrollLoop = false; this.scrollInterval = null;
			} else {
				this.scrollPane.scrollLeft = left+(x-left)/2;
				this.scrollPane.scrollTop = top+(y-top)/2;
			}
		} else {
			this.scrollInterval = setInterval('pageReference.scroll('+x+','+y+')', 10);
			this.scrollLoop = true;
		}
	},
	top : function() {
		this.scrollPane = this.scrollPane ? this.scrollPane : this.scrollPaneName ? document.getElementById(this.scrollPaneName) : document.getElementsByTagName('body')[0];
		if(snippets.getScrollTop(this.scrollPaneName) == 0) {
			location.href = '#'+this.pageTopName;
			return;
		}
		this.scroll(0, 0);
	},
	remindScroll : function(form) {
		if(clientEnvironment.isW3C) {
			this.scrollPane     = this.scrollPaneName ? document.getElementById(this.scrollPaneName) : document.getElementsByTagName('body')[0];
			this.targetForm     = form ? document.getElementById(form) : undefined;
			this.leftContainer  = this.scrollValueContainerLeft  ? document.getElementById(this.scrollValueContainerLeft)  : undefined;
			this.topContainer   = this.scrollValueContainerTop   ? document.getElementById(this.scrollValueContainerTop)   : undefined;
			this.focusContainer = this.scrollValueContainerFocus ? document.getElementById(this.scrollValueContainerFocus) : undefined;
			this.leftValue      = this.leftContainer  ? this.leftContainer.value  : pageQuery.vars['scrollLeft'] ? pageQuery.vars['scrollLeft'] : 0;
			this.topValue       = this.topContainer   ? this.topContainer.value   : pageQuery.vars['scrollTop']  ? pageQuery.vars['scrollTop']  : 0;
			this.focusedElement = this.focusContainer ? this.focusContainer.value : pageQuery.vars['focus']      ? pageQuery.vars['focus'] : undefined;
			this.focusedElement = this.focusedElement == 'undefined' ? undefined : this.focusedElement;
			snippets.attachEventMethods(this.scrollPane, 'onscroll', 'pageReference.setLeftValue(pageReference.scrollPane.scrollLeft); pageReference.setTopValue(pageReference.scrollPane.scrollTop);');
			preLoadFuncs.entry.push('pageReference.preLoadFunc');
		}
	},
	prepScrollQuery : function(tgt, attr, evt) {
		snippets.attachEventMethods(tgt, evt, 'location.href = snippets.attachGetQuery(this.'+attr+', { scrollLeft: pageReference.leftValue, scrollTop: pageReference.topValue, focus: pageReference.focusedElement }); return false;');
	},
	setLeftValue : function(val) {
		this.leftValue = val;
		if(this.leftContainer) this.leftContainer.value = val;
	},
	setTopValue : function(val) {
		this.topValue = val;
		if(this.topContainer) this.topContainer.value = val;
	},
	setFocusValue : function(val) {
		this.focusedElement = val;
		if(this.focusContainer) this.focusContainer.value = val;
	},
	setScroll : function() {
		this.scrollPane.scrollLeft = this.leftValue;
		this.scrollPane.scrollTop = this.topValue;
	},
	setOnFocusFunc : function() {
		if(this.targetForm) {
			for(i=0; i<this.targetForm.elements.length; i++) {
				snippets.attachEventMethods(this.targetForm.elements[i], 'onfocus', 'pageReference.setFocusValue(this.id.toString());');
			}
		}
	},
	preLoadFunc : function() {
		this.setScroll();
		this.setOnFocusFunc();
		if(this.focusedElement && clientEnvironment.isIE) {
			document.getElementById(this.focusedElement).focus();
		}
	}
};

var pageScrollPane = function(id, speed, upObj, downObj, contentMaskObj, contentObj) {
	this.id = id;
	this.speed = speed;
	this.upObj = snippets.getElement(upObj);
	this.downObj = snippets.getElement(downObj);
	this.contentMaskObj = snippets.getElement(contentMaskObj);
	this.contentObj = snippets.getElement(contentObj, contentMaskObj);
	this.obj = contentObj+'Object';
	eval(this.obj+'=this');
	this.contentMaskHeight = this.contentMaskObj.getClipHeight();
	this.contentHeight = this.contentObj.getHeight();
	this.contentLength = this.contentHeight-this.contentMaskHeight;
	this.scrollLength = this.trackLength/this.contentLength;
	this.scrollTimer = null;
	if(clientEnvironment.isIE) {
		this.contentObj.css.position = 'absolute';
	}
	if(this.contentHeight <= this.contentMaskHeight){
	} else {
		snippets.attachEventMethods(this.upObj, 'onmousedown', this.id+'.scroll('+this.speed+'); return false;');
		snippets.attachEventMethods(this.upObj, 'onmouseup', this.id+'.stopScroll();');
		snippets.attachEventMethods(this.upObj, 'onmouseout', this.id+'.stopScroll();');
		snippets.attachEventMethods(this.downObj, 'onmousedown', this.id+'.scroll('+-this.speed+'); return false;');
		snippets.attachEventMethods(this.downObj, 'onmouseup', this.id+'.stopScroll();');
		snippets.attachEventMethods(this.downObj, 'onmouseout', this.id+'.stopScroll();');
	}
}
pageScrollPane.prototype.scroll = function(speed){
	var contentMovement = this.contentObj.getTop()+speed;
	if(contentMovement > 0) {
		contentMovement = 0;
	} else if(contentMovement < -this.contentLength) {
		contentMovement = -this.contentLength;
	}
	this.contentObj.setTop(contentMovement);
	this.scrollTimer = window.setTimeout(this.obj+'.scroll('+speed+')', 25);
}
pageScrollPane.prototype.stopScroll = function() {
	if(this.scrollTimer) {
		window.clearTimeout(this.scrollTimer);
		this.scrollTimer = null;
	}
}

var imageButtonFader = {
	prefix : 'dxBtn',
	imgEntry : {},
	mOverEntry : {},
	mOutEntry : {},
	transform : 'filter: progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=.6,wipestyle=1,motion=reverse,duration=.3);',
	prepImages : function() {
		if(clientEnvironment.isW3C) {
			var inputimgs = document.getElementsByTagName('input');
			for(var i=0; i<inputimgs.length; i++) {
				if(inputimgs[i].type == 'image' && inputimgs[i].id.indexOf(imageButtonFader.prefix) != -1) {
					var tgt = inputimgs[i];
					var fmt = tgt.src.substring(tgt.src.lastIndexOf('.'));
					tgt.style.filter = (clientEnvironment.isIE && this.transform) ? this.transform : '' ;
					this.mOverEntry[tgt.name+'_Over'] = new Image();
					this.mOverEntry[tgt.name+'_Over'].src = tgt.src.substring(0, tgt.src.lastIndexOf('.')-1)+'2'+fmt;
					this.mOutEntry[tgt.name+'_Out'] = new Image();
					this.mOutEntry[tgt.name+'_Out'].src = tgt.src.substring(0, tgt.src.lastIndexOf('.')-1)+'1'+fmt;
					this.imgEntry[tgt.name] = new fadeHandler();
					snippets.attachEventMethods(tgt, 'onmouseover', 'imageButtonFader.imgEntry[this.name].mOver(this);');
					snippets.attachEventMethods(tgt, 'onmouseout', 'imageButtonFader.imgEntry[this.name].mOut(this);');
					snippets.attachEventMethods(tgt, 'onfocus', 'this.blur();');
				} else if(inputimgs[i].type == 'image') {
					var tgt = inputimgs[i];
					snippets.attachEventMethods(tgt, 'onfocus', 'this.blur();');
				}
			}
			var imgs = document.getElementsByTagName('img');
			for(var i=0; i<imgs.length; i++) {
				if(imgs[i].id.indexOf(imageButtonFader.prefix) != -1) {
					var tgt = imgs[i];
					var fmt = tgt.src.substring(tgt.src.lastIndexOf('.'));
					tgt.style.filter = (clientEnvironment.isIE && this.transform) ? this.transform : '' ;
					this.mOverEntry[tgt.id+'_Over'] = new Image();
					this.mOverEntry[tgt.id+'_Over'].src = tgt.src.substring(0, tgt.src.lastIndexOf('.')-1)+'2'+fmt;
					this.mOutEntry[tgt.id+'_Out'] = new Image();
					this.mOutEntry[tgt.id+'_Out'].src = tgt.src.substring(0, tgt.src.lastIndexOf('.')-1)+'1'+fmt;
					this.imgEntry[tgt.id] = new fadeHandler();
					snippets.attachEventMethods(tgt, 'onmouseover', 'imageButtonFader.imgEntry["'+tgt.id+'"].mOver(this);');
					snippets.attachEventMethods(tgt, 'onmouseout', 'imageButtonFader.imgEntry["'+tgt.id+'"].mOut(this);');
				}
			}
			if(clientEnvironment.isIE) {
				var all = document.all;
				for(var i=0; i<all.length; i++) {
					if(all[i].id.indexOf(imageButtonFader.prefix) != -1) {
						var tgt = all[i];
						tgt.style.filter = (clientEnvironment.isIE && this.transform) ? this.transform : '' ;
						this.imgEntry[tgt.id] = new fadeHandler();
						snippets.attachEventMethods(tgt, 'onmouseover', 'imageButtonFader.imgEntry["'+tgt.id+'"].mOver(this);');
						snippets.attachEventMethods(tgt, 'onmouseout', 'imageButtonFader.imgEntry["'+tgt.id+'"].mOut(this);');
					}
				}
			}
		}
	}
}

var fadeHandler = function() { };
fadeHandler.prototype.mOver = function(tgt) {
	if(clientEnvironment.isW3C) {
		tgt.style.cursor = 'pointer';
 		if(clientEnvironment.isIE && imageButtonFader.transform && tgt.id.indexOf(imageButtonFader.prefix) != -1) {
			tgt.filters[0].apply();
			if(tgt.src) tgt.src = imageButtonFader.mOverEntry[tgt.id+'_Over'].src;
			tgt.filters[0].play();
		} else {
			if(tgt.src) tgt.src = imageButtonFader.mOverEntry[tgt.id+'_Over'].src;
		}
	}
}
fadeHandler.prototype.mOut = function(tgt) {
	if(clientEnvironment.isW3C) {
		tgt.style.cursor = 'default';
		if(clientEnvironment.isIE && imageButtonFader.transform && tgt.id.indexOf(imageButtonFader.prefix) != -1) {
			tgt.filters[0].apply();
			if(tgt.src) tgt.src = imageButtonFader.mOutEntry[tgt.id+'_Out'].src;
			tgt.filters[0].play();
		} else {
			if(tgt.src) tgt.src = imageButtonFader.mOutEntry[tgt.id+'_Out'].src;
		}
	}
}

var imageWiper = {
	imgs : {}, imgcnt : 4, timer : 6, current : 1, tgtimg: document.getElementById('wipeImage'),
	transform : 'filter: progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=.4,WipeStyle=0,Motion=Forward,Duration=4);',
	loadCheck : function(next) {
		if(this.imgs['wipeImage'+next].loaded) {
			setTimeout('imageWiper.wipeImg()', imageWiper.timer*1000);
		} else {
			setTimeout('imageWiper.loadCheck('+(imageWiper.current+1)+')', 100);
		}
	},
	prepImg : function(next) {
		tgtimg.style.filter = (clientEnvironment.isIE && this.transform) ? this.transform : '' ;
		var fmt = tgtimg.src.substring(tgtimg.src.lastIndexOf('.'));

		for(var i=1; i<=this.imgcnt; i++) {
			this.imgs['wipeImage'+i] = new Image();
			this.imgs['wipeImage'+i].onload = function() {
				this.loaded = true;
			}
			this.imgs['wipeImage'+i].src = tgtimg.src.substring(0, tgtimg.src.lastIndexOf('.')-1)+i+fmt;
		}
		setTimeout('imageWiper.loadCheck('+(imageWiper.current+1)+')', 100);
	},
	wipeImg : function() {
		var next = (this.current == this.imgcnt) ? 1 : this.current+1 ;
		if(clientEnvironment.isIE && this.transform) {
			tgtimg.filters[0].apply();
			tgtimg.src = this.imgs['wipeImage'+next].src;
			tgtimg.filters[0].play();
		} else {
			tgtimg.src = this.imgs['wipeImage'+next].src;
		}
		this.current = next;
		next = (this.current == this.imgcnt) ? 1 : this.current+1 ;
		setTimeout('imageWiper.loadCheck('+next+')', 100);
	}
};

var tooltip = {
	delay       : 400,
	offsetX     : 20,
	offsetY     : 0,
	container   : undefined,
	singleField : undefined,
	transform   : 'progid:DXImageTransform.Microsoft.Fade(Duration=0.3,Overlap=1)',
	shadow      : 'progid:DXImageTransform.Microsoft.Shadow(Color=#ababac,Direction=135,Strength=3)',
	template    : ''
};
tooltip.init = function(template, singleField) {
	if(!document.getElementById) return;

	this.template    = template;
	this.singleField = singleField;

	var c = this.container = document.createElement('div');
	c.style.position = 'absolute';
	c.style.display  = 'none';
	c.style.left     = 0;
	c.style.top      = 0;
	c.style.zIndex   = 99999;
	if(clientEnvironment.isIE) {
		c.style.filter  = this.transform;
		c.style.filter += this.shadow;
	}
	document.getElementsByTagName('body')[0].appendChild(c);

	var a;
	var anchors = document.getElementsByTagName('a');
	for(var i=0; i<anchors.length; i++) {
		a = anchors[i];
		if(a.tooltip) {
			snippets.attachEventMethods(a, 'onmouseover', 'tooltip.show(this.tooltip)');
			snippets.attachEventMethods(a, 'onmouseout',  'tooltip.hide()');
		}
	}
};
tooltip.setPosition = function(evt) {
	var x=0, y=0;
	if(clientEnvironment.isIE) {
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop)  ? document.documentElement.scrollTop  : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
	} else {
		x = evt.pageX;
		y = evt.pageY;
	}
	this.container.style.left = (x+this.offsetX)+'px';
	this.container.style.top  = (y+this.offsetY)+'px';
};
tooltip._show = function() {
	if(clientEnvironment.isIE) this.container.filters[0].apply();
	this.container.style.visibility = 'visible';
	this.container.style.display    = 'block';
	if(clientEnvironment.isIE) this.container.filters[0].play();
};
tooltip.show = function(contents) {
	if(!this.container) return;

	this.setPosition();
	var tmp = this.template.toString();
	if(typeof(contents) == 'object') {
		for(var i in contents) {
			tmp = tmp.split('{'+i+'}').join(contents[i]);
		}
	} else {
		tmp = tmp.split('{'+this.singleField+'}').join(contents);
	}
	tmp = snippets.htmlEntitiesDecode(tmp);
	this.container.innerHTML = tmp;
	setTimeout('tooltip._show()', this.delay);
};
tooltip.hide = function() {
	if(!this.container) return;

	if(clientEnvironment.isIE) this.container.filters[0].apply();
	this.container.innerHTML        = '';
	this.container.style.visibility = 'hidden';
	this.container.style.display    = 'none';
	if(clientEnvironment.isIE) this.container.filters[0].play();
};

var accordion = {
	target      : undefined,
	trigger     : undefined,
	className1  : undefined,
	className2  : undefined,
	slideTimer  : undefined,
	destHeight  : undefined,
	doAccordion : function(target, trigger, className1, className2) {
		if(target)     this.target         = target;
		if(trigger)    this.trigger        = trigger;
		if(className1) this.className1     = className1;
		if(className2) this.className2     = className2;
		var oH = this.target.offsetHeight;
		var cH = this.target.firstChild.offsetHeight;
		this.destHeight = this.destHeight == undefined ? oH == 1 ? cH : 1 : this.destHeight;
		if(Math.abs(this.destHeight-oH) <= 1) {
			this.target.style.height = this.destHeight;
			if(this.destHeight == 1) {
				this.trigger.className = this.className1;
			} else {
				this.trigger.className = this.className2;
			}
			clearTimeout(this.slideTimer);
			this.slideInterval = undefined;
			this.destHeight = undefined;
		} else {
			this.target.style.height = oH+(this.destHeight-oH)/2;
			this.slideTimer = setTimeout('accordion.doAccordion(accordion.target)', 10);
		}
	}
};

var windowLauncher = {
	openWin : function(url, name, width, height, xpos, ypos, chrome, scroll) {
		var x, y, w, h, moveX = 0, moveY = 0, features = '';
		var chrome = chrome ? 'yes' : 'no';
		var scroll = scroll ? 'yes' : 'no';
		features += 'toolbar='+chrome+',location='+chrome+',status=Yes,menubar='+chrome+',directories='+chrome;
		features += ',scrollbars='+scroll+',resizable='+scroll;
		if(width) features += ',width='+width;
		if(height) features += ',height='+height;
		if(xpos && window.screen) {
			w = window.screen.availWidth;
			width = parseInt(width);
			switch(xpos) {
				case 'left' : x = 0; break;
				case 'center' : x = (w-width)/2; break;
				case 'right' : x = w-width; break;
				default : x = xpos;
			}
			features += ',screenX='+x+',left='+x;
			var moveX = x;
		}
		if(ypos && window.screen) {
			h = window.screen.availHeight;
			height = parseInt(height);
			switch(ypos) {
				case 'top' : y = 0; break;
				case 'middle' : y = (h-height)/2; break;
				case 'bottom' : y = h-height; break;
				default : y = ypos;
			}
			features += ',screenY='+y+',top='+y;
			var moveY = y;
		}
		openWinReference = window.open(url, name, features);
		openWinReference.focus();
		if(moveX || moveY) {
			openWinReference.moveTo(moveX, moveY);
		}
	},
	openScroll : function(url, name, width, height) {
		this.openWin(url, name, width, height, false, false, false, 'scroll');
	},
	openCenter : function(url, name, width, height) {
		this.openWin(url, name, width, height, 'center', 'middle');
	},
	openCenterScroll : function(url, name, width, height) {
		this.openWin(url, name, width, height, 'center', 'middle', false, 'scroll');
	},
	openFull : function(url, name) {
		this.openWin(url, name, false, false, false, false, 'chrome', 'scroll');
	}
};

var preLoadFuncs = {
	entry : ['readQuery', 'fixMacIEOverflow'],
	readQuery : function() {
		for(i in pageQuery.vars) {
			if(pageQuery.vars['addPreLoadFuncs']) {
				var pairs = pageQuery.vars['addPreLoadFuncs'].split(';');
				for(var i=0; i< pairs.length; i++) {
					eval(pairs[i]);
				}
			}
		}
	},
	fixMacIEOverflow : function() {
		if(!clientEnvironment.isW3C) {
			if(clientEnvironment.isMacIE && clientEnvironment.isW3C){
				if(document.body.clientHeight > 500){
					document.getElementsByTagName('body')[0].style.overflow = 'hidden';
				}
			}
		}
	},
	launch : function() {
		for(i in preLoadFuncs.entry) {
			var prefix = (preLoadFuncs.entry[i].indexOf('.') != -1) ? '' : 'preLoadFuncs.' ;
			var postfix = (preLoadFuncs.entry[i].indexOf('(') != -1) ? '' : '()' ;
			eval(prefix+preLoadFuncs.entry[i]+postfix+';');
		}
	}
};

var onLoadFuncs = {
	entry : ['readQuery'],
	readQuery : function() {
		for(i in pageQuery.vars) {
			if(pageQuery.vars['addOnLoadFuncs']) {
				var pairs = pageQuery.vars['addOnLoadFuncs'].split(';');
				for(var i=0; i<pairs.length; i++) {
					eval(pairs[i]);
				}
			}
		}
	},
	launch : function() {
		for(i in onLoadFuncs.entry) {
			var prefix = (onLoadFuncs.entry[i].indexOf('.') != -1) ? '' : 'onLoadFuncs.' ;
			var postfix = (onLoadFuncs.entry[i].indexOf('(') != -1) ? '' : '()' ;
			eval(prefix+onLoadFuncs.entry[i]+postfix+';');
		}
	}
};
window.onload = onLoadFuncs.launch;

var onResizeFuncs = {
	entry : ['readQuery'],
	readQuery : function() {
		for(i in pageQuery.vars) {
			if(pageQuery.vars['addOnResizeFuncs']) {
				var pairs = pageQuery.vars['addOnResizeFuncs'].split(';');
				for(var i=0; i<pairs.length; i++) {
					eval(pairs[i]);
				}
			}
		}
	},
	launch : function() {
		for(i in onResizeFuncs.entry) {
			if(typeof(onResizeFuncs.entry[i]) == 'function'){continue;}
			var prefix = (onResizeFuncs.entry[i].indexOf('.') != -1) ? '' : 'onResizeFuncs.' ;
			var postfix = (onResizeFuncs.entry[i].indexOf('(') != -1) ? '' : '()' ;
			eval(prefix+onResizeFuncs.entry[i]+postfix+';');
		}
	}
};
window.onresize = onResizeFuncs.launch;

var onUnLoadFuncs = {
	entry : ['readQuery'],
	readQuery : function() {
		for(i in pageQuery.vars) {
			if(pageQuery.vars['addOnUnLoadFuncs']) {
				var pairs = pageQuery.vars['addUnLoadFuncs'].split(';');
				for(var i=0; i<pairs.length; i++) {
					eval(pairs[i]);
				}
			}
		}
	},
	launch : function() {
		for(i in onUnLoadFuncs.entry) {
			if(typeof(onUnLoadFuncs.entry[i]) == 'function'){continue;}
			var prefix = (onUnLoadFuncs.entry[i].indexOf('.') != -1) ? '' : 'onUnLoadFuncs.' ;
			var postfix = (onUnLoadFuncs.entry[i].indexOf('(') != -1) ? '' : '()' ;
			eval(prefix+onUnLoadFuncs.entry[i]+postfix+';');
		}
	}
};
window.onunload = onUnLoadFuncs.launch;





	if(self.Node&&self.Node.prototype){
		Element.prototype.insertAdjacentHTML=insertAdj_HTML;
		Element.prototype.insert__Adj=insert__Adj;
	}
	function insertAdj_HTML(a1,a2){
		var r=document.createRange();
		r.selectNode(this);
		var t=r.createContextualFragment(a2);
		this.insert__Adj(a1,t);
	}
	function insert__Adj(a1,a2){
		var p=this.parentNode;
		var s=a1.toLowerCase();
		if(s=="beforebegin"){p.insertBefore(a2,this)}
		if(s=="afterend"){p.insertBefore(a2,this.nextSibling)}
		if(s=="afterbegin"){this.insertBefore(a2,this.childNodes[0])}
		if(s=="beforeend"){this.appendChild(a2)}
	}