
	var _keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

	 function Base64Decode(input) 
	{
		// Base64String to Array of 24Bits
		var output = [];
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = _keyStr.indexOf(input.charAt(i++));
			enc2 = _keyStr.indexOf(input.charAt(i++));
			enc3 = _keyStr.indexOf(input.charAt(i++));
			enc4 = _keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			ans=chr1;

			if (enc3 != 64) {
				ans|=chr2<<8;
			}
			if (enc4 != 64) {
				ans|=chr3<<16;
			}
			output.push(ans);
		}
		return output;
	}
var gF={},gO={};gC={};
gO[0]="";
/*----------------------------------------------------------------------------\
|                               JSBalloon                                     |
|-----------------------------------------------------------------------------|
|                   Created by Arkady (Alex) Lesniara                         |
|                           (arkady@lesniara.com)                             |
|-----------------------------------------------------------------------------|
|                  Copyright (c) 2005 Arkady Lesniara                         |
|-----------------------------------------------------------------------------|
| This software is provided "as is", without warranty of any kind, express or |
| implied, including  but not limited  to the warranties of  merchantability, |
| fitness for a particular purpose and noninfringement. In no event shall the |
| authors or  copyright  holders be  liable for any claim,  damages or  other |
| liability, whether  in an  action of  contract, tort  or otherwise, arising |
| from,  out of  or in  connection with  the software or  the  use  or  other |
| dealings in the software.                                                   |
\----------------------------------------------------------------------------*/

/* change history
Thanasan Tanhermhong

2007 03 12
	- make code running on FF1.5 and OPR9 (should remove delayShow, delayHide
2006 06 08 
	- implement public isShow function
	- scrolling bug fix
	- combo box subpress using uID hashing mark
todo
	- implement drop shadow effect
	- attach scroll bar
	- cache the image

*/

var JSBalloonPath="";

/*	Class: JSBalloon
	Provides a flexible, encapsulated way to implement a passive feedback mechanism
	in a DHTML environment. Define and initialize this object globally, otherwise it will create a new instance 
	each time you call it's constructor. Set up the object with an object array passed to the constructor or, once instantiated,
	with properties. See <Usage> for more.
*/
function JSBalloon()
{
	var tmrBalloonPopup;
	
	var blbWidth=200;;
	var titleFontStyle='font-family: MS Sans Serif;font-weight: bold; font-size:10pt;';
	var messageFontStyle='font-family: MS Sans Serif\; font-size:10pt\;';
	var footerFontStyle='font-family: MS Sans Serif\; font-size:10pt\;';
	var transShow=false;
	var transHide=false;
	var transShowFilter='progid:DXImageTransform.Microsoft.Fade(Overlap=1.00)';
	var transHideFilter='progid:DXImageTransform.Microsoft.Fade(Overlap=1.00)';
	var transDropShadowFilter='progid:DXImageTransform:Microsoft.DropShadow(color=yellow,strength=5)';
	var autoHide=true;
	var autoHideInterval=2000; // msec
	var autoAway=true;
	var showCloseBox=false;
	
	if(JSBalloon.arguments.length>0)
	{
		var oArg=JSBalloon.arguments[0];
		
		if(oArg.width!=null)
		{
			blbWidth=oArg.width;
		}
		
		if(oArg.titleFontStyle!=null)
		{
			titleFontStyle=oArg.titleFontStyle;
		}
		
		if(oArg.messageFontStyle!=null)
		{
			messageFontStyle=oArg.messageFontStyle;
		}
		
		if(oArg.footerFontStyle!=null)
		{
			footerFontStyle=oArg.footerFontStyle;
		}
		
		if(oArg.transShow!=null)
		{
			transShow=oArg.transShow;
		}
		
		if(oArg.transHide!=null)
		{
			transHide=oArg.transHide;
		}
		
		if(oArg.transShowFilter!=null)
		{
			transShowFilter=oArg.transShowFilter;
		}
		
		if(oArg.transHideFilter!=null)
		{
			transHideFilter=oArg.transHideFilter;
		}
		
		if(oArg.autoHide!=null)
		{
			autoHide=oArg.autoHide;
		}
		
		if(oArg.autoHideInterval!=null)
		{
			autoHideInterval=oArg.autoHideInterval;
		}
		
		if(oArg.autoAway!=null)
		{
			autoAway=oArg.autoAway;
		}
		
		if(oArg.showCloseBox!=null)
		{
			showCloseBox=oArg.showCloseBox;
		}
	}
	
	// Public properties
	
	/*	Property: titleFontStyle
			Sets or retrieves a Cascading Style Sheet formatted value that formats the balloon's title (heading).
		
		Syntax:
			object.titleFontStyle [= sCSS ]
			
		Possible Values:
			sCSS - *variant* that specifies a properly formed Cascading Style Sheet formatting.
			
		Examples:
			balloonObj.titleFontStyle="font-family: MS Sans Serif;font-weight: bold; font-size:12pt;";
	*/
	this.titleFontStyle=titleFontStyle;
	
	/*	Property: messageFontStyle
			Sets or retrieves a Cascading Style Sheet formatted value that formats the balloon's main message body.

		Syntax:
			object.messageFontStyle [= sCSS ]
			
		Possible Values:
			sCSS - *variant* that specifies a properly formed Cascading Style Sheet formatting.
			
		Examples:
			balloonObj.messageFontStyle="font-family: MS Sans Serif;font-weight: bold; font-size:12pt;";
	*/	
	this.messageFontStyle=messageFontStyle;
	
	/*	Property: footerFontStyle
			Sets or retrieves a Cascading Style Sheet formatted value that formats the balloon's footer.

		Syntax:
			object.footerFontStyle [= sCSS ]
			
		Possible Values:
			sCSS - *variant* that specifies a properly formed Cascading Style Sheet formatting.
			
		Examples:
			balloonObj.footerFontStyle="font-family: MS Sans Serif;font-weight: bold; font-size:12pt;";
	*/	
	this.footerFontStyle=footerFontStyle;
	
	/*	Property: transShowFilter
			Sets or retrieves a value of a transition (a filter) applied when showing the balloon.
			
		Syntax:
			object.transShowFilter [= string ]
			
		Possible Values:
			string - *variant* that specifies the transition filter. More information found at http://msdn.microsoft.com/workshop/author/filter/reference/reference.asp
		
		Examples:
			balloonObj.transShowFilter="progid:DXImageTransform.Microsoft.Stretch(stretchstyle=SPIN)";
			
		See also:
			<transShow>
	*/	
	this.transShowFilter=transShowFilter;
	
	/*	Property: transHideFilter
			Sets or retrieves a value of a transition (a filter) applied when hiding the balloon.
			
		Syntax:
			object.transHideFilter [= string ]
			
		Possible Values:
			string - *variant* that specifies the transition filter. More information found at http://msdn.microsoft.com/workshop/author/filter/reference/reference.asp
		
		Examples:
			balloonObj.transHideFilter="progid:DXImageTransform.Microsoft.Slide(slidestyle=HIDE,Bands=1)";
			
		See also:
			<transHide>
	*/	
	this.transHideFilter=transHideFilter;
	
	/*	Property: transShow
			Sets or retrieves a value indicating whether to apply transition filter specified in 
			<transShowFilter> when showing the balloon.
			
		Syntax:
			object.transShow [= bValue ]
			
		Possible Values:
			bValue - *boolean* true / false
		
		Examples:
			balloonObj.transShow=true;
			
		See also:
			<transShowFilter>
	*/	
	this.transShow=transShow;
	
	/*	Property: transHide
			Sets or retrieves a value indicating whether to apply transition filter specified in 
			<transHideFilter> when hiding the balloon.
			
		Syntax:
			object.transHide [= bValue ]
			
		Possible Values:
			bValue - *boolean* true / false
		
		Examples:
			balloonObj.transHide=true;
			
		See also:
			<transHideFilter>
	*/
	this.transHide=transHide;
	
	/*	Property: autoHide
			Sets or retrieves a value indicating whether to automatically hide the balloon 
			after s time specified in <autoHideInterval>.
			
		Syntax:
			object.autoHide [= bValue ]
			
		Possible Values:
			bValue - *boolean* true / false
		
		Examples:
			balloonObj.autoHide=true;
			
		See also:
			<autoHideInterval>
	*/	
	this.autoHide=autoHide;
	
	/*	Property: autoHideInterval
			Sets or retrieves a value indicating how long to wait before executing <autoHide>.
			
		Syntax:
			object.autoHideInterval [= iValue ]
			
		Possible Values:
			iValue - *integer* number of milliseconds to wait before activating <autoHide>.
		
		Examples:
			balloonObj.autoHideInterval=5000; // 5 Sec
			
		See also:
			<autoHide>
	*/	
	this.autoHideInterval=autoHideInterval;
	
	/*	Property: autoAway
			Sets or retrieves a value of this property. 
			When set to true the balloon will immediately run the <Hide> method on mouse over.
			
			This is particularly useful when the balloon is used only for passive feedback and 
			doesn't have to be dismissed. The user may want to perform some task quickly without having
			to wait the time specified in the <autoHideInterval> while the balloon is obstructing a page
			element.
			
		Syntax:
			object.autoAway [= bValue ]
			
		Possible Values:
			bValue - *boolean* true / false
		
		Examples:
			balloonObj.autoAway=true;
	*/	
	this.autoAway=autoAway;
	
	/*	Property: width
			Sets or retrieves a value of balloon's width. The height is dynamic, the width has to be specified.
			
		Syntax:
			object.width [= iValue ]
			
		Possible Values:
			iValue - *integer* the number of pixels.
		
		Examples:
			balloonObj.width=325;
	*/		
	this.width=blbWidth;
		
	/*	Property: showCloseBox
			Sets or retrieves a value of whether the close balloon (right-upper corner) should be displayed.
			It makes sense to turn <autoHide> off when enabling this feature.
			
		Syntax:
			object.showCloseBox [= bValue ]
			
		Possible Values:
			bValue - *boolean* true / false
		
		Examples:
			balloonObj.showCloseBox=false;
	*/	
	this.showCloseBox=showCloseBox;
	
	var childID;
	
	// Constructor
	var balloonDIV = document.createElement("DIV");
	balloonDIV.style.width=String(blbWidth);
	balloonDIV.style.position="absolute";
	balloonDIV.style.visibility="hidden";
	balloonDIV.style.filter=transShowFilter+' '+transHideFilter;
	balloonDIV.style.zIndex=2001;
	
	/*	Property: balloon
			Retrieves the reference to the instantiated balloon object.
			
		Syntax:
			[obj =] object.balloon
			
		Possible Values:
			obj - *object* balloon reference
		
		Examples:
			var obj = balloonObj.balloon;
	*/
	this.balloon=balloonDIV;

	// Pulic Methods
	this.Show=Show;
	this.Hide=Hide;
	this.isShow=isShow;
	
	/*	Function: Show
			Makes the instantiated balloon appear.
			
		Balloon content note: 
			Because SELECT objects are what's known as windowed controles
			they need to be hidden when balloons are shown, otherwise they will always be on top
			(they ignore zIndex attribute). It is normally done automatically by this control.
			Sometimes, however, you may want to place a drop-down inside the balloon itself.
			To override this default behaviour add an balloonMember expando attirbute to 
			the SELECT you are placing withing.
			
			- e.g. <SELECT id=select1 name=select1 balloonMember=true>
			
		Syntax:
			(start code)
			object.Show({[title:vTitle]
						 [,message:vMessage]
						 [,footer:vFooter]
						 [,top:vTop]
						 [,left:vLeft]
						 [,anchor:vAnchor]
						 [,icon:vIcon]
						 });
			(end)
						 
		Possible Values:
			vTitle - *string* Optional title text for the balloon.
			vMessage - *string* Optional. Message body for the balloon.
			vFooter - *string* Optional. Test displayed at the bottom of the balloon on a separate line.
			vTop - *integer* Optional. Offset from the top of the screen or top of an anchor.
			vLeft - *integer* Optional. Offset from the left of the screen or left of an anchor.
			vAnchor - *object* Optional. Reference to the object that the balloon should use as reference for location. 
			vIcon - *string* Optional. Possible icon values may include one of the values below (case sensitive):
				 - Exclaim - pre-defined, triangle with an exclamation point.
				 - Stop - pre-defined, red circle with a white x inside.
				 - Info - pre-defined, white balloon with a letter "i" inside *Default*
				 - Help - a question mark inside a blue circle.
				 - a relative path to a custom icon.
			
		Examples:
			
			- balloonObj.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj, icon:'Info'});
			- balloonObj1.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj});
			- balloonObj2.Show({message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications. ',anchor:tableCellObj});
	
	*/
	function Show()
	{
		var title;
		var message='';
		var icon='';
		var footer='';
		var btop=0, bleft=0;
		var atop=0, aleft=0;
		var anchor;
		var direction='SE';

		// Updates
		blbWidth=String(this.width);
		titleFontStyle=this.titleFontStyle;
		messageFontStyle=this.messageFontStyle;
		footerFontStyle=this.footerFontStyle;
		transShowFilter=this.transShowFilter;
		transHideFilter=this.transHideFilter;
		transShow=this.transShow;
		transHide=this.transHide;
		autoHide=this.autoHide;
		autoHideInterval=this.autoHideInterval;
		autoAway=this.autoAway;

		if(document.readyState!='complete')
		{
//			alert('Document needs to fully load before you may show JSBalloons.');
//			return;
		}
		
		if(Show.arguments.length>0)
		{
			var oArg=Show.arguments[0];
			
			if(oArg.title!=null)
			{
				title=oArg.title;
			}
			
			if(oArg.message!=null)
			{
				message=oArg.message;
			}
			
			if(oArg.icon!=null)
			{
				icon=oArg.icon;
				
				switch(icon)
				{
					case 'Exclaim':
						icon = JSBalloonPath+'images/system/exclaim.ico';
						SoundFx = 'Exclaim';
						break;
						
					case 'Stop':
						icon = JSBalloonPath+'images/system/stop.ico';
						SoundFx = 'Stop';
						break;
						
					case 'Info':
						icon = JSBalloonPath+'images/system/info.ico';
						SoundFx = 'Info';
						break;
					
					case 'Help':
						icon = JSBalloonPath+'images/system/help.ico';
						SoundFx = 'Info';
						break;
						
					default:
						SoundFx = 'Info';
				}
			}

			if(oArg.footer!=null)
			{
				footer=oArg.footer;
			}
			
			if(oArg.top!=null)
			{
				btop=oArg.top;
			}
			
			if(oArg.left!=null)
			{
				bleft=oArg.left;
			}
			
			if(oArg.anchor!=null)
			{
				anchor=oArg.anchor;
				atop=getTop(anchor);
				aleft=getLeft(anchor);
			}
		}
		
		// Figure out the best direction for the pointer
		
		// Assume SE
		var ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
		
		// Populate the contents
		balloonDIV.innerHTML=ret;
		
//		var btnClose=balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0];
//		var btnClose=document.getElementById("error_close");
//		btnClose.onclick=this.Hide;
		
		// check if the object is already initialized
		if(typeof(childID)!='object')
		{
			childID=document.body.appendChild(balloonDIV);	
		}
		
		if(anchor!=null)
		{

			balloonDIV.style.left = aleft+bleft;
			balloonDIV.style.top = (atop-balloonDIV.offsetHeight)+btop;
		}
		else
		{
			balloonDIV.style.left = bleft;
			balloonDIV.style.top = btop;		
		}
		
		
		var bAdjustedLeft=parseInt(balloonDIV.style.left, 10);
		var showSE;

	
		if(document.body.offsetWidth < (bAdjustedLeft+balloonDIV.offsetWidth+20))
		{		
			direction='SW';
			
			ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
			balloonDIV.innerHTML=ret;

			balloonDIV.style.left = bAdjustedLeft-balloonDIV.offsetWidth+20;
			showSE=false;
		}
		else
		{
			direction='SE';
			showSE=true;
		} 
		
		if(parseInt(balloonDIV.style.top, 10)<0)
		{
			if(showSE)
			{
				direction='NE';
				ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
				balloonDIV.innerHTML=ret;
			}
			else
			{
				direction='NW';
				ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
				balloonDIV.innerHTML=ret;
			}
			balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+balloonDIV.offsetHeight;
			if(anchor!=null)
			{
				balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+anchor.offsetHeight
			}
		}			
		
		if(this.showCloseBox)
		{
			btnClose=document.getElementById("error_close");
			btnClose.onclick=this.Hide;
		}
		
		// Adjust all srollers
		/* TUM, scrolling adjust is not need (why I don't known)
		var scrollOffsets=ScrollOffsets(anchor);
		balloonDIV.style.top=parseInt(balloonDIV.style.top, 10)-scrollOffsets[0];
		balloonDIV.style.left=parseInt(balloonDIV.style.left, 10)-scrollOffsets[1];
		*/
		
		// Hide any overlapping selects
		SuppressSelects();
		
		// Show balloon
		if(this.transShow)
		{
			balloonDIV.style.filter=this.transShowFilter+' '+this.transHideFilter;
			if(balloonDIV.filters(0).status==2 || balloonDIV.filters(0).status==1)
			{
				balloonDIV.filters(0).Stop();
			}
			balloonDIV.filters(0).Apply();
			balloonDIV.style.visibility='visible';
			balloonDIV.filters(0).Play();
		}
		else
		{
			balloonDIV.style.visibility='visible';
		}
					
		// Init autohide if true
		if(this.autoHide)
		{
			clearTimeout(this.tmrBalloonPopup);
			transHide=this.transHide;
			this.tmrBalloonPopup=setTimeout(this.Hide, this.autoHideInterval);
		}
		
		if(this.autoAway)
		{
			balloonDIV.onmouseover=Hide;
		}
		else
		{
			balloonDIV.onmouseover='';
		}
	}
	
	// function for Show/Hide Testing (add by tum 2006 06 08)
	function isShow()
	{
        return (balloonDIV.style.visibility!='hidden');
	}

	/*	Function: Hide
			Hide a visible balloon.
			Call this function to immediately initiate the hiding of the instantiated balloon 
			with the predefined transition in <transHideFilter> depending on the setting of <transHide>.
	*/
	function Hide()
	{
		if(balloonDIV.style.visibility=='hidden')
		{
			return;
		}

		if(transHide)
		{
			if(balloonDIV.filters(1).status==2 || balloonDIV.filters(1).status==1)
			{
				balloonDIV.filters(1).Stop();
			}
			balloonDIV.filters(1).Apply();
			balloonDIV.style.visibility='hidden';
			balloonDIV.filters(1).Play();
		}
		else
		{
			balloonDIV.style.visibility='hidden';
		}	
		
		RestoreSelects();
	}
	
	// Private

	function SuppressSelects()
	{
		var selObjects=document.getElementsByTagName("SELECT");
		for(var i=0;i<selObjects.length;i++)
		{	
			if(selObjects[i].balloonMember!='true')
			{
				if(selObjects[i].style.visibility=='visible' || selObjects[i].style.visibility=='' || selObjects[i].baloonHidden!=null) 
				{
					if(ObjectOverlap(balloonDIV, selObjects[i]))
					{
						// mark using hash
						if (selObjects[i].baloonHidden==null)
						{
							selObjects[i].style.visibility='hidden';
							selObjects[i].baloonHidden={};
						}
						selObjects[i].baloonHidden[balloonDIV.uniqueID]=1;
					}
					else // re-show balloon in another place
					{
						if (selObjects[i].baloonHidden==null)
						{
							continue;
						}
						if (selObjects[i].baloonHidden[balloonDIV.uniqueID]!=null)
						{
							selObjects[i].baloonHidden[balloonDIV.uniqueID]=null;
							selObjects[i].style.visibility='visible';
						}
					}
				}
			}
		}
	}
	
	function isEmptyObject(Obj)
	{
		var i;
		for (i in Obj)
		{
			if (Obj[i]!=null)
			{
				return false;
			}
		}
		return true;
	}

	function RestoreSelects()
	{
		var selObjects=document.getElementsByTagName("SELECT");
		
		for(var i=0;i<selObjects.length;i++)
		{	
			// balloonHidden as ReferenceCouter (Mod by tum 2006 06 08)
			if (selObjects[i].baloonHidden==null)
			{
				continue;
			}
			selObjects[i].baloonHidden[balloonDIV.uniqueID]=null;
			if(isEmptyObject(selObjects[i].baloonHidden))
			{
				selObjects[i].style.visibility='visible';
				selObjects[i].baloonHidden=null;
			}
		}
	}
	
	function ObjectOverlap(obj1, obj2)
	{
		var obj1TopX = getLeft(obj1);
		var obj1TopY = getTop(obj1);
		var obj1BottomX = getLeft(obj1)+obj1.offsetWidth;
		var obj1BottomY = getTop(obj1)+obj1.offsetHeight;
		
		var obj2TopX = getLeft(obj2);
		var obj2TopY = getTop(obj2);
		var obj2BottomX = getLeft(obj2)+obj2.offsetWidth;
		var obj2BottomY = getTop(obj2)+obj2.offsetHeight;
		
		var overlapOnX = (obj1TopX < obj2BottomX && obj2TopX < obj1BottomX);
		var overlapOnY = (obj1TopY < obj2BottomY && obj2TopY < obj1BottomY);
		
		return (overlapOnX && overlapOnY);
	}

	//Positioning functions
	function getObjLeft(anObject) 
	{
	  return(anObject.offsetParent ? (getObjLeft(anObject.offsetParent) + anObject.offsetLeft) : anObject.offsetLeft);
	}
		 
	function getObjTop(anObject) 
	{
	  return(anObject.offsetParent ? (getObjTop(anObject.offsetParent) + anObject.offsetTop) : anObject.offsetTop); 
	}
		 
		 
	function getLeft(anObject) 
	{
	    return(getObjLeft(anObject));
	}
		 
	function getTop(anObject) 
	{
	    return(getObjTop(anObject));
	}
	
	function ScrollOffsets(anchor)
	{
		var aryScrolls = new Array(0,0);

		try
		{
			var parentElem=anchor.parentElement;

			while(parentElem!=null)
			{
				if(parentElem.scrollTop!=null)
				{
					aryScrolls[0]+=parseInt(parentElem.scrollTop, 10);
					aryScrolls[1]+=parseInt(parentElem.scrollLeft, 10);
				}
	
				parentElem=parentElem.parentElement;
			}
		}
		catch(ex)
		{
			// continue
		}
		return aryScrolls;
	}

	// Rendering functions
	function balloonInfrastructure(body, direction)
	{
		var ret;
		
		switch(direction)
		{
			case 'SE':
				// South East	
				ret ='<table class="JSBalloon" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" >'+
//				ret ='<table class="JSBalloon" border="0" cellpadding="0" cellspacing="0" style=" filter:progid:DXImageTransform.Microsoft.Shadow(color=\'bbbbbb\', Direction=135, Strength=5);border-collapse: collapse" >'+
					'  <tr>'+
					'    <td height="1" width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftTop.gif" width="10" height="10"></td>'+
					'    <td height="7" width=100% style="border-top:1px solid #999999; border-left-width:1; border-right-width:1; border-bottom-width:1; background-color:#FFFFEA" colspan="4"></td>'+
					'    <td height="7"  width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightTop.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td valign=top colspan="6" style="border-left: 1px solid #999999; border-right: 1px solid #999999; background-color: #FFFFEA">'+
					body +
					'    </td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftBottom.gif" width="10" height="10"></td>'+
					'    <td height="7" style="background-color: #FFFFEA" colspan="4" width="280"></td>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightBottom.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="10"></td>'+
					'    <td width="1" style="border-top: 1px solid #999999; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" height="10"></td>'+
					'    <td  height="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/aSouthEast.gif" width="67" height="18"></td>'+
					'    <td width=100% height="10" style="border-top: 1px solid #999999; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>'+
					'    <td width="70" height="10" style="border-top: 1px solid #999999; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1"></td>'+
					'    <td width="10" height="10"></td>'+
					'  </tr>'+
					'</table>'
					break;

			case 'SW':					
				// South West
				ret ='<table class="JSBalloon" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" >'+
					'  <tr>'+
					'    <td height="1" width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftTop.gif" width="10" height="10"></td>'+
					'    <td height="7" width=179 style="border-top:1px solid #999999; border-left-width:1; border-right-width:1; border-bottom-width:1; background-color:#FFFFEA" colspan="4"></td>'+
					'    <td height="7"  width="11">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightTop.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td valign=top colspan="6" style="border-left: 1px solid #999999; border-right: 1px solid #999999;  background-color: #FFFFEA"">'+
					body +
					'    </td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftBottom.gif" width="10" height="10"></td>'+
					'    <td height="7" style="background-color: #FFFFEA" colspan="4" width="179"></td>'+
					'    <td width="11" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightBottom.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="10"></td>'+
					'    <td width="70" style="border-top: 1px solid #999999; border-left-width:1; border-right-width:1; border-bottom-width:1" height="10"></td>'+
					'    <td  height="10" style="border-left-width: 1; border-right-width: 1; border-top: 1px solid #999999; border-bottom-width: 1" width="100%">'+
					'    </td>'+
					'    <td  align="right">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/aSouthWest.gif" width="67" height="18"></td>'+
					'    <td width="1" height="10" style="border-top: 1px solid #999999;"></td>'+
					'    <td width="10" height="10"></td>'+
					'  </tr>'+
					'</table>'
					break;
					
			case 'NE':	
					// North East
					ret ='<table class="JSBalloon" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" >'+
					'   <tr>'+
					'    <td width="10" height="9"></td>'+
					'    <td width="1" style="border-bottom:1px solid #999999; " height="9"></td>'+
					'    <td  height="9" valign="bottom">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/aNorthEast.gif" width="67" height="18"></td>'+
					'    <td width=100% height="9" style="border-bottom:1px solid #999999; "></td>'+
					'    <td width="70" height="9" style="border-bottom:1px solid #999999;"></td>'+
					'    <td width="10" height="9"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td height="1" width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftTop.gif" width="10" height="10"></td>'+
					'    <td height="7" width=100% colspan="4" bgcolor="#FFFFEA"></td>'+
					'    <td height="7"  width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightTop.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td valign=top colspan="6" style="border-left: 1px solid #999999; border-right: 1px solid #999999; background-color: #FFFFEA">'+
					body +
					'    </td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftBottom.gif" width="10" height="10"></td>'+
					'    <td height="7" style="border-bottom:1px solid #999999; border-left-width:1; border-right-width:1; border-top-width:1" colspan="4" width="280" bgcolor="#FFFFEA"></td>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightBottom.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'</table>'
					break;
					
			case 'NW':	
					// North West			
					ret ='<table class="JSBalloon" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" >'+
					'  <tr>'+
					'    <td width="10" height="10"></td>'+
					'    <td width="70" style="border-bottom:1px solid #999999;  border-left-width:1; border-right-width:1; " height="10"></td>'+
					'    <td  height="10" style="border-bottom:1px solid #999999; border-left-width: 1; border-right-width: 1; " width="100%">'+
					'    </td>'+
					'    <td  align="right" valign="bottom">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/aNorthWest.gif" width="67" height="18"></td>'+
					'    <td width="1" height="10" style="border-bottom:1px solid #999999;"></td>'+
					'    <td width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td height="1" width="10">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftTop.gif" width="10" height="10"></td>'+
					'    <td height="7" width=179 colspan="4" bgcolor="#FFFFEA"></td>'+
					'    <td height="7"  width="11">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightTop.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td valign=top colspan="6" style="border-left: 1px solid #999999; border-right: 1px solid #999999;  background-color: #FFFFEA">'+
					body +
					'    </td>'+
					'  </tr>'+
					'  <tr>'+
					'    <td width="10" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cLeftBottom.gif" width="10" height="10"></td>'+
					'    <td height="7" style="border-bottom:1px solid #999999; border-left-width:1; border-right-width:1; border-top-width:1" colspan="4" width="179" bgcolor="#FFFFEA"></td>'+
					'    <td width="11" height="7">'+
					'    <img border="0" src="'+JSBalloonPath+'images/system/cRightBottom.gif" width="10" height="10"></td>'+
					'  </tr>'+
					'</table>'
					break;
		}
		
		
		return ret;
	}
	
	function balloonBody(title, icon, body, footer, titleFontStyle, 
						messageFontStyle, footerFontStyle,
						showCloseBox)
	{
		var imgShow='none';
		var iconTitle='';
		var ballonBody=body;
		var imgClose='none';
		var headerVisible='block';
		var offsetParent="-7";
		
		if(title!=undefined)
		{
			iconTitle=title;
		}
		
		if(showCloseBox)
		{
			imgClose='block';
		}
		else
		{
			imgClose='none';
		}
		
		if(icon != '')
		{
			imgShow='block';
		}
		else
		{
			imgShow='none';
		}
		
		if(imgShow=='none' && imgClose=='none' && iconTitle=='')
		{
			headerVisible='none';
			offsetParent="0";
		}
		else
		{
			headerVisible='block';
			offsetParent="-7";
		}

		return '    <table border="0" cellpadding="3" cellspacing="0" style="cursor:default;border-collapse: collapse; position:relative; top: '+offsetParent+';left:3" width="100%">' + 
				'      <tr style="display:'+headerVisible+'">' + 
				'        <td id="BIcon" width="3%" align=left><img id=BIcon src="'+icon+'" style="display:'+imgShow+'"></td>' + 
				'        <td id="BTitle" UNSELECTABLE="on" width="90%" style="'+titleFontStyle+'" align=left>'+iconTitle+'</td>' + 
				'        <td id="BClose" width="3%" valign=top align=right><img id="error_close" src="'+JSBalloonPath+'images/system/close.jpg" style="position:relative; top: 4;left:-5;display:'+imgClose+'" onmouseover="this.src=\''+JSBalloonPath+'images/system/closeActive.jpg\'" onmouseout="this.src=\''+JSBalloonPath+'images/system/close.jpg\'" onmouseup="this.src=\''+JSBalloonPath+'images/system/closeActive.jpg\'" onmousedown="this.src=\''+JSBalloonPath+'images/system/closeDown.jpg\'" title="Close">&nbsp;</td>' + 
				'      </tr>' + 
				'      <tr>' + 
				'        <td id="BBody" UNSELECTABLE="on" style="'+messageFontStyle+'" width="100%" colspan="3">' + ballonBody +'</td>' + 
				'      </tr>' + 
				'       <tr>' + 
				'        <td id="BFooter" UNSELECTABLE="on" style="'+footerFontStyle+'" width="100%" colspan="3">' + footer +'</td>' + 
				'      </tr>' + 
				'    </table>'
	}
}

/*
	Section: Usage
		Examples of the object instantiation.
	
	Examples:
	
	(start code)
	var bl=new JSBalloon({ width:300});
	var b2=new JSBalloon();
	var b3=new JSBalloon({	width:150, 
							autoAway:false, 
							autoHide:false,
							showCloseBox:true});
							
	(end)
	
	Section: Include Setup Notes
		Please read before installing.
		
		Set the global variable JSBalloonPath to the full application path (or URL) where 
		it is located. 
		
		Make sure you included the trailing forward slash.
		
	Examples:
		- var JSBalloonPath="/appname/includes/js/JSBalloon/";
		- var JSBalloonPath="http://prodserver/appname/includes/js/JSBalloon/";
*/

function isArray(aObj)
{
   return (aObj instanceof Array);
}

function isString(aObj)
{
   return (typeof aObj == 'string');
}

function isDate(aObj)
{
   return (aObj instanceof Date);
}

function HTMLSpecialChar(x)
{
	return x.replace(/([<>])/g, 
					function(a, b) 
					{
                        if (b=="<") {
                            return "&lt;";
                        }
						else if (b==">")
						{
							return "&gt;"
						}
					}
				);
}


//
// htmlArea v2.03 - Copyright (c) 2002 interactivetools.com, inc.
// This copyright notice MUST stay intact for use (see license.txt).
//
// A free WYSIWYG editor replacement for <textarea> fields.
// For full source code and docs, visit http://www.interactivetools.com/
//

// write out styles for UI buttons
document.write('<style type="text/css">\n');
document.write('.btn     { width: 22px; height: 22px; border: 1px solid buttonface; margin: 0; padding: 0; }\n');
document.write('.btnOver { width: 22px; height: 22px; border: 1px outset; }\n');
document.write('.btnDown { width: 22px; height: 22px; border: 1px inset; background-color: buttonhighlight; }\n');
document.write('.btnNA   { width: 22px; height: 22px; border: 1px solid buttonface; filter: alpha(opacity=25); }\n');
document.write('.cMenu     { background-color: threedface; color: menutext; cursor: Default; font-family: MS Sans Serif; font-size: 8pt; padding: 2 12 2 16; }');
document.write('.cMenuOver { background-color: highlight; color: highlighttext; cursor: Default; font-family: MS Sans Serif; font-size: 8pt; padding: 2 12 2 16; }');
document.write('.cMenuDivOuter { background-color: threedface; height: 9 }');
document.write('.cMenuDivInner { margin: 0 4 0 4; border-width: 1; border-style: solid; border-color: threedshadow threedhighlight threedhighlight threedshadow; }');
document.write('</style>\n');


/* ---------------------------------------------------------------------- *\
  Function    : editor_defaultConfig
  Description : default configuration settings for wysiwyg editor
\* ---------------------------------------------------------------------- */

function editor_defaultConfig(objname) {

this.version = "2.03"

this.width =  "auto";
this.height = "auto";
this.bodyStyle = 'background-color: #FFFFFF; font-family: "Verdana"; font-size: x-small;';
this.imgURL = _editor_url + 'images/';
this.debug  = 0;

this.replaceNextlines = 0; // replace nextlines from spaces (on output)
this.plaintextInput = 0;   // replace nextlines with breaks (on input)

this.toolbar = [
    ['fontname'],
    ['fontsize'],
//    ['fontstyle'],
//    ['linebreak'],
    ['bold','italic','underline','separator'],
//  ['strikethrough','subscript','superscript','separator'],
    ['justifyleft','justifycenter','justifyright','separator'],
    ['OrderedList','UnOrderedList','Outdent','Indent','separator'],
    ['forecolor','backcolor','separator'],
    ['HorizontalRule','Createlink','InsertImage','InsertTable','htmlmode','separator'],
//  ['custom1','custom2','custom3','separator'],
    ['popupeditor','about']];

this.fontnames = {
    "Arial":           "arial, helvetica, sans-serif",
    "Courier New":     "courier new, courier, mono",
    "Georgia":         "Georgia, Times New Roman, Times, Serif",
    "Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
    "Times New Roman": "times new roman, times, serif",
    "Verdana":         "Verdana, Arial, Helvetica, sans-serif",
    "impact":          "impact",
    "WingDings":       "WingDings"};

this.fontsizes = {
    "1 (8 pt)":  "1",
    "2 (10 pt)": "2",
    "3 (12 pt)": "3",
    "4 (14 pt)": "4",
    "5 (18 pt)": "5",
    "6 (24 pt)": "6",
    "7 (36 pt)": "7"
  };

//this.stylesheet = "http://www.domain.com/sample.css"; // full URL to stylesheet

this.fontstyles = [     // make sure these exist in the header of page the content is being display as well in or they won't work!
//    { name: "headline",     className: "headline",  classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
//    { name: "arial red",    className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
//    { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" },
];

this.btnList = {
    // buttonName:    commandID,               title,                onclick,                   image,             
    "bold":           ['Bold',                 'Bold',               'editor_action(this.id)',  'ed_format_bold.gif'],
    "italic":         ['Italic',               'Italic',             'editor_action(this.id)',  'ed_format_italic.gif'],
    "underline":      ['Underline',            'Underline',          'editor_action(this.id)',  'ed_format_underline.gif'],
    "strikethrough":  ['StrikeThrough',        'Strikethrough',      'editor_action(this.id)',  'ed_format_strike.gif'],
    "subscript":      ['SubScript',            'Subscript',          'editor_action(this.id)',  'ed_format_sub.gif'],
    "superscript":    ['SuperScript',          'Superscript',        'editor_action(this.id)',  'ed_format_sup.gif'],
    "justifyleft":    ['JustifyLeft',          'Justify Left',       'editor_action(this.id)',  'ed_align_left.gif'],
    "justifycenter":  ['JustifyCenter',        'Justify Center',     'editor_action(this.id)',  'ed_align_center.gif'],
    "justifyright":   ['JustifyRight',         'Justify Right',      'editor_action(this.id)',  'ed_align_right.gif'],
    "orderedlist":    ['InsertOrderedList',    'Ordered List',       'editor_action(this.id)',  'ed_list_num.gif'],
    "unorderedlist":  ['InsertUnorderedList',  'Bulleted List',      'editor_action(this.id)',  'ed_list_bullet.gif'],
    "outdent":        ['Outdent',              'Decrease Indent',    'editor_action(this.id)',  'ed_indent_less.gif'],
    "indent":         ['Indent',               'Increase Indent',    'editor_action(this.id)',  'ed_indent_more.gif'],
    "forecolor":      ['ForeColor',            'Font Color',         'editor_action(this.id)',  'ed_color_fg.gif'],
    "backcolor":      ['BackColor',            'Background Color',   'editor_action(this.id)',  'ed_color_bg.gif'],
    "horizontalrule": ['InsertHorizontalRule', 'Horizontal Rule',    'editor_action(this.id)',  'ed_hr.gif'],
    "createlink":     ['CreateLink',           'Insert Web Link',    'editor_action(this.id)',  'ed_link.gif'],
    "insertimage":    ['InsertImage',          'Insert Image',       'editor_action(this.id)',  'ed_image.gif'],
    "inserttable":    ['InsertTable',          'Insert Table',       'editor_action(this.id)',  'insert_table.gif'],
    "htmlmode":       ['HtmlMode',             'View HTML Source',   'editor_setmode(\''+objname+'\')', 'ed_html.gif'],
    "popupeditor":    ['popupeditor',          'Enlarge Editor',     'editor_action(this.id)',  'fullscreen_maximize.gif'],
    "about":          ['about',                'About this editor',  'editor_about(\''+objname+'\')',  'ed_about.gif'],

    // Add custom buttons here:
    "custom1":           ['custom1',         'Purpose of button 1',  'editor_action(this.id)',  'ed_custom.gif'],
    "custom2":           ['custom2',         'Purpose of button 2',  'editor_action(this.id)',  'ed_custom.gif'],
    "custom3":           ['custom3',         'Purpose of button 3',  'editor_action(this.id)',  'ed_custom.gif'],
   // end: custom buttons

    "help":           ['showhelp',             'Help using editor',  'editor_action(this.id)',  'ed_help.gif']};


}

/* ---------------------------------------------------------------------- *\
  Function    : editor_generate
  Description : replace textarea with wysiwyg editor
  Usage       : editor_generate("textarea_id",[height],[width]);
  Arguments   : objname - ID of textarea to replace
                w       - width of wysiwyg editor
                h       - height of wysiwyg editor
\* ---------------------------------------------------------------------- */


function editor_generate(objname,userConfig) {

  // Default Settings
  var config = new editor_defaultConfig(objname);
  if (userConfig) { 
    for (var thisName in userConfig) {
      if (userConfig[thisName]) { config[thisName] = userConfig[thisName]; }
    }
  }
  document.all[objname].config = config;                  // store config settings

  // set size to specified size or size of original object
  var obj    = document.all[objname];
  if (!config.width || config.width == "auto") {
    if      (obj.style.width) { config.width = obj.style.width; }      // use css style
    else if (obj.cols)        { config.width = (obj.cols * 8) + 22; }  // col width + toolbar
    else                      { config.width = '100%'; }               // default
  }
  if (!config.height || config.height == "auto") {
    if      (obj.style.height) { config.height = obj.style.height; }   // use css style
    else if (obj.rows)         { config.height = obj.rows * 17 }       // row height
    else                       { config.height = '200'; }              // default
  }

  var tblOpen  = '<table border=0 cellspacing=0 cellpadding=0 style="float: left;"  unselectable="on"><tr><td style="border: none; padding: 1 0 0 0"><nobr>';
  var tblClose = '</nobr></td></tr></table>\n';

  // build button toolbar

  var toolbar = '';
  var btnGroup, btnItem, aboutEditor;
  for (var btnGroup in config.toolbar) {

    // linebreak
    if (config.toolbar[btnGroup].length == 1 &&
        config.toolbar[btnGroup][0].toLowerCase() == "linebreak") {
      toolbar += '<br clear="all">';
      continue;
    }

    toolbar += tblOpen;
    for (var btnItem in config.toolbar[btnGroup]) {
      var btnName = config.toolbar[btnGroup][btnItem].toLowerCase();

      // fontname
      if (btnName == "fontname") {
        toolbar += '<select id="_' +objname+ '_FontName" onChange="editor_action(this.id)" unselectable="on" style="margin: 1 2 0 2; font-size: 12px;">';
        for (var fontname in config.fontnames) {
          toolbar += '<option value="' +config.fontnames[fontname]+ '">' +fontname+ '</option>'
        }
        toolbar += '</select>';
        continue;
      }

      // fontsize
      if (btnName == "fontsize") {
        toolbar += '<select id="_' +objname+ '_FontSize" onChange="editor_action(this.id)" unselectable="on" style="margin: 1 2 0 0; font-size: 12px;">';
        for (var fontsize in config.fontsizes) {
          toolbar += '<option value="' +config.fontsizes[fontsize]+ '">' +fontsize+ '</option>'
        }
        toolbar += '</select>\n';
        continue;
      }

      // font style
      if (btnName == "fontstyle") {
        toolbar += '<select id="_' +objname+ '_FontStyle" onChange="editor_action(this.id)" unselectable="on" style="margin: 1 2 0 0; font-size: 12px;">';
        + '<option value="">Font Style</option>';
        for (var i in config.fontstyles) {
          var fontstyle = config.fontstyles[i];
          toolbar += '<option value="' +fontstyle.className+ '">' +fontstyle.name+ '</option>'
        }
        toolbar += '</select>';
        continue;
      }

      // separator
      if (btnName == "separator") {
        toolbar += '<span style="border: 1px inset; width: 1px; font-size: 16px; height: 16px; margin: 0 3 0 3"></span>';
        continue;
      }

      // buttons
      var btnObj = config.btnList[btnName];
      if (btnName == 'linebreak') { alert("htmlArea error: 'linebreak' must be in a subgroup by itself, not with other buttons.\n\nhtmlArea wysiwyg editor not created."); return; }
      if (!btnObj) { alert("htmlArea error: button '" +btnName+ "' not found in button list when creating the wysiwyg editor for '"+objname+"'.\nPlease make sure you entered the button name correctly.\n\nhtmlArea wysiwyg editor not created."); return; }
      var btnCmdID   = btnObj[0];
      var btnTitle   = btnObj[1];
      var btnOnClick = btnObj[2];
      var btnImage   = btnObj[3];
      toolbar += '<button title="' +btnTitle+ '" id="_' +objname+ '_' +btnCmdID+ '" class="btn" onClick="' +btnOnClick+ '" onmouseover="if(this.className==\'btn\'){this.className=\'btnOver\'}" onmouseout="if(this.className==\'btnOver\'){this.className=\'btn\'}" unselectable="on"><img src="' +config.imgURL + btnImage+ '" border=0 unselectable="on"></button>';


    } // end of button sub-group
    toolbar += tblClose;
  } // end of entire button set

  // build editor

  var editor = '<span id="_editor_toolbar"><table border=0 cellspacing=0 cellpadding=0 bgcolor="buttonface" style="padding: 1 0 0 2" width=' + config.width + ' unselectable="on"><tr><td>\n'
  + toolbar
  + '</td></tr></table>\n'
  + '</td></tr></table></span>\n'
  + '<textarea ID="_' +objname + '_editor" style="width:' +config.width+ '; height:' +config.height+ '; margin-top: -1px; margin-bottom: -1px;" wrap=soft></textarea>';

  // add context menu
  editor += '<div id="_' +objname + '_cMenu" style="position: absolute; visibility: hidden;"></div>';

  //  hide original textarea and insert htmlarea after it
  if (!config.debug) { document.all[objname].style.display = "none"; }

  if (config.plaintextInput) {     // replace nextlines with breaks
    var contents = document.all[objname].value;
    contents = contents.replace(/\r\n/g, '<br>');
    contents = contents.replace(/\n/g, '<br>');
    contents = contents.replace(/\r/g, '<br>');
    document.all[objname].value = contents;
  }

  // insert wysiwyg
  document.all[objname].insertAdjacentHTML('afterEnd', editor)

  // convert htmlarea from textarea to wysiwyg editor
  editor_setmode(objname, 'init');

  // call filterOutput when user submits form
  for (var idx=0; idx < document.forms.length; idx++) {
    var r = document.forms[idx].attachEvent('onsubmit', function() { editor_filterOutput(objname); });
    if (!r) { alert("Error attaching event to form!"); }
  }

return true;

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_action
  Description : perform an editor command on selected editor content
  Usage       :
  Arguments   : button_id - button id string with editor and action name
\* ---------------------------------------------------------------------- */

function editor_action(button_id) {

  // split up button name into "editorID" and "cmdID"
  var BtnParts = Array();
  BtnParts = button_id.split("_");
  var objname    = button_id.replace(/^_(.*)_[^_]*$/, '$1');
  var cmdID      = BtnParts[ BtnParts.length-1 ];
  var button_obj = document.all[button_id];
  var editor_obj = document.all["_" +objname + "_editor"];
  var config     = document.all[objname].config;

  // help popup
  if (cmdID == 'showhelp') {
    window.open(_editor_url + "popups/editor_help.html", 'EditorHelp');
    return;
  }

  // popup editor
  if (cmdID == 'popupeditor') {
    window.open(_editor_url + "popups/fullscreen.html?"+objname,
                'FullScreen',
                'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480');
    return;
  }

  // check editor mode (don't perform actions in textedit mode)
  if (editor_obj.tagName.toLowerCase() == 'textarea') { return; }

  var editdoc = editor_obj.contentWindow.document;
  editor_focus(editor_obj);

  // get index and value for pulldowns
  var idx = button_obj.selectedIndex;
  var val = (idx != null) ? button_obj[ idx ].value : null;

  if (0) {}   // use else if for easy cutting and pasting

  //
  // CUSTOM BUTTONS START HERE
  //

  // Custom1
  else if (cmdID == 'custom1') {
    alert("Hello, I am custom button 1!");
  }

  // Custom2
  else if (cmdID == 'custom2') {  // insert some text from a popup window
    var myTitle = "This is a custom title";
    var myText = showModalDialog(_editor_url + "popups/custom2.html",
                                 myTitle,      // str or obj specified here can be read from dialog as "window.dialogArguments"
                                 "resizable: yes; help: no; status: no; scroll: no; ");
    if (myText) { editor_insertHTML(objname, myText); }
  }

  // Custom3
  else if (cmdID == 'custom3') {  // insert some text
    editor_insertHTML(objname, "It's easy to add buttons that insert text!");
  }

  //
  // END OF CUSTOM BUTTONS
  //

  // FontName
  else if (cmdID == 'FontName' && val) {
    editdoc.execCommand(cmdID,0,val);
  }

  // FontSize
  else if (cmdID == 'FontSize' && val) {
    editdoc.execCommand(cmdID,0,val);
  }

  // FontStyle (change CSS className)
  else if (cmdID == 'FontStyle' && val) {
    editdoc.execCommand('RemoveFormat');
    editdoc.execCommand('FontName',0,'636c6173734e616d6520706c616365686f6c646572');
    var fontArray = editdoc.all.tags("FONT");
    for (i=0; i<fontArray.length; i++) {
      if (fontArray[i].face == '636c6173734e616d6520706c616365686f6c646572') {
        fontArray[i].face = "";
        fontArray[i].className = val;
        fontArray[i].outerHTML = fontArray[i].outerHTML.replace(/face=['"]+/, "");
        }
    }
    button_obj.selectedIndex =0;
  }

  // fgColor and bgColor
  else if (cmdID == 'ForeColor' || cmdID == 'BackColor') {
    var oldcolor = _dec_to_rgb(editdoc.queryCommandValue(cmdID));
    var newcolor = showModalDialog(_editor_url + "popups/select_color.html", oldcolor, "resizable: no; help: no; status: no; scroll: no;");
    if (newcolor != null) { editdoc.execCommand(cmdID, false, "#"+newcolor); }
  }

  // execute command for buttons - if we didn't catch the cmdID by here we'll assume it's a
  // commandID and pass it to execCommand().   See http://msdn.microsoft.com/workshop/author/dhtml/reference/commandids.asp
  else {
    // subscript & superscript, disable one before enabling the other
    if (cmdID.toLowerCase() == 'subscript' && editdoc.queryCommandState('superscript')) { editdoc.execCommand('superscript'); }
    if (cmdID.toLowerCase() == 'superscript' && editdoc.queryCommandState('subscript')) { editdoc.execCommand('subscript'); }

    // insert link
    if (cmdID.toLowerCase() == 'createlink'){
      editdoc.execCommand(cmdID,1);
    }

    // insert image
    else if (cmdID.toLowerCase() == 'insertimage'){
      showModalDialog(_editor_url + "popups/insert_image.html", editdoc, "resizable: no; help: no; status: no; scroll: no; ");
    }

    // insert table
    else if (cmdID.toLowerCase() == 'inserttable'){
      showModalDialog(_editor_url + "popups/insert_table.html?"+objname,
                                 window,
                                 "resizable: yes; help: no; status: no; scroll: no; ");
    }

    // all other commands microsoft Command Identifiers
    else { editdoc.execCommand(cmdID); }
  }

  editor_event(objname);
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_event
  Description : called everytime an editor event occurs
  Usage       : editor_event(objname, runDelay, eventName)
  Arguments   : objname - ID of textarea to replace
                runDelay: -1 = run now, no matter what
                          0  = run now, if allowed
                        1000 = run in 1 sec, if allowed at that point
\* ---------------------------------------------------------------------- */

function editor_event(objname,runDelay) {
  var config = document.all[objname].config;
  var editor_obj  = document.all["_" +objname+  "_editor"];       // html editor object
  if (runDelay == null) { runDelay = 0; }
  var editdoc;
  var editEvent = editor_obj.contentWindow ? editor_obj.contentWindow.event : event;

  // catch keypress events
    if (editEvent && editEvent.keyCode) {
      var ord       = editEvent.keyCode;    // ascii order of key pressed
      var ctrlKey   = editEvent.ctrlKey;
      var altKey    = editEvent.altKey;
      var shiftKey  = editEvent.shiftKey;

      if (ord == 16) { return; }  // ignore shift key by itself
      if (ord == 17) { return; }  // ignore ctrl key by itself
      if (ord == 18) { return; }  // ignore alt key by itself


       // cancel ENTER key and insert <BR> instead
//       if (ord == 13 && editEvent.type == 'keypress') {
//         editEvent.returnValue = false;
//         editor_insertHTML(objname, "<br>");
//         return;
//       }

      if (ctrlKey && (ord == 122 || ord == 90)) {     // catch ctrl-z (UNDO)
//      TODO: Add our own undo/redo functionality
//        editEvent.cancelBubble = true;
        return;
      }
      if ((ctrlKey && (ord == 121 || ord == 89)) ||
          ctrlKey && shiftKey && (ord == 122 || ord == 90)) {     // catch ctrl-y, ctrl-shift-z (REDO)
//      TODO: Add our own undo/redo functionality
        return;
      }
    }

  // setup timer for delayed updates (some events take time to complete)
  if (runDelay > 0) { return setTimeout(function(){ editor_event(objname); }, runDelay); }

  // don't execute more than 3 times a second (eg: too soon after last execution)
  if (this.tooSoon == 1 && runDelay >= 0) { this.queue = 1; return; } // queue all but urgent events
  this.tooSoon = 1;
  setTimeout(function(){
    this.tooSoon = 0;
    if (this.queue) { editor_event(objname,-1); };
    this.queue = 0;
    }, 333);  // 1/3 second


  editor_updateOutput(objname);
  editor_updateToolbar(objname);

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_updateToolbar
  Description : update toolbar state
  Usage       :
  Arguments   : objname - ID of textarea to replace
                action  - enable, disable, or update (default action)
\* ---------------------------------------------------------------------- */

function editor_updateToolbar(objname,action) {
  var config = document.all[objname].config;
  var editor_obj  = document.all["_" +objname+  "_editor"];

  // disable or enable toolbar

  if (action == "enable" || action == "disable") {
    var tbItems = new Array('FontName','FontSize','FontStyle');                           // add pulldowns
    for (var btnName in config.btnList) { tbItems.push(config.btnList[btnName][0]); } // add buttons

    for (var idxN in tbItems) {
      var cmdID = tbItems[idxN].toLowerCase();
      var tbObj = document.all["_" +objname+ "_" +tbItems[idxN]];
      if (cmdID == "htmlmode" || cmdID == "about" || cmdID == "showhelp" || cmdID == "popupeditor") { continue; } // don't change these buttons
      if (tbObj == null) { continue; }
      var isBtn = (tbObj.tagName.toLowerCase() == "button") ? true : false;

      if (action == "enable")  { tbObj.disabled = false; if (isBtn) { tbObj.className = 'btn' }}
      if (action == "disable") { tbObj.disabled = true;  if (isBtn) { tbObj.className = 'btnNA' }}
    }
    return;
  }

  // update toolbar state

  if (editor_obj.tagName.toLowerCase() == 'textarea') { return; }   // don't update state in textedit mode
  var editdoc = editor_obj.contentWindow.document;

  // Set FontName pulldown
  var fontname_obj = document.all["_" +objname+ "_FontName"];
  if (fontname_obj) {
    var fontname = editdoc.queryCommandValue('FontName');
    if (fontname == null) { fontname_obj.value = null; }
    else {
      var found = 0;
      for (i=0; i<fontname_obj.length; i++) {
        if (fontname.toLowerCase() == fontname_obj[i].text.toLowerCase()) {
          fontname_obj.selectedIndex = i;
          found = 1;
        }
      }
      if (found != 1) { fontname_obj.value = null; }     // for fonts not in list
    }
  }

  // Set FontSize pulldown
  var fontsize_obj = document.all["_" +objname+ "_FontSize"];
  if (fontsize_obj) {
    var fontsize = editdoc.queryCommandValue('FontSize');
    if (fontsize == null) { fontsize_obj.value = null; }
    else {
      var found = 0;
      for (i=0; i<fontsize_obj.length; i++) {
        if (fontsize == fontsize_obj[i].value) { fontsize_obj.selectedIndex = i; found=1; }
      }
      if (found != 1) { fontsize_obj.value = null; }     // for sizes not in list
    }
  }

  // Set FontStyle pulldown
  var classname_obj = document.all["_" +objname+ "_FontStyle"];
  if (classname_obj) {
    var curRange = editdoc.selection.createRange();

    // check element and element parents for class names
    var pElement;
    if (curRange.length) { pElement = curRange[0]; }              // control tange
    else                 { pElement = curRange.parentElement(); } // text range
    while (pElement && !pElement.className) { pElement = pElement.parentElement; }  // keep going up

    var thisClass = pElement ? pElement.className.toLowerCase() : "";
    if (!thisClass && classname_obj.value) { classname_obj.value = null; }
    else {
      var found = 0;
      for (i=0; i<classname_obj.length; i++) {
        if (thisClass == classname_obj[i].value.toLowerCase()) {
          classname_obj.selectedIndex = i;
          found=1;
        }
      }
      if (found != 1) { classname_obj.value = null; }     // for classes not in list
    }
  }

  // update button states
  var IDList = Array('Bold','Italic','Underline','StrikeThrough','SubScript','SuperScript','JustifyLeft','JustifyCenter','JustifyRight','InsertOrderedList','InsertUnorderedList');
  for (i=0; i<IDList.length; i++) {
    var btnObj = document.all["_" +objname+ "_" +IDList[i]];
    if (btnObj == null) { continue; }
    var cmdActive = editdoc.queryCommandState( IDList[i] );

    if (!cmdActive)  {                                  // option is OK
      if (btnObj.className != 'btn') { btnObj.className = 'btn'; }
      if (btnObj.disabled  != false) { btnObj.disabled = false; }
    } else if (cmdActive)  {                            // option already applied or mixed content
      if (btnObj.className != 'btnDown') { btnObj.className = 'btnDown'; }
      if (btnObj.disabled  != false)   { btnObj.disabled = false; }
    }
  }
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_updateOutput
  Description : update hidden output field with data from wysiwg
\* ---------------------------------------------------------------------- */

function editor_updateOutput(objname) {
  var config     = document.all[objname].config;
  var editor_obj  = document.all["_" +objname+  "_editor"];       // html editor object
  var editEvent = editor_obj.contentWindow ? editor_obj.contentWindow.event : event;
  var isTextarea = (editor_obj.tagName.toLowerCase() == 'textarea');
  var editdoc = isTextarea ? null : editor_obj.contentWindow.document;

  // get contents of edit field
  var contents;
  if (isTextarea) { contents = editor_obj.value; }
  else            { contents = editdoc.body.innerHTML; }

  // check if contents has changed since the last time we ran this routine
  if (config.lastUpdateOutput && config.lastUpdateOutput == contents) { return; }
  else { config.lastUpdateOutput = contents; }

  // update hidden output field
  document.all[objname].value = contents;
  document.all[objname].fireEvent("onblur"); // tum
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_filterOutput
  Description :
\* ---------------------------------------------------------------------- */

function editor_filterOutput(objname) {
  editor_updateOutput(objname);
  var contents = document.all[objname].value;
  var config   = document.all[objname].config;

  // ignore blank contents
  if (contents.toLowerCase() == '<p>&nbsp;</p>') { contents = ""; }

  // filter tag - this code is run for each HTML tag matched
  var filterTag = function(tagBody,tagName,tagAttr) {
    tagName = tagName.toLowerCase();
    var closingTag = (tagBody.match(/^<\//)) ? true : false;

    // fix placeholder URLS - remove absolute paths that IE adds
    if (tagName == 'img') { tagBody = tagBody.replace(/(src\s*=\s*.)[^*]*(\*\*\*)/, "$1$2"); }
    if (tagName == 'a')   { tagBody = tagBody.replace(/(href\s*=\s*.)[^*]*(\*\*\*)/, "$1$2"); }

    // add additional tag filtering here

    // convert to vbCode
//    if      (tagName == 'b' || tagName == 'strong') {
//      if (closingTag) { tagBody = "[/b]"; } else { tagBody = "[b]"; }
//    }
//    else if (tagName == 'i' || tagName == 'em') {
//      if (closingTag) { tagBody = "[/i]"; } else { tagBody = "[i]"; }
//    }
//    else if (tagName == 'u') {
//      if (closingTag) { tagBody = "[/u]"; } else { tagBody = "[u]"; }
//    }
//    else {
//      tagBody = ""; // disallow all other tags!
//    }

    return tagBody;
  };

  // match tags and call filterTag
  RegExp.lastIndex = 0;
    var matchTag = /<\/?(\w+)((?:[^'">]*|'[^']*'|"[^"]*")*)>/g;   // this will match tags, but still doesn't handle container tags (textarea, comments, etc)

  contents = contents.replace(matchTag, filterTag);

  // remove nextlines from output (if requested)
  if (config.replaceNextlines) { 
    contents = contents.replace(/\r\n/g, ' ');
    contents = contents.replace(/\n/g, ' ');
    contents = contents.replace(/\r/g, ' ');
  }

  // update output with filtered content
  document.all[objname].value = contents;

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_setmode
  Description : change mode between WYSIWYG and HTML editor
  Usage       : editor_setmode(objname, mode);
  Arguments   : objname - button id string with editor and action name
                mode      - init, textedit, or wysiwyg
\* ---------------------------------------------------------------------- */

function editor_setmode(objname, mode) {
  var config     = document.all[objname].config;
  var editor_obj = document.all["_" +objname + "_editor"];

  // wait until document is fully loaded
  if (document.readyState != 'complete') {
    setTimeout(function() { editor_setmode(objname,mode) }, 25);
    return;
  }

  // define different editors
  var TextEdit   = '<textarea ID="_' +objname + '_editor" style="width:' +editor_obj.style.width+ '; height:' +editor_obj.style.height+ '; margin-top: -1px; margin-bottom: -1px;"></textarea>';
  var RichEdit   = '<iframe ID="_' +objname+ '_editor"    style="width:' +editor_obj.style.width+ '; height:' +editor_obj.style.height+ ';"></iframe>';

 // src="' +_editor_url+ 'popups/blank.html"

  //
  // Switch to TEXTEDIT mode
  //

  if (mode == "textedit" || editor_obj.tagName.toLowerCase() == 'iframe') {
    config.mode = "textedit";
    var editdoc = editor_obj.contentWindow.document;
    var contents = editdoc.body.createTextRange().htmlText;
    editor_obj.outerHTML = TextEdit;
    editor_obj = document.all["_" +objname + "_editor"];
    editor_obj.value = contents;
    editor_event(objname);

    editor_updateToolbar(objname, "disable");  // disable toolbar items

    // set event handlers
    editor_obj.onkeydown   = function() { editor_event(objname); }
    editor_obj.onkeypress  = function() { editor_event(objname); }
    editor_obj.onkeyup     = function() { editor_event(objname); }
    editor_obj.onmouseup   = function() { editor_event(objname); }
    editor_obj.ondrop      = function() { editor_event(objname, 100); }     // these events fire before they occur
    editor_obj.oncut       = function() { editor_event(objname, 100); }
    editor_obj.onpaste     = function() { editor_event(objname, 100); }
    editor_obj.onblur      = function() { editor_event(objname, -1); }

    editor_updateOutput(objname);
    editor_focus(editor_obj);
  }

  //
  // Switch to WYSIWYG mode
  //

  else {
    config.mode = "wysiwyg";
    var contents = editor_obj.value;
    if (mode == 'init') { contents = document.all[objname].value; } // on init use original textarea content

    // create editor
    editor_obj.outerHTML = RichEdit;
    editor_obj = document.all["_" +objname + "_editor"];

    // get iframe document object

    // create editor contents (and default styles for editor)
    var html = "";
    html += '<html><head>\n';
    if (config.stylesheet) {
      html += '<link href="' +config.stylesheet+ '" rel="stylesheet" type="text/css">\n';
    }
    html += '<style>\n';
    html += 'body {' +config.bodyStyle+ '} \n';
    for (var i in config.fontstyles) {
      var fontstyle = config.fontstyles[i];
      if (fontstyle.classStyle) {
        html += '.' +fontstyle.className+ ' {' +fontstyle.classStyle+ '}\n';
      }
    }
    html += '</style>\n'
      + '</head>\n'
      + '<body contenteditable="true" topmargin=1 leftmargin=1'

// still working on this
//      + ' oncontextmenu="parent.editor_cMenu_generate(window,\'' +objname+ '\');"'
      +'>'
      + contents
      + '</body>\n'
      + '</html>\n';

    // write to editor window
    var editdoc = editor_obj.contentWindow.document;

    editdoc.open();
    editdoc.write(html);
    editdoc.close();

    editor_updateToolbar(objname, "enable");  // enable toolbar items

    // store objname under editdoc
    editdoc.objname = objname;

    // set event handlers
    editdoc.onkeydown      = function() { editor_event(objname); }
    editdoc.onkeypress     = function() { editor_event(objname); }
    editdoc.onkeyup        = function() { editor_event(objname); }
    editdoc.onmouseup      = function() { editor_event(objname); }
    editdoc.body.ondrop    = function() { editor_event(objname, 100); }     // these events fire before they occur
    editdoc.body.oncut     = function() { editor_event(objname, 100); }
    editdoc.body.onpaste   = function() { editor_event(objname, 100); }
    editdoc.body.onblur    = function() { editor_event(objname, -1); }

    // bring focus to editor
    if (mode != 'init') {             // don't focus on page load, only on mode switch
      editor_focus(editor_obj);
    }

  }

  // Call update UI
  if (mode != 'init') {             // don't update UI on page load, only on mode switch
    editor_event(objname);
  }

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_focus
  Description : bring focus to the editor
  Usage       : editor_focus(editor_obj);
  Arguments   : editor_obj - editor object
\* ---------------------------------------------------------------------- */

function editor_focus(editor_obj) {

  // check editor mode
  if (editor_obj.tagName.toLowerCase() == 'textarea') {         // textarea
    var myfunc = function() { editor_obj.focus(); };
    setTimeout(myfunc,100);                                     // doesn't work all the time without delay
  }

  else {                                                        // wysiwyg
    var editdoc = editor_obj.contentWindow.document;            // get iframe editor document object
    var editorRange = editdoc.body.createTextRange();           // editor range
    var curRange    = editdoc.selection.createRange();          // selection range

    if (curRange.length == null &&                              // make sure it's not a controlRange
        !editorRange.inRange(curRange)) {                       // is selection in editor range
      editorRange.collapse();                                   // move to start of range
      editorRange.select();                                     // select
      curRange = editorRange;
    }
  }

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_about
  Description : display "about this editor" popup
\* ---------------------------------------------------------------------- */

function editor_about(objname) {
  showModalDialog(_editor_url + "popups/about.html", window, "resizable: yes; help: no; status: no; scroll: no; ");
}

/* ---------------------------------------------------------------------- *\
  Function    : _dec_to_rgb
  Description : convert dec color value to rgb hex
  Usage       : var hex = _dec_to_rgb('65535');   // returns FFFF00
  Arguments   : value   - dec value
\* ---------------------------------------------------------------------- */

function _dec_to_rgb(value) {
  var hex_string = "";
  for (var hexpair = 0; hexpair < 3; hexpair++) {
    var myByte = value & 0xFF;            // get low byte
    value >>= 8;                        // drop low byte
    var nybble2 = myByte & 0x0F;          // get low nybble (4 bits)
    var nybble1 = (myByte >> 4) & 0x0F;   // get high nybble
    hex_string += nybble1.toString(16); // convert nybble to hex
    hex_string += nybble2.toString(16); // convert nybble to hex
  }
  return hex_string.toUpperCase();
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_insertHTML
  Description : insert string at current cursor position in editor.  If
                two strings are specifed, surround selected text with them.
  Usage       : editor_insertHTML(objname, str1, [str2], reqSelection)
  Arguments   : objname - ID of textarea
                str1 - HTML or text to insert
                str2 - HTML or text to insert (optional argument)
                reqSelection - (1 or 0) give error if no text selected
\* ---------------------------------------------------------------------- */

function editor_insertHTML(objname, str1,str2, reqSel) {
  var config     = document.all[objname].config;
  var editor_obj = document.all["_" +objname + "_editor"];    // editor object
  if (str1 == null) { str1 = ''; }
  if (str2 == null) { str2 = ''; }

  // for non-wysiwyg capable browsers just add to end of textbox
  if (document.all[objname] && editor_obj == null) {
    document.all[objname].focus();
    document.all[objname].value = document.all[objname].value + str1 + str2;
    return;
  }

  // error checking
  if (editor_obj == null) { return alert("Unable to insert HTML.  Invalid object name '" +objname+ "'."); }

  editor_focus(editor_obj);

  var tagname = editor_obj.tagName.toLowerCase();
  var sRange;

 // insertHTML for wysiwyg iframe
  if (tagname == 'iframe') {
    var editdoc = editor_obj.contentWindow.document;
    sRange  = editdoc.selection.createRange();
    var sHtml   = sRange.htmlText;

    // check for control ranges
    if (sRange.length) { return alert("Unable to insert HTML.  Try highlighting content instead of selecting it."); }

    // insert HTML
    var oldHandler = window.onerror;
    window.onerror = function() { alert("Unable to insert HTML for current selection."); return true; } // partial table selections cause errors
    if (sHtml.length) {                                 // if content selected
      if (str2) { sRange.pasteHTML(str1 +sHtml+ str2) } // surround
      else      { sRange.pasteHTML(str1); }             // overwrite
    } else {                                            // if insertion point only
      if (reqSel) { return alert("Unable to insert HTML.  You must select something first."); }
      sRange.pasteHTML(str1 + str2);                    // insert strings
    }
    window.onerror = oldHandler;
  }

  // insertHTML for plaintext textarea
  else if (tagname == 'textarea') {
    editor_obj.focus();
    sRange  = document.selection.createRange();
    var sText   = sRange.text;

    // insert HTML
    if (sText.length) {                                 // if content selected
      if (str2) { sRange.text = str1 +sText+ str2; }  // surround
      else      { sRange.text = str1; }               // overwrite
    } else {                                            // if insertion point only
      if (reqSel) { return alert("Unable to insert HTML.  You must select something first."); }
      sRange.text = str1 + str2;                        // insert strings
    }
  }
  else { alert("Unable to insert HTML.  Unknown object tag type '" +tagname+ "'."); }

  // move to end of new content
  sRange.collapse(false); // move to end of range
  sRange.select();        // re-select

}

/* ---------------------------------------------------------------------- *\
  Function    : editor_getHTML
  Description : return HTML contents of editor (in either wywisyg or html mode)
  Usage       : var myHTML = editor_getHTML('objname');
\* ---------------------------------------------------------------------- */

function editor_getHTML(objname) {
  var editor_obj = document.all["_" +objname + "_editor"];
  var isTextarea = (editor_obj.tagName.toLowerCase() == 'textarea');

  if (isTextarea) { return editor_obj.value; }
  else            { return editor_obj.contentWindow.document.body.innerHTML; }
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_setHTML
  Description : set HTML contents of editor (in either wywisyg or html mode)
  Usage       : editor_setHTML('objname',"<b>html</b> <u>here</u>");
\* ---------------------------------------------------------------------- */

function editor_setHTML(objname, html) {
  var editor_obj = document.all["_" +objname + "_editor"];
  var isTextarea = (editor_obj.tagName.toLowerCase() == 'textarea');

  if (isTextarea) { editor_obj.value = html; }
  else            { editor_obj.contentWindow.document.body.innerHTML = html; }
}

/* ---------------------------------------------------------------------- *\
  Function    : editor_appendHTML
  Description : append HTML contents to editor (in either wywisyg or html mode)
  Usage       : editor_appendHTML('objname',"<b>html</b> <u>here</u>");
\* ---------------------------------------------------------------------- */

function editor_appendHTML(objname, html) {
  var editor_obj = document.all["_" +objname + "_editor"];
  var isTextarea = (editor_obj.tagName.toLowerCase() == 'textarea');

  if (isTextarea) { editor_obj.value += html; }
  else            { editor_obj.contentWindow.document.body.innerHTML += html; }
}

/* ---------------------------------------------------------------- */

function _isMouseOver(obj,event) {       // determine if mouse is over object
  var mouseX    = event.clientX;
  var mouseY    = event.clientY;

  var objTop    = obj.offsetTop;
  var objBottom = obj.offsetTop + obj.offsetHeight;
  var objLeft   = obj.offsetLeft;
  var objRight  = obj.offsetLeft + obj.offsetWidth;

  if (mouseX >= objLeft && mouseX <= objRight &&
      mouseY >= objTop  && mouseY <= objBottom) { return true; }

  return false;
}

/* ---------------------------------------------------------------- */

function editor_cMenu_generate(editorWin,objname) {
  var parentWin = window;
  editorWin.event.returnValue = false;  // cancel default context menu

  // define content menu options
  var cMenuOptions = [ // menu name, shortcut displayed, javascript code
    ['Cut', 'Ctrl-X', function() {}],
    ['Copy', 'Ctrl-C', function() {}],
    ['Paste', 'Ctrl-C', function() {}],
    ['Delete', 'DEL', function() {}],
    ['---', null, null],
    ['Select All', 'Ctrl-A', function() {}],
    ['Clear All', '', function() {}],
    ['---', null, null],
    ['About this editor...', '', function() {
      alert("about this editor");
    }]];
    editor_cMenu.options = cMenuOptions; // save options

  // generate context menu
  var cMenuHeader = ''
    + '<div id="_'+objname+'_cMenu" onblur="editor_cMenu(this);" oncontextmenu="return false;" onselectstart="return false"'
    + '  style="position: absolute; visibility: hidden; cursor: default; width: 167px; background-color: threedface;'
    + '         border: solid 1px; border-color: threedlightshadow threeddarkshadow threeddarkshadow threedlightshadow;">'
    + '<table border=0 cellspacing=0 cellpadding=0 width="100%" style="width: 167px; background-color: threedface; border: solid 1px; border-color: threedhighlight threedshadow threedshadow threedhighlight;">'
    + ' <tr><td colspan=2 height=1></td></tr>';

  var cMenuList = '';

  var cMenuFooter = ''
    + ' <tr><td colspan=2 height=1></td></tr>'
    + '</table></div>';

  for (var menuIdx in editor_cMenu.options) {
    var menuName = editor_cMenu.options[menuIdx][0];
    var menuKey  = editor_cMenu.options[menuIdx][1];
    var menuCode = editor_cMenu.options[menuIdx][2];

    // separator
    if (menuName == "---" || menuName == "separator") {
      cMenuList += ' <tr><td colspan=2 class="cMenuDivOuter"><div class="cMenuDivInner"></div></td></tr>';
    }

    // menu option
    else {
      cMenuList += '<tr class="cMenu" onMouseOver="editor_cMenu(this)" onMouseOut="editor_cMenu(this)" onClick="editor_cMenu(this, \'' +menuIdx+ '\',\'' +objname+ '\')">';
      if (menuKey) { cMenuList += ' <td align=left class="cMenu">' +menuName+ '</td><td align=right class="cMenu">' +menuKey+ '</td>'; }
      else         { cMenuList += ' <td colspan=2 class="cMenu">' +menuName+ '</td>'; }
      cMenuList += '</tr>';
    }
  }

  var cMenuHTML = cMenuHeader + cMenuList + cMenuFooter;


  document.all['_'+objname+'_cMenu'].outerHTML = cMenuHTML;

  editor_cMenu_setPosition(parentWin, editorWin, objname);

  parentWin['_'+objname+'_cMenu'].style.visibility = 'visible';
  parentWin['_'+objname+'_cMenu'].focus();

}

/* ---------------------------------------------------------------- */

function editor_cMenu_setPosition(parentWin, editorWin, objname) {      // set object position that won't overlap window edge
  var event    = editorWin.event;
  var cMenuObj = parentWin['_'+objname+'_cMenu'];
  var mouseX   = event.clientX + parentWin.document.all['_'+objname+'_editor'].offsetLeft;
  var mouseY   = event.clientY + parentWin.document.all['_'+objname+'_editor'].offsetTop;
  var cMenuH   = cMenuObj.offsetHeight;
  var cMenuW   = cMenuObj.offsetWidth;
  var pageH    = document.body.clientHeight + document.body.scrollTop;
  var pageW    = document.body.clientWidth + document.body.scrollLeft;

  // set horzontal position
  if (mouseX + 5 + cMenuW > pageW) { var left = mouseX - cMenuW - 5; } // too far right
  else                            { var left = mouseX + 5; }

  // set vertical position
  if (mouseY + 5 + cMenuH > pageH) { var top = mouseY - cMenuH + 5; } // too far down
  else                            { var top = mouseY + 5; }

  cMenuObj.style.top = top;
  cMenuObj.style.left = left;

}

/* ---------------------------------------------------------------- */

function editor_cMenu(obj,menuIdx,objname) {
  var action = event.type;
  if      (action == "mouseover" && !obj.disabled && obj.tagName.toLowerCase() == 'tr') {
    obj.className = 'cMenuOver';
    for (var i=0; i < obj.cells.length; i++) { obj.cells[i].className = 'cMenuOver'; }
  }
  else if (action == "mouseout" && !obj.disabled && obj.tagName.toLowerCase() == 'tr')  {
    obj.className = 'cMenu';
    for (var i=0; i < obj.cells.length; i++) { obj.cells[i].className = 'cMenu'; }
  }
  else if (action == "click" && !obj.disabled) {
    document.all['_'+objname+'_cMenu'].style.visibility = "hidden";
    var menucode = editor_cMenu.options[menuIdx][2];
    menucode();
  }
  else if (action == "blur") {
    if (!_isMouseOver(obj,event)) { obj.style.visibility = 'hidden'; }
    else {
      if (obj.style.visibility != "hidden") { obj.focus(); }
    }
  }
  else { alert("editor_cMenu, unknown action: " + action); }
}

/* ---------------------------------------------------------------------- */gO[30843]="haveAddr";gO[45213]="App";gO[82051]="tempCollection";gO[59295]="commonForm";gO[76217]="IHaveCacheLoaderManager";gO[66627]="CacheLoaderManager";gO[34008]="StringWriter";gO[4353]="Hashtable";gO[32073]="haveCommonHtmlProp";gO[19732]="IContextMenuManager";gO[73632]="ContextMenuData";gO[97874]="ContextMenu";gO[1195]="IHaveContextMenu";gO[95468]="CommonCustomControl";gO[15760]="CommonControl";gO[89698]="CommonDomainControl";gO[86073]="CommonHub";gO[47775]="CommonSearchHub";gO[12481]="CommonControlHub";gO[27265]="DefaultCommonControlHub";gO[33849]="LoadOnAddCommonControlHub";gO[37040]="ICannotSelfRenderCommonControlHub";gO[64146]="haveSite";gO[79391]="haveWidth";gO[98929]="haveHeight";gO[61928]="haveLeft";gO[72264]="haveTop";gO[69513]="haveHyperLink";gO[52963]="haveFontSize";gO[28031]="haveFontFamily";gO[76483]="haveFontColor";gO[29344]="haveFocus";gO[96876]="haveTextSize";gO[26764]="haveMaxLength";gO[42841]="haveMaxWidth";gO[8877]="haveMaxHeight";gO[54636]="haveNeedWidth";gO[22960]="haveNeedHeight";gO[95476]="haveEnabled";gO[3676]="have2LvEnabled";gO[53446]="haveVisible";gO[74587]="isDataTable";gO[8976]="SearchBy";gO[85384]="SearchByContainWith";gO[20055]="LogicalDataTable";gO[33040]="DataTable";gO[3562]="CalDataTable";gO[46397]="Encoder";gO[47864]="ParamEncoder";gO[97425]="StringEscEncoder";gO[10295]="EventHandler";gO[94633]="haveEventOnClick";gO[14522]="haveEventOnChange";gO[21297]="haveEventOnFocus";gO[98487]="haveEventOnBlur";gO[59335]="Timer";gO[54699]="haveImage";gO[95269]="haveHoverImage";gO[82502]="haveDisabledImage";gO[93850]="haveClickImage";gO[17723]="haveCheckedImage";gO[53938]="haveHoverCheckedImage";gO[50150]="haveDisabledCheckedImage";gO[86315]="IImageCacheManager";gO[64762]="ILazyManager";gO[80568]="haveMode";gO[79837]="haveModeAndChild";gO[14193]="ModelRecord";gO[85253]="IHavePos";gO[7965]="IMsgSite";gO[38684]="IMsgNotifier";gO[3592]="IPopUpManager";gO[37251]="IPopUpController";gO[38973]="IHaveSecurityContext";gO[78785]="ICanChange";gO[79308]="IServiceClient";gO[41392]="IServiceConnector";gO[35047]="ServiceConnector";gO[73796]="CanCacheServiceConnector";gO[16527]="CanSmartCacheServiceConnector";gO[83157]="CanExpiredCacheServiceConnector";gO[46323]="ThaiTool";gO[63043]="Requestor";gO[30130]="ActiveComboBoxControl";gO[3125]="ICanRecordControl";gO[81632]="IRecordControl";gO[95346]="IPageControl";gO[62520]="BitTorrent2PageControl";gO[79904]="haveTotalRecord";gO[41893]="haveRecordPerPage";gO[89725]="PageCalDataTable";gO[55941]="ButtonControl";gO[35417]="CalendarControl";gO[65319]="haveDelay";gO[55193]="havePath";gO[20187]="CanUpload";gO[17252]="CheckboxControl";gO[57883]="IHaveNormalState";gO[36824]="ComboBoxControl";gO[31674]="YearChooserControl";gO[37735]="MonthChooserControl";gO[7470]="DateChooserControl";gO[80270]="TimeChooserControl";gO[24790]="DateChooserExControl";gO[74445]="DateFormater";gO[5161]="DateEngFormater";gO[31926]="EditControl";gO[61468]="EventCalendarControl";gO[61825]="FileUploadControl";gO[22083]="ImageButtonControl";gO[16928]="ImageCheckboxControl";gO[89920]="ImageUploadControl";gO[28610]="LabelControl";gO[15258]="MemoControl";gO[62169]="IMenuCollection";gO[28470]="Menu";gO[60731]="MenuItem";gO[60904]="MenuStyle";gO[56520]="havePaddingLeft";gO[35420]="haveBgImage";gO[94403]="haveSubMenuImage";gO[38605]="haveHoverSubMenuImage";gO[65453]="haveCaption";gO[50892]="haveSubMenu";gO[69071]="haveStyle";gO[14799]="haveOrientation";gO[42235]="haveBigImage";gO[21573]="PasswordControl";gO[94910]="RichEditorControl";gO[99027]="TreeViewControl";gO[2902]="HaveFillColor";gO[44317]="HaveArcSize";gO[14561]="HaveGradientFillColor";gO[71365]="HaveShadow";gO[57183]="I2DShape";gO[89526]="I2DSimpleShape";gO[63794]="IRect";gO[4488]="ICurve";gO[12575]="IOval";gO[90252]="IRoundRect";gO[60785]="ILine";gO[28804]="ICommonPainter";gO[93738]="ICanvas";gO[7969]="VMLPainter";gO[78693]="VMLCanvas";gO[14082]="IHaveAddButtonDevice";gO[44427]="IHaveDelButtonDevice";gO[10930]="IHaveDelAllButtonDevice";gO[81223]="IHaveDelNoneButtonDevice";gO[66035]="IHaveDelSwapButtonDevice";gO[4115]="IHaveSearchButtonDevice";gO[26069]="IHaveNumberOfAddRecordDevice";gO[25871]="IHaveEditButtonDevice";gO[61271]="IHaveSaveButtonDevice";gO[76520]="IHaveCancelButtonDevice";gO[50371]="MenuStyle_MainMenu";gO[64522]="MenuStyle_SubMenu";gO[69065]="Menu_main";gO[32210]="Menu_base";gO[32649]="Menu_newsandevent";gO[96113]="Menu_advertisement";gO[33383]="Menu_information";gO[12482]="Menu_sell_buy";gO[61680]="Menu_members";gO[51019]="Menu_member_industry";gO[13602]="Menu_ISIC";gO[26689]="Menu_Harmonized";gO[21613]="Menu_train";gO[11877]="Menu_promotion";gO[7352]="Menu_admin";gO[60222]="Menu_report";gO[608]="Menu_logistic";function ReportError(ErrorMsg){throw new Error(ErrorMsg);}var gWebCommonVer="1.0.0.0";var gRDDGenVer="1.0.0.0";var gRDDILib="1.0.7.0231";var gFormVer="1.0.0.0";var gServerName="Unknown";var gServerIP="Unknown";function _ErrorMessage(aError){var ServerInfo;var ErrorMsg=aError.message;ServerInfo=(((("<b>Server :</b> "+gServerName)+" ( IP:")+gServerIP)+")<br>");if((isIE()==false)){ErrorMsg+=(((" at line "+aError.lineNumber)+" in ")+aError.fileName);}return (((((((((((((((("<h1><font color=red>"+ErrorMsg)+"</font></h1><hr><br>")+"<b>Error:-</b><br><br><table width=100% bgcolor=FFFFCC ><tr><td><br><div style=\"position:relative;left:30\">")+ErrorMsg)+"<br><br></table></div><br>")+"<b>Server Information:-</b><br><br><table width=100% bgcolor=FFFFCC ><tr><td><br><div style=\"position:relative;left:30\">")+ServerInfo)+"<br></table></div><br>")+"<hr><b>Version Information:-</b> ESWC Version ")+gWebCommonVer)+"; ESAF Version ")+gRDDGenVer)+"; ESID ")+"1.0.0.255")+"; ESUI ")+gRDDILib);}function _RaiseError(aError){throw aError;}function _haveAddr_GetClassName(){return "haveAddr";}haveAddr.prototype.GetClassName=_haveAddr_GetClassName;function _haveAddr_GetCID(){return 30843;}haveAddr.prototype.GetCID=_haveAddr_GetCID;function _haveAddr_SelfCall(CallExpr){with(this){return (((("\"try{ return gApp.GetObj("+fOID)+").")+CallExpr)+"}catch(e){_RaiseError(e)}\"");}}haveAddr.prototype.SelfCall=_haveAddr_SelfCall;function haveAddr(){this.fOID=gApp.GetNewID(this);}function _App_GetClassName(){return "App";}App.prototype.GetClassName=_App_GetClassName;function _App_GetCID(){return 45213;}App.prototype.GetCID=_App_GetCID;function _App_GetNewID(aObj){with(this){;++fCurOID;fAllObj[fCurOID]=aObj;return fCurOID;}}App.prototype.GetNewID=_App_GetNewID;function _App_GetCacheManager(ServiceID){with(this){var Result;Result=fCacheManager[ServiceID];if((Result==null)){Result=new Array();fCacheManager[ServiceID]=Result;}return Result;}}App.prototype.GetCacheManager=_App_GetCacheManager;function _App_ClearCache(){with(this){fCacheManager=new Array();}}App.prototype.ClearCache=_App_ClearCache;function _App_GetObj(aOID){with(this){;;;return fAllObj[aOID];}}App.prototype.GetObj=_App_GetObj;function _App_Init(){with(this){fSite=document.createElement("div");fSite.outerHTML="<div id=_app style=\"width:100%;height:100%\" UNSELECTABLE=on >";if((fPart!="")){var lObj=document.getElementById(fPart);if(lObj){lObj.appendChild(fSite);return true;}}document.body.appendChild(fSite);}}App.prototype.Init=_App_Init;function _App_ShowEnv(){with(this){var tmp=new StringWriter();var I;tmp.Add("<table><tr><td>id<td>obj");var _3A90=fCurOID;for(I=0;I<=_3A90;++I){tmp.Add(((("<tr><td>"+I)+"<td>")+fAllObj[I]));}tmp.Add("</table>");return tmp.ToText();}}App.prototype.ShowEnv=_App_ShowEnv;function App(AParent,Part){Part=Part||"";this.fOID=0;this.fCurOID=0;this.fCacheManager=new Array();this.fAllObj=new Array();this.fInternalData=new Array();this.LoadingStr="<b><font color=blue>loading...</font></b>";this.fChangeLevel=0;this.fActionList=new Array();this.fParamCache=new Array("()","(P[0])","(P[0],P[1])","(P[0],P[1],P[2])","(P[0],P[1],P[2],P[3])","(P[0],P[1],P[2],P[3],P[4])","(P[0],P[1],P[2],P[3],P[4],P[5])","(P[0],P[1],P[2],P[3],P[4],P[5],P[6])","(P[0],P[1],P[2],P[3],P[4],P[5],P[6],P[7])");this.fTimer=null;this.fDupCheck=new Array();this.fMenuHash=new Array();this.fObj=null;this.fSecureTab=null;this.fCacheLoaderManager=new Array();this.fImageHash=new Object();this.fPopUpObjList=new Array();this.fInfoBalloon=null;this.fSite=null;with(this){fParent=AParent;fPart=Part;fAllObj[0]=this;Init();AttachEvent_OnMouseUp();}}function _App_AttachEvent_OnMouseUp(){with(this){if(!isIE()){document.captureEvents(Event.MOUSEUP);}document.onmouseup=OnMouseUp;}}App.prototype.AttachEvent_OnMouseUp=_App_AttachEvent_OnMouseUp;function _App_PushInitData(aData){with(this){var i=(aData.length-1);while (i>=1){fInternalData[aData[(i-1)]]=aData[i];i-=2;}}}App.prototype.PushInitData=_App_PushInitData;function _App_GetData(Name){with(this){return fInternalData[Name];}}App.prototype.GetData=_App_GetData;function _App_GenDBCDArg(){with(this){var Obj=document.getElementById("__DBCD_Mode");if(Obj){return ("&__DBCD_Mode="+Obj.value);}return "";}}App.prototype.GenDBCDArg=_App_GenDBCDArg;App.prototype.BeginChange=_ILazyManager_BeginChange;App.prototype.Exec=_ILazyManager_Exec;App.prototype.RunAllTask=_ILazyManager_RunAllTask;App.prototype.ResumeRunAllTask=_ILazyManager_ResumeRunAllTask;App.prototype.AddTask=_ILazyManager_AddTask;App.prototype.isDup=_ILazyManager_isDup;App.prototype.EndChange=_ILazyManager_EndChange;App.prototype.AddMenu=_IMenuCollection_AddMenu;App.prototype.Menu=_IMenuCollection_Menu;App.prototype.ShowContextMenu=_IContextMenuManager_ShowContextMenu;App.prototype.CanServe=_IHaveSecurityContext_CanServe;App.prototype.ListCanServe=_IHaveSecurityContext_ListCanServe;App.prototype.InitSecureTab=_IHaveSecurityContext_InitSecureTab;App.prototype.GetCacheLoaderManager=_IHaveCacheLoaderManager_GetCacheLoaderManager;App.prototype.GetImage=_IImageCacheManager_GetImage;App.prototype.AddPopUp=_IPopUpManager_AddPopUp;App.prototype.RemovePopUp=_IPopUpManager_RemovePopUp;App.prototype.CanHide=_IPopUpManager_CanHide;App.prototype.HandlerPopUpObj=_IPopUpManager_HandlerPopUpObj;App.prototype.ShowMsg=_IMsgNotifier_ShowMsg;App.prototype.UpdateMsg=_IMsgNotifier_UpdateMsg;App.prototype.AddChild=_haveSite_AddChild;App.prototype.AddChild2=_haveSite_AddChild2;App.prototype.RemoveChild=_haveSite_RemoveChild;function GetData(Name){return gApp.GetData(Name);}function OnMouseUp(ev){ev=ev||window.event;gApp.HandlerPopUpObj(ev);}function _tempCollection_GetClassName(){return "tempCollection";}tempCollection.prototype.GetClassName=_tempCollection_GetClassName;function _tempCollection_GetCID(){return 82051;}tempCollection.prototype.GetCID=_tempCollection_GetCID;function _tempCollection_Records(Index){with(this){return fChild[Index];}}tempCollection.prototype.Records=_tempCollection_Records;function _tempCollection_Add(Obj){with(this){fChild.push(Obj);}}tempCollection.prototype.Add=_tempCollection_Add;function tempCollection(){this.fChild=new Array();}function _commonForm_GetClassName(){return "commonForm";}commonForm.prototype.GetClassName=_commonForm_GetClassName;function _commonForm_GetCID(){return 59295;}commonForm.prototype.GetCID=_commonForm_GetCID;function _commonForm_OwnerForm(){with(this){return this;}}commonForm.prototype.OwnerForm=_commonForm_OwnerForm;function _commonForm_ParentColletion(){with(this){var tmp=new tempCollection();tmp.Add(this);return tmp;}}commonForm.prototype.ParentColletion=_commonForm_ParentColletion;function _commonForm_MoveSite(SiteName){with(this){document.getElementById(SiteName).appendChild(fObj);}}commonForm.prototype.MoveSite=_commonForm_MoveSite;function _commonForm_Init(){with(this){fObj=document.createElement("span");fObj.id=fOID;fObj.innerHTML=gApp.LoadingStr;if(fPart){document.getElementById(fPart).appendChild(fObj);}else if(fParent){fParent.AddChild(this,fPart);}fRecordOwner=this;DoInit();InitDevice();BuildModel(true);Render();}}commonForm.prototype.Init=_commonForm_Init;function commonForm(AParent,Part){Part=Part||"";this.fErrorCnt=0;this.fCancelButton=null;this.fSaveButton=null;this.fEditButton=null;this.fAddButton=null;this.fMode=0;this.fSite=null;this.fObj=null;this.fRecordOwner=null;this.fPart=null;this.fParent=null;this.fEnabledRender=true;this.fOID=gApp.GetNewID(this);this.fFocus=false;this.fVisible=true;this.fEnabled=true;with(this){fParent=AParent;fRecordOwner=Part;fPart=Part;Init();}}function _commonForm_ReLoad(){with(this){var lParent=GetParentNode(fObj);var lObj;lObj=fObj;fObj=document.createElement("span");fObj.id=fOID;lParent.removeChild(lObj);lParent.appendChild(fObj);BuildModel(true);Recale();Render();IncErrorCnt(0);}}commonForm.prototype.ReLoad=_commonForm_ReLoad;function _commonForm_InitCustomDevice(){with(this){}}commonForm.prototype.InitCustomDevice=_commonForm_InitCustomDevice;function _commonForm_AttachCustomDevice(){with(this){}}commonForm.prototype.AttachCustomDevice=_commonForm_AttachCustomDevice;function _commonForm_InitDevice(){with(this){InitAddButton();InitEditButton();InitSaveButton();InitCancelButton();InitCustomDevice();}}commonForm.prototype.InitDevice=_commonForm_InitDevice;function _commonForm_RenderDevice(){with(this){}}commonForm.prototype.RenderDevice=_commonForm_RenderDevice;function _commonForm_AttachDevice(){with(this){RenderDevice();AttachCustomDevice();}}commonForm.prototype.AttachDevice=_commonForm_AttachDevice;function _commonForm_IncErrorCnt(aInc){aInc=aInc||0;with(this){fErrorCnt+=aInc;if(fSaveButton){if(false){document.getElementById("__ShowErrorCnt").value=fErrorCnt;}fSaveButton.SetSysEnabled((fErrorCnt==0));}}}commonForm.prototype.IncErrorCnt=_commonForm_IncErrorCnt;function _commonForm_TryAdd(){with(this){;}}commonForm.prototype.TryAdd=_commonForm_TryAdd;function _commonForm_TryEdit(){with(this){;}}commonForm.prototype.TryEdit=_commonForm_TryEdit;function _commonForm_TrySave(){with(this){;}}commonForm.prototype.TrySave=_commonForm_TrySave;function _commonForm_TryCancel(){with(this){;}}commonForm.prototype.TryCancel=_commonForm_TryCancel;function _commonForm_EnabledSaveAndCancel(Enabled){with(this){if(fAddButton){fAddButton.SetEnabled(!Enabled);}if(fEditButton){fEditButton.SetEnabled(!Enabled);}if(fSaveButton){fSaveButton.SetEnabled(Enabled);}if(fCancelButton){fCancelButton.SetEnabled(Enabled);}}}commonForm.prototype.EnabledSaveAndCancel=_commonForm_EnabledSaveAndCancel;function _commonForm_ClearSaveAndCancelPermission(){with(this){if(fSaveButton){fSaveButton.SetPermission(true);}if(fCancelButton){fCancelButton.SetPermission(true);}}}commonForm.prototype.ClearSaveAndCancelPermission=_commonForm_ClearSaveAndCancelPermission;function _commonForm_StartWithAddMode(){with(this){if(fAddButton.GetEnabled()){fMode=1;EnabledSaveAndCancel(true);}else{alert("ไม่สามารถเปลี่ยนเป็น Add Mode ได้ในขณะนี้");}}}commonForm.prototype.StartWithAddMode=_commonForm_StartWithAddMode;function _commonForm_StartWithEditMode(){with(this){if(fEditButton.GetEnabled()){fMode=2;EnabledSaveAndCancel(true);}else{alert("ไม่สามารถเปลี่ยนเป็น Edit Mode ได้ในขณะนี้");}}}commonForm.prototype.StartWithEditMode=_commonForm_StartWithEditMode;function _commonForm_OnAddButtonClick(){with(this){fMode=1;IncErrorCnt(-fErrorCnt);if(TryAdd()){EnabledSaveAndCancel(true);SetMode(1);}else{fMode=0;}}}commonForm.prototype.OnAddButtonClick=_commonForm_OnAddButtonClick;function _commonForm_OnEditButtonClick(){with(this){fMode=2;IncErrorCnt(-fErrorCnt);if(TryEdit()){EnabledSaveAndCancel(true);SetMode(2);}else{fMode=0;}}}commonForm.prototype.OnEditButtonClick=_commonForm_OnEditButtonClick;function _commonForm_OnAfterSave(){with(this){}}commonForm.prototype.OnAfterSave=_commonForm_OnAfterSave;function _commonForm_OnAfterCancel(){with(this){}}commonForm.prototype.OnAfterCancel=_commonForm_OnAfterCancel;function _commonForm_OnSaveButtonClick(){with(this){if(fSaveButton){fSaveButton.SetEnabled(false);}if(fCancelButton){fCancelButton.SetEnabled(false);}try {;TrySave();EnabledSaveAndCancel(false);OnAfterSave();fMode=0;gApp.ClearCache();ClearSaveAndCancelPermission();ReLoad();return true;} catch(e) {;if(fSaveButton){fSaveButton.SetEnabled(true);}if(fCancelButton){fCancelButton.SetEnabled(true);}alert("Error");_RaiseError(e); } ;}}commonForm.prototype.OnSaveButtonClick=_commonForm_OnSaveButtonClick;function _commonForm_OnCancelButtonClick(){with(this){if(TryCancel()){EnabledSaveAndCancel(false);OnAfterCancel();fMode=0;ClearSaveAndCancelPermission();BeginChange();ReLoad();EndChange();}}}commonForm.prototype.OnCancelButtonClick=_commonForm_OnCancelButtonClick;commonForm.prototype.AttachCancelButton=_IHaveCancelButtonDevice_AttachCancelButton;commonForm.prototype.InitCancelButton=_IHaveCancelButtonDevice_InitCancelButton;commonForm.prototype.GetCancelButton=_IHaveCancelButtonDevice_GetCancelButton;commonForm.prototype.AttachSaveButton=_IHaveSaveButtonDevice_AttachSaveButton;commonForm.prototype.InitSaveButton=_IHaveSaveButtonDevice_InitSaveButton;commonForm.prototype.GetSaveButton=_IHaveSaveButtonDevice_GetSaveButton;commonForm.prototype.AttachEditButton=_IHaveEditButtonDevice_AttachEditButton;commonForm.prototype.InitEditButton=_IHaveEditButtonDevice_InitEditButton;commonForm.prototype.GetEditButton=_IHaveEditButtonDevice_GetEditButton;commonForm.prototype.AttachAddButton=_IHaveAddButtonDevice_AttachAddButton;commonForm.prototype.InitAddButton=_IHaveAddButtonDevice_InitAddButton;commonForm.prototype.GetAddButton=_IHaveAddButtonDevice_GetAddButton;commonForm.prototype.ClearChild=_haveModeAndChild_ClearChild;commonForm.prototype.DoRenderForMode=_haveModeAndChild_DoRenderForMode;commonForm.prototype.SetMode=_haveModeAndChild_SetMode;commonForm.prototype.GetMode=_haveMode_GetMode;commonForm.prototype.AddChild=_haveSite_AddChild;commonForm.prototype.AddChild2=_haveSite_AddChild2;commonForm.prototype.RemoveChild=_haveSite_RemoveChild;commonForm.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;commonForm.prototype.SetSite=_CommonCustomControl_SetSite;commonForm.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;commonForm.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;commonForm.prototype.DoInit=_CommonCustomControl_DoInit;commonForm.prototype.DoRender=_CommonCustomControl_DoRender;commonForm.prototype._Render=_CommonCustomControl_Render;function lz_commonForm_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}commonForm.prototype.Render=lz_CommonCustomControl_Render;commonForm.prototype.SelfCall=_haveAddr_SelfCall;commonForm.prototype.DoSetFocus=_haveFocus_DoSetFocus;commonForm.prototype.DoChangeFocus=_haveFocus_DoChangeFocus;commonForm.prototype.SetFocus=_haveFocus_SetFocus;commonForm.prototype.DoSetVisible=_haveVisible_DoSetVisible;commonForm.prototype.SetVisible=_haveVisible_SetVisible;commonForm.prototype.DoSetEnabled=_haveEnabled_DoSetEnabled;commonForm.prototype.GetEnabled=_haveEnabled_GetEnabled;commonForm.prototype.SetEnabled=_haveEnabled_SetEnabled;function BrowserID(){if((gBrowserID==-1)){if(document.layers){gBrowserID=5;}else if(document.all){var agent=navigator.userAgent.toLowerCase();if((agent.indexOf("konqueror")!=-1)){gBrowserID=4;}else if((agent.indexOf("opera")!=-1)){gBrowserID=3;}else{gBrowserID=2;}}else if(document.getElementById){gBrowserID=1;}else{gBrowserID=0;}}return gBrowserID;}function BrowserName(){var ID=BrowserID();switch(ID){case 1:return "Mozilla based Browser";break;case 2:return "Internet Explorer";break;case 3:return "Opera";break;case 4:return "Konqueror";break;case 5:return "Netscape based Browser";break;default :return "Unknown Browser";}}function isIE(){return (BrowserID()==2);}var gBrowserID=-1;function _IHaveCacheLoaderManager_GetClassName(){return "IHaveCacheLoaderManager";}IHaveCacheLoaderManager.prototype.GetClassName=_IHaveCacheLoaderManager_GetClassName;function _IHaveCacheLoaderManager_GetCID(){return 76217;}IHaveCacheLoaderManager.prototype.GetCID=_IHaveCacheLoaderManager_GetCID;function _IHaveCacheLoaderManager_GetCacheLoaderManager(fService){with(this){var lObj=fCacheLoaderManager[fService];if((lObj==null)){lObj=new CacheLoaderManager();fCacheLoaderManager[fService]=lObj;}return lObj;}}IHaveCacheLoaderManager.prototype.GetCacheLoaderManager=_IHaveCacheLoaderManager_GetCacheLoaderManager;function IHaveCacheLoaderManager(){this.fCacheLoaderManager=new Array();}function _CacheLoaderManager_GetClassName(){return "CacheLoaderManager";}CacheLoaderManager.prototype.GetClassName=_CacheLoaderManager_GetClassName;function _CacheLoaderManager_GetCID(){return 66627;}CacheLoaderManager.prototype.GetCID=_CacheLoaderManager_GetCID;function _CacheLoaderManager_isLoadingState(Param){with(this){return (fList[Param]!=null);}}CacheLoaderManager.prototype.isLoadingState=_CacheLoaderManager_isLoadingState;function _CacheLoaderManager_AddWaitForLoadItem(Param,aClient,ev){ev=ev||null;with(this){var lObj;lObj=fList[Param];if((lObj==null)){lObj=new Array();fList[Param]=lObj;}lObj.push(new Array(aClient,ev));}}CacheLoaderManager.prototype.AddWaitForLoadItem=_CacheLoaderManager_AddWaitForLoadItem;function _CacheLoaderManager_FinishLoad(Param,Result){with(this){var I;var lColl=fList[Param];var _3E34=(lColl.length-1);for(I=0;I<=_3E34;++I){var lObj=lColl[I];lObj[0].ServiceCallBack(Result,lObj[1]);}fList[Param]=null;}}CacheLoaderManager.prototype.FinishLoad=_CacheLoaderManager_FinishLoad;function CacheLoaderManager(){this.fList=new Array();}function _StringWriter_GetClassName(){return "StringWriter";}StringWriter.prototype.GetClassName=_StringWriter_GetClassName;function _StringWriter_GetCID(){return 34008;}StringWriter.prototype.GetCID=_StringWriter_GetCID;function _StringWriter_Add(Str){with(this){data.push(Str);}}StringWriter.prototype.Add=_StringWriter_Add;function _StringWriter_ToText(Delim){Delim=Delim||"";with(this){return data.join(Delim);}}StringWriter.prototype.ToText=_StringWriter_ToText;function StringWriter(){this.data=new Array();}function _Hashtable_GetClassName(){return "Hashtable";}Hashtable.prototype.GetClassName=_Hashtable_GetClassName;function _Hashtable_GetCID(){return 4353;}Hashtable.prototype.GetCID=_Hashtable_GetCID;function Hashtable(Data){this.fHash=null;with(this){var I;fHash=new Array();var _3E72=(Data.length-1);for(I=0;I<=_3E72;++I){fHash[Data[I]]=I;}}}function _Hashtable_ToJSON(){with(this){return JSON.stringify(fHash);}}Hashtable.prototype.ToJSON=_Hashtable_ToJSON;function _Hashtable_Count(){with(this){return fHash.length;}}Hashtable.prototype.Count=_Hashtable_Count;function _Hashtable_GetItem(aKey){with(this){return fHash[aKey];}}Hashtable.prototype.GetItem=_Hashtable_GetItem;function _haveCommonHtmlProp_GetClassName(){return "haveCommonHtmlProp";}haveCommonHtmlProp.prototype.GetClassName=_haveCommonHtmlProp_GetClassName;function _haveCommonHtmlProp_GetCID(){return 32073;}haveCommonHtmlProp.prototype.GetCID=_haveCommonHtmlProp_GetCID;function _haveCommonHtmlProp_DoSetHint(Value){with(this){}}haveCommonHtmlProp.prototype.DoSetHint=_haveCommonHtmlProp_DoSetHint;function _haveCommonHtmlProp_DoChangeCommonHtmlProp(){with(this){Render();}}haveCommonHtmlProp.prototype.DoChangeCommonHtmlProp=_haveCommonHtmlProp_DoChangeCommonHtmlProp;function _haveCommonHtmlProp_GetHint(){with(this){return fHint;}}haveCommonHtmlProp.prototype.GetHint=_haveCommonHtmlProp_GetHint;function _haveCommonHtmlProp_GetCommonPropStr(){with(this){var tmp="";if((fHint!=null)){tmp+=(" title="+fHint);}return tmp;}}haveCommonHtmlProp.prototype.GetCommonPropStr=_haveCommonHtmlProp_GetCommonPropStr;function _haveCommonHtmlProp_SetHint(Value){with(this){if((fHint!=Value)){fHint=Value;DoChangeCommonHtmlProp();DoSetHint(fHint);}}}haveCommonHtmlProp.prototype.SetHint=_haveCommonHtmlProp_SetHint;function haveCommonHtmlProp(){this.fHint=null;}function _IContextMenuManager_GetClassName(){return "IContextMenuManager";}IContextMenuManager.prototype.GetClassName=_IContextMenuManager_GetClassName;function _IContextMenuManager_GetCID(){return 19732;}IContextMenuManager.prototype.GetCID=_IContextMenuManager_GetCID;function _IContextMenuManager_ShowContextMenu(aObj,X,Y){with(this){fObj=new ContextMenu(aObj,(X+1),(Y+1));}}IContextMenuManager.prototype.ShowContextMenu=_IContextMenuManager_ShowContextMenu;function IContextMenuManager(){this.fObj=null;}function _ContextMenuData_GetClassName(){return "ContextMenuData";}ContextMenuData.prototype.GetClassName=_ContextMenuData_GetClassName;function _ContextMenuData_GetCID(){return 73632;}ContextMenuData.prototype.GetCID=_ContextMenuData_GetCID;function _ContextMenuData_GetCmdName(){with(this){return fCmdName;}}ContextMenuData.prototype.GetCmdName=_ContextMenuData_GetCmdName;function _ContextMenuData_GetCaption(){with(this){return fCaption;}}ContextMenuData.prototype.GetCaption=_ContextMenuData_GetCaption;function _ContextMenuData_Enabled(){with(this){return fEnabled;}}ContextMenuData.prototype.Enabled=_ContextMenuData_Enabled;function ContextMenuData(aCmdName,aCaption,aEnabled){this.fCmdName=null;this.fCaption=null;this.fEnabled=null;with(this){fCmdName=aCmdName;fCaption=aCaption;fEnabled=aEnabled;}}function _ContextMenu_GetClassName(){return "ContextMenu";}ContextMenu.prototype.GetClassName=_ContextMenu_GetClassName;function _ContextMenu_GetCID(){return 97874;}ContextMenu.prototype.GetCID=_ContextMenu_GetCID;function _ContextMenu_RunCommand(Cmd){with(this){HidePopUp(fObj);fCMenu.RunCommand(Cmd);}}ContextMenu.prototype.RunCommand=_ContextMenu_RunCommand;function ContextMenu(aObj,X,Y){this.fObj=null;this.fCMenu=null;this.fOID=gApp.GetNewID(this);with(this){var I;var tmp="<table border=1 bgcolor=eeeeee >";fCMenu=aObj;var Data=aObj.GetCommandList();var _3F58=(Data.length-1);for(I=0;I<=_3F58;++I){if(Data[I].Enabled()){tmp+=(((("<tr><td style=\"cursor:pointer;cursor:hand;\" onmouseover=\"this.bgColor=\'yellow\'\" onmouseout=\"this.bgColor=\'eeeeee\'\" onclick="+SelfCall((("RunCommand(\'"+Data[I].GetCmdName())+"\')")))+" >")+Data[I].GetCaption())+"<br>");}else{tmp+=(("<tr><td ><font color=gray>"+Data[I].GetCaption())+"</font><br>");}}tmp+="</table>";fObj=document.createElement("div");fObj.style.position="absolute";fObj.innerHTML=tmp;document.getElementById("hidden").appendChild(fObj);ShowPopUp(fObj,this);SetObjLeft(fObj,X);SetObjTop(fObj,Y);}}function _ContextMenu_CanHide(aObj,ev){with(this){return !isOccurInObj((GetMouseX(ev)+1),(GetMouseY(ev)+1),aObj);}}ContextMenu.prototype.CanHide=_ContextMenu_CanHide;ContextMenu.prototype.SelfCall=_haveAddr_SelfCall;function _IHaveContextMenu_GetClassName(){return "IHaveContextMenu";}IHaveContextMenu.prototype.GetClassName=_IHaveContextMenu_GetClassName;function _IHaveContextMenu_GetCID(){return 1195;}IHaveContextMenu.prototype.GetCID=_IHaveContextMenu_GetCID;function _IHaveContextMenu_GetCommandList(){with(this){}}IHaveContextMenu.prototype.GetCommandList=_IHaveContextMenu_GetCommandList;function _IHaveContextMenu_RunCommand(CmdName){with(this){}}IHaveContextMenu.prototype.RunCommand=_IHaveContextMenu_RunCommand;function IHaveContextMenu(){}function _CommonCustomControl_GetClassName(){return "CommonCustomControl";}CommonCustomControl.prototype.GetClassName=_CommonCustomControl_GetClassName;function _CommonCustomControl_GetCID(){return 95468;}CommonCustomControl.prototype.GetCID=_CommonCustomControl_GetCID;function _CommonCustomControl_OwnerForm(){with(this){if(fParent){return fParent.OwnerForm();}return null;}}CommonCustomControl.prototype.OwnerForm=_CommonCustomControl_OwnerForm;function _CommonCustomControl_GetContactPoint(){with(this){return fObj;}}CommonCustomControl.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;function _CommonCustomControl_SetSite(Part){with(this){if((fPart!=Part)){fPart=Part;if(!Part){fParent.AddChild(this);}else if(Part.appendChild){fParent.AddChild2(this,Part);}else{fParent.AddChild(this,Part);}Render();}}}CommonCustomControl.prototype.SetSite=_CommonCustomControl_SetSite;function _CommonCustomControl_SetEnabledRender(Value){with(this){if((fEnabledRender!=Value)){fEnabledRender=Value;if(Value){DoRender();}}}}CommonCustomControl.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;function _CommonCustomControl_isReadyForRender(){with(this){return (fEnabledRender&(GetParentNode(fObj)!=null));}}CommonCustomControl.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;function _CommonCustomControl_DoInit(){with(this){}}CommonCustomControl.prototype.DoInit=_CommonCustomControl_DoInit;function _CommonCustomControl_Init(){with(this){fObj=document.createElement("span");fObj.id=fOID;fObj.innerHTML=gApp.LoadingStr;if(fParent){fParent.AddChild(this,fPart);}DoInit();}}CommonCustomControl.prototype.Init=_CommonCustomControl_Init;function _CommonCustomControl_DoRender(){with(this){}}CommonCustomControl.prototype.DoRender=_CommonCustomControl_DoRender;function _CommonCustomControl_Render(){with(this){if(isReadyForRender()){DoRender();}}}CommonCustomControl.prototype._Render=_CommonCustomControl_Render;function lz_CommonCustomControl_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}CommonCustomControl.prototype.Render=lz_CommonCustomControl_Render;function CommonCustomControl(AParent,Part){Part=Part||"";this.fObj=null;this.fRecordOwner=null;this.fPart=null;this.fParent=null;this.fEnabledRender=true;this.fMode=0;this.fOID=gApp.GetNewID(this);this.fFocus=false;this.fVisible=true;this.fEnabled=true;with(this){fParent=AParent;fMode=fParent.fMode;fRecordOwner=Part;fPart="";Init();}}CommonCustomControl.prototype.SetMode=_haveMode_SetMode;CommonCustomControl.prototype.GetMode=_haveMode_GetMode;CommonCustomControl.prototype.SelfCall=_haveAddr_SelfCall;CommonCustomControl.prototype.DoSetFocus=_haveFocus_DoSetFocus;CommonCustomControl.prototype.DoChangeFocus=_haveFocus_DoChangeFocus;CommonCustomControl.prototype.SetFocus=_haveFocus_SetFocus;CommonCustomControl.prototype.DoSetVisible=_haveVisible_DoSetVisible;CommonCustomControl.prototype.SetVisible=_haveVisible_SetVisible;CommonCustomControl.prototype.DoSetEnabled=_haveEnabled_DoSetEnabled;CommonCustomControl.prototype.GetEnabled=_haveEnabled_GetEnabled;CommonCustomControl.prototype.SetEnabled=_haveEnabled_SetEnabled;function _CommonControl_GetClassName(){return "CommonControl";}CommonControl.prototype.GetClassName=_CommonControl_GetClassName;function _CommonControl_GetCID(){return 15760;}CommonControl.prototype.GetCID=_CommonControl_GetCID;function _CommonControl_GetValue(){with(this){return fValue;}}CommonControl.prototype.GetValue=_CommonControl_GetValue;function _CommonControl_GetFormatValue(){with(this){return DoFormat(fValue);}}CommonControl.prototype.GetFormatValue=_CommonControl_GetFormatValue;function _CommonControl_DoFormat(Value){with(this){return Value;}}CommonControl.prototype.DoFormat=_CommonControl_DoFormat;function _CommonControl_SetValue(Value,ev){ev=ev||null;with(this){if((fValue!=Value)){fValue=Value;DoSetValue(fValue,ev);}}}CommonControl.prototype.SetValue=_CommonControl_SetValue;function _CommonControl_DoSetValue(Value,ev){ev=ev||null;with(this){}}CommonControl.prototype.DoSetValue=_CommonControl_DoSetValue;function _CommonControl_UserEnter(Value){with(this){gev=false;fRecordOwner.fModified=true;SetValue(Value,false);}}CommonControl.prototype.UserEnter=_CommonControl_UserEnter;function _CommonControl_Init(){with(this){fObj=document.createElement("span");fObj.id=fOID;fObj.innerHTML=gApp.LoadingStr;if(fPart.appendChild){fPart.innerHTML="";fPart.appendChild(fObj);}else if(fParent.AddChild){fParent.AddChild(this,fPart);}DoInit();}}CommonControl.prototype.Init=_CommonControl_Init;CommonControl.prototype.OwnerForm=_CommonCustomControl_OwnerForm;CommonControl.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;CommonControl.prototype.SetSite=_CommonCustomControl_SetSite;CommonControl.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;CommonControl.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;CommonControl.prototype.DoInit=_CommonCustomControl_DoInit;CommonControl.prototype.DoRender=_CommonCustomControl_DoRender;CommonControl.prototype._Render=_CommonCustomControl_Render;function lz_CommonControl_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}CommonControl.prototype.Render=lz_CommonCustomControl_Render;function CommonControl(AParent,Part){Part=Part||"";this.fValue=null;this.fObj=null;this.fRecordOwner=null;this.fPart=null;this.fParent=null;this.fEnabledRender=true;this.fMode=0;this.fOID=gApp.GetNewID(this);this.fFocus=false;this.fVisible=true;this.fEnabled=true;with(this){fParent=AParent;fMode=fParent.fMode;fRecordOwner=Part;fPart="";Init();}}CommonControl.prototype.SetMode=_haveMode_SetMode;CommonControl.prototype.GetMode=_haveMode_GetMode;CommonControl.prototype.SelfCall=_haveAddr_SelfCall;CommonControl.prototype.DoSetFocus=_haveFocus_DoSetFocus;CommonControl.prototype.DoChangeFocus=_haveFocus_DoChangeFocus;CommonControl.prototype.SetFocus=_haveFocus_SetFocus;CommonControl.prototype.DoSetVisible=_haveVisible_DoSetVisible;CommonControl.prototype.SetVisible=_haveVisible_SetVisible;CommonControl.prototype.DoSetEnabled=_haveEnabled_DoSetEnabled;CommonControl.prototype.GetEnabled=_haveEnabled_GetEnabled;CommonControl.prototype.SetEnabled=_haveEnabled_SetEnabled;function _CommonDomainControl_GetClassName(){return "CommonDomainControl";}CommonDomainControl.prototype.GetClassName=_CommonDomainControl_GetClassName;function _CommonDomainControl_GetCID(){return 89698;}CommonDomainControl.prototype.GetCID=_CommonDomainControl_GetCID;function _CommonDomainControl_DoLoad(aParams,ev){aParams=aParams||new Array();ev=ev||null;with(this){fSP.ServiceCall(aParams,ev);}}CommonDomainControl.prototype.DoLoad=_CommonDomainControl_DoLoad;function _CommonDomainControl_ServiceCallBack(aResult,ev){ev=ev||null;with(this){fTable=aResult;DoAfterBuildModel();Render();}}CommonDomainControl.prototype.ServiceCallBack=_CommonDomainControl_ServiceCallBack;function _CommonDomainControl_DoAfterBuildModel(){with(this){}}CommonDomainControl.prototype.DoAfterBuildModel=_CommonDomainControl_DoAfterBuildModel;function _CommonDomainControl_SetValue(Value,ev){ev=ev||null;with(this){if((fValue!=Value)){fValue=Value;Render();DoSetValue(fValue,ev);}}}CommonDomainControl.prototype.SetValue=_CommonDomainControl_SetValue;CommonDomainControl.prototype.GetValue=_CommonControl_GetValue;CommonDomainControl.prototype.GetFormatValue=_CommonControl_GetFormatValue;CommonDomainControl.prototype.DoFormat=_CommonControl_DoFormat;CommonDomainControl.prototype.DoSetValue=_CommonControl_DoSetValue;CommonDomainControl.prototype.UserEnter=_CommonControl_UserEnter;CommonDomainControl.prototype.Init=_CommonControl_Init;CommonDomainControl.prototype.OwnerForm=_CommonCustomControl_OwnerForm;CommonDomainControl.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;CommonDomainControl.prototype.SetSite=_CommonCustomControl_SetSite;CommonDomainControl.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;CommonDomainControl.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;CommonDomainControl.prototype.DoInit=_CommonCustomControl_DoInit;CommonDomainControl.prototype.DoRender=_CommonCustomControl_DoRender;CommonDomainControl.prototype._Render=_CommonCustomControl_Render;function lz_CommonDomainControl_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}CommonDomainControl.prototype.Render=lz_CommonCustomControl_Render;function CommonDomainControl(AParent,Part){Part=Part||"";this.fTable=null;this.fValue=null;this.fObj=null;this.fRecordOwner=null;this.fPart=null;this.fParent=null;this.fEnabledRender=true;this.fMode=0;this.fOID=gApp.GetNewID(this);this.fFocus=false;this.fVisible=true;this.fEnabled=true;with(this){fParent=AParent;fMode=fParent.fMode;fRecordOwner=Part;fPart="";Init();}}CommonDomainControl.prototype.SetMode=_haveMode_SetMode;CommonDomainControl.prototype.GetMode=_haveMode_GetMode;CommonDomainControl.prototype.SelfCall=_haveAddr_SelfCall;CommonDomainControl.prototype.DoSetFocus=_haveFocus_DoSetFocus;CommonDomainControl.prototype.DoChangeFocus=_haveFocus_DoChangeFocus;CommonDomainControl.prototype.SetFocus=_haveFocus_SetFocus;CommonDomainControl.prototype.DoSetVisible=_haveVisible_DoSetVisible;CommonDomainControl.prototype.SetVisible=_haveVisible_SetVisible;CommonDomainControl.prototype.DoSetEnabled=_haveEnabled_DoSetEnabled;CommonDomainControl.prototype.GetEnabled=_haveEnabled_GetEnabled;CommonDomainControl.prototype.SetEnabled=_haveEnabled_SetEnabled;function _CommonHub_GetClassName(){return "CommonHub";}CommonHub.prototype.GetClassName=_CommonHub_GetClassName;function _CommonHub_GetCID(){return 86073;}CommonHub.prototype.GetCID=_CommonHub_GetCID;function _CommonHub_RemoveAllFirstChild(Coll){with(this){var I;var _411B=(Coll.length-1);for(I=0;I<=_411B;++I){Coll[I].removeChild(Coll[I].firstChild);}}}CommonHub.prototype.RemoveAllFirstChild=_CommonHub_RemoveAllFirstChild;function _CommonHub_Parent(){with(this){return fRecordOwner;}}CommonHub.prototype.Parent=_CommonHub_Parent;function _CommonHub_Seek(Value){with(this){var aRecord;var _4144=(fTable.RowCount()-1);for(I=0;I<=_4144;++I){aRecord=Records(I);if((aRecord.PK()==Value)){alert(("found "+I));return I;}}return -1;}}CommonHub.prototype.Seek=_CommonHub_Seek;function _CommonHub_ParentColletion(){with(this){return this;}}CommonHub.prototype.ParentColletion=_CommonHub_ParentColletion;function _CommonHub_DoToJSON(){with(this){return ToJSON(fChild);}}CommonHub.prototype.DoToJSON=_CommonHub_DoToJSON;function _CommonHub_DoLoad(aParams,ev){aParams=aParams||new Array();ev=ev||null;with(this){fSP.ServiceCall(aParams,ev);}}CommonHub.prototype.DoLoad=_CommonHub_DoLoad;function _CommonHub_ServiceCallBack(aResult,ev){ev=ev||null;with(this){fTable=aResult;BuildModel(ev);Render();DoAfterFinishLoad();}}CommonHub.prototype.ServiceCallBack=_CommonHub_ServiceCallBack;function _CommonHub_DoAfterFinishLoad(){with(this){}}CommonHub.prototype.DoAfterFinishLoad=_CommonHub_DoAfterFinishLoad;function _CommonHub_AddRecord(aRecord){with(this){aRecord.SetRowIndex(fChild.length);fChild.push(aRecord);}}CommonHub.prototype.AddRecord=_CommonHub_AddRecord;function _CommonHub_InsertRecord(aRecord,Index){with(this){aRecord.SetRowIndex(Index);fChild[Index]=aRecord;}}CommonHub.prototype.InsertRecord=_CommonHub_InsertRecord;function _CommonHub_Records(Index){with(this){if((fChild[Index]==null)){DoLoadModelRecord(Index);fChild[Index].ReCale(true,0);}return fChild[Index];}}CommonHub.prototype.Records=_CommonHub_Records;function _CommonHub_DoLoadModelRecord(aRowIndex){with(this){}}CommonHub.prototype.DoLoadModelRecord=_CommonHub_DoLoadModelRecord;function _CommonHub_BuildModel(ev){ev=ev||null;with(this){fChild=new Array();var I;var _41D5=(fTable.RowCount()-1);for(I=0;I<=_41D5;++I){DoLoadModelRecord(I);}var _41E8=(fChild.length-1);for(I=0;I<=_41E8;++I){fChild[I].ReCale(ev,0);}}}CommonHub.prototype.BuildModel=_CommonHub_BuildModel;function _CommonHub_ValidateMsg(){with(this){var I;var _4207=(fChild.length-1);for(I=0;I<=_4207;++I){if((fChild[I]!=null)){fChild[I].IncMsgCnt(0);}}}}CommonHub.prototype.ValidateMsg=_CommonHub_ValidateMsg;function _CommonHub_DoRender(){with(this){}}CommonHub.prototype.DoRender=_CommonHub_DoRender;CommonHub.prototype.ClearChild=_haveModeAndChild_ClearChild;CommonHub.prototype.DoRenderForMode=_haveModeAndChild_DoRenderForMode;CommonHub.prototype.SetMode=_haveModeAndChild_SetMode;CommonHub.prototype.GetMode=_haveMode_GetMode;CommonHub.prototype.AddChild=_haveSite_AddChild;CommonHub.prototype.AddChild2=_haveSite_AddChild2;CommonHub.prototype.RemoveChild=_haveSite_RemoveChild;CommonHub.prototype.OwnerForm=_CommonCustomControl_OwnerForm;CommonHub.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;CommonHub.prototype.SetSite=_CommonCustomControl_SetSite;CommonHub.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;CommonHub.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;CommonHub.prototype.DoInit=_CommonCustomControl_DoInit;CommonHub.prototype.Init=_CommonCustomControl_Init;CommonHub.prototype._Render=_CommonCustomControl_Render;function lz_CommonHub_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}CommonHub.prototype.Render=lz_CommonCustomControl_Render;function CommonHub(AParent,Part){Part=Part||"";this.fSP=null;this.fTable=null;this.fChild=new Array();this.fMode=0;this.fSite=null;this.fObj=null;this.fRecordOwner=null;this.fPart=null;this.fParent=null;this.fEnabledRender=true;this.fOID=gApp.GetNewID(this);this.fFocus=false;this.fVisible=true;this.fEnabled=true;with(this){fParent=AParent;fMode=fParent.fMode;fRecordOwner=Part;fPart="";Init();}}CommonHub.prototype.SelfCall=_haveAddr_SelfCall;CommonHub.prototype.DoSetFocus=_haveFocus_DoSetFocus;CommonHub.prototype.DoChangeFocus=_haveFocus_DoChangeFocus;CommonHub.prototype.SetFocus=_haveFocus_SetFocus;CommonHub.prototype.DoSetVisible=_haveVisible_DoSetVisible;CommonHub.prototype.SetVisible=_haveVisible_SetVisible;CommonHub.prototype.DoSetEnabled=_haveEnabled_DoSetEnabled;CommonHub.prototype.GetEnabled=_haveEnabled_GetEnabled;CommonHub.prototype.SetEnabled=_haveEnabled_SetEnabled;function _CommonSearchHub_GetClassName(){return "CommonSearchHub";}CommonSearchHub.prototype.GetClassName=_CommonSearchHub_GetClassName;function _CommonSearchHub_GetCID(){return 47775;}CommonSearchHub.prototype.GetCID=_CommonSearchHub_GetCID;function _CommonSearchHub_OnSearchButtonClick(){with(this){var _421D=(fChild.length-1);for(I=0;I<=_421D;++I){fChild[I].OnSearchButtonClick();}}}CommonSearchHub.prototype.OnSearchButtonClick=_CommonSearchHub_OnSearchButtonClick;function _CommonSearchHub_InitDevice(){with(this){InitAddButton();InitDelButton();InitDelAllButton();InitDelNoneButton();InitDelSwapButton();InitNumberOfAddRecord();InitSearchButton();}}CommonSearchHub.prototype.InitDevice=_CommonSearchHub_InitDevice;function _CommonSearchHub_RenderDevice(){with(this){}}CommonSearchHub.prototype.RenderDevice=_CommonSearchHub_RenderDevice;function _CommonSearchHub_SetMode(aMode){with(this){fMode=aMode;DoRenderForMode();var I;var _424B=(fChild-1);for(I=0;I<=_424B;++I){fChild[I].SetMode(aMode);}}}CommonSearchHub.prototype.SetMode=_CommonSearchHub_SetMode;CommonSearchHub.prototype.AttachSearchButton=_IHaveSearchButtonDevice_AttachSearchButton;CommonSearchHub.prototype.InitSearchButton=_IHaveSearchButtonDevice_InitSearchButton;CommonSearchHub.prototype.GetSearchButton=_IHaveSearchButtonDevice_GetSearchButton;CommonSearchHub.prototype.InitCustomDevice=_CommonControlHub_InitCustomDevice;CommonSearchHub.prototype.AttachCustomDevice=_CommonControlHub_AttachCustomDevice;CommonSearchHub.prototype.Init=_CommonControlHub_Init;CommonSearchHub.prototype.BuildFormatAndSite=_CommonControlHub_BuildFormatAndSite;CommonSearchHub.prototype.BuildOrAttachSRControl=_CommonControlHub_BuildOrAttachSRControl;CommonSearchHub.prototype.BuildOrAttachNSRControl=_CommonControlHub_BuildOrAttachNSRControl;CommonSearchHub.prototype.RenderSRChild=_CommonControlHub_RenderSRChild;CommonSearchHub.prototype.RenderSelf=_CommonControlHub_RenderSelf;CommonSearchHub.prototype.DoAfterBuildModel=_CommonControlHub_DoAfterBuildModel;CommonSearchHub.prototype.ServiceCallBack=_CommonControlHub_ServiceCallBack;CommonSearchHub.prototype.GetStartRecord=_CommonControlHub_GetStartRecord;CommonSearchHub.prototype.GetEndRecord=_CommonControlHub_GetEndRecord;CommonSearchHub.prototype.GetRecordControl=_CommonControlHub_GetRecordControl;CommonSearchHub.prototype.DetachControl=_CommonControlHub_DetachControl;CommonSearchHub.prototype.OnAddButtonClick=_CommonControlHub_OnAddButtonClick;CommonSearchHub.prototype.AddNewRecord=_CommonControlHub_AddNewRecord;CommonSearchHub.prototype.ResetErrorCnt=_CommonControlHub_ResetErrorCnt;CommonSearchHub.prototype.BuildNewModel=_CommonControlHub_BuildNewModel;CommonSearchHub.prototype.SetBgColor=_CommonControlHub_SetBgColor;CommonSearchHub.prototype.CreateDeleteCheckBox=_CommonControlHub_CreateDeleteCheckBox;CommonSearchHub.prototype.SetAllowDelete=_CommonControlHub_SetAllowDelete;CommonSearchHub.prototype.CheckDelAssetState=_CommonControlHub_CheckDelAssetState;CommonSearchHub.prototype.CreateDeleteCmd=_CommonControlHub_CreateDeleteCmd;CommonSearchHub.prototype.RenderColor=_CommonControlHub_RenderColor;CommonSearchHub.prototype.isAllChildLoaded=_CommonControlHub_isAllChildLoaded;CommonSearchHub.prototype.DoRender=_CommonControlHub_DoRender;CommonSearchHub.prototype.AttachRecordControl=_CommonControlHub_AttachRecordControl;CommonSearchHub.prototype.AttachDelSwapButton=_IHaveDelSwapButtonDevice_AttachDelSwapButton;CommonSearchHub.prototype.InitDelSwapButton=_IHaveDelSwapButtonDevice_InitDelSwapButton;CommonSearchHub.prototype.GetDelSwapButton=_IHaveDelSwapButtonDevice_GetDelSwapButton;CommonSearchHub.prototype.OnDelSwapButtonClick=_IHaveDelSwapButtonDevice_OnDelSwapButtonClick;CommonSearchHub.prototype.AttachDelNoneButton=_IHaveDelNoneButtonDevice_AttachDelNoneButton;CommonSearchHub.prototype.InitDelNoneButton=_IHaveDelNoneButtonDevice_InitDelNoneButton;CommonSearchHub.prototype.GetDelNoneButton=_IHaveDelNoneButtonDevice_GetDelNoneButton;CommonSearchHub.prototype.OnDelNoneButtonClick=_IHaveDelNoneButtonDevice_OnDelNoneButtonClick;CommonSearchHub.prototype.AttachDelAllButton=_IHaveDelAllButtonDevice_AttachDelAllButton;CommonSearchHub.prototype.InitDelAllButton=_IHaveDelAllButtonDevice_InitDelAllButton;CommonSearchHub.prototype.GetDelAllButton=_IHaveDelAllButtonDevice_GetDelAllButton;CommonSearchHub.prototype.OnDelAllButtonClick=_IHaveDelAllButtonDevice_OnDelAllButtonClick;CommonSearchHub.prototype.AttachDelButton=_IHaveDelButtonDevice_AttachDelButton;CommonSearchHub.prototype.InitDelButton=_IHaveDelButtonDevice_InitDelButton;CommonSearchHub.prototype.GetDelButton=_IHaveDelButtonDevice_GetDelButton;CommonSearchHub.prototype.OnDelButtonClick=_IHaveDelButtonDevice_OnDelButtonClick;CommonSearchHub.prototype.AttachNumberOfAddRecord=_IHaveNumberOfAddRecordDevice_AttachNumberOfAddRecord;CommonSearchHub.prototype.InitNumberOfAddRecord=_IHaveNumberOfAddRecordDevice_InitNumberOfAddRecord;CommonSearchHub.prototype.GetNumberOfAddRecord=_IHaveNumberOfAddRecordDevice_GetNumberOfAddRecord;CommonSearchHub.prototype.OnNumberOfAddRecordClick=_IHaveNumberOfAddRecordDevice_OnNumberOfAddRecordClick;CommonSearchHub.prototype.AttachAddButton=_IHaveAddButtonDevice_AttachAddButton;CommonSearchHub.prototype.InitAddButton=_IHaveAddButtonDevice_InitAddButton;CommonSearchHub.prototype.GetAddButton=_IHaveAddButtonDevice_GetAddButton;CommonSearchHub.prototype.ChangeRecordInterval=_ICanRecordControl_ChangeRecordInterval;CommonSearchHub.prototype.RemoveAllFirstChild=_CommonHub_RemoveAllFirstChild;CommonSearchHub.prototype.Parent=_CommonHub_Parent;CommonSearchHub.prototype.Seek=_CommonHub_Seek;CommonSearchHub.prototype.ParentColletion=_CommonHub_ParentColletion;CommonSearchHub.prototype.DoToJSON=_CommonHub_DoToJSON;CommonSearchHub.prototype.DoLoad=_CommonHub_DoLoad;CommonSearchHub.prototype.DoAfterFinishLoad=_CommonHub_DoAfterFinishLoad;CommonSearchHub.prototype.AddRecord=_CommonHub_AddRecord;CommonSearchHub.prototype.InsertRecord=_CommonHub_InsertRecord;CommonSearchHub.prototype.Records=_CommonHub_Records;CommonSearchHub.prototype.DoLoadModelRecord=_CommonHub_DoLoadModelRecord;CommonSearchHub.prototype.BuildModel=_CommonHub_BuildModel;CommonSearchHub.prototype.ValidateMsg=_CommonHub_ValidateMsg;CommonSearchHub.prototype.ClearChild=_haveModeAndChild_ClearChild;CommonSearchHub.prototype.DoRenderForMode=_haveModeAndChild_DoRenderForMode;CommonSearchHub.prototype.GetMode=_haveMode_GetMode;CommonSearchHub.prototype.AddChild=_haveSite_AddChild;CommonSearchHub.prototype.AddChild2=_haveSite_AddChild2;CommonSearchHub.prototype.RemoveChild=_haveSite_RemoveChild;CommonSearchHub.prototype.OwnerForm=_CommonCustomControl_OwnerForm;CommonSearchHub.prototype.GetContactPoint=_CommonCustomControl_GetContactPoint;CommonSearchHub.prototype.SetSite=_CommonCustomControl_SetSite;CommonSearchHub.prototype.SetEnabledRender=_CommonCustomControl_SetEnabledRender;CommonSearchHub.prototype.isReadyForRender=_CommonCustomControl_isReadyForRender;CommonSearchHub.prototype.DoInit=_CommonCustomControl_DoInit;CommonSearchHub.prototype._Render=_CommonCustomControl_Render;function lz_CommonSearchHub_Render(){if(gApp.fChangeLevel==0){this._Render();}else{gApp.AddTask(this,"_Render",[]);}}CommonSearchHub.prototype.Render=lz_CommonCustomControl_Render;function CommonSearchHub(AParent,Part){Part=Part||"";this.fSearchButton=null;this.fDelCheckBox=new Array();this.fDelSwapButton=null;this.fDelNoneButton=null;this.fDelAllButton=null;this.fDelButton=null;this.fNumberOfAddRecord=null;this.fAddButton=null;this.fRecordControl=null;this.fSP=null;this.fTable=null;this.fChild=new Array();this.fMode=0;this.fSite=null;this.fObj=null;this.fRecordOwner=null;this