 
 
 
 



/*
sessvars ver 1.01
- JavaScript based session object
copyright 2008 Thomas Frank

This EULA grants you the following rights:

Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT.

Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT either in whole or in part; each copy should include all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may be distributed as a standalone product or included with your own product.

Commercial Use. You may sell for profit and freely distribute scripts and/or compiled scripts that were created with the SOFTWARE PRODUCT.

v 1.0 --> 1.01
sanitizer added to toObject-method & includeFunctions flag now defaults to false

*/

sessvars=function(){

	var x={};
	
	x.$={
		prefs:{
			memLimit:2000,
			autoFlush:true,
			crossDomain:false,
			includeProtos:false,
			includeFunctions:false
		},
		parent:x,
		clearMem:function(){
			for(var i in this.parent){if(i!="$"){this.parent[i]=undefined}};
			this.flush();
		},
		usedMem:function(){
			x={};
			return Math.round(this.flush(x)/1024);
		},
		usedMemPercent:function(){
			return Math.round(this.usedMem()/this.prefs.memLimit);
		},
		flush:function(x){
			var y,o={},j=this.$$;
			x=x||top;
			for(var i in this.parent){o[i]=this.parent[i]};
			o.$=this.prefs;
			j.includeProtos=this.prefs.includeProtos;
			j.includeFunctions=this.prefs.includeFunctions;
			y=this.$$.make(o);
			if(x!=top){return y.length};
			if(y.length/1024>this.prefs.memLimit){return false}
			x.name=y;
			return true;
		},
		getDomain:function(){
				var l=location.href
				l=l.split("///").join("//");
				l=l.substring(l.indexOf("://")+3).split("/")[0];
				while(l.split(".").length>2){l=l.substring(l.indexOf(".")+1)};
				return l
		},
		debug:function(t){
			var t=t||this,a=arguments.callee;
			if(!document.body){setTimeout(function(){a(t)},200);return};
			t.flush();
			var d=document.getElementById("sessvarsDebugDiv");
			if(!d){d=document.createElement("div");document.body.insertBefore(d,document.body.firstChild)};
			d.id="sessvarsDebugDiv";
			d.innerHTML='<div style="line-height:20px;padding:5px;font-size:11px;font-family:Verdana,Arial,Helvetica;'+
						'z-index:10000;background:#FFFFCC;border: 1px solid #333;margin-bottom:12px">'+
						'<b style="font-family:Trebuchet MS;font-size:20px">sessvars.js - debug info:</b><br/><br/>'+
						'Memory usage: '+t.usedMem()+' Kb ('+t.usedMemPercent()+'%)&nbsp;&nbsp;&nbsp;'+
						'<span style="cursor:pointer"><b>[Clear memory]</b></span><br/>'+
						top.name.split('\n').join('<br/>')+'</div>';
			d.getElementsByTagName('span')[0].onclick=function(){t.clearMem();location.reload()}
		},
		init:function(){
			var o={}, t=this;
			try {o=this.$$.toObject(top.name)} catch(e){o={}};
			this.prefs=o.$||t.prefs;
			if(this.prefs.crossDomain || this.prefs.currentDomain==this.getDomain()){
				for(var i in o){this.parent[i]=o[i]};
			}
			else {
				this.prefs.currentDomain=this.getDomain();
			};
			this.parent.$=t;
			t.flush();
			var f=function(){if(t.prefs.autoFlush){t.flush()}};
			if(window["addEventListener"]){addEventListener("unload",f,false)}
			else if(window["attachEvent"]){window.attachEvent("onunload",f)}
			else {this.prefs.autoFlush=false};
		}
	};
	
	x.$.$$={
		compactOutput:false, 		
		includeProtos:false, 	
		includeFunctions: false,
		detectCirculars:true,
		restoreCirculars:true,
		make:function(arg,restore) {
			this.restore=restore;
			this.mem=[];this.pathMem=[];
			return this.toJsonStringArray(arg).join('');
		},
		toObject:function(x){
			if(!this.cleaner){
				try{this.cleaner=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}
				catch(a){this.cleaner=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/}
			};
			if(!this.cleaner.test(x)){return {}};
			eval("this.myObj="+x);
			if(!this.restoreCirculars || !alert){return this.myObj};
			if(this.includeFunctions){
				var x=this.myObj;
				for(var i in x){if(typeof x[i]=="string" && !x[i].indexOf("JSONincludedFunc:")){
					x[i]=x[i].substring(17);
					eval("x[i]="+x[i])
				}}
			};
			this.restoreCode=[];
			this.make(this.myObj,true);
			var r=this.restoreCode.join(";")+";";
			eval('r=r.replace(/\\W([0-9]{1,})(\\W)/g,"[$1]$2").replace(/\\.\\;/g,";")');
			eval(r);
			return this.myObj
		},
		toJsonStringArray:function(arg, out) {
			if(!out){this.path=[]};
			out = out || [];
			var u; // undefined
			switch (typeof arg) {
			case 'object':
				this.lastObj=arg;
				if(this.detectCirculars){
					var m=this.mem; var n=this.pathMem;
					for(var i=0;i<m.length;i++){
						if(arg===m[i]){
							out.push('"JSONcircRef:'+n[i]+'"');return out
						}
					};
					m.push(arg); n.push(this.path.join("."));
				};
				if (arg) {
					if (arg.constructor == Array) {
						out.push('[');
						for (var i = 0; i < arg.length; ++i) {
							this.path.push(i);
							if (i > 0)
								out.push(',\n');
							this.toJsonStringArray(arg[i], out);
							this.path.pop();
						}
						out.push(']');
						return out;
					} else if (typeof arg.toString != 'undefined') {
						out.push('{');
						var first = true;
						for (var i in arg) {
							if(!this.includeProtos && arg[i]===arg.constructor.prototype[i]){continue};
							this.path.push(i);
							var curr = out.length; 
							if (!first)
								out.push(this.compactOutput?',':',\n');
							this.toJsonStringArray(i, out);
							out.push(':');                    
							this.toJsonStringArray(arg[i], out);
							if (out[out.length - 1] == u)
								out.splice(curr, out.length - curr);
							else
								first = false;
							this.path.pop();
						}
						out.push('}');
						return out;
					}
					return out;
				}
				out.push('null');
				return out;
			case 'unknown':
			case 'undefined':
			case 'function':
				if(!this.includeFunctions){out.push(u);return out};
				arg="JSONincludedFunc:"+arg;
				out.push('"');
				var a=['\n','\\n','\r','\\r','"','\\"'];
				arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};
				out.push(arg);
				out.push('"');
				return out;
			case 'string':
				if(this.restore && arg.indexOf("JSONcircRef:")==0){
					this.restoreCode.push('this.myObj.'+this.path.join(".")+"="+arg.split("JSONcircRef:").join("this.myObj."));
				};
				out.push('"');
				var a=['\n','\\n','\r','\\r','"','\\"'];
				arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};
				out.push(arg);
				out.push('"');
				return out;
			default:
				out.push(String(arg));
				return out;
			}
		}
	};
	
	x.$.init();
	return x;
}()




// Copyright IBM Corp. 2002, 2007  All Rights Reserved.
var asynchContextMenuDebug=-1;var asynchContextMenuMouseOverIndicator="";var portletIdMap=new Object();function asynchContextMenuOnMouseClickHandler(uniqueID, isLTR, urlToMenuContents, menuBorderStyle, menuTableStyle, menuItemStyle, menuItemSelectedStyle, emptyMenuText, loadingImage)
{
var menuID="contextMenu_" + uniqueID;var menu=getContextMenu(menuID);if (menu == null)
{
asynchContextMenu_menuCurrentlyLoading=uniqueID;if (loadingImage)
{
setLoadingImage(loadingImage);}menu=createContextMenu(menuID, isLTR, null, menuBorderStyle, menuTableStyle, emptyMenuText);loadAsynchContextMenu(uniqueID, urlToMenuContents, isLTR, menuItemStyle, menuItemSelectedStyle, '', true);}else
{
if (asynchContextMenu_menuCurrentlyLoading == uniqueID)
{
return;}showContextMenu(menuID, document.getElementById(uniqueID));};};var asynchContextMenu_originalMenuImgElementSrc;function setLoadingImage(img)
{
asynchContextMenu_originalMenuImgElementSrc=document.getElementById(asynchContextMenu_menuCurrentlyLoading + "_img").src;document.getElementById(asynchContextMenu_menuCurrentlyLoading + "_img").src=img;};function clearLoadingImage()
{
document.getElementById(asynchContextMenu_menuCurrentlyLoading + "_img").src=asynchContextMenu_originalMenuImgElementSrc;};function loadAsynchContextMenu(uniqueID, url, isLTR, menuItemStyle, menuItemSelectedStyle, emptyMenuText, showMenu, onMenuAffordanceShowHandler)
{
asynchDebug('ENTRY loadAsynchContextMenu p1=' + uniqueID + '; p2=' + url + '; p3=' + isLTR + '; p4=' + isLTR);var menuID="contextMenu_" + uniqueID;var dialogTag=null;var ID=uniqueID + '_DIV';if (document.getElementById(ID) != null)
{
closeMenu(ID);return;}dialogTag=document.createElement("DIV");dialogTag.style.position="absolute";if (asynchContextMenuDebug < 2)
{
dialogTag.style.left="0px";dialogTag.style.top="-100px";dialogTag.style.visibility="hidden";}if (asynchContextMenuDebug >= 2 || asynchContextMenuDebug == 999)
{
dialogTag.style.left="100px";dialogTag.style.top="100px";dialogTag.style.visibility="visible";}dialogTag.id=ID;var styleString='null';if (menuItemStyle != null)
{
styleString="'" + menuItemStyle + "'";}if (menuItemSelectedStyle != null)
{
styleString=styleString + ", '" + menuItemSelectedStyle + "'";}else
{
styleString=styleString + ", null";}dialogTag.innerHTML='<iframe id="' + menuID + '" name="' + ID + '_IFRAME" src="' + url + '" onload="buildAndDisplayMenu(this.id, this.name, ' + styleString + ', ' + showMenu + ' , \''+ onMenuAffordanceShowHandler + '\'); return false;" ></iframe>';document.body.appendChild(dialogTag);asynchDebug('EXIT createDynamicElements');};function buildAndDisplayMenu(menuID, iframeID, menuItemStyle, menuItemSelectedStyle, showMenu, onMenuAffordanceShowHandler)
{
asynchDebug('ENTRY buildAndDisplayMenu p1=' + menuID + '; p2=' + iframeID + '; p3=' + showMenu + '; p4=' + onMenuAffordanceShowHandler);var menu=getContextMenu(menuID);clearLoadingImage();asynchContextMenu_menuCurrentlyLoading=null;if (menu == null)
{
return false;}index=iframeID.indexOf("_IFRAME");var divID=iframeID.substring(0, index);index2=divID.indexOf("_DIV");var uniqueID=divID.substring(0, index2);asynchDebug('divID=' + divID);asynchDebug('uniqueID=' + uniqueID);var frame, c=-1, done=false;while ((c + 1) < window.frames.length && !done)
{
c=c+1;try
{
done=(window.frames[c].name == iframeID);}catch (e)
{
};};if (window.frames[c].getMenuContents)
{
contents=window.frames[c].getMenuContents();}else
{
return false;};for (i=0; i < contents.length; i=i+3)
{
asynchDebug2('Adding item: ' + contents[i+1]);asynchDebug2('URL: ' + contents[i]);if (contents[i])
{
asynchDebug2('url length: ' + contents[i].length);}asynchDebug2('icon: ' + contents[i+2]);if (contents[i] && contents[i].length != 0)
{
var icon=null;if (contents[i+2] && contents[i+2].length != 0)
{
icon=contents[i+2];}menu.add(new UilMenuItem(contents[i+1], true, '', contents[i], null, icon, null, menuItemStyle, menuItemSelectedStyle));}};var target=document.getElementById(uniqueID);asynchDebug('EXIT buildAndDisplayMenu');if (showMenu == null || showMenu == true)
{
return showContextMenu(menuID, target);}};function createDynamicElements(uniqueID, url, menuID, menuItemStyle, menuItemSelectedStyle)
{
asynchDebug('ENTRY createDynamicElements p1=' + uniqueID + '; p2=' + url + '; p3=' + menuID);var dialogTag=null;var ID=uniqueID + '_DIV';if (document.getElementById(ID) != null)
{
closeMenu(ID);return;}dialogTag=document.createElement("DIV");dialogTag.style.position="absolute";if (asynchContextMenuDebug < 2)
{
dialogTag.style.left="0px";dialogTag.style.top="-100px";dialogTag.style.visibility="hidden";}if (asynchContextMenuDebug >= 2 || asynchContextMenuDebug == 999)
{
dialogTag.style.left="100px";dialogTag.style.top="100px";dialogTag.style.visibility="visible";}dialogTag.id=ID;var styleString='null, null';if (menuItemStyle != null)
{
styleString="'" + menuItemStyle + "'";}if (menuItemSelectedStyle != null)
{
styleString=styleString + ", '" + menuItemSelectedStyle + "'";}else
{
styleString=styleString + ", null";}dialogTag.innerHTML='<iframe id="' + menuID + '" name="' + ID + '_IFRAME" src="' + url + '" onload="buildAndDisplayMenu(this.id, this.name, ' + styleString + '); return false;" ></iframe>';document.body.appendChild(dialogTag);asynchDebug('EXIT createDynamicElements');};function asynchDebug(str)
{
if (asynchContextMenuDebug >= 1 && asynchContextMenuDebug != 999)
{
alert(str);}};function asynchDebug2(str)
{
if (asynchContextMenuDebug >= 0 && asynchContextMenuDebug != 999)
{
alert(str) ;}};function asynchDoFormSubmit(url){
var formElem=document.createElement("form");document.body.appendChild(formElem);formElem.setAttribute("method", "GET");var delimLocation=url.indexOf("?");if (delimLocation >= 0) {
var params=url.substring(delimLocation + 1, url.length);url=url.substring(0, delimLocation);var paramArray=params.split("&");for (var i=0; i < paramArray.length; i++) {
var name=paramArray[i].substring(0, paramArray[i].indexOf("="));var value=paramArray[i].substring(paramArray[i].indexOf("=") + 1, paramArray[i].length);var inputElem=document.createElement("input");inputElem.setAttribute("type", "hidden");inputElem.setAttribute("name", name);inputElem.setAttribute("value", value);formElem.appendChild(inputElem);};}formElem.setAttribute("action", url);formElem.submit();};var asynchContextMenu_menuCurrentlyLoading=null;function menuMouseOver(id, selectedImage)
{
if (asynchContextMenu_menuCurrentlyLoading != null)
return;portletIdMap[id]='menu_'+id+'_img';showAffordance(id, selectedImage);};function menuMouseOut(id, disabledImage)
{
if (asynchContextMenu_menuCurrentlyLoading != null)
return;hideAffordance(id , disabledImage);portletIdMap[id]="";};function showAffordance(id, selectedImage)
{
document.getElementById('menu_'+id).style.cursor='pointer';document.getElementById('menu_'+id+'_img').src=selectedImage;};function hideAffordance(id, disabledImage)
{
document.getElementById('menu_'+id).style.cursor='default';document.getElementById('menu_'+id+'_img').src=disabledImage;};function menuMouseOverThinSkin(id, selectedImage, minimized)
{
if (asynchContextMenu_menuCurrentlyLoading != null)
return;portletIdMap[id]='menu_'+id+'_img';showAffordanceThinSkin(id, selectedImage, minimized);};function menuMouseOutThinSkin(id, disabledImage, minimized)
{
if (asynchContextMenu_menuCurrentlyLoading != null)
return;hideAffordanceThinSkin(id , disabledImage, minimized);portletIdMap[id]="";};function showAffordanceThinSkin(id, selectedImage, minimized)
{
document.getElementById('menu_'+id).style.cursor='pointer';document.getElementById('portletTitleBar_'+id).className='wpsThinSkinContainerBar wpsThinSkinContainerBarBorder';document.getElementById('title_'+id).className='wpsThinSkinDragZoneContainer wpsThinSkinVisible';document.getElementById('menu_'+id+'_img').src=selectedImage;};function hideAffordanceThinSkin(id, disabledImage, minimized)
{
document.getElementById('menu_'+id).style.cursor='default';if (minimized == null || minimized == false){
document.getElementById('portletTitleBar_'+id).className='wpsThinSkinContainerBar';}document.getElementById('title_'+id).className='wpsThinSkinDragZoneContainer wpsThinSkinInvisible';document.getElementById('menu_'+id+'_img').src=disabledImage;};var onmousedownold_;function closeMenu(id, disabledImage)
{
hideCurrentContextMenu();if (portletIdMap[id] == "")
{
hideAffordance(id, disabledImage);}document.onmousedown=onmousedownold_;};function showPortletMenu(id, portletNoActionsText, isRTL, menuPortletURL, disabledImage, loadingImage)
{
if (portletIdMap[id].indexOf(id) < 0)
return;asynchContextMenuOnMouseClickHandler('menu_'+id,!isRTL,menuPortletURL, null, null, null, null, portletNoActionsText, loadingImage);onmousedownold_=document.onmousedown;document.onmousedown=closeMenu;};function accessibleShowMenu(event , id , portletNoActionsText, isRTL, menuPortletURL, loadingImage)
{
if (event.which == 13)
{
asynchContextMenuOnMouseClickHandler('menu_'+id,!isRTL,menuPortletURL, null, null, null, null, portletNoActionsText, loadingImage);}else
{
return true;};};
// Copyright IBM Corp. 2002, 2007  All Rights Reserved.
BrowserDimensions.prototype=new Object();BrowserDimensions.prototype.constructor=BrowserDimensions;BrowserDimensions.superclass=null;function BrowserDimensions(){
this.body=document.body;if (this.isStrictDoctype() && !this.isSafari()) {
this.body=document.documentElement;}};BrowserDimensions.prototype.getScrollFromLeft=function(){
return this.body.scrollLeft ;};BrowserDimensions.prototype.getScrollFromTop=function(){
return this.body.scrollTop ;};BrowserDimensions.prototype.getViewableAreaWidth=function(){
return this.body.clientWidth ;};BrowserDimensions.prototype.getViewableAreaHeight=function(){
return this.body.clientHeight ;};BrowserDimensions.prototype.getHTMLElementWidth=function(){
return this.body.scrollWidth ;};BrowserDimensions.prototype.getHTMLElementHeight=function(){
return this.body.scrollHeight ;};BrowserDimensions.prototype.isStrictDoctype=function(){
return (document.compatMode && document.compatMode != "BackCompat");};BrowserDimensions.prototype.isSafari=function(){
return (navigator.userAgent.toLowerCase().indexOf("safari") >= 0);};
// Copyright IBM Corp. 2002, 2007  All Rights Reserved.
function ElementJavascriptEventController()
{
this.elements=new Array();this.arrayPosition=0;this.enableAll=enableRegisteredElementsInternal;this.disableAll=disableRegisteredElementsInternal;this.register=registerElementInternal;this.enable=enableRegisteredElementInternal;this.disable=disableRegisteredElementInternal;function enableRegisteredElementsInternal()
{
for (c=0; c < this.arrayPosition; c=c+1)
{
this.elements[c].enable();};};function enableRegisteredElementInternal(id)
{
for (c=0; c < this.arrayPosition; c=c+1)
{
if (this.elements[c].ID == id)
{
this.elements[c].enable();}};};function disableRegisteredElementsInternal()
{
for (c=0; c < this.arrayPosition; c=c+1)
{
this.elements[c].disable();};};function disableRegisteredElementInternal(id)
{
for (c=0; c < this.arrayPosition; c=c+1)
{
if (this.elements[c].ID == id)
{
this.elements[c].disable();}};};function registerElementInternal(HTMLElementID, doNotDisable, optionalOnEnableJavascriptAction)
{
this.elements[this.arrayPosition]=new RegisteredElement(HTMLElementID, doNotDisable, optionalOnEnableJavascriptAction);this.arrayPosition=this.arrayPosition + 1;};};function RegisteredElement(ElementID, doNotDisable, optionalOnEnableJavascriptAction)
{
this.ID=ElementID;this.oldCursor="normal";this.ItemOnMouseDown=null;this.ItemOnMouseUp=null;this.ItemOnMouseOver=null;this.ItemOnMouseOut=null;this.ItemOnMouseClick=null;this.ItemOnBlur=null;this.ItemOnFocus=null;this.ItemOnChange=null;this.onEnableJS=optionalOnEnableJavascriptAction;this.enable=enableInternal;this.disable=disableInternal;function enableInternal()
{
document.getElementById(this.ID).style.cursor=this.oldCursor;if (document.getElementById(this.ID).tagName == "BUTTON")
{
document.getElementById(this.ID).disabled=false;}else
{
document.getElementById(this.ID).onmousedown=this.ItemOnMouseDown;document.getElementById(this.ID).onmouseup=this.ItemOnMouseUp;document.getElementById(this.ID).onmouseover=this.ItemOnMouseOver;document.getElementById(this.ID).onmouseout=this.ItemOnMouseOut;document.getElementById(this.ID).onclick=this.ItemOnMouseClick;document.getElementById(this.ID).onblur=this.ItemOnBlur;document.getElementById(this.ID).onfocus=this.ItemOnFocus;document.getElementById(this.ID).onchange=this.ItemOnChange;};if (this.onEnableJS != null)
{
eval(this.onEnableJS);}};function disableInternal()
{
this.oldCursor=document.getElementById(this.ID).style.cursor;document.getElementById(this.ID).style.cursor="not-allowed";if (document.getElementById(this.ID).tagName == "BUTTON")
{
document.getElementById(this.ID).disabled=true;}else
{
this.ItemOnMouseDown=document.getElementById(this.ID).onmousedown;this.ItemOnMouseUp=document.getElementById(this.ID).onmouseup;this.ItemOnMouseOver=document.getElementById(this.ID).onmouseover;this.ItemOnMouseOut=document.getElementById(this.ID).onmouseout;this.ItemOnMouseClick=document.getElementById(this.ID).onclick;this.ItemOnBlur=document.getElementById(this.ID).onblur;this.ItemOnFocus=document.getElementById(this.ID).onfocus;this.ItemOnChange=document.getElementById(this.ID).onchange;document.getElementById(this.ID).onmousedown=function () { void(0); return false; };document.getElementById(this.ID).onmouseup=function () { void(0); return false; };document.getElementById(this.ID).onmouseover=function () { void(0); return false; };document.getElementById(this.ID).onmouseout=function () { void(0); return false; };document.getElementById(this.ID).onclick=function () { void(0); return false; };document.getElementById(this.ID).onblur=function () { void(0); return false; };document.getElementById(this.ID).onfocus=function () { void(0); return false; };document.getElementById(this.ID).onchange=function () { void(0); return false; };};};if (!doNotDisable)
{
this.disable();}};
// Copyright IBM Corp. 2002, 2007  All Rights Reserved.
var wpsFLY_isIE=document.all?1:0;var wpsFLY_isNetscape=document.layers?1:0;var wpsFLY_isMoz=document.getElementById && !document.all;var wpsFLY_minFlyout=0;var wpsFLY_move=15;if (wpsFLY_isIE)
wpsFLY_move=12;var wpsFLY_scrollSpeed=1;var wpsFLY_timeoutID=1;var wpsFLY_fromTop=100;var wpsFLY_leftResize;var wpsFLY_browserDimensions=new BrowserDimensions();var wpsFLY_initFlyoutExpanded=wpsFLY_getInitialFlyoutState();var wpsFLY_state=true;var wpsFLY_currIndex=-1;function wpsFLY_initFlyout(showHidden)
{
wpsFLY_Flyout=new wpsFLY_makeFlyout('wpsFLYflyout');wpsFLY_Flyout.setWidth(wpsFLY_minFlyout);wpsFLY_Flyout.css.overflow='hidden';wpsFLY_Flyout.setLeft(wpsFLY_Flyout.pageWidth() - wpsFLY_minFlyout-1);if (wpsFLY_isNetscape||wpsFLY_isMoz)
scrolled="window.pageYOffset";else if (wpsFLY_isIE)
scrolled="document.body.scrollTop";if (wpsFLY_isNetscape||wpsFLY_isMoz)
wpsFLY_fromTop=wpsFLY_Flyout.css.top;else if (wpsFLY_isIE)
wpsFLY_fromTop=wpsFLY_Flyout.css.pixelTop;if (wpsFLY_isIE) {
window.onscroll=wpsFLY_internalScroll;window.onresize=wpsFLY_internalScroll;}else {
window.onscroll=wpsFLY_internalScroll();}if (showHidden)
wpsFLY_Flyout.css.visibility="hidden";else
wpsFLY_Flyout.css.visibility="visible";if (wpsFLY_initFlyoutExpanded != null)
{
wpsFLY_toggleFlyout(wpsFLY_initFlyoutExpanded, true);}return;};function wpsFLY_initFlyoutLeft(showHidden)
{
wpsFLY_FlyoutLeft=new wpsFLY_makeFlyoutLeft('wpsFLYflyout');if (wpsFLY_isIE) {
wpsFLY_FlyoutLeft.setWidth(wpsFLY_minFlyout);wpsFLY_FlyoutLeft.css.overflow='hidden';wpsFLY_FlyoutLeft.setLeft(0);} else {
wpsFLY_FlyoutLeft.setLeft(wpsFLY_minFlyout - wpsFLY_FlyoutLeft.getWidth()- 4);};if (wpsFLY_isNetscape||wpsFLY_isMoz)
scrolled="window.pageYOffset";else if (wpsFLY_isIE)
scrolled="document.body.scrollTop";if (wpsFLY_isNetscape||wpsFLY_isMoz)
wpsFLY_fromTop=wpsFLY_FlyoutLeft.css.top;else if (wpsFLY_isIE)
wpsFLY_fromTop=wpsFLY_FlyoutLeft.css.pixelTop;if (wpsFLY_isIE) {
window.onscroll=wpsFLY_internalScrollLeft;window.onresize=wpsFLY_internalResizeLeft;} else
window.onscroll=wpsFLY_internalScrollLeft();if (showHidden)
wpsFLY_FlyoutLeft.css.visibility="hidden";else
wpsFLY_FlyoutLeft.css.visibility="visible";if (wpsFLY_initFlyoutExpanded != null)
{
wpsFLY_toggleFlyout(wpsFLY_initFlyoutExpanded, true);}};function wpsFLY_makeFlyout(obj)
{
this.origObject=document.getElementById(obj);if (wpsFLY_isNetscape)
this.css=eval('document.'+obj);else if (wpsFLY_isMoz)
this.css=document.getElementById(obj).style;else if (wpsFLY_isIE)
this.css=eval(obj+'.style');wpsFLY_state=1;this.go=0;if (wpsFLY_isNetscape)
this.width=this.css.document.width;else if (wpsFLY_isMoz)
this.width=document.getElementById(obj).offsetWidth;else if (wpsFLY_isIE)
this.width=eval(obj+'.offsetWidth');this.setWidth=wpsFLY_internalSetWidth;this.getWidth=wpsFLY_internalGetWidth;this.left=wpsFLY_internalGetLeft;this.pageWidth=wpsFLY_internalGetPageWidth;this.setLeft=wpsFLY_internalSetLeft;this.obj=obj + "Object";eval(this.obj + "=this");};function wpsFLY_makeFlyoutLeft(obj)
{
this.origObject=document.getElementById(obj);if (wpsFLY_isNetscape)
this.css=eval('document.'+obj);else if (wpsFLY_isMoz)
this.css=document.getElementById(obj).style;else if (wpsFLY_isIE)
this.css=eval(obj+'.style');wpsFLY_state=1;this.go=0;if (wpsFLY_isNetscape)
this.width=this.css.document.width;else if (wpsFLY_isMoz)
this.width=document.getElementById(obj).offsetWidth;else if (wpsFLY_isIE)
this.width=eval(obj+'.offsetWidth');this.setWidth=wpsFLY_internalSetWidthLeft;this.getWidth=wpsFLY_internalGetWidthLeft;this.left=wpsFLY_internalGetLeft;this.pageWidth=wpsFLY_internalGetPageWidth;this.setLeft=wpsFLY_internalSetLeft;this.obj=obj + "Object";eval(this.obj + "=this");};function wpsFLY_internalGetPageWidth()
{
return wpsFLY_browserDimensions.getViewableAreaWidth();};function wpsFLY_internalSetLeft(value)
{
this.css.left=value + "px";};function wpsFLY_internalSetWidth(value)
{
this.css.width=value + "px";if (navigator.userAgent.indexOf ("Opera") != -1) {
var operaIframe=document.getElementById('wpsFLY_flyoutIFrame');operaIframe.style.width=(value-wpsFLY_minFlyout) + "px" ;}};function wpsFLY_internalSetWidthLeft(value)
{
this.css.width=value + "px";if (navigator.userAgent.indexOf ("Opera") != -1) {
var operaIframe=document.getElementById('wpsFLY_flyoutIFrame');operaIframe.style.width=(value-wpsFLY_minFlyout) + "px" ;}};function wpsFLY_internalGetWidth()
{
if (wpsFLY_isNetscape)
return eval(this.css.document.width);else if (wpsFLY_isMoz||wpsFLY_isIE)
return eval(this.origObject.offsetWidth);};function wpsFLY_internalGetWidthLeft()
{
var width;if (wpsFLY_isNetscape)
width=eval(this.css.document.width);else if (wpsFLY_isMoz||wpsFLY_isIE)
width=eval(this.origObject.offsetWidth);return width;};function wpsFLY_internalGetLeft()
{
if (wpsFLY_isNetscape||wpsFLY_isMoz)
leftfunc=parseInt(this.css.left);else if (wpsFLY_isIE)
leftfunc=eval(this.css.pixelLeft);return leftfunc;};function wpsFLY_internalMoveOut()
{
document.getElementById('wpsFLYflyout').className="portalFlyoutExpanded";if (wpsFLY_Flyout.left() - wpsFLY_move > wpsFLY_Flyout.pageWidth()+ wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_Flyout.width) {
var newwidth= wpsFLY_Flyout.getWidth()+wpsFLY_move;wpsFLY_Flyout.setWidth(newwidth);wpsFLY_Flyout.setLeft(wpsFLY_Flyout.left() - wpsFLY_move);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveOut()",wpsFLY_scrollSpeed);wpsFLY_Flyout.go=1;} else {
wpsFLY_Flyout.setLeft(wpsFLY_Flyout.pageWidth() + wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_Flyout.width);wpsFLY_Flyout.setWidth(wpsFLY_Flyout.width);wpsFLY_Flyout.go=0;wpsFLY_state=0;};};function wpsFLY_internalMoveOutLeft()
{
document.getElementById('wpsFLYflyout').className="portalFlyoutExpanded";if (wpsFLY_isIE) {
if (wpsFLY_FlyoutLeft.getWidth() + wpsFLY_move < wpsFLY_FlyoutLeft.width) {
var newwidth= wpsFLY_FlyoutLeft.getWidth()+wpsFLY_move;wpsFLY_FlyoutLeft.setWidth(newwidth);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveOutLeft()",wpsFLY_scrollSpeed);wpsFLY_FlyoutLeft.go=1;} else {
wpsFLY_FlyoutLeft.setLeft(wpsFLY_FlyoutLeft.left());wpsFLY_FlyoutLeft.setWidth(wpsFLY_FlyoutLeft.width);wpsFLY_FlyoutLeft.go=0;wpsFLY_state=0;};} else {
if(wpsFLY_FlyoutLeft.left()+wpsFLY_move < wpsFLY_browserDimensions.getScrollFromLeft()) {
wpsFLY_FlyoutLeft.go=1;wpsFLY_FlyoutLeft.setLeft(wpsFLY_FlyoutLeft.left()+wpsFLY_move);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveOutLeft()",wpsFLY_scrollSpeed);} else {
wpsFLY_FlyoutLeft.setLeft(wpsFLY_browserDimensions.getScrollFromLeft());wpsFLY_FlyoutLeft.go=0;wpsFLY_state=0;};};};function wpsFLY_internalMoveIn()
{
if (wpsFLY_Flyout.left() + wpsFLY_move < wpsFLY_Flyout.pageWidth() + wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_minFlyout) {
wpsFLY_Flyout.go=1;var newwidth= wpsFLY_Flyout.getWidth()-wpsFLY_move;wpsFLY_Flyout.setWidth(newwidth);wpsFLY_Flyout.setLeft(wpsFLY_Flyout.left()+wpsFLY_move);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveIn()",wpsFLY_scrollSpeed);} else {
wpsFLY_Flyout.setWidth(wpsFLY_minFlyout);wpsFLY_Flyout.setLeft(wpsFLY_Flyout.pageWidth() + wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_minFlyout);wpsFLY_Flyout.go=0;wpsFLY_state=1;};};function wpsFLY_internalMoveInLeft()
{
if (wpsFLY_isIE) {
if (wpsFLY_FlyoutLeft.getWidth() - wpsFLY_move >  wpsFLY_minFlyout) {
var newwidth= wpsFLY_FlyoutLeft.getWidth() - wpsFLY_move;wpsFLY_FlyoutLeft.setWidth(newwidth);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveInLeft()",wpsFLY_scrollSpeed);wpsFLY_FlyoutLeft.go=1;} else {
wpsFLY_FlyoutLeft.setWidth(wpsFLY_minFlyout);wpsFLY_FlyoutLeft.setLeft(wpsFLY_FlyoutLeft.left());wpsFLY_FlyoutLeft.go=0;wpsFLY_state=1;};} else {
if(wpsFLY_FlyoutLeft.left()>-wpsFLY_FlyoutLeft.width+wpsFLY_minFlyout) {
wpsFLY_FlyoutLeft.go=1;wpsFLY_FlyoutLeft.setLeft(wpsFLY_FlyoutLeft.left()-wpsFLY_move);wpsFLY_timeoutID=setTimeout("wpsFLY_internalMoveInLeft()",wpsFLY_scrollSpeed);} else {
wpsFLY_FlyoutLeft.setLeft(wpsFLY_minFlyout - wpsFLY_FlyoutLeft.getWidth()- 4);wpsFLY_FlyoutLeft.go=0;wpsFLY_state=1;};};};function wpsFLY_internalScroll() {
if (!wpsFLY_Flyout.go) {
if (wpsFLY_state==1) {
wpsFLY_Flyout.setLeft(wpsFLY_browserDimensions.getScrollFromLeft() + wpsFLY_browserDimensions.getViewableAreaWidth() - wpsFLY_minFlyout);} else {
wpsFLY_Flyout.setLeft(wpsFLY_browserDimensions.getScrollFromLeft() + wpsFLY_browserDimensions.getViewableAreaWidth() - wpsFLY_Flyout.width);};}if (wpsFLY_isNetscape||wpsFLY_isMoz)
setTimeout('wpsFLY_internalScroll()',20);};function wpsFLY_internalScrollLeft() {
if (!wpsFLY_FlyoutLeft.go) {
if (wpsFLY_state==1) {
if (wpsFLY_isIE) {
if (wpsFLY_leftResize == null) {
wpsFLY_leftResize=wpsFLY_browserDimensions.getScrollFromLeft();}wpsFLY_FlyoutLeft.setWidth(wpsFLY_minFlyout);wpsFLY_FlyoutLeft.css.overflow='hidden';wpsFLY_FlyoutLeft.setLeft(wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_leftResize);} else {
wpsFLY_FlyoutLeft.setLeft(wpsFLY_minFlyout + wpsFLY_browserDimensions.getScrollFromLeft() - wpsFLY_FlyoutLeft.getWidth() - 4);};}}if (wpsFLY_isNetscape||wpsFLY_isMoz)
setTimeout('wpsFLY_internalScrollLeft()',20);};function wpsFLY_internalResizeLeft(){
if (wpsFLY_isIE) {
wpsFLY_leftResize=wpsFLY_browserDimensions.getScrollFromLeft(); - wpsFLY_browserDimensions.getViewableAreaWidth();}};function wpsFLY_moveOutFlyout(skipSlide)
{
if (this.wpsFLY_Flyout != null)
{
if (wpsFLY_state && !skipSlide) {
clearTimeout(wpsFLY_timeoutID);wpsFLY_internalMoveOut();}if (wpsFLY_state && skipSlide)
{
wpsFLY_Flyout.setLeft(wpsFLY_Flyout.pageWidth() + document.body.scrollLeft - wpsFLY_Flyout.width);wpsFLY_Flyout.setWidth(wpsFLY_Flyout.width);wpsFLY_Flyout.go=0;wpsFLY_state=0;document.getElementById('wpsFLYflyout').className="portalFlyoutExpanded";}}if (this.wpsFLY_FlyoutLeft != null)
{
if (wpsFLY_state && !skipSlide) {
clearTimeout(wpsFLY_timeoutID);wpsFLY_internalMoveOutLeft();}if (wpsFLY_state && skipSlide)
{
if (wpsFLY_isIE)
{
wpsFLY_FlyoutLeft.setLeft(wpsFLY_FlyoutLeft.left());wpsFLY_FlyoutLeft.setWidth(wpsFLY_FlyoutLeft.width);wpsFLY_FlyoutLeft.go=0;wpsFLY_state=0;}else
{
wpsFLY_FlyoutLeft.setLeft(document.body.scrollLeft);wpsFLY_FlyoutLeft.go=0;wpsFLY_state=0;};document.getElementById('wpsFLYflyout').className="portalFlyoutExpanded";}}};function wpsFLY_moveInFlyout()
{
if (this.wpsFLY_Flyout != null)
{
if (!wpsFLY_state) {
clearTimeout(wpsFLY_timeoutID);wpsFLY_internalMoveIn();}}if (this.wpsFLY_FlyoutLeft != null)
{
if (!wpsFLY_state) {
clearTimeout(wpsFLY_timeoutID);wpsFLY_internalMoveInLeft();}}document.getElementById('wpsFLYflyout').className="portalFlyoutCollapsed";};function wpsFLY_toggleFlyout(index, skipSlide)
{
if(flyOut[index] != null){
var checkIndex=index;var prevIndex=wpsFLY_getCurrIndex();if(checkIndex==prevIndex){
if(flyOut[index].active==true){
flyOut[index].active=false;document.getElementById("toolBarIcon"+prevIndex).src=flyOut[prevIndex].icon;document.getElementById("toolBarIcon"+prevIndex).alt=flyOut[prevIndex].altText;document.getElementById("toolBarIcon"+prevIndex).title=flyOut[prevIndex].altText;}else{
flyOut[index].active=true;document.getElementById("toolBarIcon"+index).src=flyOut[index].activeIcon;document.getElementById("toolBarIcon"+index).alt=flyOut[index].activeAltText;document.getElementById("toolBarIcon"+index).title=flyOut[index].activeAltText;};wpsFLY_clearStateCookie();wpsFLY_moveInFlyout();}else{
if(prevIndex > -1){
flyOut[prevIndex].active=false;document.getElementById("toolBarIcon"+prevIndex).src=flyOut[prevIndex].icon;document.getElementById("toolBarIcon"+prevIndex).alt=flyOut[prevIndex].altText;document.getElementById("toolBarIcon"+prevIndex).title=flyOut[prevIndex].altText;}flyOut[index].active=true;document.getElementById("toolBarIcon"+index).src=flyOut[index].activeIcon;document.getElementById("toolBarIcon"+index).alt=flyOut[index].activeAltText;document.getElementById("toolBarIcon"+index).title=flyOut[index].activeAltText;wpsFLY_setCurrIndex(index);document.getElementById("wpsFLY_flyoutIFrame").src=flyOut[index].url;};if(wpsFLY_state){
wpsFLY_setStateCookie(index);wpsFLY_moveOutFlyout(skipSlide);}}};function wpsFLY_getCurrIndex()
{
return wpsFLY_currIndex;};function wpsFLY_setCurrIndex(index)
{
wpsFLY_currIndex=index;};function wpsFLY_setStateCookie(index)
{
document.cookie='portalOpenFlyout=' + index + '; path=/;';};function wpsFLY_clearStateCookie()
{
document.cookie='portalOpenFlyout=null; expires=Wed, 1 Jan 2003 11:11:11 UTC; path=/;';};function wpsFLY_onloadShow(isRTL)
{
if (this.wpsFLY_minFlyout != null) {
var bodyObj=document.getElementById("FLYParent");if (bodyObj != null) {
var showHidden=false;if (isRTL) {
bodyObj.onload=wpsFLY_initFlyoutLeft(showHidden);} else {
bodyObj.onload=wpsFLY_initFlyout(showHidden);};}}};function wpsFLY_markupLoop(flyOut)
{
for(arrayIndex=0; arrayIndex < flyOut.length; arrayIndex++){
if(flyOut[arrayIndex].url != "" && flyOut[arrayIndex].url != null){
document.write('<a tabIndex="5" class="toolbarLink" id="toolBarLink'+arrayIndex+'" href="javascript:void(0);" onclick="wpsFLY_toggleFlyout('+arrayIndex+'); return false;" >');document.write('<img src="'+flyOut[arrayIndex].icon+'" id="toolBarIcon'+arrayIndex+'" title="'+flyOut[arrayIndex].altText+'" border="0" alt="'+flyOut[arrayIndex].altText+'" onmouseover="this.src=flyOut['+arrayIndex+'].hoverIcon;" onmouseout="if (flyOut['+arrayIndex+'].active) {this.src=flyOut['+arrayIndex+'].activeIcon;} else this.src=flyOut['+arrayIndex+'].icon;" />');document.write('</a>');}if (javascriptEventController)
{
javascriptEventController.register("toolBarLink" + arrayIndex);javascriptEventController.register("toolBarIcon" + arrayIndex);}};};function wpsFLY_checkForEmptyExpandedFlyout()
{
var index=wpsFLY_getInitialFlyoutState();if (index != null && flyOut[index] != null)
{
document.getElementById("wpsFLY_flyoutIFrame").src=flyOut[index].url;}};function wpsFLY_getInitialFlyoutState()
{
if (document.cookie.indexOf("portalOpenFlyout=") >= 0)
{
var cookies=document.cookie.split(";");var c=0;while (c < cookies.length && (cookies[c].indexOf("portalOpenFlyout=") == -1))
{
c=c+1;};initCookieValue=cookies[c].substring(18, cookies[c].length);if (initCookieValue != "null")
{
return initCookieValue;}else
{
return null;}}else
{
return null;}};

// Ver: 4.2.30519
if(typeof(st_js)=="undefined"){
stAHCM_Debug=false;
stAHCM=1;
stAHWS=1;
stAHWR=0;
nOP=nOP5=nIE=nIE4=nIE5=nNN=nNN4=nNN6=nMAC=nIEM=nIEW=nDM=nVER=st_delb=st_addb=0;
st_reg=1;
stnav();
st_ttb=nIE||nOP&&(nVER>=6&&nVER<7);
stHAL=["left","center","right"];
stVAL=["top","middle","bottom"];
stREP=["no-repeat","repeat-x","repeat-y","repeat"];
stBDS=["none","solid","double","dotted","dashed","groove","ridge"];
st_gc=st_rl=st_cl=st_ct=st_cw=st_ch=st_cm=st_cp=st_ci=st_load=st_scr=0;
st_ht="";
st_ims=[];
st_ms=[];
st_old=0;
if(nNN4){stitovn=stevfn("stitov",1);stitoun=stevfn("stitou",1);stitckn=stevfn("stitck",1);stppovn=stevfn("stppov",0);stppoun=stevfn("stppou",0);}
if(nIE4||nNN4)onerror=function(m,u,l){if(!confirm("Java Script Error\n"+"\nDescription:"+m+"\nSource:"+u+"\nLine:"+l+"\n\nSee more details?"))onerror=null;}
if(nIEM||nOP5)onunload=function(){if(st_rl){clearInterval(st_rl);st_rl=0;}for(var j=0;j<st_ms.length;++j)st_ms[j].cfrm=0;return true;}
if(nDM&&!nNN4)
{
	var s="<STYLE>\n.st_tbcss,.st_tdcss,.st_divcss,.st_ftcss{border:none;padding:0px;margin:0px;}\n</STYLE>";
	for(var j=0;j<10;++j) s+="<FONT ID=st_gl"+j+"></FONT>";
	if(nIEW && nVER>=5 && document.body){ document.body.insertAdjacentHTML("AfterBegin",s); } else { document.write(s); }
}st_js=1;}
function stm_bm(a)
{
	var w=a[2]&&a[2].charAt(a[2].length-1)!='/'?a[2]+'/':a[2];
	var p=a.length>15?a[15]&&a[15].charAt(a[15].length-1)!='/'?a[15]+'/':a[15]:"";
	st_ms[st_cm]={ps:[],mei:st_cm,ids:"Stm"+st_cm+"p",hdid:0,cked:0,cfrm:0,tfrm:window,sfrm:window,mcff:"",mcfd:0,mcfn:0,mcfb:1,mcfx:0,mcfy:0,mnam:a[0],mver:a[1],mweb:w,mbnk:stbuf(w+a[3]),mtyp:a[4],mcox:a[5],mcoy:a[6],maln:stHAL[a[7]],mcks:a[8],msdv:a[9],msdh:a[10],mhdd:nNN4?Math.max(100,a[11]):a[11],mhds:a[12],mhdo:a[13],mhdi:a[14],mpre:p,args:a.slice(0)};
}
function stm_bp(l,a)
{
	var m=st_ms[st_cm],i=m.ps.length?m.ps[st_cp].is[st_ci]:0;
	st_cp=m.ps.length;st_ci=0;
	m.ps[st_cp]={is:[],mei:st_cm,ppi:st_cp,ids:"Stm"+st_cm+"p"+st_cp+"i",par:i,tmid:0,citi:-1,issh:0,isst:!st_cp&&!m.mtyp,isck:!st_cp&&m.mcks,exed:0,pver:a[0],pdir:a[1],poffx:a[2],poffy:a[3],pspc:a[4],ppad:a[5],plmw:a[6],prmw:a[7],popc:a[8],pesh:a[9]?a[9]:"Normal",pesi:a[10],pehd:a[11]?a[11]:"Normal",pehi:a[12],pesp:a[13],pstp:a[14],psds:nIEW?a[15]:0,pscl:a[16],pbgc:a[17],pbgi:stbuf(stgsrc(a[18],m,0)),pbgr:stREP[a[19]],pbds:stBDS[a[20]],ipbw:a[21],pbdc:(!nDM||nNN4)?a[22].split(/\s/gi)[0]:a[22],args:a.slice(0)};
	var p=m.ps[st_cp];
	if(st_cp)	p.par.sub=p;
	p.zind=!st_cp?1000:stgpar(p.par).zind+1;
	p.pbgd=stgbg(p.pbgc,p.pbgi,p.pbgr);
	if(nIEW&&nVER>=5.5)
	{
		p.efsh=p.pesh=="Normal"?"stnm":"stft";
		p.efhd=p.pehd=="Normal"?"stnm":"stft";
	}
	else if(nIEW&&(nVER>=5||nVER>=4&&!p.isst))
	{
		p.efsh=p.pesi>=0?"stft":"stnm";
		p.efhd=p.pehi>=0?"stft":"stnm";
	}
	else
		p.efsh=p.efhd="stnm";
	eval(l+"=p");
}
function stm_bpx(l,r,a)
{
	var p=eval(r);
	stm_bp(l,a.concat(p.args.slice(a.length)));
}
function stm_ai(l,a)
{
	st_ci=st_ms[st_cm].ps[st_cp].is.length;
	var m=st_ms[st_cm],p=m.ps[st_cp];
	if(a[0]==6)
		p.is[st_ci]={ssiz:a[1],ibgc:[a[2]],simg:stbuf(stgsrc(a[3],m,1)),simw:a[4],simh:a[5],simb:a[6],args:a.slice(0)};
	else
		p.is[st_ci]={itex:a[0]?a[1]:a[1].replace(/ /g,"&nbsp;"),iimg:[stbuf(stgsrc(a[2],m,0)),stbuf(stgsrc(a[3],m,0))],iimw:a[4],iimh:a[5],iimb:a[6],iurl:(!a[7]||stabs(a[7])?a[7]:m.mpre+a[7]),itgt:a[8]?a[8]:"_self",istt:a[9],itip:a[10].replace(/"/g,"&quot;"),iicn:[stbuf(stgsrc(a[11],m,1)),stbuf(stgsrc(a[12],m,1))],iicw:a[13],iich:a[14],iicb:a[15],iarr:[stbuf(stgsrc(a[16],m,1)),stbuf(stgsrc(a[17],m,1))],iarw:a[18],iarh:a[19],iarb:a[20],ihal:stHAL[a[21]],ival:stVAL[a[22]],ibgc:nOP5&&nVER<7&&a[24]&&a[26]?["transparent","transparent"]:[nOP5&&nVER<7||!a[24]?a[23]:"transparent",nOP5&&nVER<7||!a[26]?a[25]:"transparent"],ibgi:[stbuf(stgsrc(a[27],m,0)),stbuf(stgsrc(a[28],m,0))],ibgr:[stREP[a[29]],stREP[a[30]]],ibds:stBDS[a[31]],ipbw:a[32],ibdc:(!nDM||nNN4)?[a[33].split(/\s/gi)[0],a[34].split(/\s/gi)[0]]:[a[33],a[34]],itxc:[a[35],a[36]],itxf:[a[37],a[38]],itxd:[stgdec(a[39]),stgdec(a[40])],args:a.slice(0)};
	var i=st_ms[st_cm].ps[st_cp].is[st_ci];
	i.ityp=a[0];
	i.mei=st_cm;
	i.ppi=st_cp;
	i.iti=st_ci;
	i.ids=p.ids+st_ci+"e";
	i.sub=0;
	i.tmid=0;
	if(i.ityp!=6)
		i.ibgd=[stgbg(i.ibgc[0],i.ibgi[0],i.ibgr[0]),stgbg(i.ibgc[1],i.ibgi[1],i.ibgr[1])];
	eval(l+"=i");
}
function stm_aix(l,r,a)
{
	var i=eval(r);
	stm_ai(l,a.concat(i.args.slice(a.length)));
}
function stm_ep()
{
	var m=st_ms[st_cm],p=m.ps[st_cp],i=p.par;
	if(i)
	{
		st_cm=i.mei;
		st_cp=i.ppi;
		st_ci=i.iti;
	}
	if(!p.is.length)
	{
		--m.ps.length;
		if(i)
			i.sub=0;
	}
}
function stm_em(smwidth)
{
	if(!st_cm&&nDM)
	{
		if(typeof(onload)!="undefined"&&onload!=st_onload)
			st_old=onload;
		onload=st_onload;
	}
	var m=st_ms[st_cm];
	if(!m.ps.length)
	{
		--st_ms.length;
		return;
	}
	var mh="",mc="<STYLE TYPE='text/css'>\n";
	for(var n=nDM?m.ps.length:1,j=0;j<n;++j)
	{
		var p=m.ps[j],ph=(p.isst&&m.maln!="left"?"<TABLE STYLE='border:none;padding:0px;' CELLPADDING=0 CELLSPACING=0 ALIGN="+m.maln+"><TD class=st_tdcss>":"")+stpbtx(p);
		for(var k=0;k<p.is.length;++k)
		{
			var i=p.is[k];
			ph+=(p.pver?"<TR ID="+i.ids+"TR>":"")+stittx(i,smwidth)+(p.pver?"</TR>":"");
			if(i.ityp!=6)
				mc+="."+i.ids+"TX0{"+sttcss(i,0)+"}\n."+i.ids+"TX1{"+sttcss(i,1)+"}\n";
		}
		ph+=stpetx(p);
		if(p.isst&&m.maln!="left")
			ph+="</TD></TABLE>";
		if(p.isst||nNN||!nDM)
			mh+=ph;
		else
			st_ht+=ph;
	}
	mc+="</STYLE>";
	if(!nDM||nNN4)
		document.write(mc);
	if(mh)
		document.write(mh);
	if(nOP5||nIEW&&nVER>=5||nNN6)
	{
		if(st_ht)
		{
			var o=stgobj("st_gl"+st_gc);
			if(nOP)
				o.document.write(st_ht);
			else if(nIE)
				o.insertAdjacentHTML("BeforeEnd",st_ht);
			st_gc++;
			st_ht="";
		}
		if(nIE)
			stpre(m);
	}
	++st_cm;st_cp=0;st_ci=0;
}
function stpbtx(p)
{
	with(p)
	return nNN4||!nDM?(isst?"<ILAYER":"<LAYER")+" VISIBILITY=hide ID="+ids+" Z-INDEX="+zind+"><LAYER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING="+pspc+" BACKGROUND='"+pbgi+"' BGCOLOR="+(pbgi||pbgc=="transparent"?"''":pbgc)+">":(st_ttb?"<TABLE class=st_tbcss CELLPADDING=0 CELLSPACING=0":"<DIV class=st_divcss")+stppev(p)+" ID="+ids+" STYLE='"+(nIEM?"width:1px;":(nIE?"width:0px;":""))+stfcss(p)+"position:"+(p.isst?"static":"absolute")+";z-index:"+zind+";visibility:hidden;'>"+(st_ttb?"<TD class=st_tdcss ID="+ids+"TTD>":"")+"<TABLE class=st_tbcss CELLSPACING=0 CELLPADDING=0 ID="+ids+"TB STYLE='"+stpcss(p)+(nIEW?"margin:"+(nVER<5.5?psds:0)+"px;":"")+"'>";
}
function stpetx(p)
{
	return "</TABLE>"+(nNN4||!nDM?"</LAYER></LAYER>":(st_ttb?"</TD></TABLE>":"</DIV>"));
}
function stittx(i,smwidth)
{
	var s="",p=stgpar(i);
	with(i)
	if(nNN4||!nDM)
	{
		s+="<TD WIDTH=1 NOWRAP><FONT STYLE='font-size:1pt;'><ILAYER ID="+ids+"><LAYER";
		if(ityp!=6&&ipbw)
			s+=" BGCOLOR="+ibdc[0];
		s+=">";
		for(var n=0;n<(nNN4?2:1);++n)
		{
			if(ityp==6&&n)
				break;
			s+="<LAYER Z-INDEX=10 VISIBILITY="+(n?"HIDE":"SHOW");
			if(ityp!=6)
				s+=" LEFT="+ipbw+" TOP="+ipbw;
				s+="><TABLE ALIGN=LEFT WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING="+(ityp==6?0:p.ppad);
			if(ityp==6)
				s+=" BACKGROUND='' BGCOLOR='"+(ibgc[n]=="transparent"?"":ibgc[n])+"'";
			else
				s+=" BACKGROUND='"+ibgi[n]+"' BGCOLOR="+(ibgi[n]||ibgc[n]=="transparent"?"''":ibgc[n]);
			s+=">";
			if(ityp==6)
				s+="<TD NOWRAP VALIGN=TOP HEIGHT="+(p.pver?ssiz:"100%")+" WIDTH="+(p.pver?"100%":ssiz)+" STYLE='font-size:0pt;'>"+stgimg(simg,ids+"LINE",simw,simh,0)+"</TD>";
			else
			{
				if(p.pver&&p.plmw||!p.pver&&iicw)
					s+="<TD ALIGN=CENTER VALIGN=MIDDLE"+stgiws(i)+">"+stgimg(iicn[n],"",iicw,iich,iicb)+"</TD>";
					s+="<TD WIDTH=100% NOWRAP ALIGN="+ihal+" VALIGN="+ival+"><A "+(nNN4?"":stgurl(i,1))+" CLASS='"+(ids+"TX"+n)+"'>";
				if(ityp==2)
					s+=stgimg(iimg[n],ids+"IMG",iimw,iimh,iimb);
				else
					s+="<IMG SRC='"+stgme(i).mbnk+"' WIDTH=1 HEIGHT=1 BORDER=0 ALIGN=ABSMIDDLE>"+itex;
				s+="</A></TD>";
				if(p.pver&&p.prmw||!p.pver&&iarw)
					s+="<TD ALIGN=CENTER VALIGN=MIDDLE"+stgaws(i)+">"+stgimg(iarr[n],"",iarw,iarh,iarb)+"</TD>";
			}
			s+="</TABLE>";
			if(ityp!=6&&ipbw)
				s+="<BR CLEAR=ALL><SPACER HEIGHT=1 WIDTH="+ipbw+"></SPACER><SPACER WIDTH=1 HEIGHT="+ipbw+"></SPACER>";
			s+="</LAYER>";
		}
		if(ityp!=6)
			s+="<LAYER Z-INDEX=20></LAYER>";
		s+="</LAYER></ILAYER></FONT></TD>";
	}
	else
	{
		s+="<TD class=st_tdcss NOWRAP VALIGN="+(nIE?"MIDDLE":"TOP")+" STYLE='padding:"+p.pspc+"px;' ID="+p.ids+iti;
		if(nIEW)
			s+=" HEIGHT=100%";
		s+=">";
		if(ityp!=6)
			s+="<A STYLE='text-decoration:none;' "+stgurl(i,0)+">";
		if(!nOP&&!nIE)
			s+="<DIV class=st_divcss ID="+ids+stitev(i)+" STYLE='"+sticss(i,0)+"'>";
		s+="<TABLE class=st_tbcss CELLSPACING=0 CELLPADDING=0";
		if(!nOP)
			s+=" HEIGHT=100%";
		if(nOP||nIE)
			s+=" STYLE='"+sticss(i,0)+"'"+stitev(i);
		if(p.pver||nIEM) 
			if (smwidth > 0) {
				s+=" WIDTH='"+String(smwidth)+"'";
			} else {
				s+=" WIDTH=100%";
			}
		s+=" ID="+(nOP||nIE?ids:(ids+"TB"));
		if(ityp!=6)
			s+=" TITLE="+stquo(itip);
		s+=">";
		if(ityp==6)
			s+="<TD class=st_tdcss NOWRAP VALIGN=TOP ID="+ids+"MTD HEIGHT="+(p.pver?ssiz:"100%")+" WIDTH="+(p.pver?"100%":ssiz)+">"+stgimg(simg,ids+"LINE",simw,simh,0)+"</TD>";
		else
		{
			if(p.pver&&p.plmw||!p.pver&&iicw)
				s+="<TD class=st_tdcss NOWRAP ALIGN=CENTER VALIGN=MIDDLE HEIGHT=100% STYLE='padding:"+p.ppad+"px' ID="+ids+"LTD"+stgiws(i)+">"+stgimg(iicn[0],ids+"ICON",iicw,iich,iicb)+"</TD>";
			s+="<TD class=st_tdcss NOWRAP HEIGHT=100% STYLE='color:"+itxc[0]+";padding:"+p.ppad+"px;' ID="+ids+"MTD ALIGN="+ihal+" VALIGN="+ival+">";
			s+="<FONT class=st_ftcss ID="+ids+"TX STYLE=\""+sttcss(i,0)+"\">";
			if(ityp==2)
				s+=stgimg(iimg[0],ids+"IMG",iimw,iimh,iimb);
			else
				s+=itex;
			s+="</FONT>";
			s+="</TD>";
			if(p.pver&&p.prmw||!p.pver&&iarw)
				s+="<TD class=st_tdcss NOWRAP ALIGN=CENTER VALIGN=MIDDLE HEIGHT=100% STYLE='padding:"+p.ppad+"px' ID="+ids+"RTD"+stgaws(i)+">"+stgimg(iarr[0],ids+"ARROW",iarw,iarh,iarb)+"</TD>";
		}
		s+="</TABLE>";
		if(!nOP&&!nIE)
			s+="</DIV>";
		if(ityp!=6)
			s+="</A>";
		s+="</TD>";
	}
	return s;
}
function stpcss(p)
{
	with(p)
	return "border-style:"+pbds+";border-width:"+ipbw+"px;border-color:"+pbdc+";"+(nIE?"background:"+pbgd+";":"background-color:"+pbgc+";"+(pbgi?"background-image:url("+pbgi+");background-repeat:"+pbgr+";":""));
}
function stfcss(p)
{
	var dx=nVER>=5.5?"progid:DXImageTransform.Microsoft.":"";
	with(p)
	return nIEW&&(nVER>=5||!isst)?"filter:"+(nVER>=5.5?(pesh!="Normal"?pesh+" ":""):(pesi<24&&pesi>=0?"revealTrans(Transition="+pesi+",Duration="+((110-pesp)/100)+") ":""))+dx+"Alpha(enabled="+(nIE5||popc!=100)+",opacity="+popc+") "+(psds?dx+(pstp==1?"dropshadow(color="+pscl+",offx="+psds+",offy="+psds+",positive=1) ":"Shadow(color="+pscl+",direction=135,strength="+psds+") "):"")+(nVER>=5.5?(pehd!="Normal"?pehd+" ":""):(pehi<24&&pehi>=0?"revealTrans(Transition="+pehi+",Duration="+((110-pesp)/100)+") ":""))+";":"";
}
function sticss(i,n)
{
	with(i)
	return (ityp!=6?"border-style:"+ibds+";border-width:"+ipbw+"px;border-color:"+ibdc[n]+";"+(!nIEM&&ibgi[n]?"background-image:url("+ibgi[n]+");background-repeat:"+ibgr[n]+";":""):"")+(nIEM&&ityp!=6?"background:"+ibgd[n]+";":"background-color:"+ibgc[n]+";")+"cursor:"+(nIEM?"default":stgcur(i))+";"
}
function sttcss(i,n)
{
	with(i)
	return "cursor:"+stgcur(i)+";font:"+itxf[n]+";text-decoration:"+itxd[n]+";"+(!nDM||nNN4||nIE5?"background-color:transparent;color:"+itxc[n]:"");
}
function stitov(e,o,i)
{
	var p=stgpar(i);
	if(nIEW)
	{
		if(!i.layer)
			i.layer=o;
		if(!p.issh||(e.fromElement&&o.contains(e.fromElement)))
			return;
	}
	else
	{
		if(!p.issh||(!nNN&&(e.fromElement&&e.fromElement.id&&e.fromElement.id.indexOf(i.ids)>=0)))
			return;
	}
	if(nNN4)
		stglay(i).document.layers[0].captureEvents(Event.CLICK);
	var m=stgme(i);
	stfrm(m);
	var w=m.sfrm;
	if(w!=window)
		m=w.stmenu(m.mnam);
	if(m.hdid)
	{
		w.clearTimeout(m.hdid);
		m.hdid=0;
	}
	if(!p.isck||stgme(i).cked)
	{
		if(p.citi!=i.iti&&p.citi>=0)
			sthdit(p.is[p.citi]);
		stshit(i);
		p.citi=i.iti;
	}
	if(nNN4&&i.istt)
		stcstt(i);
}
function stitou(e,o,i)
{
	if(nIEW)
	{
		if(!stgpar(i).issh||e.toElement&&o.contains(e.toElement))
			return;
	}
	else
	{
		if(!stgpar(i).issh||(!nNN&&(e.toElement&&e.toElement.id&&e.toElement.id.indexOf(i.ids)>=0)))
			return;
	}
	if(nNN4)
		stglay(i).document.layers[0].releaseEvents(Event.CLICK);
	stfrm(stgme(i));
	var p=stgtsub(i);
	if(!p||!p.issh)
	{
		stshst(i,0);
		stgpar(i).citi=-1;
	}
	else if(p&&p.issh&&!p.exed)
		sthdit(i);
	if(nNN4&&i.istt)
		status="";
}
function stitck(e,o,i)
{
	if(nNN4&&e.which!=1)
		return;
	var m=stgme(i);
	stfrm(m);
	var p=stgpar(i);
	if(p.isck)
	{
		m.cked=!m.cked;
		if(m.cked)
		{
			stshit(i);
			p.citi=i.iti;
		}
		else
		{
			sthdit(i);
			p.citi=-1;
		}
	}
	with(i)
	if(iurl)
	{
		stcls();
		if(nIEW)
		{
			var w=stgtgt(i);
			if(w)
				w.location.href=iurl;
			else
				open(iurl,itgt);
		}
	}
}
function stppov(e,o,p)
{
	if(nIEW)
	{
		if(!p.layer)
			p.layer=o;
		if(!p.issh||(e.fromElement&&o.contains(e.fromElement)))
			return;
	}
	else
	{
		if(!p.issh||(!nNN&&(e.fromElement&&e.fromElement.id&&e.fromElement.id.indexOf(p.ids)>=0)))
			return;
	}
	var m=stgme(p);
	stfrm(m);
	var w=m.sfrm;
	if(w!=window)
		m=w.stmenu(m.mnam);
	if(m.hdid)
	{
		w.clearTimeout(m.hdid);
		m.hdid=0;
	}
}
function stppou(e,o,p)
{
	if(nIEW)
	{
		if(!p.issh||(e.toElement&&o.contains(e.toElement)))
			return;
	}
	else
	{
		if(!p.issh||(!nNN&&(e.toElement&&e.toElement.id&&e.toElement.id.indexOf(p.ids)>=0)))
			return;
	}
	var m=stgme(p);
	stfrm(m);
	var w=m.sfrm;
	if(w!=window)
		m=w.stmenu(m.mnam);
	if(m.hdid)
		w.clearTimeout(m.hdid);
	m.hdid=w.setTimeout("sthdall(st_ms['"+m.mei+"'],0);",m.mhdd);
}
function stshst(i,n)
{
	with(i)
	if(nNN4)
	{
		var ls=stgstlay(i);
		ls[n].parentLayer.bgColor=ibdc[n];
		ls[n].visibility="show";
		ls[1-n].visibility="hide";
	}
	else
	{
		var o=stglay(i);
		var s=o.style;
		if(nIEM)
		{
			if(ibgd[0]!=ibgd[1])	s.background=ibgd[n];
		}
		else
		{
			if(ibgc[0]!=ibgc[1])
			{
				if(nOP&&nVER<6)
					s.background=ibgc[n];
				else
					s.backgroundColor=ibgc[n];
			}
			if(ibgi[0]!=ibgi[1])	s.backgroundImage="url("+(ibgi[n]?ibgi[n]:stgme(i).mbnk)+")";
			if(ibgr[0]!=ibgr[1])	s.backgroundRepeat=ibgr[n];
		}
		if(ibdc[0]!=ibdc[1])	s.borderColor=ibdc[n];
		var t;
		if(iicn[0]!=iicn[1])
		{
			t=nIE?o.all[ids+"ICON"]:stgobj(ids+"ICON");
			if(t)	t.src=iicn[n];
		}
		if(iarr[0]!=iarr[1])
		{
			t=nIE?o.all[ids+"ARROW"]:stgobj(ids+"ARROW");
			if(t)	t.src=iarr[n];
		}
		if(ityp==2&&iimg[0]!=iimg[1])
		{
			t=nIE?o.all[ids+"IMG"]:stgobj(ids+"IMG");
			if(t)	t.src=iimg[n];
		}
		if(!i.txstyle)	i.txstyle=(nIE?o.all[ids+"TX"]:stgobj(ids+"TX")).style;
		t=txstyle;
		if(itxf[0]!=itxf[1])
			t.font=itxf[n];
		if(itxd[0]!=itxd[1])
			t.textDecoration=itxd[n];
		if(nOP)	stgobj(ids+"MTD").style.color=itxc[n];
		else	t.color=itxc[n];
	}
}
function stshpp(p)
{
	stshow(p);
}
function sthdpp(p)
{
	if(p.citi>=0)
	{
		var t=p.is[p.citi].sub;
		if(t&&t.issh)
			sthdpp(t);
		stshst(p.is[p.citi],0);
		p.citi=-1;
	}
	sthide(p);
}
function stshit(i)
{
	var w=stgme(i).tfrm,p=stgtsub(i);
	if(p&&!p.issh)
		w.stshpp(p);
	stshst(i,1);
}
function sthdit(i)
{
	var w=stgme(i).tfrm,p=stgtsub(i);
	if(p&&p.issh)
		w.sthdpp(p);
	stshst(i,0);
}
function stshow(p)
{
	var d=p.ppi&&stgpar(p.par).pver?stgme(p).msdv:stgme(p).msdh;
	p.exed=0;
	if(!p.rc)
		stgxy(p);
	if(p.tmid)
	{
		clearTimeout(p.tmid);
		p.tmid=0;
		stwels(1,p)
	}
	if(d>0)
		p.tmid=setTimeout(stsdstr(p,1),d);
	p.issh=1;
	if(d<=0)
		eval(stsdstr(p,1));
}
function sthide(p)
{
	if(p.tmid)
	{
		clearTimeout(p.tmid);
		p.tmid=0;
	}
	if(p.issh&&!p.exed)
	{
		p.exed=0;
		p.issh=0;
	}
	else
	{
		p.exed=0;
		p.issh=0;
		eval(stsdstr(p,0));
	}
}
function stshx(p)
{
	var l=stglay(p);
	if(nNN4)
	{
		l.visibility="show";
		if(!p.fixed)
		{
			l.resizeBy(p.ipbw*2,p.ipbw*2);
			l=l.document.layers[0];
			l.moveTo(p.ipbw,p.ipbw);
			l.onmouseover=stppovn;
			l.onmouseout=stppoun;
			for(var j=p.is.length-1;j>=0;--j)
			{
				var i=p.is[j];
				if(i.ityp!=6)
				{
					var ls=stgstlay(i);
					if(i.ityp!=1||i.iurl)
						ls[2].resizeTo(ls[0].parentLayer.clip.width,ls[0].parentLayer.clip.height);
					if(i.iurl)
					{
						with(ls[2].document)
						{
							open();
							write("<A "+stgurl(i,0)+"><IMG BORDER=0 SRC='"+stgme(i).mbnk+"' WIDTH="+ls[2].clip.width+" HEIGHT="+ls[2].clip.height+"></A>");
							close();
						}
					}
					ls[0].resizeBy(-i.ipbw,-i.ipbw);
					ls[1].resizeBy(-i.ipbw,-i.ipbw);
					l=stglay(i).document.layers[0];
					l.onmouseover=stitovn;
					l.onmouseout=stitoun;
					l.onclick=stitckn;
				}
			}
			if(p.ipbw)
				setTimeout("var p=st_ms["+p.mei+"].ps["+p.ppi+"];stglay(p).bgColor=p.pbdc;",1);
			p.fixed=1;
		}
	}
	else
	{
		l.style.visibility="visible";
		if(nIE5)
			l.filters["Alpha"].opacity=p.popc;
	}
}
function sthdx(p)
{
	var l=stglay(p);
	if(nNN4)
		l.visibility="hide";
	else
	{
		if(nIE5)
			l.filters["Alpha"].opacity=0;
		l.style.visibility="hidden";
	}
}
function sthdall(m,f)
{
	var w=m.sfrm,s=w==window?m:w.stmenu(m.mnam),p=s.ps[0];
	if(s.hdid)
	{
		w.clearTimeout(s.hdid);
		s.hdid=0;
	}
	s.cked=0;
	if(p.issh)
	{
		if(p.citi>=0)
		{
			w.sthdit(p.is[p.citi]);
			p.citi=-1;
		}
		if(s.mtyp==2&&(f||stAHCM))
			w.sthide(p);
	}
}
function stcls()
{
	for(var i=st_ms.length-1;i>=0;--i)
		sthdall(st_ms[i],0);
}
function stnmsh(p)
{
	stmvto(stgxy(p),p);
	stwels(-1,p);
	stshx(p);
}
function stnmhd(p)
{
	sthdx(p);
	stwels(1,p);
}
function stftsh(p)
{
	if(nVER<5.5)
		stshfx(p);
	else if(st_reg)
		eval("try{stshfx(p);}catch(e){st_reg=0;stnmsh(p);}");
	else
		stnmsh(p);
}
function stfthd(p)
{
	if(nVER<5.5)
		sthdfx(p);
	else if(st_reg)
		eval("try{sthdfx(p);}catch(e){st_reg=0;stnmhd(p);}");
	else
		stnmhd(p);
}
function stshfx(p)
{
	var t=stglay(p).filters[0];
	if(nVER>=5.5)
		t.enabled=1;
	if(t.Status)
		t.stop();
	stmvto(stgxy(p),p);
	stwels(-1,p);
	t.apply();
	stshx(p);
	t.play();
}
function sthdfx(p)
{
	var t=stglay(p).filters[stglay(p).filters.length-1];
	if(nVER>=5.5)
		t.enabled=1;
	if(t.Status)
		t.stop();
	t.apply();
	sthdx(p);
	stwels(1,p);
	t.play();
}
function ststxy(m,xy)
{
	m.mcox=xy[0];
	m.mcoy=xy[1];
}
function stnav()
{
	var v=navigator.appVersion,a=navigator.userAgent;
	nMAC=v.indexOf("Mac")>=0;
	nOP=a.indexOf("Opera")>=0;
	if(nOP)
	{
		nVER=parseFloat(a.substring(Math.max(a.indexOf("Opera/"),a.indexOf("Opera "))+6,a.length));
		nOP5=nVER>=5.12;
	}
	else
	{
		nIE=document.all?1:0;
		if(nIE)
		{
			nIE4=(eval(v.substring(0,1)>=4));
			nVER=parseFloat(a.substring(a.indexOf("MSIE ")+5,a.length));
			nIE5=nVER>=5&&nVER<5.5&&!nMAC;
			nIEM=nIE4&&nMAC;
			nIEW=nIE4&&!nMAC;
		}
		else
		{
			nNN4=navigator.appName.toLowerCase()=="netscape"&&v.substring(0,1)=="4";
			if(!nNN4)
			{
				nNN6=(document.getElementsByTagName("*")&&a.indexOf("Gecko")!=-1);
				if(nNN6)
				{
					nVER=parseInt(navigator.productSub);
					if(a.indexOf("Netscape")>=0)
					{
						st_delb=nVER<20001108+1;
						st_addb=nVER>20020512-1;
					}
					else
					{
						st_delb=nVER<20010628+1;
						st_addb=nVER>20011221-1;
					}
				}
			}
			else
				nVER=parseFloat(v);
			nNN=nNN4||nNN6;
		}
	}
	nDM=nOP5||nIE4||nNN;
}
function stckpg()
{
	var w=st_cw,h=st_ch,l=st_cl,t=st_ct;
	st_cw=stgcw();
	st_ch=stgch();
	st_cl=stgcl();
	st_ct=stgct();
	if((st_cw-w||st_ch-h)&&(nOP&&nVER<7||nNN4))
		document.location.reload();
	else if((st_cl-l||st_ct-t)&&!nIE)
		stscr();
	else if(stAHWR&&(st_cw-w||st_ch-h))
		stcls();
}
function st_onload()
{
	if(st_load)	return;
	if(nIEM||nOP5||nNN||(nIEW&&nVER<5))
	{
		if(st_ht)
			document.body.insertAdjacentHTML("BeforeEnd",st_ht);
		for(var j=0;j<st_ms.length;++j)
			stpre(st_ms[j]);
	}
	st_load=1;
	if(st_old)
	{
		st_old();
		st_old=0;
	}
	for(var j=0;j<st_ms.length;++j)
	{
		var m=st_ms[j];
		for(var k=0;k<m.ps.length;++k)
		{
			var p=m.ps[k];
			if(p.issh&&p.exed)
				stwels(-1,p);
		}
	}
}
function stpre(m)
{
	var p=m.ps[m.ps.length-1],i=p.is[p.is.length-1];
	while(1)
		if(stglay(i)) break;
	if(!nNN4)
		stfix(m);
	if(m.mtyp!=2)
		stshow(m.ps[0]);
	if(nIE)
		onscroll=new Function("if(st_scr)clearTimeout(st_scr);st_scr=setTimeout('stscr();',500);");
	if(!st_rl)
	{
		st_cw=stgcw();
		st_ch=stgch();
		st_cl=stgcl();
		st_ct=stgct();
		st_rl=setInterval("stckpg();",500);
	}
	m.ready=1;
}
function stfix(m)
{
	for(var j=0;j<m.ps.length;++j)
	{
		var p=m.ps[j];
		if(!p.isst&&(nOP&&nVER>=7||nNN6))
		{
			var l=stglay(p);
			l.style.left="0px";
			l.style.top="0px";
			document.body.appendChild(l);
		}
		if(nOP&&nVER<6)
			stglay(p).style.pixelWidth=parseInt(stgobj(p.ids+"TB").style.pixelWidth);
		if(nIE5)
			stglay(p).style.width=stglay(p).offsetWidth;
		else if(nIEM||!nIE)
		{
			if(!p.pver)
			{
				var f=stgobj(p.ids+0),h=parseInt(nOP&&nVER<7?f.style.pixelHeight:f.offsetHeight);
				if(h)
				{
					h-=2*p.pspc;
					for(var k=0;k<p.is.length;++k)
					{
						var i=p.is[k];
						with(stglay(i).style)
						if(nOP)
							pixelHeight=nVER<7||i.ityp==6?h:h-2*p.ppad-2*i.ipbw;
						else if(i.ityp==6||nIE)
							height=h+"px";
						else
							height=h-2*i.ipbw+"px";
						if(nIEM)
						{
							var l=stgobj(i.ids+"LTD"),r=stgobj(i.ids+"RTD");
							if(l)
								l.style.height=h+"px";
							stgobj(i.ids+"MTD").style.height=h+"px";
							if(r)
								r.style.height=h+"px";
						}
					}
				}
			}
			else if(nOP)
			{
				for(var k=0;k<p.is.length;++k)
				{
					var i=p.is[k];
					if(i.ityp!=6)
					{
						with(stglay(i).style)
						{
							var w=parseInt(stgobj(p.ids+k).style.pixelWidth),h=parseInt(pixelHeight);
							if(w)
								pixelWidth=w-2*p.pspc;
							if(h)
								pixelHeight=h;
						}
					}
				}
			}
		}
	}
}
function stscr()
{
	for(var j=0;j<st_ms.length;++j)
	{
		var m=st_ms[j];
		stfrm(m);
		if(stAHWS)	sthdall(m,0);
		if(m.mtyp==1)
		{
			var p=m.ps[0];
			stwels(1,p);
			stmvto(stgxy(m.ps[0]),p);
			stwels(-1,p);
		}
	}
}
function stwels(c,p)
{
	var m=stgme(p);
	if(!st_load||nNN4||nOP||p.isst)	return;
	if(m.mhds&&!nIEM)	stwtag("SELECT",c,p);
	if(m.mhdo&&nIE4)	{stwtag("OBJECT",c,p);stwtag("APPLET",c,p);}
	if(m.mhdi&&(nIEM||nIEW&&nVER<5.5))	stwtag("IFRAME",c,p);
}
function stwtag(tg,c,o)
{
	var es=nIE?document.all.tags(tg):document.getElementsByTagName(tg);
	for(var j=0;j<es.length;++j)
	{
		var f=0,e=es.item(j);
		for(var t=e.offsetParent;t;t=t.offsetParent)
			if(t.id&&t.id.indexOf("Stm")>=0)
				f=1;
		if(f)
			continue;
		else if(stwover(e,o))
		{
			if(e.visLevel)
				e.visLevel+=c;
			else
				e.visLevel=c;
			if(e.visLevel==-1)
			{
				if(typeof(e.visSave)=="undefined")
					e.visSave=e.style.visibility;
				e.style.visibility="hidden";
			}
			else if(!e.visLevel)
				e.style.visibility=e.visSave;
		}
	}
}
function stmvto(xy,p)
{
	if(xy&&(p.ppi||stgme(p).mtyp))
	{
		var l=stglay(p);
		if(nNN4)
			l.moveToAbsolute(xy[0],xy[1]);
		else if(nOP)
		{
			var s=l.style;
			s.pixelLeft=xy[0];
			s.pixelTop=xy[1];
		}
		else
		{
			var s=l.style;
			s.left=xy[0]+"px";
			s.top=xy[1]+"px";
		}
		p.rc=[xy[0],xy[1],p.rc[2],p.rc[3]];
	}
}
function stsdstr(p,s)
{
	return	"var p=st_ms["+p.mei+"].ps["+p.ppi+"];p.tmid=0;"+(s?p.efsh+"sh(":p.efhd+"hd(")+"p);p.exed=1;";
}
function stwover(e,o)
{
	var l=0,t=0,w=e.offsetWidth,h=e.offsetHeight;
	if(w)
		e._wd=w;
	else
		w=e._wd;
	if(h)
		e._ht=h;
	else
		h=e._ht;
	while(e)
	{
		l+=e.offsetLeft;
		t+=e.offsetTop;
		e=e.offsetParent;
	}
	return l<o.rc[2]+o.rc[0]&&l+w>o.rc[0]&&t<o.rc[3]+o.rc[1]&&t+h>o.rc[1];
}
function stevfn(n,i)
{
	return new Function("e","var r=/Stm(\\d*)p(\\d*)i"+(i?"(\\d*)e":"")+"/;r.exec(this.parentLayer.id);var m=RegExp.$1;var p=parseInt(RegExp.$2);"+(i?"var i=parseInt(RegExp.$3);":"")+"return "+n+"(e,this,st_ms[m].ps[p]"+(i?".is[i]":"")+");");
}
function stppev(p)
{
	return " onMouseOver='stppov(event,this,st_ms["+p.mei+"].ps["+p.ppi+"]);' onMouseOut='stppou(event,this,st_ms["+p.mei+"].ps["+p.ppi+"]);'";
}
function stitev(i)
{
	with(i)
	return ityp==6?"":" onMouseOver='stitov(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onMouseOut='stitou(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onClick='stitck(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);'";
}
function stquo(n)
{
	return "\""+n+"\"";
}
function stgurl(i,f)
{
	with(i)
	return (iurl||f?"HREF="+stquo(iurl?iurl.replace(/"/g,"&quot;").replace(/'/g,"&#39;"):"#")+(iurl&&itgt?" TARGET="+stquo(itgt):""):"")+(istt?" onMouseOver='return stcstt(st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onMouseOut=\"top.status=\'\';return true;\"":"");
}
function stcstt(i)
{
	top.status=i.istt;return true;
}
function stgdec(v)
{
	return v?(v&1?"underline ":"")+(v&2?"line-through ":"")+(v&4?"overline":""):"none";
}
function stgimg(src,id,w,h,b)
{
	return "<IMG SRC="+stquo(src)+(id?" ID="+id:"")+(w>0?" WIDTH="+w:(nNN?" WIDTH=0":""))+(h>0?" HEIGHT="+h:(nNN?" HEIGHT=0":""))+" BORDER="+b+">";
}
function stgbg(c,i,r)
{
	return i?c+" url("+i+") "+r:c;
}
function stgcur(i)
{
	return i.ityp!=6&&i.iurl?(nNN6?"pointer":"hand"):"default";
}
function stgiws(i)
{
	var p=stgpar(i);
	return p.pver?(p.plmw>0?" WIDTH="+(p.plmw+2):""):(i.iicw>0?" WIDTH="+(i.iicw+2):"");
}
function stgaws(i)
{
	var p=stgpar(i);
	return p.pver?(p.prmw>0?" WIDTH="+(p.prmw+2):""):(i.iarw>0?" WIDTH="+(i.iarw+2):"");
}
function stgme(ip)
{
	return st_ms[ip.mei];
}
function stgpar(ip)
{
	return st_ms[ip.mei].ps[ip.ppi];
}
function stgcl()
{
	return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).scrollLeft:pageXOffset;
}
function stgct()
{
	return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).scrollTop:pageYOffset;
}
function stgcw()
{
	return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).clientWidth:innerWidth;
}
function stgch()
{
	return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).clientHeight:innerHeight;
}
function stgobj(id)
{
	with(document)
	return nIE&&nVER<5?all[id]:nNN4?layers[id]:getElementById(id);
}
function stglay(ip)
{
	if(!ip.layer)
		ip.layer=typeof(ip.iti)=="undefined"||nNN6||nOP5?stgobj(ip.ids):nNN4?stglay(stgpar(ip)).document.layers[0].document.layers[ip.ids]:stglay(stgpar(ip)).all.tags("table")[ip.ids];
	return ip.layer;
}
function stgstlay(i)
{
	return stglay(i).document.layers[0].document.layers;
}
function stgrc(ip)
{
	var ly=stglay(ip);
	if(nNN4)
		return [ly.pageX,ly.pageY,ly.clip.width,ly.clip.height];
	else
	{
		var l=0,t=0,w=typeof(ip.rc)=="undefined"?parseInt(nOP&&nVER<7?ly.style.pixelWidth:ly.offsetWidth):ip.rc[2],h=typeof(ip.rc)=="undefined"?parseInt(nOP&&nVER<7?ly.style.pixelHeight:ly.offsetHeight):ip.rc[3];
		while(ly)
		{
			l+=parseInt(ly.offsetLeft);
			t+=parseInt(ly.offsetTop);
			ly=ly.offsetParent;
		}
		if(nIEM)
		{
			l+=parseInt(document.body.leftMargin);
			l-=ip.ipbw;
			t-=ip.ipbw;
		}
		if(typeof(ip.iti)!="undefined")
		{
			if(st_delb)
			{
				l-=ip.ipbw;
				t-=ip.ipbw;
			}
			if(st_addb)
			{
				l+=stgpar(ip).ipbw;
				t+=stgpar(ip).ipbw;
			}
		}
		return [l,t,w,h];
	}
}
function stgxy(p)
{
	var sr=stgrc(p);
	p.rc=sr;
	if(!p.ppi)
	{
		var m=stgme(p);
		var x=!m.mtyp?sr[0]:m.mtyp==1?eval(m.mcox):m.mcox;
		var y=!m.mtyp?sr[1]:m.mtyp==1?eval(m.mcoy):m.mcoy;
		if(nIEW&&nVER<5.5){x-=p.psds;y-=p.psds;}
		return [x,y];
	}
	var ir=stgirc(p.par),l=nIEW&&nVER<5.5?stgcl()-p.psds:stgcl(),t=nIEW&&nVER<5.5?stgct()-p.psds:stgct(),r=stgcl()+stgcw(),b=stgct()+stgch(),x=p.poffx+ir[0],y=p.poffy+ir[1];
	if(p.pdir==1)
		x-=sr[2];
	else if(p.pdir==2)
		x+=ir[2];
	if(p.pdir!=1&&nIEW&&nVER<5.5)
		x-=p.psds;
	if(x>r-sr[2])
		x=r-sr[2];
	if(x<l)
		x=l;
	if(p.pdir==3)
		y-=sr[3];
	else if(p.pdir==4)
		y=y+ir[3];
	if(p.pdir!=3&&nIEW&&nVER<5.5)
		y-=p.psds;
	if(y>b-sr[3])
		y=b-sr[3];
	if(y<t)
		y=t;
	return [x,y];
}
function stbuf(s)
{
	if(s)
	{
		var i=new Image();
		st_ims[st_ims.length]=i;
		i.src=s;
	}
	return s;
}
function stabs(s)
{
	var t=s.toLowerCase();
	return t.indexOf(":")==1&&t.charCodeAt()>="a"&&t.charCodeAt()<="z"||!t.indexOf("http:")||!t.indexOf("https:")||!t.indexOf("file:")||!t.indexOf("ftp:")||!t.indexOf("/")||!t.indexOf("javascript:")||!t.indexOf("mailto:")||!t.indexOf("about:")||!t.indexOf("gopher:")||!t.indexOf("news:")||!t.indexOf("telnet:")||!t.indexOf("wais:");
}
function stgsrc(s,m,f)
{
	return s?stabs(s)?s:m.mweb+s:f?m.mbnk:s;
}
function showFloatMenuAt(n,x,y)
{
	if(nDM)
	{
		var m=stmenu(n);
		if(m&&typeof(m.ready)!="undefined"&&m.mtyp==2&&m.ps.length&&!m.ps[0].issh)
		{
			ststxy(m,[x,y]);
			stshow(m.ps[0]);
		}
	}
}
function hideMenu(n)
{
	var m=stmenu(n);
	sthdall(m,1);
}
function stmenu(n)
{
	for(var j=st_ms.length-1;j>=0;--j)
		if(st_ms[j].mnam==n)
			return st_ms[j];
	return 0;
}
function stgtsub(i)
{
	var m=stgme(i);
	if(m.mcfb)
	{
		var w=m.tfrm;
		if(i.ppi||w==window)
			return i.sub;
		if(typeof(w.stmenu)!="undefined")
			return w.stmenu(m.mnam).ps[i.ppi].is[i.iti].sub;
	}
	return 0;
}
function stgirc(i)
{
	var m=stgme(i),w=m.sfrm;
	if(i.ppi||w==window)
		return stgrc(i);
	m=w.stmenu(m.mnam);
	var rc=w.stgrc(m.ps[0].is[i.iti]),x=rc[0]-w.stgcl(),y=rc[1]-w.stgct();
	switch(m.mcfd)
	{
		case 0:y-=w.stgch();break;
		case 1:y+=stgch();break;
		case 2:x-=w.stgcw();break;
		case 3:x+=stgcw();break;
	}
	return [x+stgcl()+m.mcfx,y+stgct()+m.mcfy,rc[2],rc[3]];
}
function stgtgt(i)
{
	if(i.itgt=="_self")
		return window;
	else if(i.itgt=="_parent")
		return parent;
	else if(i.itgt=="_top")
		return top;
	else
		for(var co=window;co!=co.parent;co=co.parent)
			if(typeof(co.parent.frames[i.itgt])!="undefined")
				return co.parent.frames[i.itgt];
	return 0;
}
function stgfrm(m)
{
	var a=m.mcff.split("."),w="parent";
	for(var j=0;j<a.length;++j)
	{
		w+="."+a[j];
		if(typeof(eval(w))=="undefined")
			return 0;
	}
	return eval("parent."+m.mcff);
}
function stfrm(m)
{
	if(m.mcff)
	{
		var w=stgfrm(m);
		if(w&&typeof(w.st_load)!="undefined"&&w.st_load)
		{
			var t=w.stmenu(m.mnam);
			if(typeof(t)=="object"&&t)
			{
				if(!m.cfrm||!t.cfrm)
				{
					if(t.mhdd<1000)
						m.mhdd=t.mhdd=1000;
					sthdall(m,1);
					m.sfrm=t.sfrm=window;
					m.tfrm=t.tfrm=w;
					m.cfrm=t.cfrm=1;
				}
				m.mcfb=1;
				return;
			}
		}
		m.mcfb=m.mcfn;
		m.tfrm=window;
	}
	else
	{
		var w=m.sfrm;
		if(w==window)
			return;
		else if(typeof(w.st_load)!="undefined"&&w.st_load)
		{
			var s=w.stmenu(m.mnam);
			if(typeof(s)=="object"&&s)
				if(s.cfrm)
					return;
		}
		m.sfrm=window;
		var p=m.ps[0];
		for(var j=0;j<p.is.length;++j)
			sthdit(p.is[j]);
	}
}
var mfilepath = new Object();
var meffect = new Object();
var mstyle= new Object();

function setmattrib(mbaseurl,mori,marrow){
	var imgdir;
	  
	imgdir = mbaseurl.replace(/Default.jsp/,"");

	//default - no arrow for expand/collapse
	mfilepath.width = 0;
	mfilepath.height = 0;
	mfilepath.arrowdou = "";
	mfilepath.arrowrou = "";
	mfilepath.arrowdov = "";
	mfilepath.arrowrov = "";

	meffect.arrowtype = marrow;

	if (mori == "top") {
		imgdir += "images/topNav/";
		meffect.morimain = 0;
		meffect.morisub = 4;

		if (marrow == "all") {
			mfilepath.width = 7;
			mfilepath.height = 7;
			mfilepath.arrowdou = imgdir+"arrow_d.gif";
			mfilepath.arrowdov = imgdir+"arrow_dw.gif";		
			mfilepath.arrowrou = imgdir+"arrow_r.gif";
			mfilepath.arrowrov = imgdir+"arrow_rw.gif";
		}

		if (marrow == "sub") {
			mfilepath.width = 7;
			mfilepath.height = 7;
			mfilepath.arrowrou = imgdir+"arrow_r.gif";
			mfilepath.arrowrov = imgdir+"arrow_rw.gif";
		}	
	} else if (mori == "side") {
		imgdir += "images/sideNav/";
		meffect.morimain = 1;
		meffect.morisub = 2;

		if (marrow == "all" || marrow == "sub") {
			mfilepath.width = 7;
			mfilepath.height = 7;
			mfilepath.arrowdou = imgdir+"arrow_r.gif";
			mfilepath.arrowrou = imgdir+"arrow_r.gif";
			mfilepath.arrowdov = imgdir+"arrow_rw.gif";
			mfilepath.arrowrov = imgdir+"arrow_rw.gif";      
		}
	} else {
		imgdir += "images/"
	}

	mfilepath.blank = imgdir+"blank.gif";

	//mstyle.backg = "#ffffff";
	mstyle.backg = "transparent";
	mstyle.backgsub = "#ffffff";
	//mstyle.backgover = "#8ebbc1";
	mstyle.backgover = "#eaeaec";
	mstyle.fnttype = "bold 8pt Arial";
	mstyle.fntcolor = "#666666";
	mstyle.fntcolorover = "#333333";
	mstyle.bordercolor = "#afafaf #afafaf #afafaf #afafaf"; //Top Right Bottom Left
	mstyle.bordercolorover = "#666666";
	mstyle.borderwidth = 1;
	mstyle.borderpadding = 2; //4
	mstyle.borderpaddingsub = 3;
	mstyle.mbordercolor = "#ffffff #ffffff #ffffff #ffffff"; //Top Right Bottom Left de contono do submenu
	mstyle.mborderpaddingi = 0;
	mstyle.mborderpaddingo = 0;
	mstyle.mborderpaddingis = 1;
	mstyle.mborderpaddingos = 1;

	meffect.separator = "|";
	meffect.mshow = "";
	meffect.mhide = "";
	//meffect.mshow = "progid:DXImageTransform.Microsoft.Checkerboard(squaresX=16,squaresY=16,direction=up,enabled=0,Duration=0.20)";
	//meffect.mhide = "progid:DXImageTransform.Microsoft.Checkerboard(squaresX=12,squaresY=12,direction=down,enabled=0,Duration=0.20)";  
	//meffect.mshow = "progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,enabled=0,Duration=0.60)";
	//meffect.mhide = "progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,enabled=0,Duration=0.60)";
}

function setmnode(nlevel,nlabel,nlink,ntarget,nnewwin,nhaschildren) {
	var mnode = new Object();

	mnode.nlevel = nlevel;
	mnode.nlabel = nlabel;
	mnode.nlink = nlink;
	mnode.ntarget = ntarget;
	mnode.nnewwin = nnewwin;
	mnode.nhaschildren = nhaschildren;

	return mnode;
}

function setmenu() {
	var ret;

	ret = ["tubtehr",400,"",mfilepath.blank,0,"","",0,0,250,0,1000,1,0,0,""];

	return ret;
}

function setmenuitem(border,label,link,ntype,ntarget) {
	var ret;
	var arrow_w, arrow_h;
	var mwidth;

	if (!border) { mwidth = 0; } else { mwidth = mstyle.borderwidth; }

	if (ntype == "linked") {
		ret = [0,label,"","",-1,-1,0,link,ntarget,"","","","",0,0,0,"","",0,0,0,0,1,mstyle.backg,0,mstyle.backgover,0,"","",3,3,mwidth,mwidth,mstyle.bordercolor,mstyle.bordercolorover,mstyle.fntcolor,mstyle.fntcolorover,mstyle.fnttype,mstyle.fnttype];
	} else if (ntype == "down") {
		if (meffect.arrowtype = "sub") { arrow_w = 0; arrow_h = 0; } else { arrow_w = mfilepath.width; arrow_h = mfilepath.height;}
		ret = [0,label,"","",-1,-1,0,link,ntarget,"","","","",0,0,0,mfilepath.arrowdou,mfilepath.arrowdov,arrow_w,arrow_h,0,0,1,mstyle.backg,0,mstyle.backgover,0,"","",3,3,mwidth,mwidth,mstyle.bordercolor,mstyle.bordercolorover,mstyle.fntcolor,mstyle.fntcolorover,mstyle.fnttype,mstyle.fnttype];
	} else if (ntype == "right") {
		ret = [0,label,"","",-1,-1,0,link,ntarget,"","","","",0,0,0,mfilepath.arrowrou,mfilepath.arrowrov,mfilepath.width,mfilepath.height,0,0,1,mstyle.backg,0,mstyle.backgover,0,"","",3,3,mwidth,mwidth,mstyle.bordercolor,mstyle.bordercolorover,mstyle.fntcolor,mstyle.fntcolorover,mstyle.fnttype,mstyle.fnttype];
	} else {
		ret = [0,label,"","",-1,-1,0,"",ntarget,"","","","",0,0,0,"","",0,0,0,0,1,mstyle.backg,0,mstyle.backg,0,"","",3,3,mwidth,mwidth,mstyle.bordercolor,mstyle.bordercolorover,mstyle.fntcolor,mstyle.fntcolor,mstyle.fnttype,mstyle.fnttype,0,0];
	}

	return ret;
}

function setmenulevel(level,isnewbaselevel) {
	var ret;
	var levelid; // 0 = no arrow,  otherwise = arrow

	if (!isnewbaselevel) { levelid = 0; } else { levelid = mfilepath.width; }

	if (level == 0) {
		ret = [meffect.morimain,meffect.morisub,0,0,0,mstyle.borderpadding,0,levelid,100,"",-2,"",-2,90,0,0,"#000000",mstyle.backg,"",3,mstyle.mborderpaddingi,mstyle.mborderpaddingo,mstyle.bordercolor];
	} else if (level == 1) {
		ret = [1,meffect.morisub,0,0,0,mstyle.borderpaddingsub,0,levelid,100,meffect.mshow,-2,meffect.mhide,-2,90,0,0,"#000000",mstyle.backgsub,"",3,mstyle.mborderpaddingis,mstyle.mborderpaddingos,mstyle.mbordercolor];
	} else if (level > 1){
		ret = [1,2,0,0,0,mstyle.borderpaddingsub,0,levelid,100,meffect.mshow,-2,meffect.mhide,-2,90,0,0,"#000000",mstyle.backgsub,"",3,mstyle.mborderpaddingis,mstyle.mborderpaddingos,mstyle.mbordercolor];
	} else { ret = []; }

	return ret;
}

function buildmenu(mbaseurl,mori,mnodeset) {
  var nodeindex=0;
  var ntype="";
  var n;
  var isnewbaselevel;
  var arrowtype="sub"; //all - All arrows, sub - Sub menu arrows, else - No arrows
  var submenuwidth=205; //0 - sub menu width is auto , else - sub menu width is <submenuwidth> pixels
  var border = false;
  
  setmattrib(mbaseurl,mori,"sub");
  
  stm_bm(setmenu(),this);
    
    stm_bp("mbase",setmenulevel(0,true));
	
	  for (var nodeindex=0; nodeindex < mnodeset.length; nodeindex++) {
        
      //while (nodeindex < mnodeset.length) {
        
		if (mnodeset[nodeindex].nlevel == 1) { border = false;} else { border = true;}
		
        if (!mnodeset[nodeindex].nhaschildren) {
			if (mnodeset[nodeindex].nlink == "") { ntype = ""; } else { ntype = "linked"; }

			if (mnodeset[nodeindex].nlevel == 1 && nodeindex > 0) {
				stm_ai("isep"+String(nodeindex),setmenuitem(false,meffect.separator,"","",""));
			}
			
			stm_ai("i"+String(nodeindex),setmenuitem(border,mnodeset[nodeindex].nlabel,mnodeset[nodeindex].nlink,ntype,mnodeset[nodeindex].ntarget));
        } else {
			if (mnodeset[nodeindex].nlevel == 1) { ntype = "down"; } else { ntype = "right"; }
			
			if (mnodeset[nodeindex].nlevel == 1  && nodeindex > 0) {
				stm_ai("isep"+String(nodeindex),setmenuitem(false,meffect.separator,"","",""));
			}			
			
			stm_ai("i"+String(nodeindex),setmenuitem(border,mnodeset[nodeindex].nlabel,mnodeset[nodeindex].nlink,ntype,mnodeset[nodeindex].ntarget));          

			n = 1;
			isnewbaselevel = false;
			while ((!isnewbaselevel) && ((nodeindex+n) < mnodeset.length) && (mnodeset[nodeindex+n].nlevel == (mnodeset[nodeindex].nlevel+1))) {
				if (mnodeset[nodeindex+n].nhaschildren) { isnewbaselevel = true; }
				n++;
			}

			stm_bp("isub"+String(nodeindex),setmenulevel(mnodeset[nodeindex].nlevel,isnewbaselevel));
        }
        
        if (nodeindex < (mnodeset.length-1)) {
			if (mnodeset[nodeindex+1].nlevel < mnodeset[nodeindex].nlevel) {
			for (n=0;n<(mnodeset[nodeindex].nlevel - mnodeset[nodeindex+1].nlevel);n++) { stm_ep(); }
			}
        }
        //nodeindex++;
      }      

    stm_ep();
        
  stm_em(submenuwidth);
}

function NewWindow(mypage,myname,w,h,scroll){
	var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
	var win = window.open(mypage,myname,settings);
	//if(win.window.focus){ win.window.focus(); }
}

function mudaImagem(){
	var imgout = '/wps/themes/html/PC_Default/images/banner/img_out_header_2.jpg';
	var imgin = '/wps/themes/html/PC_Default/images/banner/img_in_header_2.jpg';

	if(document.getElementById('areaClickBusca').style.backgroundImage =='url('+imgout+')'){
		document.getElementById('areaClickBusca').style.backgroundImage = 'url('+imgin+')';
	}else{
		document.getElementById('areaClickBusca').style.backgroundImage = 'url('+imgout+')';
	}
}

//This function was utilized in stm31.js for debbuging
function writeSrc(src, idt) {
	var win=window.open('','','');
	win.document.open("text/html","replace");
	if (idt) { src = src.replace(/>/gi,">\n"); }
	win.document.writeln('<textarea cols=150 rows=40 scroll>'+src+'</textarea>');
	win.document.close();
}

//Posiciona a busca do WCM no header do tema.
//A DIV da busca do WCM sobrepõe a DIV fake do tema.
function posicionaBusca(){ 
	try{
		var grupoPesquisa = document.getElementById('grupoPesquisa');
		var busca         = document.getElementById('busca');
		
		busca.innerHTML = grupoPesquisa.innerHTML;
		grupoPesquisa.innerHTML = "";
		busca.style.visibility="visible";
	}catch(err){} 
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIEb=document.all;
isNNb=!document.all&&document.getElementById;
isN4b=document.layers;
isHotb=false;

function ddInit(e){
	try{
		topDog=isIEb ? "BODY" : "HTML";
		whichDog=isIEb ? document.all.theLayer : document.getElementById("theLayer");  
		hotDog=isIEb ? event.srcElement : e.target;  
				
		while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
			hotDog=isIEb ? hotDog.parentElement : hotDog.parentNode;
		}  
	    
		if (hotDog.id=="titleBar"){
			offsetx=isIEb ? event.clientX : e.clientX;
			offsety=isIEb ? event.clientY : e.clientY;
			nowX=parseInt(whichDog.style.left.slice(0,whichDog.style.left.length-2));
			nowY=parseInt(whichDog.style.top.slice(0,whichDog.style.top.length-2));
			ddEnabled=true;
			document.onmousemove=dd;
		}
	}catch(err) {}
}

function dd(e){
	try{
		if (!ddEnabled) return;
		whichDog.style.left=String(isIEb ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx)+"px";
		whichDog.style.top=String(isIEb ? nowY+event.clientY-offsety : nowY+e.clientY-offsety)+"px";
	} catch(err) {}

	return false;  
}

function ddN4(whatDog){
	if (!isN4b) return;
	
	N4=eval(whatDog);
	N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	
	N4.onmousedown=function(e){
		N4.captureEvents(Event.MOUSEMOVE);
		N4x=e.x;
		N4y=e.y;
	}
	
	N4.onmousemove=function(e){
		if (isHotb){
			N4.moveBy(e.x-N4x,e.y-N4y);
			return false;
		}
	}
	
	N4.onmouseup=function(){ N4.releaseEvents(Event.MOUSEMOVE); }
}

function hideMe(){
	var whichDog=isIEb ? document.all.theLayer : document.getElementById("theLayer");  

	if (isIEb||isNNb) whichDog.style.visibility="hidden";
	else if (isN4b) document.theLayer.visibility="hide";
}

function showMe(){
	var whichDog=isIEb ? document.all.theLayer : document.getElementById("theLayer");  
	
	if (isIEb||isNNb) whichDog.style.visibility="visible";
	else if (isN4b) document.theLayer.visibility="show";
}

/**
 * SWFObject v2.0: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		try {
			if(q) {
				var pairs = q.substring(1).split("&");
				for (var i=0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return pairs[i].substring((pairs[i].indexOf("=")+1));
					}
				}
			}
		} catch(err) {}
		
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;


/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
 * -----------------------------------------------------------
 *
 * The DHTML Calendar, version 1.0 "It is happening again"
 *
 * Details and latest version at:
 * www.dynarch.com/projects/calendar
 *
 * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 */

// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $

/* The Calendar object constructor. */
Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
	// member variables
	this.activeDiv = null;
	this.currentDateEl = null;
	this.getDateStatus = null;
	this.getDateToolTip = null;
	this.getDateText = null;
	this.timeout = null;
	this.onSelected = onSelected || null;
	this.onClose = onClose || null;
	this.dragging = false;
	this.hidden = false;
	this.minYear = 1970;
	this.maxYear = 2050;
	this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
	this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
	this.isPopup = true;
	this.weekNumbers = true;
	this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
	this.showsOtherMonths = false;
	this.dateStr = dateStr;
	this.ar_days = null;
	this.showsTime = false;
	this.time24 = true;
	this.yearStep = 2;
	this.hiliteToday = true;
	this.multiple = null;
	// HTML elements
	this.table = null;
	this.element = null;
	this.tbody = null;
	this.firstdayname = null;
	// Combo boxes
	this.monthsCombo = null;
	this.yearsCombo = null;
	this.hilitedMonth = null;
	this.activeMonth = null;
	this.hilitedYear = null;
	this.activeYear = null;
	// Information
	this.dateClicked = false;

	// one-time initializations
	if (typeof Calendar._SDN == "undefined") {
		// table of short day names
		if (typeof Calendar._SDN_len == "undefined")
			Calendar._SDN_len = 3;
		var ar = new Array();
		for (var i = 8; i > 0;) {
			ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
		}
		Calendar._SDN = ar;
		// table of short month names
		if (typeof Calendar._SMN_len == "undefined")
			Calendar._SMN_len = 3;
		ar = new Array();
		for (var i = 12; i > 0;) {
			ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
		}
		Calendar._SMN = ar;
	}
};

// ** constants

// "static", needed for event handlers.
Calendar._C = null;

// detect a special case of "web browser"
Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) );

Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );

// detect Opera browser
Calendar.is_opera = /opera/i.test(navigator.userAgent);

// detect KHTML-based browsers
Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);

// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
//        library, at some point.

Calendar.getAbsolutePos = function(el) {
	var SL = 0, ST = 0;
	var is_div = /^div$/i.test(el.tagName);
	if (is_div && el.scrollLeft)
		SL = el.scrollLeft;
	if (is_div && el.scrollTop)
		ST = el.scrollTop;
	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
	if (el.offsetParent) {
		var tmp = this.getAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
};

Calendar.isRelated = function (el, evt) {
	var related = evt.relatedTarget;
	if (!related) {
		var type = evt.type;
		if (type == "mouseover") {
			related = evt.fromElement;
		} else if (type == "mouseout") {
			related = evt.toElement;
		}
	}
	while (related) {
		if (related == el) {
			return true;
		}
		related = related.parentNode;
	}
	return false;
};

Calendar.removeClass = function(el, className) {
	if (!(el && el.className)) {
		return;
	}
	var cls = el.className.split(" ");
	var ar = new Array();
	for (var i = cls.length; i > 0;) {
		if (cls[--i] != className) {
			ar[ar.length] = cls[i];
		}
	}
	el.className = ar.join(" ");
};

Calendar.addClass = function(el, className) {
	Calendar.removeClass(el, className);
	el.className += " " + className;
};

// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
Calendar.getElement = function(ev) {
	var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
	while (f.nodeType != 1 || /^div$/i.test(f.tagName))
		f = f.parentNode;
	return f;
};

Calendar.getTargetElement = function(ev) {
	var f = Calendar.is_ie ? window.event.srcElement : ev.target;
	while (f.nodeType != 1)
		f = f.parentNode;
	return f;
};

Calendar.stopEvent = function(ev) {
	ev || (ev = window.event);
	if (Calendar.is_ie) {
		ev.cancelBubble = true;
		ev.returnValue = false;
	} else {
		ev.preventDefault();
		ev.stopPropagation();
	}
	return false;
};

Calendar.addEvent = function(el, evname, func) {
	if (el.attachEvent) { // IE
		el.attachEvent("on" + evname, func);
	} else if (el.addEventListener) { // Gecko / W3C
		el.addEventListener(evname, func, true);
	} else {
		el["on" + evname] = func;
	}
};

Calendar.removeEvent = function(el, evname, func) {
	if (el.detachEvent) { // IE
		el.detachEvent("on" + evname, func);
	} else if (el.removeEventListener) { // Gecko / W3C
		el.removeEventListener(evname, func, true);
	} else {
		el["on" + evname] = null;
	}
};

Calendar.createElement = function(type, parent) {
	var el = null;
	if (document.createElementNS) {
		// use the XHTML namespace; IE won't normally get here unless
		// _they_ "fix" the DOM2 implementation.
		el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
	} else {
		el = document.createElement(type);
	}
	if (typeof parent != "undefined") {
		parent.appendChild(el);
	}
	return el;
};

// END: UTILITY FUNCTIONS

// BEGIN: CALENDAR STATIC FUNCTIONS

/* Internal -- adds a set of events to make some element behave like a button. */
Calendar._add_evs = function(el) {
	with (Calendar) {
		addEvent(el, "mouseover", dayMouseOver);
		addEvent(el, "mousedown", dayMouseDown);
		addEvent(el, "mouseout", dayMouseOut);
		if (is_ie) {
			addEvent(el, "dblclick", dayMouseDblClick);
			el.setAttribute("unselectable", true);
		}
	}
};

Calendar.findMonth = function(el) {
	if (typeof el.month != "undefined") {
		return el;
	} else if (typeof el.parentNode.month != "undefined") {
		return el.parentNode;
	}
	return null;
};

Calendar.findYear = function(el) {
	if (typeof el.year != "undefined") {
		return el;
	} else if (typeof el.parentNode.year != "undefined") {
		return el.parentNode;
	}
	return null;
};

Calendar.showMonthsCombo = function () {
	var cal = Calendar._C;
	if (!cal) {
		return false;
	}
	var cal = cal;
	var cd = cal.activeDiv;
	var mc = cal.monthsCombo;
	if (cal.hilitedMonth) {
		Calendar.removeClass(cal.hilitedMonth, "hilite");
	}
	if (cal.activeMonth) {
		Calendar.removeClass(cal.activeMonth, "active");
	}
	var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
	Calendar.addClass(mon, "active");
	cal.activeMonth = mon;
	var s = mc.style;
	s.display = "block";
	if (cd.navtype < 0)
		s.left = cd.offsetLeft + "px";
	else {
		var mcw = mc.offsetWidth;
		if (typeof mcw == "undefined")
			// Konqueror brain-dead techniques
			mcw = 50;
		s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
	}
	s.top = (cd.offsetTop + cd.offsetHeight) + "px";
};

Calendar.showYearsCombo = function (fwd) {
	var cal = Calendar._C;
	if (!cal) {
		return false;
	}
	var cal = cal;
	var cd = cal.activeDiv;
	var yc = cal.yearsCombo;
	if (cal.hilitedYear) {
		Calendar.removeClass(cal.hilitedYear, "hilite");
	}
	if (cal.activeYear) {
		Calendar.removeClass(cal.activeYear, "active");
	}
	cal.activeYear = null;
	var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
	var yr = yc.firstChild;
	var show = false;
	for (var i = 12; i > 0; --i) {
		if (Y >= cal.minYear && Y <= cal.maxYear) {
			yr.innerHTML = Y;
			yr.year = Y;
			yr.style.display = "block";
			show = true;
		} else {
			yr.style.display = "none";
		}
		yr = yr.nextSibling;
		Y += fwd ? cal.yearStep : -cal.yearStep;
	}
	if (show) {
		var s = yc.style;
		s.display = "block";
		if (cd.navtype < 0)
			s.left = cd.offsetLeft + "px";
		else {
			var ycw = yc.offsetWidth;
			if (typeof ycw == "undefined")
				// Konqueror brain-dead techniques
				ycw = 50;
			s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
		}
		s.top = (cd.offsetTop + cd.offsetHeight) + "px";
	}
};

// event handlers

Calendar.tableMouseUp = function(ev) {
	var cal = Calendar._C;
	if (!cal) {
		return false;
	}
	if (cal.timeout) {
		clearTimeout(cal.timeout);
	}
	var el = cal.activeDiv;
	if (!el) {
		return false;
	}
	var target = Calendar.getTargetElement(ev);
	ev || (ev = window.event);
	Calendar.removeClass(el, "active");
	if (target == el || target.parentNode == el) {
		Calendar.cellClick(el, ev);
	}
	var mon = Calendar.findMonth(target);
	var date = null;
	if (mon) {
		date = new Date(cal.date);
		if (mon.month != date.getMonth()) {
			date.setMonth(mon.month);
			cal.setDate(date);
			cal.dateClicked = false;
			cal.callHandler();
		}
	} else {
		var year = Calendar.findYear(target);
		if (year) {
			date = new Date(cal.date);
			if (year.year != date.getFullYear()) {
				date.setFullYear(year.year);
				cal.setDate(date);
				cal.dateClicked = false;
				cal.callHandler();
			}
		}
	}
	with (Calendar) {
		removeEvent(document, "mouseup", tableMouseUp);
		removeEvent(document, "mouseover", tableMouseOver);
		removeEvent(document, "mousemove", tableMouseOver);
		cal._hideCombos();
		_C = null;
		return stopEvent(ev);
	}
};

Calendar.tableMouseOver = function (ev) {
	var cal = Calendar._C;
	if (!cal) {
		return;
	}
	var el = cal.activeDiv;
	var target = Calendar.getTargetElement(ev);
	if (target == el || target.parentNode == el) {
		Calendar.addClass(el, "hilite active");
		Calendar.addClass(el.parentNode, "rowhilite");
	} else {
		if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
			Calendar.removeClass(el, "active");
		Calendar.removeClass(el, "hilite");
		Calendar.removeClass(el.parentNode, "rowhilite");
	}
	ev || (ev = window.event);
	if (el.navtype == 50 && target != el) {
		var pos = Calendar.getAbsolutePos(el);
		var w = el.offsetWidth;
		var x = ev.clientX;
		var dx;
		var decrease = true;
		if (x > pos.x + w) {
			dx = x - pos.x - w;
			decrease = false;
		} else
			dx = pos.x - x;

		if (dx < 0) dx = 0;
		var range = el._range;
		var current = el._current;
		var count = Math.floor(dx / 10) % range.length;
		for (var i = range.length; --i >= 0;)
			if (range[i] == current)
				break;
		while (count-- > 0)
			if (decrease) {
				if (--i < 0)
					i = range.length - 1;
			} else if ( ++i >= range.length )
				i = 0;
		var newval = range[i];
		el.innerHTML = newval;

		cal.onUpdateTime();
	}
	var mon = Calendar.findMonth(target);
	if (mon) {
		if (mon.month != cal.date.getMonth()) {
			if (cal.hilitedMonth) {
				Calendar.removeClass(cal.hilitedMonth, "hilite");
			}
			Calendar.addClass(mon, "hilite");
			cal.hilitedMonth = mon;
		} else if (cal.hilitedMonth) {
			Calendar.removeClass(cal.hilitedMonth, "hilite");
		}
	} else {
		if (cal.hilitedMonth) {
			Calendar.removeClass(cal.hilitedMonth, "hilite");
		}
		var year = Calendar.findYear(target);
		if (year) {
			if (year.year != cal.date.getFullYear()) {
				if (cal.hilitedYear) {
					Calendar.removeClass(cal.hilitedYear, "hilite");
				}
				Calendar.addClass(year, "hilite");
				cal.hilitedYear = year;
			} else if (cal.hilitedYear) {
				Calendar.removeClass(cal.hilitedYear, "hilite");
			}
		} else if (cal.hilitedYear) {
			Calendar.removeClass(cal.hilitedYear, "hilite");
		}
	}
	return Calendar.stopEvent(ev);
};

Calendar.tableMouseDown = function (ev) {
	if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
		return Calendar.stopEvent(ev);
	}
};

Calendar.calDragIt = function (ev) {
	var cal = Calendar._C;
	if (!(cal && cal.dragging)) {
		return false;
	}
	var posX;
	var posY;
	if (Calendar.is_ie) {
		posY = window.event.clientY + document.body.scrollTop;
		posX = window.event.clientX + document.body.scrollLeft;
	} else {
		posX = ev.pageX;
		posY = ev.pageY;
	}
	cal.hideShowCovered();
	var st = cal.element.style;
	st.left = (posX - cal.xOffs) + "px";
	st.top = (posY - cal.yOffs) + "px";
	return Calendar.stopEvent(ev);
};

Calendar.calDragEnd = function (ev) {
	var cal = Calendar._C;
	if (!cal) {
		return false;
	}
	cal.dragging = false;
	with (Calendar) {
		removeEvent(document, "mousemove", calDragIt);
		removeEvent(document, "mouseup", calDragEnd);
		tableMouseUp(ev);
	}
	cal.hideShowCovered();
};

Calendar.dayMouseDown = function(ev) {
	var el = Calendar.getElement(ev);
	if (el.disabled) {
		return false;
	}
	var cal = el.calendar;
	cal.activeDiv = el;
	Calendar._C = cal;
	if (el.navtype != 300) with (Calendar) {
		if (el.navtype == 50) {
			el._current = el.innerHTML;
			addEvent(document, "mousemove", tableMouseOver);
		} else
			addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
		addClass(el, "hilite active");
		addEvent(document, "mouseup", tableMouseUp);
	} else if (cal.isPopup) {
		cal._dragStart(ev);
	}
	if (el.navtype == -1 || el.navtype == 1) {
		if (cal.timeout) clearTimeout(cal.timeout);
		cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
	} else if (el.navtype == -2 || el.navtype == 2) {
		if (cal.timeout) clearTimeout(cal.timeout);
		cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
	} else {
		cal.timeout = null;
	}
	return Calendar.stopEvent(ev);
};

Calendar.dayMouseDblClick = function(ev) {
	Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
	if (Calendar.is_ie) {
		document.selection.empty();
	}
};

Calendar.dayMouseOver = function(ev) {
	var el = Calendar.getElement(ev);
	if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
		return false;
	}
	if (el.ttip) {
		if (el.ttip.substr(0, 1) == "_") {
			el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
		}
		el.calendar.tooltips.innerHTML = el.ttip;
	}
	if (el.navtype != 300) {
		Calendar.addClass(el, "hilite");
		if (el.caldate) {
			Calendar.addClass(el.parentNode, "rowhilite");
		}
	}
	return Calendar.stopEvent(ev);
};

Calendar.dayMouseOut = function(ev) {
	with (Calendar) {
		var el = getElement(ev);
		if (isRelated(el, ev) || _C || el.disabled)
			return false;
		removeClass(el, "hilite");
		if (el.caldate)
			removeClass(el.parentNode, "rowhilite");
		if (el.calendar)
			el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
		return stopEvent(ev);
	}
};

/*
 *  A generic "click" handler :) handles all types of buttons defined in this
 *  calendar.
 */
Calendar.cellClick = function(el, ev) {
	var cal = el.calendar;
	var closing = false;
	var newdate = false;
	var date = null;
	if (typeof el.navtype == "undefined") {
		if (cal.currentDateEl) {
			Calendar.removeClass(cal.currentDateEl, "cselected");
			Calendar.addClass(el, "cselected");
			closing = (cal.currentDateEl == el);
			if (!closing) {
				cal.currentDateEl = el;
			}
		}
		cal.date.setDateOnly(el.caldate);
		date = cal.date;
		var other_month = !(cal.dateClicked = !el.otherMonth);
		if (!other_month && !cal.currentDateEl)
			cal._toggleMultipleDate(new Date(date));
		else
			newdate = !el.disabled;
		// a date was clicked
		if (other_month)
			cal._init(cal.firstDayOfWeek, date);
	} else {
		if (el.navtype == 200) {
			Calendar.removeClass(el, "hilite");
			cal.callCloseHandler();
			return;
		}
		date = new Date(cal.date);
		if (el.navtype == 0)
			date.setDateOnly(new Date()); // TODAY
		// unless "today" was clicked, we assume no date was clicked so
		// the selected handler will know not to close the calenar when
		// in single-click mode.
		// cal.dateClicked = (el.navtype == 0);
		cal.dateClicked = false;
		var year = date.getFullYear();
		var mon = date.getMonth();
		function setMonth(m) {
			var day = date.getDate();
			var max = date.getMonthDays(m);
			if (day > max) {
				date.setDate(max);
			}
			date.setMonth(m);
		};
		switch (el.navtype) {
		    case 400:
			Calendar.removeClass(el, "hilite");
			var text = Calendar._TT["ABOUT"];
			if (typeof text != "undefined") {
				text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
			} else {
				// FIXME: this should be removed as soon as lang files get updated!
				text = "Help and about box text is not translated into this language.\n" +
					"If you know this language and you feel generous please update\n" +
					"the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
					"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n" +
					"Thank you!\n" +
					"http://dynarch.com/mishoo/calendar.epl\n";
			}
			alert(text);
			return;
		    case -2:
			if (year > cal.minYear) {
				date.setFullYear(year - 1);
			}
			break;
		    case -1:
			if (mon > 0) {
				setMonth(mon - 1);
			} else if (year-- > cal.minYear) {
				date.setFullYear(year);
				setMonth(11);
			}
			break;
		    case 1:
			if (mon < 11) {
				setMonth(mon + 1);
			} else if (year < cal.maxYear) {
				date.setFullYear(year + 1);
				setMonth(0);
			}
			break;
		    case 2:
			if (year < cal.maxYear) {
				date.setFullYear(year + 1);
			}
			break;
		    case 100:
			cal.setFirstDayOfWeek(el.fdow);
			return;
		    case 50:
			var range = el._range;
			var current = el.innerHTML;
			for (var i = range.length; --i >= 0;)
				if (range[i] == current)
					break;
			if (ev && ev.shiftKey) {
				if (--i < 0)
					i = range.length - 1;
			} else if ( ++i >= range.length )
				i = 0;
			var newval = range[i];
			el.innerHTML = newval;
			cal.onUpdateTime();
			return;
		    case 0:
			// TODAY will bring us here
			if ((typeof cal.getDateStatus == "function") &&
			    cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
				return false;
			}
			break;
		}
		if (!date.equalsTo(cal.date)) {
			cal.setDate(date);
			newdate = true;
		} else if (el.navtype == 0)
			newdate = closing = true;
	}
	if (newdate) {
		ev && cal.callHandler();
	}
	if (closing) {
		Calendar.removeClass(el, "hilite");
		ev && cal.callCloseHandler();
	}
};

// END: CALENDAR STATIC FUNCTIONS

// BEGIN: CALENDAR OBJECT FUNCTIONS

/*
 *  This function creates the calendar inside the given parent.  If _par is
 *  null than it creates a popup calendar inside the BODY element.  If _par is
 *  an element, be it BODY, then it creates a non-popup calendar (still
 *  hidden).  Some properties need to be set before calling this function.
 */
Calendar.prototype.create = function (_par) {
	var parent = null;
	if (! _par) {
		// default parent is the document body, in which case we create
		// a popup calendar.
		parent = document.getElementsByTagName("body")[0];
		this.isPopup = true;
	} else {
		parent = _par;
		this.isPopup = false;
	}
	this.date = this.dateStr ? new Date(this.dateStr) : new Date();

	var table = Calendar.createElement("table");
	this.table = table;
	table.cellSpacing = 0;
	table.cellPadding = 0;
	table.calendar = this;
	Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);

	var div = Calendar.createElement("div");
	this.element = div;
	div.className = "calendar";
	if (this.isPopup) {
		div.style.position = "absolute";
		div.style.display = "none";
	}
	div.appendChild(table);

	var thead = Calendar.createElement("thead", table);
	var cell = null;
	var row = null;

	var cal = this;
	var hh = function (text, cs, navtype) {
		cell = Calendar.createElement("td", row);
		cell.colSpan = cs;
		cell.className = "button";
		if (navtype != 0 && Math.abs(navtype) <= 2)
			cell.className += " nav";
		Calendar._add_evs(cell);
		cell.calendar = cal;
		cell.navtype = navtype;
		cell.innerHTML = "<div unselectable='on'>" + text + "</div>";
		return cell;
	};

	row = Calendar.createElement("tr", thead);
	var title_length = 6;
	(this.isPopup) && --title_length;
	(this.weekNumbers) && ++title_length;

	hh("?", 1, 400).ttip = Calendar._TT["INFO"];
	this.title = hh("", title_length, 300);
	this.title.className = "title";
	if (this.isPopup) {
		this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
		this.title.style.cursor = "move";
		hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
	}

	row = Calendar.createElement("tr", thead);
	row.className = "headrow";

	this._nav_py = hh("&#x00ab;", 1, -2);
	this._nav_py.ttip = Calendar._TT["PREV_YEAR"];

	this._nav_pm = hh("&#x2039;", 1, -1);
	this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];

	this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
	this._nav_now.ttip = Calendar._TT["GO_TODAY"];

	this._nav_nm = hh("&#x203a;", 1, 1);
	this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];

	this._nav_ny = hh("&#x00bb;", 1, 2);
	this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];

	// day names
	row = Calendar.createElement("tr", thead);
	row.className = "daynames";
	if (this.weekNumbers) {
		cell = Calendar.createElement("td", row);
		cell.className = "name wn";
		cell.innerHTML = Calendar._TT["WK"];
	}
	for (var i = 7; i > 0; --i) {
		cell = Calendar.createElement("td", row);
		if (!i) {
			cell.navtype = 100;
			cell.calendar = this;
			Calendar._add_evs(cell);
		}
	}
	this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
	this._displayWeekdays();

	var tbody = Calendar.createElement("tbody", table);
	this.tbody = tbody;

	for (i = 6; i > 0; --i) {
		row = Calendar.createElement("tr", tbody);
		if (this.weekNumbers) {
			cell = Calendar.createElement("td", row);
		}
		for (var j = 7; j > 0; --j) {
			cell = Calendar.createElement("td", row);
			cell.calendar = this;
			Calendar._add_evs(cell);
		}
	}

	if (this.showsTime) {
		row = Calendar.createElement("tr", tbody);
		row.className = "time";

		cell = Calendar.createElement("td", row);
		cell.className = "time";
		cell.colSpan = 2;
		cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";

		cell = Calendar.createElement("td", row);
		cell.className = "time";
		cell.colSpan = this.weekNumbers ? 4 : 3;

		(function(){
			function makeTimePart(className, init, range_start, range_end) {
				var part = Calendar.createElement("span", cell);
				part.className = className;
				part.innerHTML = init;
				part.calendar = cal;
				part.ttip = Calendar._TT["TIME_PART"];
				part.navtype = 50;
				part._range = [];
				if (typeof range_start != "number")
					part._range = range_start;
				else {
					for (var i = range_start; i <= range_end; ++i) {
						var txt;
						if (i < 10 && range_end >= 10) txt = '0' + i;
						else txt = '' + i;
						part._range[part._range.length] = txt;
					}
				}
				Calendar._add_evs(part);
				return part;
			};
			var hrs = cal.date.getHours();
			var mins = cal.date.getMinutes();
			var t12 = !cal.time24;
			var pm = (hrs > 12);
			if (t12 && pm) hrs -= 12;
			var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
			var span = Calendar.createElement("span", cell);
			span.innerHTML = ":";
			span.className = "colon";
			var M = makeTimePart("minute", mins, 0, 59);
			var AP = null;
			cell = Calendar.createElement("td", row);
			cell.className = "time";
			cell.colSpan = 2;
			if (t12)
				AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
			else
				cell.innerHTML = "&nbsp;";

			cal.onSetTime = function() {
				var pm, hrs = this.date.getHours(),
					mins = this.date.getMinutes();
				if (t12) {
					pm = (hrs >= 12);
					if (pm) hrs -= 12;
					if (hrs == 0) hrs = 12;
					AP.innerHTML = pm ? "pm" : "am";
				}
				H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
				M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
			};

			cal.onUpdateTime = function() {
				var date = this.date;
				var h = parseInt(H.innerHTML, 10);
				if (t12) {
					if (/pm/i.test(AP.innerHTML) && h < 12)
						h += 12;
					else if (/am/i.test(AP.innerHTML) && h == 12)
						h = 0;
				}
				var d = date.getDate();
				var m = date.getMonth();
				var y = date.getFullYear();
				date.setHours(h);
				date.setMinutes(parseInt(M.innerHTML, 10));
				date.setFullYear(y);
				date.setMonth(m);
				date.setDate(d);
				this.dateClicked = false;
				this.callHandler();
			};
		})();
	} else {
		this.onSetTime = this.onUpdateTime = function() {};
	}

	var tfoot = Calendar.createElement("tfoot", table);

	row = Calendar.createElement("tr", tfoot);
	row.className = "footrow";

	cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
	cell.className = "ttip";
	if (this.isPopup) {
		cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
		cell.style.cursor = "move";
	}
	this.tooltips = cell;

	div = Calendar.createElement("div", this.element);
	this.monthsCombo = div;
	div.className = "combo";
	for (i = 0; i < Calendar._MN.length; ++i) {
		var mn = Calendar.createElement("div");
		mn.className = Calendar.is_ie ? "label-IEfix" : "label";
		mn.month = i;
		mn.innerHTML = Calendar._SMN[i];
		div.appendChild(mn);
	}

	div = Calendar.createElement("div", this.element);
	this.yearsCombo = div;
	div.className = "combo";
	for (i = 12; i > 0; --i) {
		var yr = Calendar.createElement("div");
		yr.className = Calendar.is_ie ? "label-IEfix" : "label";
		div.appendChild(yr);
	}

	this._init(this.firstDayOfWeek, this.date);
	parent.appendChild(this.element);
};

/* keyboard navigation, only for popup calendars */
Calendar._keyEvent = function(ev) {
	var cal = window._dynarch_popupCalendar;
	if (!cal || cal.multiple)
		return false;
	(Calendar.is_ie) && (ev = window.event);
	var act = (Calendar.is_ie || ev.type == "keypress"),
		K = ev.keyCode;
	if (ev.ctrlKey) {
		switch (K) {
		    case 37: // KEY left
			act && Calendar.cellClick(cal._nav_pm);
			break;
		    case 38: // KEY up
			act && Calendar.cellClick(cal._nav_py);
			break;
		    case 39: // KEY right
			act && Calendar.cellClick(cal._nav_nm);
			break;
		    case 40: // KEY down
			act && Calendar.cellClick(cal._nav_ny);
			break;
		    default:
			return false;
		}
	} else switch (K) {
	    case 32: // KEY space (now)
		Calendar.cellClick(cal._nav_now);
		break;
	    case 27: // KEY esc
		act && cal.callCloseHandler();
		break;
	    case 37: // KEY left
	    case 38: // KEY up
	    case 39: // KEY right
	    case 40: // KEY down
		if (act) {
			var prev, x, y, ne, el, step;
			prev = K == 37 || K == 38;
			step = (K == 37 || K == 39) ? 1 : 7;
			function setVars() {
				el = cal.currentDateEl;
				var p = el.pos;
				x = p & 15;
				y = p >> 4;
				ne = cal.ar_days[y][x];
			};setVars();
			function prevMonth() {
				var date = new Date(cal.date);
				date.setDate(date.getDate() - step);
				cal.setDate(date);
			};
			function nextMonth() {
				var date = new Date(cal.date);
				date.setDate(date.getDate() + step);
				cal.setDate(date);
			};
			while (1) {
				switch (K) {
				    case 37: // KEY left
					if (--x >= 0)
						ne = cal.ar_days[y][x];
					else {
						x = 6;
						K = 38;
						continue;
					}
					break;
				    case 38: // KEY up
					if (--y >= 0)
						ne = cal.ar_days[y][x];
					else {
						prevMonth();
						setVars();
					}
					break;
				    case 39: // KEY right
					if (++x < 7)
						ne = cal.ar_days[y][x];
					else {
						x = 0;
						K = 40;
						continue;
					}
					break;
				    case 40: // KEY down
					if (++y < cal.ar_days.length)
						ne = cal.ar_days[y][x];
					else {
						nextMonth();
						setVars();
					}
					break;
				}
				break;
			}
			if (ne) {
				if (!ne.disabled)
					Calendar.cellClick(ne);
				else if (prev)
					prevMonth();
				else
					nextMonth();
			}
		}
		break;
	    case 13: // KEY enter
		if (act)
			Calendar.cellClick(cal.currentDateEl, ev);
		break;
	    default:
		return false;
	}
	return Calendar.stopEvent(ev);
};

/*
 *  (RE)Initializes the calendar to the given date and firstDayOfWeek
 */
Calendar.prototype._init = function (firstDayOfWeek, date) {
	var today = new Date(),
		TY = today.getFullYear(),
		TM = today.getMonth(),
		TD = today.getDate();
	//this.table.style.visibility = "hidden";
	var year = date.getFullYear();
	if (year < this.minYear) {
		year = this.minYear;
		date.setFullYear(year);
	} else if (year > this.maxYear) {
		year = this.maxYear;
		date.setFullYear(year);
	}
	this.firstDayOfWeek = firstDayOfWeek;
	this.date = new Date(date);
	var month = date.getMonth();
	var mday = date.getDate();
	var no_days = date.getMonthDays();

	// calendar voodoo for computing the first day that would actually be
	// displayed in the calendar, even if it's from the previous month.
	// WARNING: this is magic. ;-)
	date.setDate(1);
	var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
	if (day1 < 0)
		day1 += 7;
	date.setDate(-day1);
	date.setDate(date.getDate() + 1);

	var row = this.tbody.firstChild;
	var MN = Calendar._SMN[month];
	var ar_days = this.ar_days = new Array();
	var weekend = Calendar._TT["WEEKEND"];
	var dates = this.multiple ? (this.datesCells = {}) : null;
	for (var i = 0; i < 6; ++i, row = row.nextSibling) {
		var cell = row.firstChild;
		if (this.weekNumbers) {
			cell.className = "day wn";
			cell.innerHTML = date.getWeekNumber();
			cell = cell.nextSibling;
		}
		row.className = "daysrow";
		var hasdays = false, iday, dpos = ar_days[i] = [];
		for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
			iday = date.getDate();
			var wday = date.getDay();
			cell.className = "day";
			cell.pos = i << 4 | j;
			dpos[j] = cell;
			var current_month = (date.getMonth() == month);
			if (!current_month) {
				if (this.showsOtherMonths) {
					cell.className += " othermonth";
					cell.otherMonth = true;
				} else {
					cell.className = "emptycell";
					cell.innerHTML = "&nbsp;";
					cell.disabled = true;
					continue;
				}
			} else {
				cell.otherMonth = false;
				hasdays = true;
			}
			cell.disabled = false;
			cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
			if (dates)
				dates[date.print("%Y%m%d")] = cell;
			if (this.getDateStatus) {
				var status = this.getDateStatus(date, year, month, iday);
				if (this.getDateToolTip) {
					var toolTip = this.getDateToolTip(date, year, month, iday);
					if (toolTip)
						cell.title = toolTip;
				}
				if (status === true) {
					cell.className += " disabled";
					cell.disabled = true;
				} else {
					if (/disabled/i.test(status))
						cell.disabled = true;
					cell.className += " " + status;
				}
			}
			if (!cell.disabled) {
				cell.caldate = new Date(date);
				cell.ttip = "_";
				if (!this.multiple && current_month
				    && iday == mday && this.hiliteToday) {
					cell.className += " cselected";
					this.currentDateEl = cell;
				}
				if (date.getFullYear() == TY &&
				    date.getMonth() == TM &&
				    iday == TD) {
					cell.className += " today";
					cell.ttip += Calendar._TT["PART_TODAY"];
				}
				if (weekend.indexOf(wday.toString()) != -1)
					cell.className += cell.otherMonth ? " oweekend" : " weekend";
			}
		}
		if (!(hasdays || this.showsOtherMonths))
			row.className = "emptyrow";
	}
	this.title.innerHTML = Calendar._MN[month] + ", " + year;
	this.onSetTime();
	this.table.style.visibility = "visible";
	this._initMultipleDates();
	// PROFILE
	// this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
};

Calendar.prototype._initMultipleDates = function() {
	if (this.multiple) {
		for (var i in this.multiple) {
			var cell = this.datesCells[i];
			var d = this.multiple[i];
			if (!d)
				continue;
			if (cell)
				cell.className += " cselected";
		}
	}
};

Calendar.prototype._toggleMultipleDate = function(date) {
	if (this.multiple) {
		var ds = date.print("%Y%m%d");
		var cell = this.datesCells[ds];
		if (cell) {
			var d = this.multiple[ds];
			if (!d) {
				Calendar.addClass(cell, "cselected");
				this.multiple[ds] = date;
			} else {
				Calendar.removeClass(cell, "cselected");
				delete this.multiple[ds];
			}
		}
	}
};

Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
	this.getDateToolTip = unaryFunction;
};

/*
 *  Calls _init function above for going to a certain date (but only if the
 *  date is different than the currently selected one).
 */
Calendar.prototype.setDate = function (date) {
	if (!date.equalsTo(this.date)) {
		this._init(this.firstDayOfWeek, date);
	}
};

/*
 *  Refreshes the calendar.  Useful if the "disabledHandler" function is
 *  dynamic, meaning that the list of disabled date can change at runtime.
 *  Just * call this function if you think that the list of disabled dates
 *  should * change.
 */
Calendar.prototype.refresh = function () {
	this._init(this.firstDayOfWeek, this.date);
};

/* Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
	this._init(firstDayOfWeek, this.date);
	this._displayWeekdays();
};

/*
 *  Allows customization of what dates are enabled.  The "unaryFunction"
 *  parameter must be a function object that receives the date (as a JS Date
 *  object) and returns a boolean value.  If the returned value is true then
 *  the passed date will be marked as disabled.
 */
Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
	this.getDateStatus = unaryFunction;
};

/* Customization of allowed year range for the calendar. */
Calendar.prototype.setRange = function (a, z) {
	this.minYear = a;
	this.maxYear = z;
};

/* Calls the first user handler (selectedHandler). */
Calendar.prototype.callHandler = function () {
	if (this.onSelected) {
		this.onSelected(this, this.date.print(this.dateFormat));
	}
};

/* Calls the second user handler (closeHandler). */
Calendar.prototype.callCloseHandler = function () {
	if (this.onClose) {
		this.onClose(this);
	}
	this.hideShowCovered();
};

/* Removes the calendar object from the DOM tree and destroys it. */
Calendar.prototype.destroy = function () {
	var el = this.element.parentNode;
	el.removeChild(this.element);
	Calendar._C = null;
	window._dynarch_popupCalendar = null;
};

/*
 *  Moves the calendar element to a different section in the DOM tree (changes
 *  its parent).
 */
Calendar.prototype.reparent = function (new_parent) {
	var el = this.element;
	el.parentNode.removeChild(el);
	new_parent.appendChild(el);
};

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
Calendar._checkCalendar = function(ev) {
	var calendar = window._dynarch_popupCalendar;
	if (!calendar) {
		return false;
	}
	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
	for (; el != null && el != calendar.element; el = el.parentNode);
	if (el == null) {
		// calls closeHandler which should hide the calendar.
		window._dynarch_popupCalendar.callCloseHandler();
		return Calendar.stopEvent(ev);
	}
};

/* Shows the calendar. */
Calendar.prototype.show = function () {
	var rows = this.table.getElementsByTagName("tr");
	for (var i = rows.length; i > 0;) {
		var row = rows[--i];
		Calendar.removeClass(row, "rowhilite");
		var cells = row.getElementsByTagName("td");
		for (var j = cells.length; j > 0;) {
			var cell = cells[--j];
			Calendar.removeClass(cell, "hilite");
			Calendar.removeClass(cell, "active");
		}
	}
	this.element.style.display = "block";
	this.hidden = false;
	if (this.isPopup) {
		window._dynarch_popupCalendar = this;
		Calendar.addEvent(document, "keydown", Calendar._keyEvent);
		Calendar.addEvent(document, "keypress", Calendar._keyEvent);
		Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
	}
	this.hideShowCovered();
};

/*
 *  Hides the calendar.  Also removes any "hilite" from the class of any TD
 *  element.
 */
Calendar.prototype.hide = function () {
	if (this.isPopup) {
		Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
		Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
		Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
	}
	this.element.style.display = "none";
	this.hidden = true;
	this.hideShowCovered();
};

/*
 *  Shows the calendar at a given absolute position (beware that, depending on
 *  the calendar element style -- position property -- this might be relative
 *  to the parent's containing rectangle).
 */
Calendar.prototype.showAt = function (x, y) {
	var s = this.element.style;
	s.left = x + "px";
	s.top = y + "px";
	this.show();
};

/* Shows the calendar near a given element. */
Calendar.prototype.showAtElement = function (el, opts) {
	var self = this;
	var p = Calendar.getAbsolutePos(el);
	if (!opts || typeof opts != "string") {
		this.showAt(p.x, p.y + el.offsetHeight);
		return true;
	}
	function fixPosition(box) {
		if (box.x < 0)
			box.x = 0;
		if (box.y < 0)
			box.y = 0;
		var cp = document.createElement("div");
		var s = cp.style;
		s.position = "absolute";
		s.right = s.bottom = s.width = s.height = "0px";
		document.body.appendChild(cp);
		var br = Calendar.getAbsolutePos(cp);
		document.body.removeChild(cp);
		if (Calendar.is_ie) {
			br.y += document.body.scrollTop;
			br.x += document.body.scrollLeft;
		} else {
			br.y += window.scrollY;
			br.x += window.scrollX;
		}
		var tmp = box.x + box.width - br.x;
		if (tmp > 0) box.x -= tmp;
		tmp = box.y + box.height - br.y;
		if (tmp > 0) box.y -= tmp;
	};
	this.element.style.display = "block";
	Calendar.continuation_for_the_fucking_khtml_browser = function() {
		var w = self.element.offsetWidth;
		var h = self.element.offsetHeight;
		self.element.style.display = "none";
		var valign = opts.substr(0, 1);
		var halign = "l";
		if (opts.length > 1) {
			halign = opts.substr(1, 1);
		}
		// vertical alignment
		switch (valign) {
		    case "T": p.y -= h; break;
		    case "B": p.y += el.offsetHeight; break;
		    case "C": p.y += (el.offsetHeight - h) / 2; break;
		    case "t": p.y += el.offsetHeight - h; break;
		    case "b": break; // already there
		}
		// horizontal alignment
		switch (halign) {
		    case "L": p.x -= w; break;
		    case "R": p.x += el.offsetWidth; break;
		    case "C": p.x += (el.offsetWidth - w) / 2; break;
		    case "l": p.x += el.offsetWidth - w; break;
		    case "r": break; // already there
		}
		p.width = w;
		p.height = h + 40;
		self.monthsCombo.style.display = "none";
		fixPosition(p);
		self.showAt(p.x, p.y);
	};
	if (Calendar.is_khtml)
		setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
	else
		Calendar.continuation_for_the_fucking_khtml_browser();
};

/* Customizes the date format. */
Calendar.prototype.setDateFormat = function (str) {
	this.dateFormat = str;
};

/* Customizes the tooltip date format. */
Calendar.prototype.setTtDateFormat = function (str) {
	this.ttDateFormat = str;
};

/*
 *  Tries to identify the date represented in a string.  If successful it also
 *  calls this.setDate which moves the calendar to the given date.
 */
Calendar.prototype.parseDate = function(str, fmt) {
	if (!fmt)
		fmt = this.dateFormat;
	this.setDate(Date.parseDate(str, fmt));
};

Calendar.prototype.hideShowCovered = function () {
	if (!Calendar.is_ie && !Calendar.is_opera)
		return;
	function getVisib(obj){
		var value = obj.style.visibility;
		if (!value) {
			if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
				if (!Calendar.is_khtml)
					value = document.defaultView.
						getComputedStyle(obj, "").getPropertyValue("visibility");
				else
					value = '';
			} else if (obj.currentStyle) { // IE
				value = obj.currentStyle.visibility;
			} else
				value = '';
		}
		return value;
	};

	var tags = new Array("applet", "iframe", "select");
	var el = this.element;

	var p = Calendar.getAbsolutePos(el);
	var EX1 = p.x;
	var EX2 = el.offsetWidth + EX1;
	var EY1 = p.y;
	var EY2 = el.offsetHeight + EY1;

	for (var k = tags.length; k > 0; ) {
		var ar = document.getElementsByTagName(tags[--k]);
		var cc = null;

		for (var i = ar.length; i > 0;) {
			cc = ar[--i];

			p = Calendar.getAbsolutePos(cc);
			var CX1 = p.x;
			var CX2 = cc.offsetWidth + CX1;
			var CY1 = p.y;
			var CY2 = cc.offsetHeight + CY1;

			if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
				if (!cc.__msh_save_visibility) {
					cc.__msh_save_visibility = getVisib(cc);
				}
				cc.style.visibility = cc.__msh_save_visibility;
			} else {
				if (!cc.__msh_save_visibility) {
					cc.__msh_save_visibility = getVisib(cc);
				}
				cc.style.visibility = "hidden";
			}
		}
	}
};

/* Internal function; it displays the bar with the names of the weekday. */
Calendar.prototype._displayWeekdays = function () {
	var fdow = this.firstDayOfWeek;
	var cell = this.firstdayname;
	var weekend = Calendar._TT["WEEKEND"];
	for (var i = 0; i < 7; ++i) {
		cell.className = "day name";
		var realday = (i + fdow) % 7;
		if (i) {
			cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
			cell.navtype = 100;
			cell.calendar = this;
			cell.fdow = realday;
			Calendar._add_evs(cell);
		}
		if (weekend.indexOf(realday.toString()) != -1) {
			Calendar.addClass(cell, "weekend");
		}
		cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
		cell = cell.nextSibling;
	}
};

/* Internal function.  Hides all combo boxes that might be displayed. */
Calendar.prototype._hideCombos = function () {
	this.monthsCombo.style.display = "none";
	this.yearsCombo.style.display = "none";
};

/* Internal function.  Starts dragging the element. */
Calendar.prototype._dragStart = function (ev) {
	if (this.dragging) {
		return;
	}
	this.dragging = true;
	var posX;
	var posY;
	if (Calendar.is_ie) {
		posY = window.event.clientY + document.body.scrollTop;
		posX = window.event.clientX + document.body.scrollLeft;
	} else {
		posY = ev.clientY + window.scrollY;
		posX = ev.clientX + window.scrollX;
	}
	var st = this.element.style;
	this.xOffs = posX - parseInt(st.left);
	this.yOffs = posY - parseInt(st.top);
	with (Calendar) {
		addEvent(document, "mousemove", calDragIt);
		addEvent(document, "mouseup", calDragEnd);
	}
};

// BEGIN: DATE OBJECT PATCHES

/* Adds the number of days array to the Date object. */
Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

/* Constants used for time computations */
Date.SECOND = 1000 /* milliseconds */;
Date.MINUTE = 60 * Date.SECOND;
Date.HOUR   = 60 * Date.MINUTE;
Date.DAY    = 24 * Date.HOUR;
Date.WEEK   =  7 * Date.DAY;

Date.parseDate = function(str, fmt) {
	var today = new Date();
	var y = 0;
	var m = -1;
	var d = 0;
	var a = str.split(/\W+/);
	var b = fmt.match(/%./g);
	var i = 0, j = 0;
	var hr = 0;
	var min = 0;
	for (i = 0; i < a.length; ++i) {
		if (!a[i])
			continue;
		switch (b[i]) {
		    case "%d":
		    case "%e":
			d = parseInt(a[i], 10);
			break;

		    case "%m":
			m = parseInt(a[i], 10) - 1;
			break;

		    case "%Y":
		    case "%y":
			y = parseInt(a[i], 10);
			(y < 100) && (y += (y > 29) ? 1900 : 2000);
			break;

		    case "%b":
		    case "%B":
			for (j = 0; j < 12; ++j) {
				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
			}
			break;

		    case "%H":
		    case "%I":
		    case "%k":
		    case "%l":
			hr = parseInt(a[i], 10);
			break;

		    case "%P":
		    case "%p":
			if (/pm/i.test(a[i]) && hr < 12)
				hr += 12;
			else if (/am/i.test(a[i]) && hr >= 12)
				hr -= 12;
			break;

		    case "%M":
			min = parseInt(a[i], 10);
			break;
		}
	}
	if (isNaN(y)) y = today.getFullYear();
	if (isNaN(m)) m = today.getMonth();
	if (isNaN(d)) d = today.getDate();
	if (isNaN(hr)) hr = today.getHours();
	if (isNaN(min)) min = today.getMinutes();
	if (y != 0 && m != -1 && d != 0)
		return new Date(y, m, d, hr, min, 0);
	y = 0; m = -1; d = 0;
	for (i = 0; i < a.length; ++i) {
		if (a[i].search(/[a-zA-Z]+/) != -1) {
			var t = -1;
			for (j = 0; j < 12; ++j) {
				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
			}
			if (t != -1) {
				if (m != -1) {
					d = m+1;
				}
				m = t;
			}
		} else if (parseInt(a[i], 10) <= 12 && m == -1) {
			m = a[i]-1;
		} else if (parseInt(a[i], 10) > 31 && y == 0) {
			y = parseInt(a[i], 10);
			(y < 100) && (y += (y > 29) ? 1900 : 2000);
		} else if (d == 0) {
			d = a[i];
		}
	}
	if (y == 0)
		y = today.getFullYear();
	if (m != -1 && d != 0)
		return new Date(y, m, d, hr, min, 0);
	return today;
};

/* Returns the number of days in the current month */
Date.prototype.getMonthDays = function(month) {
	var year = this.getFullYear();
	if (typeof month == "undefined") {
		month = this.getMonth();
	}
	if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
		return 29;
	} else {
		return Date._MD[month];
	}
};

/* Returns the number of day in the year. */
Date.prototype.getDayOfYear = function() {
	var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
	var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
	var time = now - then;
	return Math.floor(time / Date.DAY);
};

/* Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function() {
	var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
	var DoW = d.getDay();
	d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
	var ms = d.valueOf(); // GMT
	d.setMonth(0);
	d.setDate(4); // Thu in Week 1
	return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
};

/* Checks date and time equality */
Date.prototype.equalsTo = function(date) {
	return ((this.getFullYear() == date.getFullYear()) &&
		(this.getMonth() == date.getMonth()) &&
		(this.getDate() == date.getDate()) &&
		(this.getHours() == date.getHours()) &&
		(this.getMinutes() == date.getMinutes()));
};

/* Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function(date) {
	var tmp = new Date(date);
	this.setDate(1);
	this.setFullYear(tmp.getFullYear());
	this.setMonth(tmp.getMonth());
	this.setDate(tmp.getDate());
};

/* Prints the date in a string according to the given format. */
Date.prototype.print = function (str) {
	var m = this.getMonth();
	var d = this.getDate();
	var y = this.getFullYear();
	var wn = this.getWeekNumber();
	var w = this.getDay();
	var s = {};
	var hr = this.getHours();
	var pm = (hr >= 12);
	var ir = (pm) ? (hr - 12) : hr;
	var dy = this.getDayOfYear();
	if (ir == 0)
		ir = 12;
	var min = this.getMinutes();
	var sec = this.getSeconds();
	s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
	s["%A"] = Calendar._DN[w]; // full weekday name
	s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
	s["%B"] = Calendar._MN[m]; // full month name
	// FIXME: %c : preferred date and time representation for the current locale
	s["%C"] = 1 + Math.floor(y / 100); // the century number
	s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
	s["%e"] = d; // the day of the month (range 1 to 31)
	// FIXME: %D : american date style: %m/%d/%y
	// FIXME: %E, %F, %G, %g, %h (man strftime)
	s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
	s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
	s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
	s["%k"] = hr;		// hour, range 0 to 23 (24h format)
	s["%l"] = ir;		// hour, range 1 to 12 (12h format)
	s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
	s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
	s["%n"] = "\n";		// a newline character
	s["%p"] = pm ? "PM" : "AM";
	s["%P"] = pm ? "pm" : "am";
	// FIXME: %r : the time in am/pm notation %I:%M:%S %p
	// FIXME: %R : the time in 24-hour notation %H:%M
	s["%s"] = Math.floor(this.getTime() / 1000);
	s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
	s["%t"] = "\t";		// a tab character
	// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
	s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
	s["%u"] = w + 1;	// the day of the week (range 1 to 7, 1 = MON)
	s["%w"] = w;		// the day of the week (range 0 to 6, 0 = SUN)
	// FIXME: %x : preferred date representation for the current locale without the time
	// FIXME: %X : preferred time representation for the current locale without the date
	s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
	s["%Y"] = y;		// year with the century
	s["%%"] = "%";		// a literal '%' character

	var re = /%./g;
	if (!Calendar.is_ie5 && !Calendar.is_khtml)
		return str.replace(re, function (par) { return s[par] || par; });

	var a = str.match(re);
	for (var i = 0; i < a.length; i++) {
		var tmp = s[a[i]];
		if (tmp) {
			re = new RegExp(a[i], 'g');
			str = str.replace(re, tmp);
		}
	}

	return str;
};

Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
Date.prototype.setFullYear = function(y) {
	var d = new Date(this);
	d.__msh_oldSetFullYear(y);
	if (d.getMonth() != this.getMonth())
		this.setDate(28);
	this.__msh_oldSetFullYear(y);
};

// END: DATE OBJECT PATCHES

// global object that remembers the calendar
window._dynarch_popupCalendar = null;


/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
 * ---------------------------------------------------------------------------
 *
 * The DHTML Calendar
 *
 * Details and latest version at:
 * http://dynarch.com/mishoo/calendar.epl
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 *
 * This file defines helper functions for setting up the calendar.  They are
 * intended to help non-programmers get a working calendar on their site
 * quickly.  This script should not be seen as part of the calendar.  It just
 * shows you what one can do with the calendar, while in the same time
 * providing a quick and simple method for setting it up.  If you need
 * exhaustive customization of the calendar creation process feel free to
 * modify this code to suit your needs (this is recommended and much better
 * than modifying calendar.js itself).
 */

// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $

/*
 *  This function "patches" an input field (or other element) to use a calendar
 *  widget for date selection.
 *
 *  The "params" is a single object that can have the following properties:
 *
 *    prop. name   | description
 *  -------------------------------------------------------------------------------------------------
 *   inputField    | the ID of an input field to store the date
 *   displayArea   | the ID of a DIV or other element to show the date
 *   button        | ID of a button or other element that will trigger the calendar
 *   eventName     | event that will trigger the calendar, without the "on" prefix (default: "click")
 *   ifFormat      | date format that will be stored in the input field
 *   daFormat      | the date format that will be used to display the date in displayArea
 *   singleClick   | (true/false) wether the calendar is in single click mode or not (default: true)
 *   firstDay      | numeric: 0 to 6.  "0" means display Sunday first, "1" means display Monday first, etc.
 *   align         | alignment (default: "Br"); if you don't know what's this see the calendar documentation
 *   range         | array with 2 elements.  Default: [1900, 2999] -- the range of years available
 *   weekNumbers   | (true/false) if it's true (default) the calendar will display week numbers
 *   flat          | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
 *   flatCallback  | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
 *   disableFunc   | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
 *   onSelect      | function that gets called when a date is selected.  You don't _have_ to supply this (the default is generally okay)
 *   onClose       | function that gets called when the calendar is closed.  [default]
 *   onUpdate      | function that gets called after the date is updated in the input field.  Receives a reference to the calendar.
 *   date          | the date that the calendar will be initially displayed to
 *   showsTime     | default: false; if true the calendar will include a time selector
 *   timeFormat    | the time format; can be "12" or "24", default is "12"
 *   electric      | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
 *   step          | configures the step of the years in drop-down boxes; default: 2
 *   position      | configures the calendar absolute position; default: null
 *   cache         | if "true" (but default: "false") it will reuse the same calendar object, where possible
 *   showOthers    | if "true" (but default: "false") it will show days from other months too
 *
 *  None of them is required, they all have default values.  However, if you
 *  pass none of "inputField", "displayArea" or "button" you'll get a warning
 *  saying "nothing to setup".
 */
Calendar.setup = function (params) {
	function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };

	param_default("inputField",     null);
	param_default("displayArea",    null);
	param_default("button",         null);
	param_default("eventName",      "click");
	param_default("ifFormat",       "%Y/%m/%d");
	param_default("daFormat",       "%Y/%m/%d");
	param_default("singleClick",    true);
	param_default("disableFunc",    null);
	param_default("dateStatusFunc", params["disableFunc"]);	// takes precedence if both are defined
	param_default("dateText",       null);
	param_default("firstDay",       null);
	param_default("align",          "Br");
	param_default("range",          [1900, 2999]);
	param_default("weekNumbers",    true);
	param_default("flat",           null);
	param_default("flatCallback",   null);
	param_default("onSelect",       null);
	param_default("onClose",        null);
	param_default("onUpdate",       null);
	param_default("date",           null);
	param_default("showsTime",      false);
	param_default("timeFormat",     "24");
	param_default("electric",       true);
	param_default("step",           2);
	param_default("position",       null);
	param_default("cache",          false);
	param_default("showOthers",     false);
	param_default("multiple",       null);

	var tmp = ["inputField", "displayArea", "button"];
	for (var i in tmp) {
		if (typeof params[tmp[i]] == "string") {
			params[tmp[i]] = document.getElementById(params[tmp[i]]);
		}
	}
	if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) {
		alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
		return false;
	}

	function onSelect(cal) {
		var p = cal.params;
		var update = (cal.dateClicked || p.electric);
		if (update && p.inputField) {
			p.inputField.value = cal.date.print(p.ifFormat);
			if (typeof p.inputField.onchange == "function")
				p.inputField.onchange();
		}
		if (update && p.displayArea)
			p.displayArea.innerHTML = cal.date.print(p.daFormat);
		if (update && typeof p.onUpdate == "function")
			p.onUpdate(cal);
		if (update && p.flat) {
			if (typeof p.flatCallback == "function")
				p.flatCallback(cal);
		}
		if (update && p.singleClick && cal.dateClicked)
			cal.callCloseHandler();
	};

	if (params.flat != null) {
		if (typeof params.flat == "string")
			params.flat = document.getElementById(params.flat);
		if (!params.flat) {
			alert("Calendar.setup:\n  Flat specified but can't find parent.");
			return false;
		}
		var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
		cal.showsOtherMonths = params.showOthers;
		cal.showsTime = params.showsTime;
		cal.time24 = (params.timeFormat == "24");
		cal.params = params;
		cal.weekNumbers = params.weekNumbers;
		cal.setRange(params.range[0], params.range[1]);
		cal.setDateStatusHandler(params.dateStatusFunc);
		cal.getDateText = params.dateText;
		if (params.ifFormat) {
			cal.setDateFormat(params.ifFormat);
		}
		if (params.inputField && typeof params.inputField.value == "string") {
			cal.parseDate(params.inputField.value);
		}
		cal.create(params.flat);
		cal.show();
		return false;
	}

	var triggerEl = params.button || params.displayArea || params.inputField;
	triggerEl["on" + params.eventName] = function() {
		var dateEl = params.inputField || params.displayArea;
		var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
		var mustCreate = false;
		var cal = window.calendar;
		if (dateEl)
			params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt);
		if (!(cal && params.cache)) {
			window.calendar = cal = new Calendar(params.firstDay,
							     params.date,
							     params.onSelect || onSelect,
							     params.onClose || function(cal) { cal.hide(); });
			cal.showsTime = params.showsTime;
			cal.time24 = (params.timeFormat == "24");
			cal.weekNumbers = params.weekNumbers;
			mustCreate = true;
		} else {
			if (params.date)
				cal.setDate(params.date);
			cal.hide();
		}
		if (params.multiple) {
			cal.multiple = {};
			for (var i = params.multiple.length; --i >= 0;) {
				var d = params.multiple[i];
				var ds = d.print("%Y%m%d");
				cal.multiple[ds] = d;
			}
		}
		cal.showsOtherMonths = params.showOthers;
		cal.yearStep = params.step;
		cal.setRange(params.range[0], params.range[1]);
		cal.params = params;
		cal.setDateStatusHandler(params.dateStatusFunc);
		cal.getDateText = params.dateText;
		cal.setDateFormat(dateFmt);
		if (mustCreate)
			cal.create();
		cal.refresh();
		if (!params.position)
			cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
		else
			cal.showAt(params.position[0], params.position[1]);
		return false;
	};

	return cal;
};

// Calendar pt-BR language
// Author: Fernando Dourado, <fernando.dourado@ig.com.br>
// Encoding: any
// Distributed under the same terms as the calendar itself.

// For translators: please use UTF-8 if possible.  We strongly believe that
// Unicode is the answer to a real internationalized world.  Also please
// include your contact information in the header, as can be seen above.

// full day names
Calendar._DN = new Array("Domingo", "Segunda", "Terca", "Quarta", "Quinta", "Sexta", "Sabado", "Domingo");

// Please note that the following array of short day names (and the same goes
// for short month names, _SMN) isn't absolutely necessary.  We give it here
// for exemplification on how one can customize the short day names, but if
// they are simply the first N letters of the full name you can simply say:
//
//   Calendar._SDN_len = N; // short day name length
//   Calendar._SMN_len = N; // short month name length
//
// If N = 3 then this is not needed either since we assume a value of 3 if not
// present, to be compatible with translation files that were written before
// this feature.

// short day names
// [No changes using default values]
// short day names
Calendar._SDN = new Array("Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom");

// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
Calendar._FD = 0; 
 
// full month names
Calendar._MN = new Array("Janeiro", "Fevereiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro");

// short month names
Calendar._SMN = new Array("Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez");

// tooltips
Calendar._TT = {};

Calendar._TT["INFO"] = "Selecione uma data";

Calendar._TT["ABOUT"] = "Selecione uma data";

Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Selecionar hora:\n" +
"- Clique em qualquer uma das partes da hora para aumentar\n" +
"- ou Shift-clique para diminuir\n" +
"- ou clique e arraste para selecionar rapidamente.";

Calendar._TT["PREV_YEAR"] = "Ano anterior";
Calendar._TT["PREV_MONTH"] = "Mes anterior";
Calendar._TT["GO_TODAY"] = "Ir para a data atual";
Calendar._TT["NEXT_MONTH"] = "Proximo mes";
Calendar._TT["NEXT_YEAR"] = "Proximo ano";
Calendar._TT["SEL_DATE"] = "Selecione uma data";
Calendar._TT["DRAG_TO_MOVE"] = "Clique e segure para mover";
Calendar._TT["PART_TODAY"] = " (hoje)";

// the following is to inform that "%s" is to be the first day of week
// %s will be replaced with the day name.
Calendar._TT["DAY_FIRST"] = "Exibir %s primeiro";

// This may be locale-dependent.  It specifies the week-end days, as an array
// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
// means Monday, etc.
Calendar._TT["WEEKEND"] = "0,6";

Calendar._TT["CLOSE"] = "Fechar";
Calendar._TT["TODAY"] = "Hoje";
//Calendar._TT["TIME_PART"] = "(Shift-)Clique ou arraste para mudar o valor";
Calendar._TT["TIME_PART"] = "Clique e arraste para mudar";

// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y";
Calendar._TT["TT_DATE_FORMAT"] = "%d de %B de %Y";

Calendar._TT["WK"] = "sem";
Calendar._TT["TIME"] = "Hora:";






	
		
	
        

