//----------------
//core.js
/*Comments erased*/ 
var iw = {
	isIE: (navigator.appVersion.indexOf("MSIE") != -1) ? true : false,
	isWin: (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false,
	isOpera: (navigator.userAgent.indexOf("Opera") != -1) ? true : false
};

//----------------------------------------------------------------------------

/*Comments erased*/ 
iw.Core = {
	
	definePackage: function(p_strPackage, p_objParent){
		if(typeof p_strPackage != 'string')
			return;
			
		if(p_strPackage.indexOf(".") > 0){
			var strPackage = p_strPackage.substr(0, p_strPackage.indexOf("."));
			p_strPackage = p_strPackage.substr(p_strPackage.indexOf(".") +1);
			if(!p_objParent)
				p_objParent = window;
			
			p_objParent[strPackage] = {};
			
			if(p_strPackage)
				iw.Core.definePackage(p_strPackage, p_objParent[strPackage]);
				
		}
		else if(p_objParent && p_objParent[p_strPackage] == null){
			p_objParent[p_strPackage] = {};
		}
		else if(window[p_strPackage] == null){
			window[p_strPackage] = {};
		}
	},
	
	defineClass: function(p_strClassName){
		var objClass = function(){
			this.toString = function(){
				return p_strClassName?"[object "+p_strClassName+"]":"[object InteliWISE]";
			}
			
			iw.Core.bindAllMethods(this);  
			
			if(this.SuperClass){
				this.Super = {};
				for(var strProperty in this.SuperClass.prototype){
					this.Super[strProperty] = this.SuperClass.prototype[strProperty];	
				}
				iw.Core.bindAllMethods(this.Super, this); 
			}
				 
			if(typeof this.initialize == 'function') this.initialize.apply(this, arguments); 
			
		};
		
		objClass.toString = function(){
			return "[class "+p_strClassName+"]";
		}
		
		return objClass; 
	},
	
	bind: function(p_funMethod, p_objOwner){
		if(typeof p_funMethod != 'function')
			return null;
		
		return function(){return p_funMethod.apply(p_objOwner, arguments);};
	},
	
	bindAllMethods: function(p_objObject, p_objTarget){
		if(!p_objTarget)
			p_objTarget = p_objObject;
		for(property in p_objObject) 
			if(typeof p_objObject[property] == "function" && property != "SuperClass") 
				p_objObject[property] = this.bind(p_objObject[property], p_objTarget);
	},
	
	extendDefinition: function(p_objDefinition, p_objBase){
		if(typeof p_objBase != 'function' || typeof p_objDefinition != 'function'){
			return;
		}
		p_objDefinition.prototype.SuperClass = p_objBase;
		for(strProperty in p_objBase.prototype){
			if(p_objDefinition.prototype[strProperty] == undefined)
				p_objDefinition.prototype[strProperty] = p_objBase.prototype[strProperty];
		}
		return p_objDefinition;
	},
	
	
	
	setProperties: function(p_objTarget, p_objSource){
		var strProperty;
		for (strProperty in p_objSource){
			var strSetterName = "set"+strProperty.substr(0,1).toUpperCase()+strProperty.substr(1);
			if (p_objTarget[strSetterName]){
				p_objTarget[strSetterName](p_objSource[strProperty]);
			}
		}
	},
	
	reportError: function(p_strInfo, p_objError){
		var strError = p_strInfo?p_strInfo+":\n":"Error :\n";
		for(var strProperty in p_objError)
			strError += strProperty + ": "+p_objError[strProperty]+"\n ";
		if(console){
			console.log(strError);
		}
		else
			alert(strError);
	}
	
		
};

//----------------------------------------------------------------------------

/*Comments erased*/ 
iw.DOMFactory = {
	appendHTML: function(p_objElement, p_strHTML){
		
		if(!p_objElement || !p_objElement.tagName)
			return;
		var objTemp = document.createElement("div");
		objTemp.innerHTML = p_strHTML;
		if(objTemp.childNodes.length>0)
			for(var i=0; i<objTemp.childNodes.length; i++)
				p_objElement.appendChild(objTemp.childNodes[i]);
	},
	
	getElement: function(p_strId){
		if(typeof p_strId == "string")
			return document.getElementById(p_strId);
		return p_strId;
	},
	
	getFormField: function(p_objForm, p_strFieldName){
		if(!p_objForm || p_objForm.tagName.toLowerCase() != "form")
			return null;
			
		if(p_objForm[p_strFieldName])
			return p_objForm[p_strFieldName];
			
		if(p_objForm.elements[0]){
			var iFormIter = 0;
			var iCollectionIter = 0;
			var arrCollection = [];
			var objField;
			while(objField = p_objForm.elements[iFormIter++])
				if(objField.name == p_strFieldName)
					arrCollection[iCollectionIter++] = objField;
				
			return arrCollection.length > 1 ? arrCollection : arrCollection[0];		
		}
		
		return null;
	},
	
	getElementPosition: function(p_objElement) {
		var valueT = 0, valueL = 0;
		var objElement = p_objElement;
		do {
			valueT += objElement.offsetTop  || 0;
			valueL += objElement.offsetLeft || 0;
			objElement = objElement.offsetParent;
			if (objElement) {
				if (objElement.tagName.toUpperCase() == 'BODY') break;
				if (objElement.style.position !== 'static') break;
			}
		} while (objElement);
		return [valueL, valueT];
	},
	
	newElement: function(p_strType, p_objAttributes){
		if(typeof p_strType != 'string')//wrong element type
			return null;
		if(p_strType.toLowerCase() == 'text'){//text node
			return document.createTextNode(p_objAttributes);
		}
		
		//other elements
		var objElement = document.createElement(p_strType.toLowerCase());
		for(var strName in p_objAttributes){
			if(strName == 'style' && typeof p_objAttributes[strName] == 'string')
				objElement.style.cssText = p_objAttributes[strName];
			else
				objElement[strName] = p_objAttributes[strName];
		}
		return objElement;
	},
	
	newStyleSheet: function(p_strStyleSheet){
		var objStyleSheet = iw.DOMFactory.newElement("style", {"type": "text/css"});
		iw.DOMFactory.updateStyleSheet(objStyleSheet, p_strStyleSheet);
		return objStyleSheet;
	},
	
	updateStyleSheet: function(p_objStyleSheet, p_strStyleSheet){
		if(!p_objStyleSheet || typeof p_strStyleSheet != "string")
			return;
		
		if (iw.isIE){  
            p_objStyleSheet.styleSheet.cssText = p_strStyleSheet;
        }
        else {  
			var arrNodes = p_objStyleSheet.childNodes;
			if(arrNodes && arrNodes.length)
			for(var i=0; i< arrNodes.length; i++)
				p_objStyleSheet.removeChild(arrNodes[i]);
				
        	if(p_strStyleSheet)
				p_objStyleSheet.appendChild(document.createTextNode(p_strStyleSheet));
        }
		
	},
	
	applyStyleSheet: function(p_objStyleSheet){
		if(!p_objStyleSheet)
			return;
		var objHead = document.getElementsByTagName("head")[0];				
		objHead.appendChild(p_objStyleSheet);
	}
	
};

//----------------------------------------------------------------------------

/*Comments erased*/ 
iw.DOMEvents = {
	getTarget: function (event){
		return event.target || window.event.srcElement;
	},
	
	pointerX: function (event) {
		event = event || window.event;
		var docElement = document.documentElement,
		body = document.body || { scrollLeft: 0 };

		return event.pageX || (event.clientX +
			(docElement.scrollLeft || body.scrollLeft) -
			(docElement.clientLeft || 0));
	},
	
	pointerY: function(event) {
		event = event || window.event;
		var docElement = document.documentElement,
		body = document.body || { scrollTop: 0 };
		
		return  event.pageY || (event.clientY +
			(docElement.scrollTop || body.scrollTop) -
			(docElement.clientTop || 0));
	},
	
	addEventListener: function(p_objTarget, p_strEventType, p_funCallback){
		if(p_objTarget.addEventListener){
			p_objTarget.addEventListener(p_strEventType, p_funCallback, false);
		}
		else if(p_objTarget.attachEvent){
			p_objTarget.attachEvent("on"+p_strEventType, p_funCallback);
		}
		//event || window.event
	},
	
	removeEventListener: function(p_objTarget, p_strEventType, p_funCallback){
		if(p_objTarget.addEventListener){
			p_objTarget.removeEventListener(p_strEventType, p_funCallback, false);
		}
		else if(p_objTarget.detachEvent){
			p_objTarget.detachEvent("on"+p_strEventType, p_funCallback);
		}
		
	}
}

//----------------------------------------------------------------------------

/*Comments erased*/ 
iw.FlashFactory = {

	controlVersion: function ()
	{
		var version;
		var axo;
		var e;
	
		// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	
		try {
			// version will be set for 7.X or greater players
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	
		if (!version)
		{
			try {
				// version will be set for 6.X players only
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				
				// installed player is some revision of 6.0
				// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
				// so we have to be careful. 
				
				// default to the first public version
				version = "WIN 6,0,21,0";
	
				// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
				axo.AllowScriptAccess = "always";
	
				// safe to call for 6.0r47 or greater
				version = axo.GetVariable("$version");
	
			} catch (e) {
			}
		}
	
		if (!version)
		{
			try {
				// version will be set for 4.X or 5.X player
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
				version = axo.GetVariable("$version");
			} catch (e) {
			}
		}
	
		if (!version)
		{
			try {
				// version will be set for 3.X player
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
				version = "WIN 3,0,18,0";
			} catch (e) {
			}
		}
	
		if (!version)
		{
			try {
				// version will be set for 2.X player
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				version = "WIN 2,0,0,11";
			} catch (e) {
				version = -1;
			}
		}
		
		return version;
	},

	// JavaScript helper required to detect Flash Player PlugIn version information
	getSwfVer: function (){
		// NS/Opera version >= 3 check for Flash plugin in plugin array
		var flashVer = -1;
		
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
				var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
				var descArray = flashDescription.split(" ");
				var tempArrayMajor = descArray[2].split(".");			
				var versionMajor = tempArrayMajor[0];
				var versionMinor = tempArrayMajor[1];
				var versionRevision = descArray[3];
				if (versionRevision == "") {
					versionRevision = descArray[4];
				}
				if (versionRevision[0] == "d") {
					versionRevision = versionRevision.substring(1);
				} else if (versionRevision[0] == "r") {
					versionRevision = versionRevision.substring(1);
					if (versionRevision.indexOf("d") > 0) {
						versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
					}
				}
				var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			}
		}
		// MSN/WebTV 2.6 supports Flash 4
		else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
		// WebTV 2.5 supports Flash 3
		else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
		// older WebTV supports Flash 2
		else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
		else if ( iw.isIE && iw.isWin && !iw.isOpera ) {
			flashVer = iw.FlashFactory.controlVersion();
		}	
		return flashVer;
	},

	// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
	detectFlashVer: function(reqMajorVer, reqMinorVer, reqRevision)
	{
		versionStr = iw.FlashFactory.getSwfVer();
		if (versionStr == -1 ) {
			return false;
		} else if (versionStr != 0) {
			if(iw.isIE && iw.isWin && !iw.isOpera) {
				// Given "WIN 2,0,0,11"
				tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
				tempString        = tempArray[1];			// "2,0,0,11"
				versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
			} else {
				versionArray      = versionStr.split(".");
			}
			var versionMajor      = versionArray[0];
			var versionMinor      = versionArray[1];
			var versionRevision   = versionArray[2];
	
	        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if (versionMajor > parseFloat(reqMajorVer)) {
				return true;
			} else if (versionMajor == parseFloat(reqMajorVer)) {
				if (versionMinor > parseFloat(reqMinorVer))
					return true;
				else if (versionMinor == parseFloat(reqMinorVer)) {
					if (versionRevision >= parseFloat(reqRevision))
						return true;
				}
			}
			return false;
		}
	},

	_addExtension: function(src, ext)
	{
	  if (src.indexOf('?') != -1)
	    return src.replace(/\?/, ext+'?'); 
	  else
	    return src + ext;
	},

	_generateobj: function(objAttrs, params, embedAttrs) 
	{ 
	  var str = '';
	  if (iw.isIE && iw.isWin && !iw.isOpera)
	  {
	    str += '<object ';
	    for (var i in objAttrs)
	    {
	      str += i + '="' + objAttrs[i] + '" ';
	    }
	    str += '>';
	    for (var i in params)
	    {
	      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
	    }
	    str += '</object>';
	  }
	  else
	  {
	    str += '<embed ';
	    for (var i in embedAttrs)
	    {
	      str += i + '="' + embedAttrs[i] + '" ';
	    }
	    str += '/>';//'></embed>';
	  }
	
	  return str;
	},
	
	 _getArgs: function(args, ext, srcParamName, classid, mimeType){
	  var ret = new Object();
	  ret.embedAttrs = new Object();
	  ret.params = new Object();
	  ret.objAttrs = new Object();
	  for (var i=0; i < args.length; i=i+2){
	    var currArg = args[i].toLowerCase();    
	
	    switch (currArg){	
	      case "classid":
	        break;
	      case "pluginspage":
	        ret.embedAttrs[args[i]] = args[i+1];
	        break;
	      case "src":
	      case "movie":	
	        args[i+1] = iw.FlashFactory._addExtension(args[i+1], ext);
	        ret.embedAttrs["src"] = args[i+1];
	        ret.params[srcParamName] = args[i+1];
	        break;
	      case "onafterupdate":
	      case "onbeforeupdate":
	      case "onblur":
	      case "oncellchange":
	      case "onclick":
	      case "ondblclick":
	      case "ondrag":
	      case "ondragend":
	      case "ondragenter":
	      case "ondragleave":
	      case "ondragover":
	      case "ondrop":
	      case "onfinish":
	      case "onfocus":
	      case "onhelp":
	      case "onmousedown":
	      case "onmouseup":
	      case "onmouseover":
	      case "onmousemove":
	      case "onmouseout":
	      case "onkeypress":
	      case "onkeydown":
	      case "onkeyup":
	      case "onload":
	      case "onlosecapture":
	      case "onpropertychange":
	      case "onreadystatechange":
	      case "onrowsdelete":
	      case "onrowenter":
	      case "onrowexit":
	      case "onrowsinserted":
	      case "onstart":
	      case "onscroll":
	      case "onbeforeeditfocus":
	      case "onactivate":
	      case "onbeforedeactivate":
	      case "ondeactivate":
	      case "type":
	      case "codebase":
	      case "id":
	        ret.objAttrs[args[i]] = args[i+1];
	        break;
	      case "width":
	      case "height":
	      case "align":
	      case "vspace": 
	      case "hspace":
	      case "class":
	      case "title":
	      case "accesskey":
	      case "name":
	      case "tabindex":
	        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
	        break;
	      default:
	        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
	    }
	  }
	  ret.objAttrs["classid"] = classid;
	  if (mimeType) ret.embedAttrs["type"] = mimeType;
	  return ret;
	},
	
	newObjectString: function(){
	  var ret = 
	    iw.FlashFactory._getArgs
	    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	     , "application/x-shockwave-flash"
	    );
	  return iw.FlashFactory._generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
	},
	
	getFlashObject: function(p_strName){
		if (iw.isIE) {
			return document.getElementById(p_strName);
		}
		
		return document[p_strName];
	}	

}


//----------------
//character.js
/*Comments erased*/ 
iw.Core.definePackage("ichr");

//----------------------------------------------------------------------------

try{
/*Comments erased*/  
ichr.Character = iw.Core.defineClass("ichr.Character");

ichr.Character.instances = [];

ichr.Character.prototype = {
	//public property holding references to created dockers
	dockerList: null,
	
	m_objDispatcher: null,
	
	m_objCharacter: null,
	m_arrLoadListners: null,
	m_strInstanceName: null,
	m_objWinWrapper: null,
	m_objWin: null,
	m_iWidth: "1px",
	m_iHeight: "1px",
	m_iWrapperWidth: "auto",
	m_iWrapperHeight: 0,
	m_iOffsetX: 0,
	m_iOffsetY: 0,
	m_bNestedMode: false,
	m_strAlternateContent: '<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;" >Please <a href="http://www.macromedia.com/go/getflash/" target="_blank">update</a> your Adobe Flash Player to see our <strong><nobr>Virtual Assistant</nobr></strong></span>.',
	
	/*Comments erased*/ 
	initialize: function(p_strInstanceName, p_strPath, p_iWidth, p_iHeight, p_strAlternateContent){
		
		this.m_strInstanceName = p_strInstanceName;
		
		this.setSize(p_iWidth, p_iHeight);
		
		if(p_strAlternateContent)
			this.m_strAlternateContent = p_strAlternateContent;
		
		p_strPath += p_strPath.indexOf("?") > -1?"&amp;":"?";
		p_strPath += "instanceName=ichr.Character.instances['"+p_strInstanceName+"']";
		
		strPath = p_strPath.substr(0, p_strPath.indexOf("?"));
		
		strParams = p_strPath.substr(p_strPath.indexOf("?")+1);
		
		
		
		this.m_objCharacter = iw.FlashFactory.getFlashObject(p_strInstanceName);
		if(this.m_objCharacter){
			this.m_objCharacter.setIWConfiguration(strParams);
			if(this.m_objCharacter.parentNode){
				this.m_objWin = iw.DOMFactory.newElement("div", {"id": this.m_strInstanceName+"_win"});
				this.m_objWinWrapper = iw.DOMFactory.newElement("div", {"id": this.m_strInstanceName+"_win_wrapper", "style":"position: relative;"});
				this.m_objWinWrapper.appendChild(this.m_objWin);			
				this.m_objCharacter.parentNode.insertBefore(this.m_objWinWrapper, this.m_objCharacter);
				this.m_bNestedMode = true;
			}
		
		} 
		else{
			var strProtocol = p_strPath.indexOf("https://") != -1 ? "https" : "http";
			this.m_strFlashObject = iw.FlashFactory.newObjectString(
				'codebase', strProtocol+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
				'width', '100%',
				'height', '100%',
				'src', strPath,
				'quality', 'high',
				'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
				'align', 'middle',
				'play', 'true',
				'loop', 'true',
				'scale', 'noscale',
				'wmode', 'transparent',
				'devicefont', 'false',
				'id', p_strInstanceName,
				'bgcolor', '#ffffff',
				'name', p_strInstanceName,
				'menu', 'true',
				'allowFullScreen', 'false',
				'allowScriptAccess','always',
				'movie', strPath,
				'salign', 'tl',
				'flashVars', strParams
				); 
		}
		
		
		
		ichr.Character.instances[p_strInstanceName] = this;
		this.m_arrLoadListners = new Array();	
		
		this.dockerList = new Array();
	},
	
	/*Comments erased*/ 
	embed: function(p_strReturn){
		if(this.m_objWinWrapper){
			iw.Core.reportError("Error while invoking embed() method. Module is already embedded");
			return false;
		}
		
		if(iw.FlashFactory.detectFlashVer(9, 0, 115) && this.m_strFlashObject){
			var strEmbedHTML = "<div id=\""+this.m_strInstanceName+"_win_wrapper\" style=\"position: relative; width: "+this.m_iWrapperWidth+"; height: "+this.m_iWrapperHeight+";\">";
			strEmbedHTML += "<div id=\""+this.m_strInstanceName+"_win\" style=\"position: absolute; left: 0; top: 0; width: "+this.m_iWidth+"; height: "+this.m_iHeight+";\">";
			strEmbedHTML += this.m_strFlashObject + "</div></div>";
			if(!p_strReturn){
				document.write(strEmbedHTML);				
				this.m_objCharacter = iw.FlashFactory.getFlashObject(this.m_strInstanceName);
				this.m_objWin = iw.DOMFactory.getElement(this.m_strInstanceName+"_win");
				this.m_objWinWrapper = iw.DOMFactory.getElement(this.m_strInstanceName+"_win_wrapper");
				return true;
			}
			return strEmbedHTML;
		}
		else if(this.m_strFlashObject && !p_strReturn){
			document.write(this.m_strAlternateContent);
		}
		return p_strReturn ? this.m_strAlternateContent : false;
	},
	
	/*Comments erased*/ 
	getInstance: function(){
		if(this.m_objCharacter == null){
			return this.m_objCharacter = iw.FlashFactory.getFlashObject(this.m_strInstanceName);
		}
		return this.m_objCharacter;
	},
	
	/*Comments erased*/ 
	getWindowWrapper: function(){
		this.m_objWinWrapper = iw.DOMFactory.getElement(this.m_strInstanceName+"_win_wrapper");
		this.m_objWin = iw.DOMFactory.getElement(this.m_strInstanceName+"_win");
		
		if(this.m_objWinWrapper == null && this.m_strFlashObject && !this.m_objWinWrapper && !this.m_objWin){			
			this.m_objWin = iw.DOMFactory.newElement("div", {"id": this.m_strInstanceName+"_win", "style":"position: absolute; left: 0; top: 0; width: "+this.m_iWidth+"; height: "+this.m_iHeight+";"});
			this.m_objWinWrapper = iw.DOMFactory.newElement("div", {"id": this.m_strInstanceName+"_win_wrapper", "style":"position: relative; left: 0; top: 0; width: "+this.m_iWrapperWidth+"; height: "+this.m_iWrapperHeight+";"});
			this.m_objWinWrapper.appendChild(this.m_objWin);	
			this.m_objWin.innerHTML = iw.FlashFactory.detectFlashVer(9, 0, 115) ? this.m_strFlashObject : this.m_strAlternateContent;			
		}
		return this.m_objWinWrapper;
	},
	
	/*Comments erased*/ 
	getWindow: function(){
		return this.m_objWin;
	},
	
	/*Comments erased*/ 
	setSize: function(p_iWidth, p_iHeight, p_iWrapperWidth, p_iWrapperHeight, p_iOffsetX, p_iOffsetY){
		p_iWidth = parseInt(p_iWidth);
		p_iHeight = parseInt(p_iHeight);
		p_iWrapperWidth = parseInt(p_iWrapperWidth);
		p_iWrapperHeight = parseInt(p_iWrapperHeight);
		
		if(isNaN(p_iWrapperWidth))
			p_iWrapperWidth = p_iWidth;
		if(isNaN(p_iWrapperHeight))
			p_iWrapperHeight = p_iHeight;
			
		
			
		this.m_iOffsetX = !isNaN(p_iOffsetX) ? p_iOffsetX + "px" : this.m_iOffsetX;
		this.m_iOffsetY = !isNaN(p_iOffsetY) ? p_iOffsetY + "px" : this.m_iOffsetY;
			
		this.m_iWidth = !isNaN(p_iWidth) ? p_iWidth+"px" : this.m_iWidth;
		this.m_iHeight = !isNaN(p_iHeight) ? p_iHeight+"px" : this.m_iHeight;
		this.m_iWrapperWidth = !isNaN(p_iWrapperWidth) ? p_iWrapperWidth+"px" : this.m_iWrapperWidth;
		this.m_iWrapperHeight = !isNaN(p_iWrapperHeight) ? p_iWrapperHeight+"px" : this.m_iWrapperHeight;
		
		if(this.m_objWinWrapper && this.m_objWin && !this.m_bNestedMode){
			this.m_objWin.style.width = this.m_iWidth;
			this.m_objWin.style.height = this.m_iHeight;
			this.m_objWin.style.left = this.m_iOffsetX;
			this.m_objWin.style.top = this.m_iOffsetY;
			
			this.m_objWinWrapper.style.width = this.m_iWrapperWidth;
			this.m_objWinWrapper.style.height = this.m_iWrapperHeight;			
		}
		
	},
	
	
	
	/*Comments erased*/ 
	addLoadListener: function(p_funCallback){
		this.m_arrLoadListners.push(p_funCallback);
	},
	
	/*Comments erased*/ 
	createDocker: function(p_objProperties){
		var objClass = ichr.ExternalDocker;
		
		switch(p_objProperties.type){
			case "ExternalDocker":
				objClass = ichr.ExternalDocker;
				break;
			case "ExternalOutputWindow":
				objClass = ichr.ExternalOutputWindow;
				break;
			case "ExternalInputWindow":
				objClass = null;
				break;
				
		}
		
		if(objClass){
			try{
				var objDocker = new objClass(p_objProperties, this.m_objWinWrapper);	
				iw.Core.setProperties(objDocker, p_objProperties);			
				this.dockerList[p_objProperties.id] = objDocker;			
				return "dockerList['"+p_objProperties.id+"'].";
			}
			catch(error){
				iw.Core.reportError("Docker ("+p_objProperties.id+") class definition error", error);
			}
		}
		
		return "";
	},
	
	/*Comments erased*/ 
	defineUserAction: function(p_strActionType, p_strElementId){
		this.m_objDispatcher.defineUserAction(p_strActionType, p_strElementId);
	},
	
	getWindowSize: function(){
		if(this.m_objCharacter && this.m_objWin && this.m_objWin.style.width && this.m_objWin.style.height){
			try{				
				return [parseInt(this.m_objWin.style.width), parseInt(this.m_objWin.style.height)];
			}
			catch(error){					
				iw.Core.reportError("Error while appling browser scale", error);
			}
			
		}
		return [];
	},
	
		
	_loadComplete: function(p_strMsg){
		if(this.m_objCharacter == null)
			this.m_objCharacter = iw.FlashFactory.getFlashObject(this.m_strInstanceName);
			
		if(this.m_objWinWrapper == null)		
			this.m_objWinWrapper = iw.DOMFactory.getElement(this.m_strInstanceName+"_win_wrapper");
			
		if(this.m_objWin == null)
			this.m_objWin = iw.DOMFactory.getElement(this.m_strInstanceName+"_win");
			
		this.m_objDispatcher = new ichr.EventDispatcher(this.m_objCharacter);
		
		for (var ind = 0; ind < this.m_arrLoadListners.length; ind++){
			try{
				this.m_arrLoadListners[ind](this.m_objCharacter);
			}
			catch(error){					
				iw.Core.reportError("Load listener error", error);
			}
		}
	}
	
	
}

}
catch(err){
	iw.Core.reportError("ichr.Character class definition error", err);
}


//----------------
//event_dispatcher.js
try{	
iw.Core.definePackage("ichr");
/*Comments erased*/  
ichr.EventDispatcher = iw.Core.defineClass("ichr.EventDispatcher");

ichr.EventDispatcher.prototype = {
	m_objInstance: null,
	m_strLastFocused: null,
	
	/*Comments erased*/ 
	initialize: function(p_objInstance){
		this.m_objInstance = p_objInstance;
		
	},
	
	/*Comments erased*/ 
	dispatchEvent: function(p_strEventType, p_objElement){
		var strId = p_objElement.id;
		var strValue = p_objElement.innerHTML;
		var strFormFields = "INPUT, SELECT, TEXTAREA";
		if(strFormFields.indexOf(p_objElement.tagName.toUpperCase()) > -1){//element is a form field
			
			if(p_objElement.tagName.toUpperCase() == 'INPUT' && p_objElement.type.toUpperCase() == 'CHECKBOX'){
				
				strValue = p_objElement.checked?'true':'false';			}
			else{
				strValue = p_objElement.value;
			}
			var objForm = p_objElement.form;
			if(objForm){
				strId = objForm.id+":"+p_objElement.name;
			}
		}
		
		var objEvent = {type:p_strEventType, result:"eventSuccess", sourceId:strId, sourceValue:strValue};	
		this.m_objInstance.dispatchEvent(objEvent);
		
	},
	
	/*Comments erased*/ 
	runUserAction: function(p_strActionType, p_strElementId){
		var objElement = iw.DOMFactory.getElement(p_strElementId);
		if(p_strElementId.indexOf(":") > -1){
			var arrIds = p_strElementId.split(":");
			var objForm = iw.DOMFactory.getElement(arrIds[0]);
			if(objForm){
				objElement = iw.DOMFactory.getFormField(objForm, arrIds[1]);
			}
		}
		if(objElement){
			this.dispatchEvent(p_strActionType, objElement);
		}
	},
	
	/*Comments erased*/ 
	defineUserAction: function(p_strActionType, p_strElementId){
		
		var objElement = iw.DOMFactory.getElement(p_strElementId);
		
		if(p_strElementId.indexOf(":") > -1){
			var arrIds = p_strElementId.split(":");
			var objForm = iw.DOMFactory.getElement(arrIds[0]);
			if(objForm){
				objElement = iw.DOMFactory.getFormField(objForm, arrIds[1]);
			}
		}
		
		if(objElement){
			var arrElements = objElement.length && objElement.tagName == undefined ? objElement : [objElement];
			
			for (var iTer = 0; iTer < arrElements.length; iTer++){
				objElement = arrElements[iTer];
				switch(p_strActionType){
					case "mouseClick":
						iw.DOMEvents.removeEventListener(objElement, 'click', this._onUserClick);
						iw.DOMEvents.addEventListener(objElement, 'click', this._onUserClick);
						break;
					case "suggestedAnswer":
						if(objElement.tagName.toUpperCase() == 'A'){
							iw.DOMEvents.removeEventListener(objElement, 'click', this._onUserSuggestedAnswer);
							iw.DOMEvents.addEventListener(objElement, 'click', this._onUserSuggestedAnswer);
						}
						break;
					case "mouseOver" :
						iw.DOMEvents.removeEventListener(objElement, 'mouseover', this._onUserMouseOver);
						iw.DOMEvents.addEventListener(objElement, 'mouseover', this._onUserMouseOver);
						break;
					case "mouseOut" :_onUserMouseOut
						iw.DOMEvents.removeEventListener(objElement, 'mouseout', this._onUserMouseOut);
						iw.DOMEvents.addEventListener(objElement, 'mouseout', this._onUserMouseOut);
						break;
					case "valueChange" :
						if(objElement.tagName.toUpperCase() == 'INPUT' && objElement.type.toUpperCase() == 'TEXT' || objElement.tagName.toUpperCase() == 'TEXTAREA' ||  objElement.tagName.toUpperCase() == 'SELECT'){
							iw.DOMEvents.removeEventListener(objElement, 'change', this._onUserValueChange);
							iw.DOMEvents.addEventListener(objElement, 'change', this._onUserValueChange);
							
						} 
						else{
							iw.DOMEvents.removeEventListener(objElement, 'click', this._onUserValueChange);
							iw.DOMEvents.addEventListener(objElement, 'click', this._onUserValueChange);
						}
						break;
					case "focusIn" :
						iw.DOMEvents.removeEventListener(objElement, 'focus', this._onUserFocusIn);
						iw.DOMEvents.addEventListener(objElement, 'focus', this._onUserFocusIn);
						break;
					case "focusOut" :
						iw.DOMEvents.removeEventListener(objElement, 'blur', this._onUserFocusOut);
						iw.DOMEvents.addEventListener(objElement, 'blur', this._onUserFocusOut);
						break;
				}
			}
			
		}
	},
	
	
	_onUserClick: function(event){
		this.dispatchEvent("mouseClick", iw.DOMEvents.getTarget(event));
	},
	
	_onUserMouseOver: function(event){
		this.dispatchEvent("mouseOver", iw.DOMEvents.getTarget(event));
	},
	
	_onUserMouseOut: function(event){
		this.dispatchEvent("mouseOut", iw.DOMEvents.getTarget(event));		
	},
	
	_onUserValueChange: function(event){
		
		this.dispatchEvent("valueChange", iw.DOMEvents.getTarget(event));		
	},
	
	_onUserFocusIn: function(event){
		this.dispatchEvent("focusIn", iw.DOMEvents.getTarget(event));		
	},
	
	_onUserFocusOut: function(event){
		this.dispatchEvent("focusOut", iw.DOMEvents.getTarget(event));		
	},
	
	_onUserSuggestedAnswer: function(event){
		this.dispatchEvent("suggestedAnswer", iw.DOMEvents.getTarget(event));		
	}
}
	
}
catch(err){
	iw.Core.reportError("ichr.EventDispatcher class definition error", err);
}

//----------------
//external_docker.js
try{
iw.Core.definePackage("ichr");
/*Comments erased*/  
ichr.ExternalDocker = iw.Core.defineClass("ichr.ExternalDocker");
ichr.ExternalDocker.prototype = {
	m_objDocker: null,
	m_objProperties: null,
	initialize: function(p_objProperties, p_objWinWrapper){
		this.m_objProperties = p_objProperties;
		//iw.Core.reportError("proterties for "+p_objProperties.id+" as ExternalDocker", this.m_objProperties);
		this.m_objDocker = iw.DOMFactory.getElement(p_objProperties.id);
		if(!this.m_objDocker){
			this.m_objDocker = iw.DOMFactory.newElement("DIV", {"id":p_objProperties.id});
			p_objWinWrapper.appendChild(this.m_objDocker);			
		}
	},
	
	setId: function(p_strId){
		this.m_objProperties.id = p_strId;
		this.m_objDocker.id = p_strId;
	},
	
	getId: function(){
		return this.m_objDocker.id;
	},
	
	setX: function(p_iX){		
		if(!isNaN(p_iX)){
			this.m_objProperties.x = p_iX;
			this.m_objDocker.style.position = "absolute";
			this.m_objDocker.style.left = p_iX+"px";
		}
		else{
			this.m_objProperties.x = undefined;
			this.m_objDocker.style.position = "";
			this.m_objDocker.style.left = "";
		}
	},
	
	getX: function(){
		return this.m_objProperties.x;
	},
	
	setY: function(p_iY){
		if(!isNaN(p_iY)){
			this.m_objProperties.y = p_iY;
			this.m_objDocker.style.position = "absolute";
			this.m_objDocker.style.top = p_iY+"px";
		}
		else{
			this.m_objProperties.y = undefinded;
			this.m_objDocker.style.position = "";
			this.m_objDocker.style.top = "";
		}
	},
	
	getY: function(){
		return this.m_objProperties.y;
	},
	
	setWidth: function(p_iWidth){
		if(!isNaN(p_iWidth)){
			this.m_objProperties.width = p_iWidth;
			this.m_objDocker.style.width = p_iWidth+"px";
			this.m_objDocker.style.overflowX = "hidden";
		}
		else{
			this.m_objProperties.width = undefined;
			this.m_objDocker.style.width = "";
			this.m_objDocker.style.overflowX = "";
		}
	},
	
	getWidth: function(){
		return this.m_objProperties.width;
	},
	
	setHeight: function(p_iHeight){
		if(!isNaN(p_iHeight)){
			this.m_objProperties.height = p_iHeight;
			this.m_objDocker.style.height = p_iHeight+"px";
			this.m_objDocker.style.overflowY = "hidden";
		}
		else{
			this.m_objProperties.height = undefined;
			this.m_objDocker.style.height = "";
			this.m_objDocker.style.overflowY = "";
		}
	},
	
	getHeight: function(){
		return this.m_objProperties.height;
	},
	
	setVisible: function(p_bVisible){
	   if(p_bVisible && p_bVisible != "false") {
	   		this.m_objProperties.visible = true;
			this.m_objDocker.style.display = "";
			if(this.m_objDocker.style.visibility == "hidden"){
				this.m_objDocker.style.visibility = "show";
			}
	   } else {
	   		this.m_objProperties.visible = false;
			this.m_objDocker.style.display = "none";
	   }
	},
	
	getVisible: function(){
	   return this.m_objProperties.visible;
	},
	
	setAlpha: function(p_numAlpha){
		this.m_objProperties.alpha = p_numAlpha;
		if(iw.isIE && !isNaN(p_numAlpha)){
			this.m_objDocker.style.filter = "alpha(opacity = "+Math.round(p_numAlpha*100)+")";
		}
		else if(!isNaN(p_numAlpha)){
			this.m_objDocker.style.opacity = p_numAlpha;
		}
		
	},
	
	getAlpha: function(){
		this.m_objProperties.alpha;
	},	
	
	setBackgroundSkin: function(p_backgroundSkin){
		if(p_backgroundSkin){
			this.m_objProperties.backgroundSkin = p_backgroundSkin;
			this.m_objDocker.style.backgroundImage = "url("+p_backgroundSkin+")";
			this.m_objDocker.style.backgroundPosition = "top left";
		}
		else{
			this.m_objProperties.backgroundSkin = "";
			this.m_objDocker.style.backgroundImage = "";
			this.m_objDocker.style.backgroundPosition = "";
		}
	},
	
	getBackgroundSkin: function(){
		return this.m_objProperties.backgroundSkin;
	},
	
	setBackgroundColor: function(p_strColor){
		if(typeof p_strColor == 'string' && p_strColor.indexOf("#") === 0 && p_strColor.length == 7){
			this.m_objProperties.backgroundColor = p_strColor;
			this.m_objDocker.style.backgroundColor = p_strColor;
		}
		else{
			this.m_objProperties.backgroundColor = "";
			this.m_objDocker.style.backgroundColor = "";
		}
	},
	
	getBackgroundColor: function(){
		return this.m_objProperties.backgroundColor;
	},
	
	setPadding: function(p_iPadding){
		if(!isNaN(p_iPadding) && p_iPadding >= 0){
			this.m_objProperties.padding = p_iPadding;
			this.m_objDocker.style.padding = p_iPadding+"px";
		}
		else{
			this.m_objProperties.padding = undefined;
			this.m_objDocker.style.padding = "";
		}
	},
	
	getPadding: function(){
		return this.m_objProperties.padding;
	},
	
	setBorderWidth: function(p_iWidth){
		if(!isNaN(p_iWidth) && p_iWidth > 0){
			this.m_objProperties.borderWidth = p_iWidth;
			this.m_objDocker.style.borderStyle = "solid";
			this.m_objDocker.style.borderWidth = p_iWidth+"px";
		}
		else{
			this.m_objProperties.borderWidth = 0;
			this.m_objDocker.style.borderStyle = "";
			this.m_objDocker.style.borderWidth = "";
		}
	},
	
	getBorderWidth: function(){
		return this.m_objProperties.borderWidth;
	},
	
	setBorderColor: function(p_strColor){
		if(typeof p_strColor == 'string' && p_strColor.indexOf("#") === 0 && p_strColor.length == 7){
			this.m_objProperties.borderColor = p_strColor;
			this.m_objDocker.style.borderColor = p_strColor;
			if(!this.m_objProperties.borderWidth){
				this.m_objDocker.style.borderStyle = "solid";
				this.m_objDocker.style.borderWidth = "1px";
			}
		}
		else{
			this.m_objProperties.borderColor = "";
			this.m_objDocker.style.borderColor = "";
		}
	},
	
	getBorderColor: function(){
		return this.m_objProperties.borderColor;
	}
	
}
}
catch(err){
	iw.Core.reportError("ichr.ExternalDocker class definition error", err);
}

//----------------
//external_output_window.js
try{
iw.Core.definePackage("ichr");
/*Comments erased*/  
ichr.ExternalOutputWindow = iw.Core.defineClass("ichr.ExternalOutputWindow");
ichr.ExternalOutputWindow.prototype = {
	formList: null,
	m_objStyleSheet: null,
	
	initialize: function(p_objProperties, p_objWinWrapper){	
		this.Super.initialize(p_objProperties, p_objWinWrapper);
		//iw.Core.reportError("proterties for "+p_objProperties.id+" as ExternalOutputWindow", this.m_objProperties);
		this.formList = new Array();
	},
	
	addHtml: function(p_strHtml){
		if(this.m_objDocker){	
			//alert(this.m_objDocker);
			iw.DOMFactory.appendHTML(this.m_objDocker, "<span class='standard'>"+p_strHtml+"</span>");
		}
	},
	
	addLink: function(p_strText, p_strLinkId){
		if(this.m_objDocker && !iw.DOMFactory.getElement(p_strLinkId)){
			iw.DOMFactory.appendHTML(this.m_objDocker, "<a id='"+p_strLinkId+"' href='#'>"+p_strText+"</a>");
		}
	},
	
	addImage: function(p_strImageId, p_strURL, p_iWidth, p_iHeight){
		if(this.m_objDocker && !iw.DOMFactory.getElement(p_strImageId)){
			if(p_strURL.indexOf(".swf") != -1){
				var strParams = p_strURL.indexOf("?") > 0?p_strURL.split("?")[1]:"";
				p_strURL = p_strURL.split("?")[0];
				p_strURL = p_strURL.substr(0, p_strURL.lastIndexOf(".swf"));
				var strProtocol = p_strURL.indexOf("https://") != -1 ? "https" : "http";
				var strFlash = iw.FlashFactory.newObjectString(
					'codebase', strProtocol+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
					'width', p_iWidth?p_iWidth:"100%",
					'height', p_iHeight?p_iHeight:"100%",
					'src', p_strURL,
					'quality', 'high',
					'pluginspage', strProtocol+'://www.macromedia.com/go/getflashplayer',
					'align', 'middle',
					'play', 'true',
					'loop', 'true',
					'scale', 'noscale',
					'wmode', 'transparent',
					'devicefont', 'false',
					'id', p_strImageId,
					'bgcolor', '#ffffff',
					'name', p_strImageId,
					'menu', 'true',
					'allowFullScreen', 'true',
					'allowScriptAccess','always',
					'movie', p_strURL,
					'FlashVars', strParams,
					'salign', 'tl'
					); //end AC code	
				iw.DOMFactory.appendHTML(this.m_objDocker, strFlash);
			}
			else{
				this.m_objDocker.appendChild(iw.DOMFactory.newElement("img", {"id":p_strImageId, "src": p_strURL}));
			}
		}
	},
	
	addForm: function(p_strFormId){
		if(this.m_objDocker){
			var objForm = new ichr.ExternalForm(this.m_objDocker, p_strFormId);
			this.formList[p_strFormId] = objForm;
			return "formList['"+p_strFormId+"'].";
		}
	},
	
	clear: function(){
		this.m_objDocker.innerHTML = "";
		this.formList = new Array();
	},
	
	setScrollbarVisible: function(p_bScrollVisible){
		this.m_objProperties.scrollbarVisible = p_bScrollVisible;
		this.m_objDocker.style.overflowY = p_bScrollVisible && p_bScrollVisible != "false"?"scroll":(this.m_objDocker.style.height?"hidden":"");
	},
	
	getScrollbarVisible: function(){
		return this.m_objProperties.scrollbarVisible != "false" && this.m_objProperties.scrollbarVisible?true:false;
	},
	
	
	setHeight: function(p_iHeight){
		if(!isNaN(p_iHeight)){
			this.Super.setHeight(p_iHeight);
			this.m_objDocker.style.overflowY = this.getScrollbarVisible()?"scroll":"hidden";
		}
	},
	
	getStyleSheet: function(){
		return this.m_objProperties.styleSheet;
	},
	
	setStyleSheet: function(p_strStyle){
		this.m_objProperties.styleSheet = p_strStyle;
		if(this.getId()){	
			p_strStyle = p_strStyle.replace(/\n/g, " ");//removing enters
			p_strStyle = p_strStyle.replace(/\t/g, "");//removing tabs
			p_strStyle = p_strStyle.replace(/\}/g, "}\n#"+this.getId()+" ");//adding dockerId prefixes
			p_strStyle = "#"+this.getId()+" "+p_strStyle;//adding dockerId prefix to first class
			p_strStyle = p_strStyle.substr(0, p_strStyle.lastIndexOf("#"+this.getId()));
			var objStyleSheet = this.m_objStyleSheet;
			if(!objStyleSheet){
				
				objStyleSheet = iw.DOMFactory.newStyleSheet(p_strStyle);
				this.m_objStyleSheet = objStyleSheet;
				iw.DOMFactory.applyStyleSheet(objStyleSheet);
			}
			else 
				iw.DOMFactory.updateStyleSheet(this.m_objStyleSheet, p_strStyle);
		}
	}
	
}

iw.Core.extendDefinition(ichr.ExternalOutputWindow, ichr.ExternalDocker);
}
catch(err){
	iw.Core.reportError("ichr.ExternalOutputWindow class definition error", err);
}

//----------------------------------------------------------------------------
try{
/*Comments erased*/ 
ichr.ExternalForm = iw.Core.defineClass("ichr.ExternalForm");
ichr.ExternalForm.prototype = {
	m_objForm: null,
	initialize: function(p_objDocker, p_strFormId){
		if(!iw.DOMFactory.getElement(p_strFormId)){
			p_objDocker.appendChild(iw.DOMFactory.newElement("form", {"id": p_strFormId}));
		}
		this.m_objForm = iw.DOMFactory.getElement(p_strFormId);
		//alert(this.m_objForm.parentNode);
	},
	
	addHtml: function(p_strHtml){
		if(this.m_objForm){	
			iw.DOMFactory.appendHTML(this.m_objForm, p_strHtml);
		}
	},
	
	addCheckBox: function(p_strCheckboxId, p_strLabel, p_strValue){
		if(!this.m_objForm)
			return;
			
		var objField = iw.DOMFactory.getFormField(this.m_objForm, p_strCheckboxId);
		if(!objField){
			var objLabel = iw.DOMFactory.newElement("label");
			objLabel.appendChild(iw.DOMFactory.newElement("input", {"type":"checkbox", "checked": p_strValue=="true"?true:false}));
			objLabel.appendChild(iw.DOMFactory.newElement("text", p_strLabel?p_strLabel:""));
			this.m_objForm.appendChild(objLabel);
		}
		else if(this.m_objForm && p_strValue){
			
			objField.checked = p_strValue == "true"?true:false;
		}
	},

	addComboBox: function(p_strComboboxId, p_arrOptions, p_iSelected) {
		if(!this.m_objForm)
			return;
			
		var iTer;
		var objOptionProperties;
		
		var objSelect = iw.DOMFactory.getFormField(this.m_objForm, p_strComboboxId);
		if(!objSelect){
			objSelect = iw.DOMFactory.newElement("select", {"name": p_strComboboxId});
			this.m_objForm.appendChild(objSelect);
		}
		
		if(p_arrOptions){
			var arrOptions = objSelect.getElementsByTagName("option");
		
			var iLength = p_arrOptions.length > arrOptions.length ? p_arrOptions.length : arrOptions.length;
			var iRemoved = 0;
			for(iTer = 0; iTer < iLength; iTer++) {
				objOptionProperties = p_arrOptions[iTer];	
				if(arrOptions[iTer] && iTer < p_arrOptions.length){//option already exists
					arrOptions[iTer].selected = iTer == p_iSelected;
					arrOptions[iTer].value = objOptionProperties.value;
					arrOptions[iTer].innerHTML = objOptionProperties.label?objOptionProperties.label:objOptionProperties.value;
				}
				else if(objOptionProperties && iTer < p_arrOptions.length){//option needs to be created
					objSelect.appendChild(iw.DOMFactory.newElement("option", {"selected": iTer == p_iSelected, "value": objOptionProperties.value, "innerHTML": objOptionProperties.label}));
				}
				else if(arrOptions[iLength + p_arrOptions.length - iTer - 1]){//existing but already redundant option element
					iRemoved++;
					objSelect.removeChild(arrOptions[iLength + p_arrOptions.length - iTer - 1]);
					
				}
	
			}
		}
		else if(p_iSelected >= 0){
			objSelect.selectedIndex = p_iSelected;
		}
	},
	
	addRadioGroup: function(p_strRadioId, p_arrOptions, p_iSelected) {
		if(!this.m_objForm)
			return;
			
		var iTer;
		var objOptionProperties;
		var objLabel; 
		
		
		var arrRadios = iw.DOMFactory.getFormField(this.m_objForm, p_strRadioId);
		if(!arrRadios)
			arrRadios = [];
			
		if(p_arrOptions){
			
			var iLength = p_arrOptions.length > arrRadios.length?p_arrOptions.length:arrRadios.length;
			
			for(iTer = 0; iTer < iLength; iTer++) {				
				objOptionProperties = p_arrOptions[iTer];
				if(arrRadios[iTer] && iTer < p_arrOptions.length){//radio button already exists	
					arrRadios[iTer].checked = iTer == p_iSelected;
					arrRadios[iTer].value = p_arrOptions[iTer].value;
					objLabel = arrRadios[iTer].parentNode;
					
					if(objLabel && objLabel.tagName.toLowerCase() == "label"){//update label
						objLabel.removeChild(arrRadios[iTer]);
						objLabel.innerHTML = "";//clear node
						objLabel.appendChild(arrRadios[iTer]);//append button to empty label
						objLabel.appendChild(iw.DOMFactory.newElement("text", p_arrOptions[iTer].label?p_arrOptions[iTer].label:p_arrOptions[iTer].value));
					} 
				}
				else if(objOptionProperties && iTer < p_arrOptions.length){//radio button needs to be created
					objLabel = iw.DOMFactory.newElement("label");
					objLabel.appendChild(iw.DOMFactory.newElement("input", {"type":"radio", "name":p_strRadioId, "checked":iTer == p_iSelected, "value":p_arrOptions[iTer].value}));
					objLabel.appendChild(iw.DOMFactory.newElement("text", p_arrOptions[iTer].label?p_arrOptions[iTer].label:p_arrOptions[iTer].value));	
					this.m_objForm.appendChild(objLabel);
				}
				else if(arrRadios[iTer] && arrRadios[iTer].parentNode.tagName.toLowerCase() == "label"){//existing but already redundant labeled radio button
					objLabel = arrRadios[iTer].parentNode;
					objLabel.parentNode.removeChild(objLabel);
				}
				else if(arrRadios[iTer]){//existing but already redundant not labeled radio button
					arrRadios[iTer].parentNode.removeChild(arrRadios[iTer]);
				}
			}
		}
		else if(p_iSelected >= 0 && arrRadios[p_iSelected]){
			arrRadios[p_iSelected].checked = true;
		}
	},
	
	addTextField: function(p_strTextfieldId, p_strText, p_bMultiline, p_iMaxlength, p_strRestrict){
		if(!this.m_objForm)
			return;
			
		var objField = iw.DOMFactory.getFormField(this.m_objForm, p_strTextfieldId);
		if(!objField){
			var objParams = {"name": p_strTextfieldId, "value": p_strText?p_strText:""};
			if(p_bMultiline){
				this.m_objForm.appendChild(iw.DOMFactory.newElement("textarea", objParams));
			}
			else{
				objParams["type"] = "text";
				if(p_iMaxlength)
					objParams["maxlength"] = p_iMaxlength;
				this.m_objForm.appendChild(iw.DOMFactory.newElement("input", objParams));
			}
			
		}
		else if(p_strText != null){		
			objField.value = p_strText;
		}	
	},
	
	clear: function(){
		if(this.m_objForm){
			this.m_objForm.innerHTML = '';
		}
	}
}


}
catch(err){
	iw.Core.reportError("ichr.ExternalForm class definition error", err);
}

//----------------
//log.js
try{
	
	
ichr.Log = iw.Core.defineClass("ichr.Log");
ichr.Log.instances = [];

ichr.Log.OUTPUT_STYLE = "text-align: left; background-color: #fff; border-top: 1px solid #777; border-left: 1px solid #777; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; cursor: text; margin-bottom: 2px; font-family: \"Courier New\", Courier, monospace !important; font-size: 11px !important; padding: 0 10px; ";
ichr.Log.LOG_OUTPUT_STYLE = ichr.Log.OUTPUT_STYLE+"overflow-y: scroll; ";
ichr.Log.CM_OUTPUT_STYLE = ichr.Log.OUTPUT_STYLE+"overflow: scroll;";
ichr.Log.PROFILER_OUTPUT_STYLE = ichr.Log.OUTPUT_STYLE+"overflow-y: scroll; ";

ichr.Log.DETAILS_STYLE = "font-family: \"Courier New\", Courier, monospace; border: 1px solid #bbb; margin: 2px 0; background: #fff; padding: 2px 5px; "; 

ichr.Log.prototype = {

	m_objInstance: null,
	
	m_arrWindows: null,
	
	m_arrProcHeaders: null,
	m_arrProcCells: null,
	
	
	
	m_objActiveWindow: null,
	
	m_bInitialized: false,
	
	m_objSwitch: null,
	
	m_objLogOutput: null,
	m_objProfilerOutput: null,
	m_objControlStatus:null,
	
	m_objCSLegend: null,
	m_objCSInfo: null,
	
	m_objCSTable: null,
	m_objCSHeaders: null,
	
	m_arrCmdDetails: null,
	m_arrResetCounts: null,
	
	m_objWrapper: null,
	m_objEnabledInput: null,
	m_objPrioritySelect: null,
	m_objFilterInput: null,
	m_objFilterButton: null,
	
	m_strInstanceName: null,
	m_iWidth: 800,
	m_iHeight: 300,
	
	m_bMinimilized: false,
	m_objBottomWrapper: null,
	
	m_arrMsgHistory: null,
	m_arrMsgQueue: null,
	
	m_arrFilters: null,
	
	m_iMsgPointer: 0,
	
	m_activeCmdBox: null,
	
	m_arrTempMsgHistory: null,
	m_arrTempInstancesList: null,
	m_arrTempCSList: null,
	
	m_objSwitchesLabel: null,
	initialize: function(p_objAplication, p_strInstanceName, p_iWidth, p_iHeight){
		
		this.m_strInstanceName = p_strInstanceName;
		if(p_objAplication){
			this.m_objInstance = p_objAplication.getInstance();
			p_objAplication.addLoadListener(this._onAplicationLoad);
		}
		
		if(p_iWidth)
			this.m_iWidth = p_iWidth;
		if(p_iHeight)
			this.m_iHeight = p_iHeight;
		
		iw.DOMEvents.addEventListener(window, "load", this._onDocumentLoad);
		
		this.m_arrMsgHistory = new Array();
		this.m_arrFilters = new Array();
		this.m_arrMsgQueue = new Array();
		this.m_arrWindows = new Array();
		
		this.m_arrProcHeaders = new Array();
		this.m_arrProcCells = new Array();
		
		this.m_arrCmdDetails = new Array();
		this.m_arrResetCounts = new Array();
		
		this.m_arrTempMsgHistory = new Array();
		this.m_arrTempInstancesList = new Array();
		this.m_arrTempCSList = new Array();
	},
	
	log: function(p_arrList){
		if(this.m_objProfilerOutput && this.m_bInitialized && this.m_objEnabledInput.checked){
			this.m_iMsgPointer = this.m_arrMsgHistory.length - 1;		
			this.m_arrMsgHistory = this.m_arrMsgHistory.concat(p_arrList);
			this.writeMessages(p_arrList);
		}
		else{
			this.m_arrTempMsgHistory = this.m_arrTempMsgHistory.concat(p_arrList);
		}
	},
	
	showInstances: function(p_arrList){
		if(this.m_objProfilerOutput && this.m_bInitialized && this.m_objEnabledInput.checked){
			this.m_objProfilerOutput.innerHTML = "";
			var strLastName = "";
			var iCounter = 1;
			var objLastName = null;
			for(var i = 0; i < p_arrList.length; i++){
				var strName = p_arrList[i];
				var strTime = strName;
				strName = strName.substr(0, strName.indexOf(" "));
				strTime = strTime.substr(strName.length);
				if(strName != strLastName){
					if(objLastName)
						objLastName.appendChild(document.createTextNode(strLastName+" ("+iCounter+")"));
					iCounter = 1;
					objLastName = document.createElement("b");
					if(i>0){
						this.m_objProfilerOutput.appendChild(document.createElement("br"));
						this.m_objProfilerOutput.appendChild(document.createElement("br"));
					}
					this.m_objProfilerOutput.appendChild(objLastName);
					this.m_objProfilerOutput.appendChild(document.createElement("br"));
					strLastName = strName;
				}
				else{
					iCounter++;
				}
				this.m_objProfilerOutput.appendChild(document.createTextNode(strTime));
				//this.m_objProfilerOutput.appendChild(document.createElement("br"));				
			}
			if(objLastName)
				objLastName.appendChild(document.createTextNode(strLastName+" ("+iCounter+")"));
		}
		else{
			this.m_arrTempInstancesList = p_arrList;
		}
	},
	
	
	
	showControlStatus: function(p_arrList){
		if(this.m_objControlStatus && this.m_bInitialized && this.m_objEnabledInput.checked){
			
			for(var i = 0; i < p_arrList.length; i++){
				this._updateProcStatus(p_arrList[i]);		
			}
		}
		else{
			this.m_arrTempCSList = this.m_arrTempCSList.concat(p_arrList);
		}
	},
	
	_setLogEnabled: function(event){
		if(this.m_objEnabledInput.checked){
			this.log(this.m_arrTempMsgHistory);
			this.showInstances(this.m_arrTempInstancesList);
			this.showControlStatus(this.m_arrTempCSList);
			this.m_arrTempMsgHistory = new Array();
			this.m_arrTempInstancesList = new Array();
			this.m_arrTempCSList = new Array();
		}			
	},
	
	_updateProcStatus: function(p_objStatus){
		if(p_objStatus && this.m_objControlStatus && this.m_bInitialized && this.m_objEnabledInput.checked){
			var strId = "procCell"+p_objStatus.procId;
			
			
			if(this.m_objCSTable == null || this.m_objCSHeaders == null){
				var objTable = iw.DOMFactory.newElement("table", {"style":"table-layout:fixed; border-spacing: 0;"});
				this.m_objCSHeaders = iw.DOMFactory.newElement("tr");
				objTable.appendChild(this.m_objCSHeaders);
				this.m_objCSTable = iw.DOMFactory.newElement("tr");
				objTable.appendChild(this.m_objCSTable);
				
				this.m_objControlStatus.appendChild(objTable);
			}
			
			
			
				
			var objProcHeader  = this.m_arrProcHeaders[strId];
			if(!objProcHeader){
				objProcHeader = iw.DOMFactory.newElement("th", {"style":"text-align: left; padding: 5px; margin: 0; border-right: 1px solid #cfcfcf; white-space:nowrap;"});
				this.m_objCSHeaders.appendChild(objProcHeader);
				this.m_arrProcHeaders[strId] = objProcHeader;
				
			}
			objProcHeader.innerHTML = "#"+(p_objStatus.procId?p_objStatus.procId:"default")+" ("+p_objStatus.pointer+"/"+p_objStatus.commandCount+")";
			
			
			var objProcCell  = this.m_arrProcCells[strId];
			if(!objProcCell){
				objProcCell = iw.DOMFactory.newElement("td", {"style":"vertical-align: top; margin: 0; border-right: 1px solid #cfcfcf; white-space:nowrap;"});
				this.m_objCSTable.appendChild(objProcCell);
				this.m_arrProcCells[strId] = objProcCell;
			}
			
			if(this.m_arrResetCounts[strId] != p_objStatus.resetCount){
				this.m_arrResetCounts[strId] = p_objStatus.resetCount;
				objProcCell.innerHTML = "";
			}
			
			
			if(p_objStatus.activeCommands){
				
				//alert(p_objStatus.activeCommands);
				for(var i = 0; i < p_objStatus.activeCommands.length; i++){
					var objCommandStatus = p_objStatus.activeCommands[i];
					if(objCommandStatus){
						var objCmdBox = objProcCell.childNodes[objCommandStatus.id];
						var strInfoId = p_objStatus.procId+"_"+objCommandStatus.id;
						if(!objCmdBox){
							objCmdBox = iw.DOMFactory.newElement("div", {"style":"color: #666; cursor: pointer; padding: 2px 5px;"});
							objProcCell.appendChild(objCmdBox);
							
							objCmdBox.innerHTML = objCommandStatus.type+" #"+objCommandStatus.id+" "+(objCommandStatus.synchronous?"[S]":"")+(objCommandStatus.waitAfter?"["+objCommandStatus.waitAfter+"]":"");
							objCmdBox.id = strInfoId;
							iw.DOMEvents.addEventListener(objCmdBox, "click", this._showCmdInfo);
						}
						
						if(objCommandStatus.startTime){
							objCmdBox.style.fontWeight = "bold";
						}
						
						if(objCommandStatus.startTime && !objCommandStatus.endTime)
							objCmdBox.style.color = "red";
						else if(objCommandStatus.endTime)
							objCmdBox.style.color = "#000000";
							
						if(objCommandStatus.terminated){
							objCmdBox.style.textDecoration = "line-through";
							objCmdBox.style.color = "#666";
						}
						this.m_arrCmdDetails[strInfoId] = objCommandStatus;
						
											
					}
					
					
				}
			}
		}
	},
	
	_showCmdInfo: function(event){
		var objCmdBox = event.target || window.event.srcElement;
		if(!objCmdBox)
			return;
		
		if(this.m_activeCmdBox)
			this.m_activeCmdBox.style.backgroundColor = "";
		
		objCmdBox.style.backgroundColor = "#cccccc";
		this.m_activeCmdBox = objCmdBox;
		var objStatus = this.m_arrCmdDetails[objCmdBox.id];
		
		if(objStatus){
			var strTimeRange = objStatus.startTime?(objStatus.startTime+" - "+(objStatus.endTime?objStatus.endTime:"still running")):"awaiting";
			var strInfo = "<div style='padding: 0 10px 0 0'>Command <b>"+objStatus.type+" #"+objStatus.id+"</b> on processor <b>#"+(objStatus.procId?objStatus.procId:"default")+"</b> ["+strTimeRange+"] :</div>";
			strInfo +="<div style='"+ichr.Log.DETAILS_STYLE+"'>";
			for(strProperty in objStatus.properties){				
				var strPropertyValue = objStatus.properties[strProperty];
				if(typeof strPropertyValue == "string")
					strPropertyValue = strPropertyValue.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "\\n");
				else if(typeof strPropertyValue == "object"){
					var objComplexValue = strPropertyValue;
					strPropertyValue = "";
					for(var strSubProperty in objComplexValue){
						strPropertyValue += objComplexValue[strSubProperty]["label"] ? "\""+objComplexValue[strSubProperty]["label"]+"\":\""+objComplexValue[strSubProperty]["value"]+"\", " : objComplexValue[strSubProperty]+", ";
					}
					strPropertyValue = strPropertyValue.substr(0, strPropertyValue.lastIndexOf(","));
				}
				strInfo += "<div style='float: left; padding: 0 10px 2px 0'><b>"+strProperty+":</b> <code>"+strPropertyValue+"</code>;</div>";
			}
			strInfo +="<div style='clear: both'></div></div>";
			this.m_objCSInfo.innerHTML = strInfo;
		}
	},
	
	writeMessages: function(p_arrList){
		if(this.m_objLogOutput && this.m_bInitialized){
			//var strOutput = "";
			for(var i = 0; i < p_arrList.length; i++){
				var strMsg = p_arrList[i];
				
				var iPriority = parseInt(strMsg.charAt(2));
				if(strMsg == "" || (this.isFiltered(strMsg) && iPriority <= this.m_objPrioritySelect.value)){
					//alert(strMsg);
					var strSource = strMsg.substr(0, strMsg.indexOf(":", 21));
					var strTrace = strMsg.substr(strSource.length);
					var arrTrace = strTrace.split("\n");
					var objSourceBold = document.createElement("b")
					objSourceBold.appendChild(document.createTextNode(strSource));
					this.m_objLogOutput.appendChild(objSourceBold);
					if(arrTrace.length > 1){
						for(var iPartNo = 0; iPartNo < arrTrace.length; iPartNo++){
							this.m_objLogOutput.appendChild(document.createTextNode(arrTrace[iPartNo]));
							this.m_objLogOutput.appendChild(document.createElement("br"));
						}
					}
					else
						this.m_objLogOutput.appendChild(document.createTextNode(strTrace));
					this.m_objLogOutput.appendChild(document.createElement("br"));
				}
				
			}
			
			this.m_objLogOutput.scrollTop = this.m_objLogOutput.scrollHeight - this.m_objLogOutput.clientHeight;
			this.m_objLogOutput.style.display = "";
		}
	},
	
	isFiltered: function (p_strMsg){
		
		if(!this.m_arrFilters.length)
			return true;
			
		var iMatchCount = 0;
			
		for (var i = 0; i < this.m_arrFilters.length; i++){
			var strFilter = this.m_arrFilters[i];
			if(p_strMsg.indexOf(strFilter) > -1 && strFilter.length > 0)
				iMatchCount++;

		}
		return iMatchCount == this.m_arrFilters.length ? true : false;
		
	},
	
	clear: function(){
		if(this.m_objLogOutput && this.m_bInitialized){
			this.m_objLogOutput.style.display = "none";
			this.m_objLogOutput.innerHTML = "";
			this.m_objLogOutput.scrollTop = 0;//this.m_objLogOutput.scrollHeight - this.m_objLogOutput.clientHeight;
		}
	},
	
	_onDocumentLoad: function(event){
		
	},
	
	_toggle: function(){
		this.m_objWrapper.style.top = "";
		if(this.m_bMinimilized){
			this.m_objWrapper
			this.m_objWrapper.style.height = this.m_iHeight+"px";			
			this.m_bMinimilized = false;
			this.m_objBottomWrapper.style.display = "";	
			this.m_objWrapper.style.bottom = "-1px";
			this.m_objWrapper.style.left = "-1px";
			this.m_objWrapper.style.width = this.m_iWidth+"px";
			this.m_objSwitchesLabel.style.display = "";
			this.m_objHeaderText.style.display = "";
			this.m_objMinimizedInfo.style.display = "none";
		}
		else{
			this.m_objWrapper.style.height = "30px";			
			this.m_objBottomWrapper.style.display = "none";
			this.m_bMinimilized = true;
			this.m_objWrapper.style.top = "";
			this.m_objWrapper.style.left = "-1px";
			this.m_objWrapper.style.bottom = "-7px";
			this.m_objWrapper.style.width = "";
			
			this.m_objSwitchesLabel.style.display = "none";
			this.m_objHeaderText.style.display = "none";
			this.m_objMinimizedInfo.style.display = "";
		}
	},
	
	
	
	_changePriority: function(event){
		this.clear();
		this.writeMessages(this.m_arrMsgHistory);
	},
	
	_filter: function(event){
		if(this.m_objFilterInput.value){
				this.m_arrFilters = this.m_objFilterInput.value.split(" ");
		}
		else
			this.m_arrFilters = [];
			
		this.clear();
		this.writeMessages(this.m_arrMsgHistory);
	},
	
	_startDrag: function(event){	
		if(!this.m_bMinimilized){	
			this.m_bDraggable = true;
			var objPosition = iw.DOMFactory.getElementPosition(this.m_objWrapper);
			
			//alert(objPosition);
			this.m_startX = iw.DOMEvents.pointerX(event || window.event) - objPosition[0];
			this.m_startY = iw.DOMEvents.pointerY(event || window.event) - objPosition[1];		
			iw.DOMEvents.addEventListener(document, "mousemove", this._drag);
		}
	},
	
	_stopDrag: function(event){
		this.m_bDraggable = false;	
		iw.DOMEvents.removeEventListener(document, "mousemove", this._drag);
	},
	
	_drag: function(event){
		var iNewX = iw.DOMEvents.pointerX(event || window.event) - this.m_startX;
		var iNewY = iw.DOMEvents.pointerY(event || window.event) - this.m_startY;
		//this.log(iNewX+"/"+iNewY);
		this.m_objWrapper.style.left = iNewX+"px";
		this.m_objWrapper.style.top = iNewY+"px";		
	},
	
	_switchWindow: function(event){
		this._activateWindow(this.m_objSwitch.value);
	},
	
	
	_activateWindow: function(p_strId){
		var objWindow = this.m_arrWindows[p_strId];
		if(objWindow && objWindow != this.m_objActiveWindow){
			if(this.m_objActiveWindow)
				this.m_objActiveWindow.style.display = "none";
			objWindow.style.display = "block";
			this.m_objActiveWindow = objWindow;
		}
	},
	
	_createWindow: function(p_strId, p_strStyle, p_iWidth, p_iHeight, p_bHidden){
		if(p_iWidth)
			p_strStyle += "width: "+p_iWidth+"px; ";
		if(p_iHeight)
			p_strStyle += "height: "+p_iHeight+"px; ";
		if(p_bHidden)
			p_strStyle += "display: none; ";
		var objElement = iw.DOMFactory.newElement("div", {"id":p_strId, "style":p_strStyle});
		this.m_arrWindows[p_strId] = objElement;
		return objElement;
	},
	
	
	_onAplicationLoad: function(p_objInstance){
		this.m_objInstance = p_objInstance;
		//alert(this.m_objInstance.setLog);
		
		this.m_objWrapper = iw.DOMFactory.newElement("div", {"id" : this.m_strInstanceName, "style" : "position: absolute; position:fixed; z-index: 10000; overflow: hidden; bottom: 0px; font-family: Arial, Helvetica, sans-serif !important; font-size: 11px !important; border-top: 1px solid #ddd; border-left: 1px solid #ddd; border-bottom: 1px solid #777; border-right: 1px solid #777; background-color: #ababab; width: "+this.m_iWidth+"px; height: "+this.m_iHeight+"px"})
		this.m_objHeader = iw.DOMFactory.newElement("div", {"style" : "cursor: move; height: 21px; padding: 3px 5px 0 5px; font-size: 15px"});
		
		
		
		
		this.m_objSwitch = iw.DOMFactory.newElement("select", {"style":"float: right; margin: 0"});
		this.m_objSwitch.appendChild(iw.DOMFactory.newElement("option", {"value" : "LogWindow", "innerHTML": "Log console"}));
		this.m_objSwitch.appendChild(iw.DOMFactory.newElement("option", {"value" : "IMWindow", "innerHTML": "Profiler"}));
		this.m_objSwitch.appendChild(iw.DOMFactory.newElement("option", {"value" : "CSWindow", "innerHTML": "Processors"}));
		
		//this.m_objHeader.appendChild(this.m_objSwitch);		
		
		this.m_objEnabledInput = iw.DOMFactory.newElement("input", {"type" : "checkbox", "style":"vertical-align: middle;"});
		
		this.m_objSwitchesLabel = iw.DOMFactory.newElement("span", {"style" : "float: right; padding: 0 0 0 20px; font-family: Arial, Helvetica, sans-serif !important; font-size: 11px !important;"})
		this.m_objSwitchesLabel.appendChild(this.m_objEnabledInput);
		this.m_objSwitchesLabel.appendChild(this.m_objSwitch);
		iw.DOMFactory.appendHTML(this.m_objSwitchesLabel,"enable &nbsp;&nbsp;&nbsp;&nbsp; "); 
		this.m_objHeader.appendChild(this.m_objSwitchesLabel);
		this.m_objHeaderText = iw.DOMFactory.newElement("span", {"innerHTML": "<b>InteliWISE CHARACTER 2.2.0 - Debug Console</b> <span style='font-size: 11px'>[<b>dbclick</b> to hide, <b>press</b> and hold to drag]</span>"});
		this.m_objMinimizedInfo = iw.DOMFactory.newElement("span", {"innerHTML": "<b>dbclick</b> to open Debug Console</span>", "style": "display: none"});
		this.m_objHeader.appendChild(this.m_objHeaderText);
		this.m_objHeader.appendChild(this.m_objMinimizedInfo);
		
		
		this.m_objWrapper.appendChild(this.m_objHeader);
		
		this.m_objBottomWrapper = iw.DOMFactory.newElement("div");	
		this.m_objWrapper.appendChild(this.m_objBottomWrapper);
		
		
		var objLogWindow = this._createWindow("LogWindow", "");					
		this.m_objLogOutput = this._createWindow("LogOutput",  ichr.Log.LOG_OUTPUT_STYLE, null, this.m_iHeight - 55);		
		objLogWindow.appendChild(this.m_objLogOutput);
		this.m_objBottomWrapper.appendChild(objLogWindow);
		
		this._activateWindow(objLogWindow.id);
		
		var objIMWindow = this._createWindow("IMWindow", "", null, null, true);		
		this.m_objProfilerOutput = this._createWindow("IMOutput", ichr.Log.PROFILER_OUTPUT_STYLE, null, this.m_iHeight - 26);
		objIMWindow.appendChild(this.m_objProfilerOutput);
		this.m_objBottomWrapper.appendChild(objIMWindow);
		
		var objCSWindow = this._createWindow("CSWindow", "", null, null, true);
		this.m_objControlStatus = this._createWindow("CSOutput", ichr.Log.CM_OUTPUT_STYLE, null/*Comments erased*/ , this.m_iHeight - 100);
		objCSWindow.appendChild(this.m_objControlStatus);
		this.m_objBottomWrapper.appendChild(objCSWindow);
		var strLegend = "<div style='float: left; width: 120px; padding: 0 10px;'><b>Legend:</b>";
		strLegend += "<div style='"+ichr.Log.DETAILS_STYLE+"'> - <span style='color: #666;'>awaiting</span>";
		strLegend += "<br/> - <span style='color: red; font-weight:bold;'>in progress</span>";
		strLegend += "<br/> - <span style='font-weight:bold;'>finished</span>";
		strLegend += "<br/> - <span style='color: #666; text-decoration: line-through; font-weight:bold;'>terminated</span>";
		strLegend += "</div></div>";
		
		iw.DOMFactory.appendHTML(objCSWindow, strLegend);
		
		var strCmdInfo = "<b>Command details:</b><br/><br/>Click on any command label to see its details."
		
		this.m_objCSInfo = iw.DOMFactory.newElement("div", {"style":"float: left; height: 75px; width: "+(this.m_iWidth-150)+"px; overflow-y: auto;"});
		iw.DOMFactory.appendHTML(this.m_objCSInfo, strCmdInfo);
		objCSWindow.appendChild(this.m_objCSInfo);
		
		//this.log(this.m_objEnabledInput.value);
		
		this.m_objPrioritySelect = iw.DOMFactory.newElement("select");
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 0, "innerHTML": "0 - exceptions"}));
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 1, "innerHTML": "1 - very high"}));
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 2, "innerHTML": "2 - high"}));
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 3, "selected" : true, "innerHTML": "3 - medium"}));
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 4, "innerHTML": "4 - low"}));
		this.m_objPrioritySelect.appendChild(iw.DOMFactory.newElement("option", {"value" : 5, "innerHTML": "5 - very low"}));
		this.m_objFilterInput = iw.DOMFactory.newElement("input", {"type" : "text", "style" : "width: 400px"});
		this.m_objFilterButton = iw.DOMFactory.newElement("input", {"type" : "button", "value" : "filter"});
		
		var objLabel = iw.DOMFactory.newElement("label", {"style" : "font-family: Arial, Helvetica, sans-serif !important; padding-left: 5px; font-size: 11px !important;"});
		objLabel.appendChild(iw.DOMFactory.newElement("text", "Priority filter: "));
		objLabel.appendChild(this.m_objPrioritySelect);
		objLogWindow.appendChild(objLabel);
		
		var objLabel = iw.DOMFactory.newElement("label", {"style" : "font-family: Arial, Helvetica, sans-serif !important; padding-left: 30px; font-size: 11px !important;", "innerHTML": "Keyword filter: "});
		objLabel.appendChild(this.m_objFilterInput);
		objLogWindow.appendChild(objLabel);
		objLogWindow.appendChild(this.m_objFilterButton);
		
		
		
		document.body.appendChild(this.m_objWrapper);
		
		iw.DOMEvents.addEventListener(this.m_objSwitch, "change", this._switchWindow);
		
		iw.DOMEvents.addEventListener(this.m_objEnabledInput, "click", this._setLogEnabled);		
		iw.DOMEvents.addEventListener(this.m_objPrioritySelect, "change", this._changePriority);
		iw.DOMEvents.addEventListener(this.m_objFilterButton, "click", this._filter);
		
		iw.DOMEvents.addEventListener(this.m_objHeader, "dblclick", this._toggle);
		iw.DOMEvents.addEventListener(this.m_objHeader, "mousedown", this._startDrag);
		iw.DOMEvents.addEventListener(document, "mouseup", this._stopDrag);
		
		
		ichr.Log.instances[this.m_strInstanceName] = this;
		this.m_bInitialized = true;
		//this.writeMessages(this.m_arrMsgHistory);
		
		
		if(this.m_objEnabledInput){
			this.m_objEnabledInput.checked = true;
			try{		
				this.m_objInstance.setLog("ichr.Log.instances['"+this.m_strInstanceName+"']");
			}
			catch(error){
				alert('Log init error: \n'+error);
			}
		}
		
		this._toggle();
		
	}
	
}

}
catch(err){
	alert(err);
}




//-----------------
//Application init
function IW_get_time(){ var objDate = new Date(); return objDate.getTime()-(objDate.getTimezoneOffset()*60000);}
var objICHR_Millos_TourGuide = new ichr.Character("Millos_TourGuide", "http://client.inteliwise.com/ichr/v_2.2.2/CharacterApplication?sourcePath=http%3A%2F%2Fclient.inteliwise.com%2Fservices%2Fgateway%2Fv_2.0%2F%3FclientId%3DMillos_TourGuide_26%26params%3D%7B%22app_path%22%3A%22http%253A%252F%252Fclient.inteliwise.com%252Fproxy%252FMillos%252FTourGuide%252F%22%2C%22revision%22%3A26%2C%22referer%22%3A%22%22%7D%26initTime%3D"+IW_get_time()+"&amp;assistantId=Millos/TourGuide/index&amp;skinFile=../../proxy/Millos/TourGuide/skins/skin.swf&amp;serviceName=ICAPI_AssistantSwitch.get&amp;revision=Millos/TourGuide/index_v26", null, null);
objICHR_Millos_TourGuide.embed();
var objLog_Millos_TourGuide = null; 
if(document.location.href.indexOf("iw_debug=true") != -1) objLog_Millos_TourGuide = new ichr.Log(objICHR_Millos_TourGuide, "log_Millos_TourGuide");

function IW_discover_page(){

	if(!iw.DOMFactory.getElement('footerAll')){
		iw.DOMEvents.addEventListener(window, "load", IW_adjust_init);
		//alert("load");
	}
	else{
		//alert("loaded");
		IW_adjust_init();
	}


}

function IW_adjust_init(){
	var strStepInfo = $('.stepind .sel').text();
	var bNoHits = $('.nohits').text() ? true : false;
	
	//alert("init: "+strStepInfo);
	var strConfig = "";
	try{
		var objConfig = get_search_config();
		
		if(objConfig){
			objConfig["noHits"] = bNoHits;
			objConfig["stepInfo"] = strStepInfo;
			for(var strParam in objConfig)
				strConfig += '"'+strParam+'": "'+objConfig[strParam]+'", ';
				
			strConfig = '{'+strConfig.substr(0, strConfig.length-2)+'}';
			//alert(strConfig);
			//iw.Core.reportError("search config: "+strConfig, {});
		}
		else{
			strConfig = '{"noHits":'+bNoHits+', "stepInfo":"'+strStepInfo+'"}';
		}
	}
	catch(err){
		strConfig = '{"noHits":'+bNoHits+', "stepInfo":"'+strStepInfo+'"}';
		//iw.Core.reportError("search config error", err);
	}
	//alert(strConfig);
	objICHR_Millos_TourGuide.getInstance().initAdjust(strConfig);
}

function IW_initDateField(p_strFormId, p_strInputName, p_strFormat, p_strInitValue){
	try{
		
		var objForm = iw.DOMFactory.getElement(p_strFormId);		
		var objInput = $(iw.DOMFactory.getFormField(objForm, p_strInputName));
		eval('var objFormat = '+p_strFormat);
		objFormat.onSelect = function(){
			objICHR_Millos_TourGuide.getInstance().storeTimestamp(p_strFormId+":"+p_strInputName+":"+IW_getTimestamp(p_strFormId, p_strInputName));
		}
		objInput.addClass('datepickers');
		try{
			var objConfig = qs.datePickerConfig();
			objFormat.dayNamesMin = objConfig.dayNamesMin;
			objFormat.maxDate = objConfig.maxDate;
			objFormat.minDate = objConfig.minDate;
			objFormat.monthNames = objConfig.monthNames;
		}
		catch(err){
		}
		objInput.datepicker(objFormat);
		//alert(p_strInitValue);
		objInput.datepicker('setDate', isNaN(p_strInitValue) ? p_strInitValue : new Date(p_strInitValue));
		$('#ui-datepicker-div').css('z-index', '20000');
		
		//auto store generated date
		objICHR_Millos_TourGuide.getInstance().storeTimestamp(p_strFormId+":"+p_strInputName+":"+IW_getTimestamp(p_strFormId, p_strInputName));
	}catch(err){iw.Core.reportError("Field init error", err)}
}


function IW_getTimestamp(p_strFormId, p_strInputName) {
	var objForm = iw.DOMFactory.getElement(p_strFormId);
	var objInput = $(iw.DOMFactory.getFormField(objForm, p_strInputName));
	if(objInput.get(0)){
		var termin = objInput.get(0).value;
		var years = termin.substr(0,4);
		var months = termin.substr(5,2);
		var days = termin.substr(8,2);
		timestamp = Math.round(((new Date()).setFullYear(years,months-1,days))/1000);
		return timestamp;
	}
	return "";
}


function IW_openTab(p_strId){
	try{
		open_tab(p_strId);
	}
	catch(err){
	}
}

function IW_openFlightDetails(){
	try{
		open_flight_details();
	}
	catch(err){
	}
}
