// JavaScript Document

	function HideContent(d) {
		if(d.length < 1) { return; }
		document.getElementById(d).style.visibility = "hidden";
	}
	function ShowContent(d) {
		if(d.length < 1) { return; }
		document.getElementById(d).style.visibility = "visible";
	}
	function ShowOverflow(d) {
		if(d.length < 1) { return; }
		document.getElementById(d).style.overflow = "visible";
		document.getElementById('more').style.visibility = "hidden";
		document.getElementById('less').style.visibility = "visible";
	}
	function HideOverflow(d) {
		if(d.length < 1) { return; }
		document.getElementById(d).style.overflow = "hidden";
		document.getElementById('less').style.visibility = "hidden";
		document.getElementById('more').style.visibility = "visible";
	}
	// clear field of any default text
	function doClear(theText) {
		 if (theText.value == theText.defaultValue) {
			 theText.value = ""
		 }
	}
	// submit on enter
	function submitenter(myfield,e){
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
	
		if (keycode == 13) {
		   myfield.form.submit();
		   return false;
		} else
		   return true;
	}
	function dss_addLoadEvent(fn) {
		if(typeof(fn)!="function")return;
		var tempFunc=window.onload;
		window.onload=function() {
		if(typeof(tempFunc)=="function")tempFunc();
			fn();
		}
	}
	function changeInputType(
	oldElm, // a reference to the input element
	iType, // value of the type property: 'text' or 'password'
	iValue, // the default value, set to 'password' in the demo
	blankValue, // true if the value should be empty, false otherwise
	noFocus) {  // set to true if the element should not be given focus
		if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
		!document.getElementById || !document.createElement) return;
		var newElm = document.createElement('input');
		newElm.type = iType;
		if(oldElm.name) newElm.name = oldElm.name;
		if(oldElm.id) newElm.id = oldElm.id;
		if(oldElm.className) newElm.className = oldElm.className;
		if(oldElm.size) newElm.size = oldElm.size;
		if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex;
		if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey;
		newElm.onfocus = function(){return function(){
			if(this.hasFocus) return;
			var newElm = changeInputType(this,'password',iValue,
			(this.value.toLowerCase()==iValue.toLowerCase())?true:false);
			if(newElm) newElm.hasFocus=true;
		}}();
		newElm.onblur = function(){return function(){
			if(this.hasFocus)
			if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) {
				changeInputType(this,'text',iValue,false,true);
			}
		}}();
		// hasFocus is to prevent a loop where onfocus is triggered over and over again
		newElm.hasFocus=false;
		oldElm.parentNode.replaceChild(newElm,oldElm);
		if(!blankValue) newElm.value = iValue;
		if(!noFocus || typeof(noFocus)=='undefined') {
			window.tempElm = newElm;
			setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
		}
		return newElm;
	}
	dss_addLoadEvent(function(){
	var ua = navigator.userAgent.toLowerCase();
	if(!((ua.indexOf('konqueror')!=-1) && (document.all || 
	(ua.indexOf('khtml/3.4')!=-1))) && !(((ua.indexOf('safari')!=-1) && 
	!window.print) || (document.defaultCharset && !window.print))) {
		// Set the third value to the text you want to appear in the field.
		changeInputType(document.forms[0].password,'text','enter password',false,true);
	}
	});
	// adds confirmation to actions like delete or status changes
	function affirm(q,m,m2,to) {
		var answer = confirm(q)
		if (answer){
			alert(m)
			window.location = to;
		}
		else{
			alert(m2)
		}
	}

	function popUp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=700,left = 340,top = 162');");
	}
	
	// some javascript to hide emails using class: change
	function mangle() {
		var at = / at /;
		var dot = / dot /g;
		var address = this.getAttribute("title");
	
		address = address.replace(at, "@");
		address = address.replace(dot, ".");
	
		this.innerHTML = address;
		this.setAttribute("href", "mailto:"+address);
		this.setAttribute("title", "");
		this.onmouseover = null;
	}
	
	function fixLinks() {
		if (!document.getElementsByTagName && !document.createElement &&
			!document.createTextNode) return;
		var nodes = document.getElementsByTagName("*");
		for(var i=nodes.length-1;i>=0;i--) {
			if (nodes[i].className.search("change")>=0) {
				var node = document.createElement("a");
				node.setAttribute("href", "mailto:");
				node.setAttribute("title", nodes[i].innerHTML);
				node.innerHTML = nodes[i].innerHTML;
				node.onmouseover = mangle;
	
				var prnt = nodes[i].parentNode;
				for(var j=0;j<prnt.childNodes.length;j++)
					if (prnt.childNodes[j] == nodes[i]) {
						if (!prnt.replaceChild) return;
						prnt.replaceChild(node, prnt.childNodes[j]);
						break;
					}
			}
		}
	}
	// Dreamweaver JS
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function PassStrengthMeter(passwd,minpasslength,title,level1,level2,level3,level4,level5) {
		var description = new Array();
		description[0] = title + ": <b>" + level1 + "</b><br><div class='pmempty'></div>";
		description[1] = title + ": <b>" + level2 + "</b><br><div class='pmempty'><div class='pmquarteron'></div></div>";
		description[2] = title + ": <b>" + level3 + "</b><br><div class='pmempty'><div class='pmhalfon'></div></div>";
		description[3] = title + ": <b>" + level4 + "</b><br><div class='pmempty'><div class='pm3quaron'></div></div>";
		description[4] = title + ": <b>" + level5 + "</b><br><div class='pmfull'></div>";
		description[5] = title + ": <b>" + level1 + "</b><br><div class='pmempty'></div>";
		
		var intScore   = 0
		var strVerdict = 0
		
		// PASSWORD LENGTH
		if (passwd.length<minpasslength || !passwd.length) // length 0
		{
			intScore = -1
		}
		else if (passwd.length>5 && passwd.length<8) // length between 6 and 7
		{
			intScore = (intScore+6)
		}
		else if (passwd.length>7 && passwd.length<12)// length between 8 and 15
		{
			intScore = (intScore+12)
		}
		else if (passwd.length>11)                    // length 16 or more
		{
			intScore = (intScore+18)
		}
		// LETTERS 
		if (passwd.match(/[a-z]/))                              // [verified] at least one lower case letter
		{
			intScore = (intScore+1)
		}
		if (passwd.match(/[A-Z]/))                              // [verified] at least one upper case letter
		{
			intScore = (intScore+5)
		}
		// NUMBERS
		if (passwd.match(/\d+/))                                 // [verified] at least one number
		{
			intScore = (intScore+5)
		}
		if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/))             // [verified] at least three numbers
		{
			intScore = (intScore+5)
		}
		// SPECIAL CHAR
		if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))            // [verified] at least one special character
		{
			intScore = (intScore+5)
		}														 
		if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/))  // [verified] at least two special characters
		{
			intScore = (intScore+5)
		}
		// COMBOS
		if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))        // [verified] both upper and lower case
		{
			intScore = (intScore+2)
		}
		if (passwd.match(/(\d.*\D)|(\D.*\d)/))                    // [FAILED] both letters and numbers, almost works because an additional character is required
		{
			intScore = (intScore+2)
		}				  
		if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/))  // [verified] letters, numbers, and special characters
		{
			intScore = (intScore+2)
		}
		
		if (passwd.length<minpasslength || !passwd.length) // length 0
		{
			intScore = -1
		}
		
		if(intScore == -1)
		{
		   strVerdict = description[5];
		}
		else if(intScore > -1 && intScore < 16)
		{
		   strVerdict = description[1];
		}
		else if (intScore > 15 && intScore < 25)
		{
		   strVerdict = description[1];
		}
		else if (intScore > 24 && intScore < 35)
		{
		   strVerdict = description[2];
		}
		else if (intScore > 34 && intScore < 45)
		{
		   strVerdict = description[3];
		}
		else
		{
		   strVerdict = description[4];
		}
			
		document.getElementById("passmeter").innerHTML= (strVerdict);
		
	}
	
// Tooltip JS

	var DHTMLgoodies_globalTooltipObj;
	
	
	/** 
	Constructor 
	**/
	function DHTMLgoodies_formTooltip()
	{
		var tooltipDiv;
		var tooltipText;
		var tooltipContentDiv;				// Reference to inner div with tooltip content
		var imagePath;						// Relative path to images
		var arrowImageFile;					// Name of arrow image
		var arrowImageFileRight;			// Name of arrow image
		var arrowRightWidth;
		var arrowTopHeight;
		var tooltipWidth;					// Width of tooltip
		var roundedCornerObj;				// Reference to object of class DHTMLgoodies_roundedCorners
		var tooltipBgColor;
		var closeMessage;					// Close message
		var activeInput;					// Reference to currently active input
		var tooltipPosition;				// Tooltip position, possible values: "below" or "right"
		var tooltipCornerSize;				// Size of rounded corners
		var displayArrow;					// Display arrow above or at the left of the tooltip?
		var cookieName;						// Name of cookie
		var disableTooltipPossibility;		// Possibility of disabling tooltip
		var disableTooltipByCookie;			// If tooltip has been disabled, save the settings in cookie, i.e. for other pages with the same cookie name.
		var disableTooltipMessage;
		var tooltipDisabled;
		var isMSIE;
		var tooltipIframeObj;
		var pageBgColor;					// Color of background - used in ie when applying iframe which covers select boxes
		var currentTooltipObj;				// Reference to form field which tooltip is currently showing for
		
		this.currentTooltipObj = false,
		this.tooltipDiv = false,
		this.tooltipText = false;
		this.imagePath = 'pics/scripts/';
		this.arrowImageFile = 'arrow.gif';
		this.arrowImageFileRight = 'arrow-right.gif';
		this.tooltipWidth = 200;
		this.tooltipBgColor = '#FFCE3A';
		this.closeMessage = 'Close';
		this.disableTooltipMessage = 'Don\'t show these again';
		this.activeInput = false;
		this.tooltipPosition = 'right';
		this.arrowRightWidth = 16;			// Default width of arrow when the tooltip is on the right side of the inputs.
		this.arrowTopHeight = 13;			// Default height of arrow at the top of tooltip
		this.tooltipCornerSize = 10;
		this.displayArrow = true;
		this.cookieName = 'DHTMLgoodies_tooltipVisibility';
		this.disableTooltipByCookie = false;
		this.tooltipDisabled = false;
		this.disableTooltipPossibility = true;
		this.tooltipIframeObj = false;
		this.pageBgColor = '#FFFFFF';
		
		DHTMLgoodies_globalTooltipObj = this;
		
		if(navigator.userAgent.indexOf('MSIE')>=0)this.isMSIE = true; else this.isMSIE = false;
	}
	
	
	DHTMLgoodies_formTooltip.prototype = {
		// {{{ initFormFieldTooltip()
		/**
		 *
		 *
		 *  Initializes the tooltip script. Most set methods needs to be executed before you call this method.
		 * 
		 * @public
		 */		
		initFormFieldTooltip : function()
		{
			var formElements = new Array();
			var inputs = document.getElementsByTagName('INPUT');
			for(var no=0;no<inputs.length;no++){
				var attr = inputs[no].getAttribute('tooltipText');
				if(!attr)attr = inputs[no].tooltipText;
				if(attr)formElements[formElements.length] = inputs[no];
			}
				
			var inputs = document.getElementsByTagName('TEXTAREA');
			for(var no=0;no<inputs.length;no++){
				var attr = inputs[no].getAttribute('tooltipText');
				if(!attr)attr = inputs[no].tooltipText;
				if(attr)formElements[formElements.length] = inputs[no];
			}
			var inputs = document.getElementsByTagName('SELECT');
			for(var no=0;no<inputs.length;no++){
				var attr = inputs[no].getAttribute('tooltipText');
				if(!attr)attr = inputs[no].tooltipText;
				if(attr)formElements[formElements.length] = inputs[no];
			}
				
			window.refToFormTooltip = this;
			
			for(var no=0;no<formElements.length;no++){
				formElements[no].onfocus = this.__displayTooltip;
			}
			this.addEvent(window,'resize',function(){ window.refToFormTooltip.__positionCurrentToolTipObj(); });
			
			this.addEvent(document.documentElement,'click',function(e){ window.refToFormTooltip.__autoHideTooltip(e); });
		}
		
		// }}}
		,		
		// {{{ setTooltipPosition()
		/**
		 *
		 *
		 *  Specify position of tooltip(below or right)
		 *	@param String newPosition (Possible values: "below" or "right") 
		 * 
		 * @public
		 */	
		setTooltipPosition : function(newPosition)
		{
			this.tooltipPosition = newPosition;
		}
		// }}}
		,		
		// {{{ setCloseMessage()
		/**
		 *
		 *
		 *  Specify "Close" message
		 *	@param String closeMessage
		 * 
		 * @public
		 */
		setCloseMessage : function(closeMessage)
		{
			this.closeMessage = closeMessage;
		}
		// }}}
		,	
		// {{{ setDisableTooltipMessage()
		/**
		 *
		 *
		 *  Specify disable tooltip message at the bottom of the tooltip
		 *	@param String disableTooltipMessage
		 * 
		 * @public
		 */
		setDisableTooltipMessage : function(disableTooltipMessage)
		{
			this.disableTooltipMessage = disableTooltipMessage;
		}
		// }}}
		,		
		// {{{ setTooltipDisablePossibility()
		/**
		 *
		 *
		 *  Specify whether you want the disable link to appear or not.
		 *	@param Boolean disableTooltipPossibility
		 * 
		 * @public
		 */
		setTooltipDisablePossibility : function(disableTooltipPossibility)
		{
			this.disableTooltipPossibility = disableTooltipPossibility;
		}
		// }}}
		,		
		// {{{ setCookieName()
		/**
		 *
		 *
		 *  Specify name of cookie. Useful if you're using this script on several pages. 
		 *	@param String newCookieName
		 * 
		 * @public
		 */
		setCookieName : function(newCookieName)
		{
			this.cookieName = newCookieName;
		}
		// }}}
		,		
		// {{{ setTooltipWidth()
		/**
		 *
		 *
		 *  Specify width of tooltip
		 *	@param Int newWidth
		 * 
		 * @public
		 */	
		setTooltipWidth : function(newWidth)
		{
			this.tooltipWidth = newWidth;
		}
		
		// }}}
		,		
		// {{{ setArrowVisibility()
		/**
		 *
		 *
		 *  Display arrow at the top or at the left of the tooltip?
		 *	@param Boolean displayArrow
		 * 
		 * @public
		 */	
		
		setArrowVisibility : function(displayArrow)
		{
			this.displayArrow = displayArrow;
		}
		
		// }}}
		,		
		// {{{ setTooltipBgColor()
		/**
		 *
		 *
		 *  Send true to this method if you want to be able to save tooltip visibility in cookie. If it's set to true,
		 *	It means that when someone returns to the page, the tooltips won't show.
		 * 
		 *	@param Boolean disableTooltipByCookie
		 * 
		 * @public
		 */	
		setDisableTooltipByCookie : function(disableTooltipByCookie)
		{
			this.disableTooltipByCookie = disableTooltipByCookie;
		}	
		// }}}
		,		
		// {{{ setTooltipBgColor()
		/**
		 *
		 *
		 *  This method specifies background color of tooltip
		 *	@param String newBgColor
		 * 
		 * @public
		 */	
		setTooltipBgColor : function(newBgColor)
		{
			this.tooltipBgColor = newBgColor;
		}
		
		// }}}
		,		
		// {{{ setTooltipCornerSize()
		/**
		 *
		 *
		 *  Size of rounded corners around tooltip
		 *	@param Int newSize (0 = no rounded corners)
		 * 
		 * @public
		 */	
		setTooltipCornerSize : function(tooltipCornerSize)
		{
			this.tooltipCornerSize = tooltipCornerSize;
		}
		
		// }}}
		,
		// {{{ setTopArrowHeight()
		/**
		 *
		 *
		 *  Size height of arrow at the top of tooltip
		 *	@param Int arrowTopHeight
		 * 
		 * @public
		 */	
		setTopArrowHeight : function(arrowTopHeight)
		{
			this.arrowTopHeight = arrowTopHeight;
		}
		
		// }}}
		,	
		// {{{ setRightArrowWidth()
		/**
		 *
		 *
		 *  Size width of arrow when the tooltip is on the right side of inputs
		 *	@param Int arrowTopHeight
		 * 
		 * @public
		 */	
		setRightArrowWidth : function(arrowRightWidth)
		{
			this.arrowRightWidth = arrowRightWidth;
		}
		
		// }}}
		,	
		// {{{ setPageBgColor()
		/**
		 *
		 *
		 *  Specify background color of page.
		 *	@param String pageBgColor
		 * 
		 * @public
		 */	
		setPageBgColor : function(pageBgColor)
		{
			this.pageBgColor = pageBgColor;
		}
		
		// }}}
		,		
		// {{{ __hideTooltip()
		/**
		 *
		 *
		 *  This method displays the tooltip
		 *
		 * 
		 * @private
		 */		
	
		__displayTooltip : function()
		{
			if(DHTMLgoodies_globalTooltipObj.disableTooltipByCookie){
				var cookieValue = DHTMLgoodies_globalTooltipObj.getCookie(DHTMLgoodies_globalTooltipObj.cookieName) + '';	
				if(cookieValue=='1')DHTMLgoodies_globalTooltipObj.tooltipDisabled = true;
			}	
			
			if(DHTMLgoodies_globalTooltipObj.tooltipDisabled)return;	// Tooltip disabled
			var tooltipText = this.getAttribute('tooltipText');
			DHTMLgoodies_globalTooltipObj.activeInput = this;
			
			if(!tooltipText)tooltipText = this.tooltipText;
			DHTMLgoodies_globalTooltipObj.tooltipText = tooltipText;
	
			
			if(!DHTMLgoodies_globalTooltipObj.tooltipDiv)DHTMLgoodies_globalTooltipObj.__createTooltip();
			
			DHTMLgoodies_globalTooltipObj.__positionTooltip(this);
			
			
			
		
			DHTMLgoodies_globalTooltipObj.tooltipContentDiv.innerHTML = tooltipText;
			DHTMLgoodies_globalTooltipObj.tooltipDiv.style.display='block';
			
			if(DHTMLgoodies_globalTooltipObj.isMSIE){
				if(DHTMLgoodies_globalTooltipObj.tooltipPosition == 'below'){
					DHTMLgoodies_globalTooltipObj.tooltipIframeObj.style.height = (DHTMLgoodies_globalTooltipObj.tooltipDiv.clientHeight - DHTMLgoodies_globalTooltipObj.arrowTopHeight);
				}else{
					DHTMLgoodies_globalTooltipObj.tooltipIframeObj.style.height = (DHTMLgoodies_globalTooltipObj.tooltipDiv.clientHeight);
				}
			}
			
		}
		// }}}
		,		
		// {{{ __hideTooltip()
		/**
		 *
		 *
		 *  This function hides the tooltip
		 *
		 * 
		 * @private
		 */		
		__hideTooltip : function()
		{
			try{
				DHTMLgoodies_globalTooltipObj.tooltipDiv.style.display='none';
			}catch(e){
			}
			
		}
		// }}}
		,
		// {{{ getSrcElement()
		/**
		 *
		 *
		 *  Return the source of an event.
		 *
		 * 
		 * @private
		 */		
		getSrcElement : function(e)
		{
			var el;
			if (e.target) el = e.target;
				else if (e.srcElement) el = e.srcElement;
				if (el.nodeType == 3) // defeat Safari bug
					el = el.parentNode;
			return el;	
		}	
		// }}}
		,
		__autoHideTooltip : function(e)
		{
			if(document.all)e = event;	
			var src = this.getSrcElement(e);
			if(src.tagName.toLowerCase()!='input' && src.tagName.toLowerCase().toLowerCase()!='textarea' && src.tagName.toLowerCase().toLowerCase()!='select')this.__hideTooltip();
	
			var attr = src.getAttribute('tooltipText');
			if(!attr)attr = src.tooltipText;
			if(!attr){
				this.__hideTooltip();
			}	
			
		}
		// }}}
		,		
		// {{{ __hideTooltipFromLink()
		/**
		 *
		 *
		 *  This function hides the tooltip
		 *
		 * 
		 * @private
		 */	
		__hideTooltipFromLink : function()
		{
			
			this.activeInput.focus();
			window.refToThis = this;
			setTimeout('window.refToThis.__hideTooltip()',10);
		}
		// }}}
		,		
		// {{{ disableTooltip()
		/**
		 *
		 *
		 *  Hide tooltip and disable it
		 *
		 * 
		 * @public
		 */	
		disableTooltip : function()
		{
			this.__hideTooltipFromLink();
			if(this.disableTooltipByCookie)this.setCookie(this.cookieName,'1',500);	
			this.tooltipDisabled = true;	
		}	
		// }}}
		,		
		// {{{ __positionTooltip()
		/**
		 *
		 *
		 *  This function creates the tooltip elements
		 *
		 * 
		 * @private
		 */	
		__createTooltip : function()
		{
			this.tooltipDiv = document.createElement('DIV');
			this.tooltipDiv.style.position = 'absolute';
			
			if(this.displayArrow){
				var topDiv = document.createElement('DIV');
				
				if(this.tooltipPosition=='below'){
					
					topDiv.style.marginLeft = '20px';
					var arrowDiv = document.createElement('IMG');
					arrowDiv.src = this.imagePath + this.arrowImageFile + '?rand='+ Math.random();
					arrowDiv.style.display='block';
					topDiv.appendChild(arrowDiv);
						
				}else{
					topDiv.style.marginTop = '5px';
					var arrowDiv = document.createElement('IMG');
					arrowDiv.src = this.imagePath + this.arrowImageFileRight + '?rand='+ Math.random();	
					arrowDiv.style.display='block';
					topDiv.appendChild(arrowDiv);					
					topDiv.style.position = 'absolute';			
				}
				
				this.tooltipDiv.appendChild(topDiv);	
			}
			
			var outerDiv = document.createElement('DIV');
			outerDiv.style.position = 'relative';
			outerDiv.style.zIndex = 1000;
			if(this.tooltipPosition!='below' && this.displayArrow){			
				outerDiv.style.left = this.arrowRightWidth + 'px';
			}
					
			outerDiv.id = 'DHTMLgoodies_formTooltipDiv';
			outerDiv.className = 'DHTMLgoodies_formTooltipDiv';
			outerDiv.style.backgroundColor = this.tooltipBgColor;
			this.tooltipDiv.appendChild(outerDiv);
	
			if(this.isMSIE){
				this.tooltipIframeObj = document.createElement('<IFRAME name="tooltipIframeObj" width="' + this.tooltipWidth + '" frameborder="no" src="about:blank"></IFRAME>');
				this.tooltipIframeObj.style.position = 'absolute';
				this.tooltipIframeObj.style.top = '0px';
				this.tooltipIframeObj.style.left = '0px';
				this.tooltipIframeObj.style.width = (this.tooltipWidth) + 'px';
				this.tooltipIframeObj.style.zIndex = 100;
				this.tooltipIframeObj.background = this.pageBgColor;
				this.tooltipIframeObj.style.backgroundColor= this.pageBgColor;
				this.tooltipDiv.appendChild(this.tooltipIframeObj);	
				if(this.tooltipPosition!='below' && this.displayArrow){
					this.tooltipIframeObj.style.left = (this.arrowRightWidth) +  'px';	
				}else{
					this.tooltipIframeObj.style.top = this.arrowTopHeight + 'px';	
				}
	
				setTimeout("self.frames['tooltipIframeObj'].document.documentElement.style.backgroundColor='" + this.pageBgColor + "'",500);
	
			}
			
			this.tooltipContentDiv = document.createElement('DIV');	
			this.tooltipContentDiv.style.position = 'relative';	
			this.tooltipContentDiv.id = 'DHTMLgoodies_formTooltipContent';
			outerDiv.appendChild(this.tooltipContentDiv);			
			
			var closeDiv = document.createElement('DIV');
			closeDiv.style.textAlign = 'center';
		
			closeDiv.innerHTML = '<A class="DHTMLgoodies_formTooltip_closeMessage" href="#" onclick="DHTMLgoodies_globalTooltipObj.__hideTooltipFromLink();return false">' + this.closeMessage + '</A>';
			
			if(this.disableTooltipPossibility){
				var tmpHTML = closeDiv.innerHTML;
				tmpHTML = tmpHTML + ' | <A class="DHTMLgoodies_formTooltip_closeMessage" href="#" onclick="DHTMLgoodies_globalTooltipObj.disableTooltip();return false">' + this.disableTooltipMessage + '</A>';
				closeDiv.innerHTML = tmpHTML;
			} 
			
			outerDiv.appendChild(closeDiv);
			
			document.body.appendChild(this.tooltipDiv);
			
			
					
			if(this.tooltipCornerSize>0){
				this.roundedCornerObj = new DHTMLgoodies_roundedCorners();
				// (divId,xRadius,yRadius,color,backgroundColor,padding,heightOfContent,whichCorners)
				this.roundedCornerObj.addTarget('DHTMLgoodies_formTooltipDiv',this.tooltipCornerSize,this.tooltipCornerSize,this.tooltipBgColor,this.pageBgColor,5);
				this.roundedCornerObj.init();
			}
			
	
			this.tooltipContentDiv = document.getElementById('DHTMLgoodies_formTooltipContent');
		}
		// }}}
		,
		addEvent : function(whichObject,eventType,functionName)
		{ 
		  if(whichObject.attachEvent){ 
			whichObject['e'+eventType+functionName] = functionName; 
			whichObject[eventType+functionName] = function(){whichObject['e'+eventType+functionName]( window.event );} 
			whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName] ); 
		  } else 
			whichObject.addEventListener(eventType,functionName,false); 	    
		} 	
		// }}}
		,
		__positionCurrentToolTipObj : function()
		{
			if(DHTMLgoodies_globalTooltipObj.activeInput)this.__positionTooltip(DHTMLgoodies_globalTooltipObj.activeInput);
			
		}
		// }}}
		,		
		// {{{ __positionTooltip()
		/**
		 *
		 *
		 *  This function positions the tooltip
		 *
		 * @param Obj inputObj = Reference to text input
		 * 
		 * @private
		 */	
		__positionTooltip : function(inputObj)
		{	
			var offset = 0;
			if(!this.displayArrow)offset = 3;	
			if(this.tooltipPosition=='below'){
				this.tooltipDiv.style.left = this.getLeftPos(inputObj)+  'px';
				this.tooltipDiv.style.top = (this.getTopPos(inputObj) + inputObj.offsetHeight + offset) + 'px';
			}else{
			
				this.tooltipDiv.style.left = (this.getLeftPos(inputObj) + inputObj.offsetWidth + offset)+  'px';
				this.tooltipDiv.style.top = this.getTopPos(inputObj) + 'px';			
			}
			this.tooltipDiv.style.width=this.tooltipWidth + 'px';
			
		}
		,
		// {{{ getTopPos()
		/**
		 * This method will return the top coordinate(pixel) of an object
		 *
		 * @param Object inputObj = Reference to HTML element
		 * @public
		 */	
		getTopPos : function(inputObj)
		{		
		  var returnValue = inputObj.offsetTop;
		  while((inputObj = inputObj.offsetParent) != null){
			if(inputObj.tagName!='HTML'){
				returnValue += inputObj.offsetTop;
				if(document.all)returnValue+=inputObj.clientTop;
			}
		  } 
		  return returnValue;
		}
		// }}}
		
		,
		// {{{ getLeftPos()
		/**
		 * This method will return the left coordinate(pixel) of an object
		 *
		 * @param Object inputObj = Reference to HTML element
		 * @public
		 */	
		getLeftPos : function(inputObj)
		{	  
		  var returnValue = inputObj.offsetLeft;
		  while((inputObj = inputObj.offsetParent) != null){
			if(inputObj.tagName!='HTML'){
				returnValue += inputObj.offsetLeft;
				if(document.all)returnValue+=inputObj.clientLeft;
			}
		  }
		  return returnValue;
		}
		
		,
		
		// {{{ getCookie()
		/**
		 *
		 * 	These cookie functions are downloaded from 
		 * 	http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
		 *
		 *  This function returns the value of a cookie
		 *
		 * @param String name = Name of cookie
		 * @param Object inputObj = Reference to HTML element
		 * @public
		 */	
		getCookie : function(name) { 
		   var start = document.cookie.indexOf(name+"="); 
		   var len = start+name.length+1; 
		   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
		   if (start == -1) return null; 
		   var end = document.cookie.indexOf(";",len); 
		   if (end == -1) end = document.cookie.length; 
		   return unescape(document.cookie.substring(len,end)); 
		} 	
		// }}}
		,	
		
		// {{{ setCookie()
		/**
		 *
		 * 	These cookie functions are downloaded from 
		 * 	http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
		 *
		 *  This function creates a cookie. (This method has been slighhtly modified)
		 *
		 * @param String name = Name of cookie
		 * @param String value = Value of cookie
		 * @param Int expires = Timestamp - days
		 * @param String path = Path for cookie (Usually left empty)
		 * @param String domain = Cookie domain
		 * @param Boolean secure = Secure cookie(SSL)
		 * 
		 * @public
		 */	
		setCookie : function(name,value,expires,path,domain,secure) { 
			expires = expires * 60*60*24*1000;
			var today = new Date();
			var expires_date = new Date( today.getTime() + (expires) );
			var cookieString = name + "=" +escape(value) + 
			   ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
			   ( (path) ? ";path=" + path : "") + 
			   ( (domain) ? ";domain=" + domain : "") + 
			   ( (secure) ? ";secure" : ""); 
			document.cookie = cookieString; 
		}
		// }}}
			
			
	}
	
	// {{{ Constructor
	function DHTMLgoodies_roundedCorners()
	{
		var roundedCornerTargets;
		
		this.roundedCornerTargets = new Array();
		
	}
		var string = '';
	// }}}
	DHTMLgoodies_roundedCorners.prototype = {
	
		// {{{ addTarget() 
		/**
		 *
		 *
		 *  Add rounded corners to an element
		 *
		 *	@param String divId = Id of element on page. Example "leftColumn" for &lt;div id="leftColumn">
		 *	@param Int xRadius = Y radius of rounded corners, example 10
		 *	@param Int yRadius = Y radius of rounded corners, example 10
		 *  @param String color = Background color of element, example #FFF or #AABBCC
		 *  @param String color = backgroundColor color of element "behind", example #FFF or #AABBCC
		 *  @param Int padding = Padding of content - This will be added as left and right padding(not top and bottom)
		 *  @param String heightOfContent = Optional argument. You can specify a fixed height of your content. example "15" which means pixels, or "50%". 
		 *  @param String whichCorners = Optional argument. Commaseparated list of corners, example "top_left,top_right,bottom_left"
		 * 
		 * @public
		 */		
		addTarget : function(divId,xRadius,yRadius,color,backgroundColor,padding,heightOfContent,whichCorners)
		{	
			var index = this.roundedCornerTargets.length;
			this.roundedCornerTargets[index] = new Array();
			this.roundedCornerTargets[index]['divId'] = divId;
			this.roundedCornerTargets[index]['xRadius'] = xRadius;
			this.roundedCornerTargets[index]['yRadius'] = yRadius;
			this.roundedCornerTargets[index]['color'] = color;
			this.roundedCornerTargets[index]['backgroundColor'] = backgroundColor;
			this.roundedCornerTargets[index]['padding'] = padding;
			this.roundedCornerTargets[index]['heightOfContent'] = heightOfContent;
			this.roundedCornerTargets[index]['whichCorners'] = whichCorners;  
			
		}
		// }}}
		,
		// {{{ init()
		/**
		 *
		 *
		 *  Initializes the script
		 *
		 * 
		 * @public
		 */	    
		init : function()
		{
			
			for(var targetCounter=0;targetCounter < this.roundedCornerTargets.length;targetCounter++){
				
				// Creating local variables of each option
				whichCorners = this.roundedCornerTargets[targetCounter]['whichCorners'];
				divId = this.roundedCornerTargets[targetCounter]['divId'];
				xRadius = this.roundedCornerTargets[targetCounter]['xRadius'];
				yRadius = this.roundedCornerTargets[targetCounter]['yRadius'];
				color = this.roundedCornerTargets[targetCounter]['color'];
				backgroundColor = this.roundedCornerTargets[targetCounter]['backgroundColor'];
				padding = this.roundedCornerTargets[targetCounter]['padding'];
				heightOfContent = this.roundedCornerTargets[targetCounter]['heightOfContent'];
				whichCorners = this.roundedCornerTargets[targetCounter]['whichCorners'];
	
				// Which corners should we add rounded corners to?
				var cornerArray = new Array();
				if(!whichCorners || whichCorners=='all'){
					cornerArray['top_left'] = true;
					cornerArray['top_right'] = true;
					cornerArray['bottom_left'] = true;
					cornerArray['bottom_right'] = true;
				}else{
					cornerArray = whichCorners.split(/,/gi);
					for(var prop in cornerArray)cornerArray[cornerArray[prop]] = true;
				}
						
					
				var factorX = xRadius/yRadius;	// How big is x radius compared to y radius
			
				var obj = document.getElementById(divId);	// Creating reference to element
				obj.style.backgroundColor=null;	// Setting background color blank
				obj.style.backgroundColor='transparent';
				var content = obj.innerHTML;	// Saving HTML content of this element
				obj.innerHTML = '';	// Setting HTML content of element blank-
				
		
				
				
				// Adding top corner div.
				
				if(cornerArray['top_left'] || cornerArray['top_right']){
					var topBar_container = document.createElement('DIV');
					topBar_container.style.height = yRadius + 'px';
					topBar_container.style.overflow = 'hidden';	
			
					obj.appendChild(topBar_container);		
					var currentAntialiasSize = 0;
					var savedRestValue = 0;
					
					for(no=1;no<=yRadius;no++){
						var marginSize = (xRadius - (this.getY((yRadius - no),yRadius,factorX)));					
						var marginSize_decimals = (xRadius - (this.getY_withDecimals((yRadius - no),yRadius,factorX)));					
						var restValue = xRadius - marginSize_decimals;		
						var antialiasSize = xRadius - marginSize - Math.floor(savedRestValue)
						var foregroundSize = xRadius - (marginSize + antialiasSize);	
						
						var el = document.createElement('DIV');
						el.style.overflow='hidden';
						el.style.height = '1px';					
						if(cornerArray['top_left'])el.style.marginLeft = marginSize + 'px';				
						if(cornerArray['top_right'])el.style.marginRight = marginSize + 'px';	
						topBar_container.appendChild(el);				
						var y = topBar_container;		
						
						for(var no2=1;no2<=antialiasSize;no2++){
							switch(no2){
								case 1:
									if (no2 == antialiasSize)
										blendMode = ((restValue + savedRestValue) /2) - foregroundSize;
									else {
									  var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
									  blendMode = (restValue - foregroundSize - antialiasSize + 1) * (tmpValue - (yRadius - no)) /2;
									}						
									break;							
								case antialiasSize:								
									var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);								
									blendMode = 1 - (1 - (tmpValue - (yRadius - no))) * (1 - (savedRestValue - foregroundSize)) /2;							
									break;
								default:			
									var tmpValue2 = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
									var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);		
									blendMode = ((tmpValue + tmpValue2) / 2) - (yRadius - no);							
							}
							
							el.style.backgroundColor = this.__blendColors(backgroundColor,color,blendMode);
							y.appendChild(el);
							y = el;
							var el = document.createElement('DIV');
							el.style.height = '1px';	
							el.style.overflow='hidden';
							if(cornerArray['top_left'])el.style.marginLeft = '1px';
							if(cornerArray['top_right'])el.style.marginRight = '1px';    						
							el.style.backgroundColor=color;					
						}
						
						y.appendChild(el);				
						savedRestValue = restValue;
					}
				}
				
				// Add content
				var contentDiv = document.createElement('DIV');
				contentDiv.className = obj.className;
				contentDiv.style.border='1px solid ' + color;
				contentDiv.innerHTML = content;
				contentDiv.style.backgroundColor=color;
				contentDiv.style.paddingLeft = padding + 'px';
				contentDiv.style.paddingRight = padding + 'px';
		
				if(!heightOfContent)heightOfContent = '';
				heightOfContent = heightOfContent + '';
				if(heightOfContent.length>0 && heightOfContent.indexOf('%')==-1)heightOfContent = heightOfContent + 'px';
				if(heightOfContent.length>0)contentDiv.style.height = heightOfContent;
				
				obj.appendChild(contentDiv);
		
			
				if(cornerArray['bottom_left'] || cornerArray['bottom_right']){
					var bottomBar_container = document.createElement('DIV');
					bottomBar_container.style.height = yRadius + 'px';
					bottomBar_container.style.overflow = 'hidden';	
			
					obj.appendChild(bottomBar_container);		
					var currentAntialiasSize = 0;
					var savedRestValue = 0;
					
					var errorOccured = false;
					var arrayOfDivs = new Array();
					for(no=1;no<=yRadius;no++){
						
						var marginSize = (xRadius - (this.getY((yRadius - no),yRadius,factorX)));					
						var marginSize_decimals = (xRadius - (this.getY_withDecimals((yRadius - no),yRadius,factorX)));						
		
						var restValue = (xRadius - marginSize_decimals);				
						var antialiasSize = xRadius - marginSize - Math.floor(savedRestValue)
						var foregroundSize = xRadius - (marginSize + antialiasSize);	
						
						var el = document.createElement('DIV');
						el.style.overflow='hidden';
						el.style.height = '1px';					
						if(cornerArray['bottom_left'])el.style.marginLeft = marginSize + 'px';				
						if(cornerArray['bottom_right'])el.style.marginRight = marginSize + 'px';	
						bottomBar_container.insertBefore(el,bottomBar_container.firstChild);				
						
						var y = bottomBar_container;		
						
						for(var no2=1;no2<=antialiasSize;no2++){
							switch(no2){
								case 1:
									if (no2 == antialiasSize)
										blendMode = ((restValue + savedRestValue) /2) - foregroundSize;
									else {
									  var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
									  blendMode = (restValue - foregroundSize - antialiasSize + 1) * (tmpValue - (yRadius - no)) /2;
									}						
									break;							
								case antialiasSize:								
									var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);								
									blendMode = 1 - (1 - (tmpValue - (yRadius - no))) * (1 - (savedRestValue - foregroundSize)) /2;							
									break;
								default:			
									var tmpValue2 = this.getY_withDecimals((xRadius - marginSize - no2),xRadius,1/factorX);
									var tmpValue = this.getY_withDecimals((xRadius - marginSize - no2 + 1),xRadius,1/factorX);		
									blendMode = ((tmpValue + tmpValue2) / 2) - (yRadius - no);							
							}
							
							el.style.backgroundColor = this.__blendColors(backgroundColor,color,blendMode);
							
							if(y==bottomBar_container)arrayOfDivs[arrayOfDivs.length] = el;
							
							try{	// Need to look closer at this problem which occures in Opera.
								var firstChild = y.getElementsByTagName('DIV')[0];
								y.insertBefore(el,y.firstChild);
							}catch(e){
								y.appendChild(el);							
								errorOccured = true;
							}
							y = el;
							
							var el = document.createElement('DIV');
							el.style.height = '1px';	
							el.style.overflow='hidden';
							if(cornerArray['bottom_left'])el.style.marginLeft = '1px';
							if(cornerArray['bottom_right'])el.style.marginRight = '1px';    						
											
						}
						
						if(errorOccured){	// Opera fix
							for(var divCounter=arrayOfDivs.length-1;divCounter>=0;divCounter--){
								bottomBar_container.appendChild(arrayOfDivs[divCounter]);
							}
						}
						
						el.style.backgroundColor=color;	
						y.appendChild(el);				
						savedRestValue = restValue;
					}
		
				}			
			}
		}		
		// }}}
		,		
		// {{{ getY()
		/**
		 *
		 *
		 *  Add rounded corners to an element
		 *
		 *	@param Int x = x Coordinate
		 *	@param Int maxX = Size of rounded corners
		 *
		 * 
		 * @private
		 */		
		getY : function(x,maxX,factorX){
			// y = sqrt(100 - x^2)			
			// Y = 0.5 * ((100 - x^2)^0.5);			
			return Math.max(0,Math.ceil(factorX * Math.sqrt( (maxX * maxX) - (x*x)) ));
			
		}	
		// }}}
		,		
		// {{{ getY_withDecimals()
		/**
		 *
		 *
		 *  Add rounded corners to an element
		 *
		 *	@param Int x = x Coordinate
		 *	@param Int maxX = Size of rounded corners
		 *
		 * 
		 * @private
		 */		
		getY_withDecimals : function(x,maxX,factorX){
			// y = sqrt(100 - x^2)			
			// Y = 0.5 * ((100 - x^2)^0.5);			
			return Math.max(0,factorX * Math.sqrt( (maxX * maxX) - (x*x)) );
			
		}
		
	
		,
	
		// {{{ __blendColors()
		/**
		 *
		 *
		 *  Simply blending two colors by extracting red, green and blue and subtracting difference between colors from them.
		 * 	Finally, we multiply it with the blendMode value
		 *
		 *	@param String colorA = RGB color
		 *	@param String colorB = RGB color
		 *	@param Float blendMode 
		 *
		 * 
		 * @private
		 */		
		__blendColors : function (colorA, colorB, blendMode) {
			if(colorA.length=='4'){	// In case we are dealing with colors like #FFF
				colorA = '#' + colorA.substring(1,1) + colorA.substring(1,1) + colorA.substring(2,1) + colorA.substring(2,1) + colorA.substring(3,1) + colorA.substring(3,1);
			}	
			if(colorB.length=='4'){	// In case we are dealing with colors like #FFF
				colorB = '#' + colorB.substring(1,1) + colorB.substring(1,1) + colorB.substring(2,1) + colorB.substring(2,1) + colorB.substring(3,1) + colorB.substring(3,1);
			}
			var colorArrayA = [parseInt('0x' + colorA.substring(1,3)), parseInt('0x' + colorA.substring(3, 5)), parseInt('0x' + colorA.substring(5, 7))];	// Create array of Red, Green and Blue ( 0-255)
			var colorArrayB = [parseInt('0x' + colorB.substring(1,3)), parseInt('0x' + colorB.substring(3, 5)), parseInt('0x' + colorB.substring(5, 7))];	// Create array of Red, Green and Blue ( 0-255)		
			var red = Math.round(colorArrayA[0] + (colorArrayB[0] - colorArrayA[0])*blendMode).toString(16);	// Create new Red color ( Hex )
			var green = Math.round(colorArrayA[1] + (colorArrayB[1] - colorArrayA[1])*blendMode).toString(16);	// Create new Green color ( Hex )
			var blue = Math.round(colorArrayA[2] + (colorArrayB[2] - colorArrayA[2])*blendMode).toString(16);	// Create new Blue color ( Hex )
			
			if(red.length==1)red = '0' + red;
			if(green.length==1)green = '0' + green;
			if(blue.length==1)blue = '0' + blue;
				
			return '#' + red + green+ blue;	// Return new RGB color
		}
	}				
	
// Calendar in lib/calendar

	//Global Variables
	var day;
	var mth;
	var yrs;
	
	//-----------------------------------------------------------------------------------------------------------
	// FUNCTIONS
	//-----------------------------------------------------------------------------------------------------------
	function findPosX(obj)
	{
		var curleft = 0;
		if (document.getElementById || document.all)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (document.layers)
			curleft += obj.x;
		return curleft;
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function findPosY(obj)
	{
		var curtop = 0;
		if (document.getElementById || document.all)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (document.layers)
			curtop += obj.y;
		return curtop;
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfIsLeapYear(int_year)
	{
		var isleapyr;
		if (int_year%4==0)
		{	isleapyr = true;	}
		else 
		{	isleapyr = false;	}
		return isleapyr;
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfGetMaxDays(dt_day, dt_mth, dt_yrs)
	{
		var ls_max;
		if (dt_mth==2)
		{
			if (cbfIsLeapYear(dt_yrs))
			{	ls_max = 29;	}
			else
			{	ls_max = 28;	}
		}
		else if ((dt_mth==4) || (dt_mth==6) || (dt_mth==9) || (dt_mth==11))
		{	ls_max = 30;	}
		else
		{	ls_max = 31;	}
		return ls_max;
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfGetMonthName(mth)
	{
		switch(mth)
		{
			case 0 : return "January";
			case 1 : return "February";
			case 2 : return "March";
			case 3 : return "April";
			case 4 : return "May";
			case 5 : return "June";
			case 6 : return "July";
			case 7 : return "August";
			case 8 : return "September";
			case 9 : return "October";
			case 10 : return "November";
			case 11 : return "December";
			default : return "January";
		}
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfloadmefirst(formname, objname)
	{
		var tempObj;
		var tempDate;
		tempObj = eval("document." + formname + "." + objname);
		tempDate = tempObj.value;
		
		if (tempDate.length<=3)
		{	
			tempDate = new Date();
			day = tempDate.getDate();
			mth = tempDate.getMonth()+1;
			yrs = tempDate.getFullYear();
		}
		else
		{
			day = tempDate.slice(tempDate.search("/")+1);
			day = day.slice(0,day.search("/"));
			mth = tempDate.slice(0,tempDate.search("/"));
			tempDate = tempDate.slice(3);
			yrs = tempDate.substr(tempDate.search("/")+1,4);
		}
		
		document.frames.CalFrame.document.fx.txtday.value=day;
		document.frames.CalFrame.document.fx.txtmth.value=mth;
		document.frames.CalFrame.document.fx.txtyrs.value=yrs;
		document.frames.CalFrame.document.fx.txtobj.value=objname;
		document.frames.CalFrame.document.fx.txtfrm.value=formname;
		document.frames.CalFrame.document.fx.txtcurmth.value=mth;
		document.frames.CalFrame.document.fx.txtcuryrs.value=yrs;
		
		cbfdrawcalendar(day,mth,yrs);
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfshowcalendar(formname, objname, imgname)
	{
		//The current size of the IFRAME is width=167 and height=200
		//var x=eval("document.all." + imgname + ".offsetLeft");
		//var y=eval("document.all." + imgname + ".offsetTop");
		var x=findPosX(eval("document.all." + imgname));
		var y=findPosY(eval("document.all." + imgname));
		var max_x = window.screen.width;
		var max_y = window.screen.height-100;
		
		cbfloadmefirst(formname, objname);
		if ((max_y-y<200) && (max_x-x<167))
		{
		document.all.CalFrame.style.top=y-200;
		document.all.CalFrame.style.left=x-167+eval("document.all." + imgname + ".offsetWidth");
		}
		else if (max_y-y<200) 
		{
		document.all.CalFrame.style.top=y-200;
		document.all.CalFrame.style.left=x;
		}
		else if (max_x-x<167)
		{
		document.all.CalFrame.style.top=y+eval("document.all." + imgname + ".offsetHeight");
		document.all.CalFrame.style.left=x-167+eval("document.all." + imgname + ".offsetWidth");
		}
		else
		{
		document.all.CalFrame.style.top=y+eval("document.all." + imgname + ".offsetHeight");
		document.all.CalFrame.style.left=x;
		}
	
		document.all.CalFrame.style.display="block";
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfselectdate(objid)
	{
		var tmpobj;
		var d=eval("document.all." + objid + ".value");
		var m=parent.document.frames.CalFrame.document.fx.txtmth.value;
		var y=parent.document.frames.CalFrame.document.fx.txtyrs.value;
		var objname=parent.document.frames.CalFrame.document.fx.txtobj.value;
		var frmname=parent.document.frames.CalFrame.document.fx.txtfrm.value;
		
		if (d!="")
		{
		cbfdrawcalendar(d,m,y);
		parent.document.frames.CalFrame.document.fx.txtday.value=d;
		
		tmpobj=eval("parent.document." + frmname + "." + objname);
		newdate=m+"/"+d+"/"+y;
		tmpobj.value=newdate;
		
		parent.document.all.CalFrame.style.display="none";
		}
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfgotomonth(action, d, m, y)
	{	
		if (action=="next")
		{	m++;
			if (m>12){m=1;y++;}
		}
		else if (action=="prev")
		{	m--;
			if (m<1){m=12;y--;}
		}
		else
		{	return false;	}
		parent.document.frames.CalFrame.document.fx.txtday.value=d;
		parent.document.frames.CalFrame.document.fx.txtmth.value=m;
		parent.document.frames.CalFrame.document.fx.txtyrs.value=y;
		cbfdrawcalendar(d,m,y);
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfdrawcalendar(dd,mm,yy)
	{
		var dayname;
		var mthname;
		var maxdays;
		var datenow = new Date();
		
		if ((dd!="") || (mm!="") || (yy!=""))
		{
			datenow.setDate(1);
			datenow.setMonth(mm-1);
			datenow.setYear(yy);
		}
		
		datenow.setDate(1);
		dayname = datenow.getDay()+1;
		mthname = cbfGetMonthName(datenow.getMonth());
		maxdays = cbfGetMaxDays("",datenow.getMonth()+1,datenow.getYear());
		
		if (!document.frames.CalFrame)
		{
			parent.document.frames.CalFrame.document.fx.txtmthyrs.value=mthname + " " + datenow.getYear();
			cbfclearcalendar();
			for (var x=1 ; x<=maxdays ; x++)
			{
				eval("parent.document.frames.CalFrame.document.all.d" + dayname + ".value=" + x);
				if ((dd==x) && (mm==parent.document.frames.CalFrame.document.fx.txtcurmth.value) && (yy==parent.document.frames.CalFrame.document.fx.txtcuryrs.value))
				{eval("parent.document.frames.CalFrame.document.all.d" + dayname + ".style.backgroundColor='pink'");}
				dayname++;
			}
		}
		else
		{
			document.frames.CalFrame.document.fx.txtmthyrs.value=mthname + " " + datenow.getYear();
			cbfclearcalendar();
			for (var x=1 ; x<=maxdays ; x++)
			{
				eval("document.frames.CalFrame.document.all.d" + dayname + ".value=" + x);
				if ((dd==x) && (mm==document.frames.CalFrame.document.fx.txtcurmth.value) && (yy==document.frames.CalFrame.document.fx.txtcuryrs.value))
				{eval("document.frames.CalFrame.document.all.d" + dayname + ".style.backgroundColor='pink'");}
				dayname++;
			}
		}
	}
	
	//-----------------------------------------------------------------------------------------------------------
	function cbfclearcalendar()
	{
		for (var x=1 ; x<=42 ; x++)
		{	
			if (!document.frames.CalFrame)
			{
			eval("parent.document.frames.CalFrame.document.all.d" + x + ".value=''");	
			eval("parent.document.frames.CalFrame.document.all.d" + x + ".style.backgroundColor='white'");
			}
			else
			{
			eval("document.frames.CalFrame.document.all.d" + x + ".value=''");	
			eval("document.frames.CalFrame.document.all.d" + x + ".style.backgroundColor='white'");
			}
		}
	}
	
	//-----------------------------------------------------------------------------------------------------------
	/*----------------------------*/
	/*		NO SHORTCUT KEY		  */
	/*----------------------------*/
	function disable_keycode()
	{
		event.keyCode=0;
		event.returnValue=false;
	}
	
	function keydown()
	{
	//alert(event.keyCode);
		if ((event.altKey) && ((event.keyCode==37) || (event.keyCode==39))) disable_keycode();
		if ((event.ctrlKey) && ((event.keyCode==78) || (event.keyCode==82) || (event.keyCode==69) || (event.keyCode==87) || (event.keyCode==66) || (event.keyCode==72) || (event.keyCode==73) || (event.keyCode==76) || (event.keyCode==79) || (event.keyCode==68)  || (event.keyCode==83))) disable_keycode();
		if (event.keyCode==8) disable_keycode();
	//	if (event.keyCode==116) disable_keycode();
		if (event.keyCode==122) disable_keycode();
		if (event.keyCode==93) {alert("No context menu"); disable_keycode();}
	}
	
	//-----------------------------------------------------------------------------------------------------------
	/*----------------------------*/
	/*		NO RIGHT CLICK		  */
	/*----------------------------*/
	function norightclick()
	{
		if (window.event){
		if (event.button!=1)
		{	
			alert("No right click");
			event.cancelBubble=true;
			event.returnValue=false;
			return false;
		}}
	}
	
	function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
	{
	   var arVersion = navigator.appVersion.split("MSIE")
	   var version = parseFloat(arVersion[1])
	   if ((version >= 5.5) && (document.body.filters)) 
	   {
		  for(var i=0; i<document.images.length; i++)
		  {
			 var img = document.images[i]
			 var imgName = img.src.toUpperCase()
			 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			 {
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML
				i = i-1
			 }
		  }
		  window.attachEvent("onload", correctPNG);
	   }    
	}
	

//-----------------------------------------------------------------------------------------------------------
// MAIN PROCEDURE
//-----------------------------------------------------------------------------------------------------------

		
// AJAX FUNCTIONS

	function new_region(list) {
		document.getElementById("region").style.display = "block";
		document.getElementById("region").innerHTML = list;
	}
	function do_new_region(cid) {
		x_loc_update_region(cid,new_region);
	}
	function update_postal(postal) {
		document.getElementById("postal").style.display = "block";
		document.getElementById("postal").innerHTML = postal;
	}
	function do_update_postal(cid) {
		x_loc_update_postal(cid,update_postal);
	}
	function show_check(html) {
		document.getElementById("warning").style.display = "block";
		document.getElementById("warning").innerHTML = html;
		
	}
	function do_check_orgcategory(oid,cid) {
		x_check_org_cat(oid,cid,show_check);
	}