// Copyright (c) Microsoft Corporation. All rights reserved. 
 JT = {};; JT.Class = function(arg) { var ret = function(initArgs) { if(!initArgs || !initArgs.$noCallctor) { ret.$superClass && ret.$superClass.call(this, initArgs); ret.$ctor && ret.$ctor.call(this, initArgs); } };; if(arg.superClass) { ret.$superClass = arg.superClass; ret.prototype = new arg.superClass({$noCallctor: true}); } else { ret.$superClass = null; } ;ret.$ctor = (arg.ctor ? arg.ctor : null); ret.$dector = (arg.dector ? arg.dector : null); ret.prototype.Dispose = function() { try { ret.$dector && ret.$dector.call(this); ret.$superClass && ret.$superClass.prototype.Dispose.call(this); } catch(e) { ; } };; var retp = ret.prototype; var argp = arg.prototype; for(var item in argp) { retp[item] = argp[item]; } ;for(var item in arg.static_member) { ret[item] = arg.static_member[item]; } ;return ret; } ;JT.UIComponent = JT.Class( { ctor: function(args) { if(args) { if(args.id) { ; } ;this.id = args.id; this._notifyHandler = args.notifyHandler; } ;if(!this.id) { this.id = "jt-" + JT.UIComponent._id++; } ;this.ref = null; }, dector: function() { this.ref = this.ref.obj = null; }, prototype:{ GetHeight: function() { return this.ref.offsetHeight; }, GetWidth: function() { return this.ref.offsetWidth; }, GetHTML: function() { }, Initialize: function() { this.ref = document.getElementById(this.id); this.ref.obj = this; }, Resize: function(width, height) { this.ResizeWidth(width); this.ResizeHeight(height); }, ResizeHeight: function(height) { this.ref.style.height = height + "px"; return this.ref.offsetHeight; }, ResizeWidth: function(width) { this.ref.style.width = width + "px"; return this.ref.offsetWidth; }, SetHint: function(hintText) { this.ref.title = hintText; } }}); JT.UIComponent._id = 0; JT.BaseRowContainer = JT.Class( { superClass: JT.UIComponent, ctor: function(args) { if(args && args.components) { this._components = args.components; this._resizeableIndex = args.components.length - 1; } }, prototype:{ GetHTML: function() { var text = "<table id='" + this.id + "' cellspacing='0' cellpadding='0' width='100%'><tbody><tr>"; for(var i = 0; i < this._components.length; ++i) { if(typeof this._components[i] == "number") { text += "<td width='1'><div style='overflow:hidden; width:" + this._components[i] + "px'>&nbsp;</div></td>"; } else { if(this._resizeableIndex != null) { if(i == this._resizeableIndex) { text += "<td>" + this._components[i].GetHTML() + "</td>"; } else { text += "<td width='1'>" + this._components[i].GetHTML() + "</td>"; } } else { text += "<td width='1000000000'>" + this._components[i].GetHTML() + "</td>"; } } } ;return text + "</tr></tbody></table>"; }, Initialize: function() { JT.UIComponent.prototype.Initialize.call(this); for(var i = 0; i < this._components.length; ++i) { if(typeof this._components[i] == "object") { this._components[i].Initialize(); } } } }}); JT.Button = JT.Class( { superClass: JT.UIComponent, ctor: function(args) { if(args) { this._text = args.content ? args.content : ""; } else { this._text = ""; } }, prototype:{ GetHTML: function() { return "<div id='" + this.id + "'>" + this._text + "</div>"; }, Initialize: function() { JT.UIComponent.prototype.Initialize.call(this); if(this._notifyHandler) { this.ref.onmouseover = Delegate(this, this._OnMouseOver); this.ref.onmouseout = Delegate(this, this._OnMouseOut); this.ref.onclick = Delegate(this, this._OnClick); } }, _OnClick: function(e) { if(!e) { e = window.event; } ;this._notifyHandler("click", this, {e: e}); }, _OnMouseOut: function() { this._notifyHandler("mouseout", this); }, _OnMouseOver: function() { this._notifyHandler("mouseover", this); } }}); JT.InlineEdit = JT.Class( { superClass: JT.UIComponent, ctor: function() { }, prototype:{ GetHTML: function() { return "<input id='" + this.id + "' type='text' style='width:100%' />"; }, GetText: function() { return this.ref.value; }, SelectAll: function() { this.ref.select(); }, SetCss: function(cssName) { this.ref.className = cssName; }, SetFocus: function() { this.ref.focus(); }, SetText: function(text) { this.ref.value = text; }, Initialize: function() { JT.UIComponent.prototype.Initialize.call(this); if(this._notifyHandler) { this.ref.onclick = Delegate(this, this._OnClick); this.ref.onfocus = Delegate(this, this._OnFoucs); this.ref.onblur = Delegate(this, this._OnBlur); this.ref.onkeydown = Delegate(this, this._OnKeyDown); if(document.all) { this.ref.onpropertychange = Delegate(this, this._OnChange); } else if(this.ref.addEventListener) { this.ref.addEventListener("input", Delegate(this, this._OnChange), false); } } }, _OnChange: function(e) { if(!e) { e = window.event; } ;if(document.all) { if(e.propertyName == "value") { this._notifyHandler(this, "onChange"); } } else { this._notifyHandler(this, "onChange"); } }, _OnInput: function(e) { alert("s"); this._notifyHandler(this, "onChange"); }, _OnClick: function(e) { if(!e) { e = window.event; } ;this._notifyHandler(this, "onClick", {e: e}); }, _OnFoucs: function() { this._notifyHandler(this, "onFocus"); }, _OnBlur: function() { this._notifyHandler(this, "onBlur"); }, _OnKeyDown: function(event) { if(!event) { event = window.event; } ;this._notifyHandler(this, "onKeyDown", {keyCode: event.keyCode}); } }}); function Clone( other ) { ; var it; for( it in this ) { if (typeof this[it] == "function") continue; delete this[it]; } ;for( it in other ) { if (typeof other[it] == "function") continue; this[it] = other[it]; } } ;function Update( other ) { ; var updateRecord = null; for( var it in other ) { if( other[it] != null && typeof other[it] != "function" && this[it] != other[it] ) { this[it] = other[it]; if( !updateRecord ) updateRecord = new Object(); updateRecord[it] = other[it]; } } ;return updateRecord; } ;function UpdateProperty ( name, value ) { ; ; var updateRecord = null; if( this[name] != value ) { this[name] = value; updateRecord = new Object(); updateRecord[name] = value; } ;return updateRecord; } ;function RemoveProperty ( name ) { ; return delete this[name]; } ;function Addon( other ) { ; for( var it in other ) { if( typeof other[it] != "function" ) { this[it] = other[it]; } } } ;function CWA__ToString( ) { var _CRLF = "\n"; var info = ""; for ( var it in this ) { if (typeof this[it] == "function") continue; info += "[" + it + ":]" + ((this[it] != null && this[it].toString != null) ? this[it].toString() : this[it]) + _CRLF; } ;return info; } ;function Map() { this._map = new Object(); this._count = 0; } ;Map.prototype.Add = function(key, value) { if( ! this._map[key] ) { this._count ++; this._map[key] = value; return true; } else { return false; } } ;Map.prototype.Update = function(key, value) { ; if( this._map[key] ) { this._map[key] = value; return true; } else { return false; } } ;Map.prototype.Remove = function(key) { if( this._map[key] && (delete this._map[key] == true) ) { this._count --; return true; } else { return false; } } ;Map.prototype.Get = function( key ) { return this._map[key]; } ;Map.prototype.GetMap = function() { return this._map; } ;Map.prototype.GetCount = function() { return this._count; } ;Map.prototype.ClearAll = function() { delete this._map; this._map = new Object(); this._count = 0; } ;function NoCaseKeyMap() { this._map = new Object(); this._count = 0; } ;NoCaseKeyMap.prototype = new Map(); NoCaseKeyMap.prototype.Add = function(key, value) { return typeof key == "string" && Map.prototype.Add.call(this, key.toLowerCase(), value) || null; } ;NoCaseKeyMap.prototype.Update = function(key, value) { return typeof key == "string" && Map.prototype.Update.call(this, key.toLowerCase(), value) || null; } ;NoCaseKeyMap.prototype.Remove = function(key) { return typeof key == "string" && Map.prototype.Remove.call(this, key.toLowerCase()) || null; } ;NoCaseKeyMap.prototype.Get = function( key ) { return typeof key == "string" && Map.prototype.Get.call(this, key.toLowerCase()) || null; } ;function ChangeMethodExeContext(classObj, funcName) { eval("var method = classObj.prototype." + funcName); if (method == null) return; var tmpFuncName = "_" + funcName; eval("classObj.prototype." + tmpFuncName + "= method"); var funcString = "classObj.prototype." + funcName + "= function()"; funcString += "{"; funcString += "var args = new Array();"; funcString += "args[0] = this;"; funcString += "args[1] = this." + tmpFuncName + ";"; funcString += "for( var i = 0; i < arguments.length; i++){"; funcString += "args[i + 2] = arguments[i];"; funcString += "}"; funcString += "var timerHandler = Delegate.apply(null, args);"; funcString += "window.setTimeout(timerHandler, 0);"; funcString += "}"; eval(funcString); } ;function Delegate2(contextObj, funcObj, isWindowContextChanged) { if (isWindowContextChanged == true) { var _delegate = function() { var args = new Array(); args[0] = contextObj; args[1] = funcObj; for( var i = 0; i < arguments.length; i++) { args[i + 2] = arguments[i]; } ;var timerHandler = TimerHandler.apply(null, args); window.setTimeout(timerHandler, 0); };; return _delegate; } else { return Delegate(contextObj, funcObj); } } ;function TimerHandler(contextObj, funcObj) { var _arguments = null; if( arguments.length > 2) { _arguments = new Array(); for( var i = 2; i < arguments.length; i ++ ) { _arguments[i - 2] = arguments[i]; } } ;var _delegate = function() { if( _arguments ) { funcObj.apply( contextObj, _arguments ); } else { funcObj.apply( contextObj ); } };; return _delegate; } ;function Delegate(contextObj, funcObj) { var _arguments = null; if( arguments.length > 2) { _arguments = new Array(); for( var i = 2; i < arguments.length; i ++ ) { _arguments[i - 2] = arguments[i]; } } ;var _delegate = function() { if( _arguments ) { if( arguments.length > 0 ) { var args = new Array(); args.push.apply( args, arguments ); args.push.apply( args, _arguments ); } else { var args = _arguments; } } else { var args = arguments; } ;return funcObj.apply( contextObj, args ); };; return _delegate; } ;function Event(name) { this.args = new Object(); this._delegates = new Array(); this.name = name; } ;Event.prototype.Add = function( delegate, key, token ) { delegate.key = key; delegate.token = token; var count = this._delegates.length; if (key) { for( var i = 0; i < count; i++ ) { var localKey = this._delegates[i].key; if(localKey && localKey == key ) { this._delegates[i] = delegate; break; } } ;if( i == count ) { this._delegates[ count ] = delegate; } } else { this._delegates[ count ] = delegate; } } ;Event.prototype.Remove = function( key ) { if (key == null) { this._delegates = new Array(); } else { for( var i = 0; i < this._delegates.length; i++ ) { try { var localKey = this._delegates[i].key; if(localKey && localKey == key ) { this._delegates.splice( i, 1 ); return true; } } catch (ex) { this._delegates.splice( i, 1 ); ; } } } ;return false; } ;Event.prototype.ClearAll = function() { for(var i = 0; i < this._delegates.length; i ++) { this._delegates[i] = null; } ;this._delegates = new Array(); } ;Event.prototype.IsHooked = function() { return this._delegates.length > 0; } ;Event.prototype.Fire = function(sender, eventArgs) { var len = this._delegates.length; for(var i = 0; i < len; ++i){ try{ this._delegates[i](sender, eventArgs, this._delegates[i].token); } catch(e){ ; } } } ;Event.prototype.Dispose = function() { try { if (this.args != null) { for (var key in this.args) { this.args[key] = null; } ;this.args = null; } ;if (this._delegates != null) { for(var i = 0; i < this._delegates.length; i ++) { this._delegates[i] = null; } ;this._delegates = null; } } catch (ex) { } } ;function ErrorType() { } ;ErrorType.SessionError = "Session Error"; ErrorType.CrossDomainError = "Cross-Domain Error"; ErrorType.XMLHttpRequestError = "XMLHttpRequest Error"; ErrorType.ConnectionError = "Connection Error"; ErrorType.ServerError = "Server Error"; ErrorType.TimeoutError = "Timeout"; ErrorType.AuthError = "Auth Error"; ErrorType.DataError = "Data Error"; ErrorType.DomError = "Dom Error"; ErrorType.ScriptError = "Script Error"; ErrorType.Unexpected = "Unexpected Error"; ErrorType.InternetError = "Internet Error"; ErrorType.GeneralError = "General Error"; ErrorType.ArgumentError = "Invalid Argument"; ErrorType.PolicyError = "Policy Error"; ErrorType.DebugInfo = "Debug Info"; function Error(errorCode, type, description, displayCode, detailsInfo, failedCommand) { this.errorCode = errorCode; this.displayCode = displayCode ? displayCode : "2-3-" + errorCode; this.type = type; this.description = (description != null)? description.replace( /%p/g, L_Product_ShortName ) : ""; this.detailsInfo = detailsInfo ? detailsInfo : ""; this.failedCommand = failedCommand; } ;Error.prototype.toString = function() { var _CRLF = "\n"; var str = ""; for (var it in this) { if (it != "toString") { str += "[" + it + "] " + this[it] + _CRLF; } } ;return str; } ;function APIError(errorCode){ var error; if((typeof Error) == "function") { error = new Error(); } else { error = new Object(); } ;error.errorCode = errorCode; error.type = "SDK API Runtime Error"; switch(error.errorCode){ default: error.description = "unknown error."; break; case 5001: error.description = "the argument is error."; break; case 5002: error.description = "the url is invalid."; break; case 5004: error.description = "you must initialize this control first."; break; } ;return error; } ;function IdentifyError(errorCode) { var type = null; var description = null; var code = errorCode; var detailsInfo = ""; switch (code) { case 377: type = ErrorType.ConnectionError; description = L_ErrorPane_Connection_Text; code = "1-1-" + code; break; case 440: case 482: case 484: case 488: type = ErrorType.AuthError; description = L_Sign_Off_Text; code = "0-1-" + code; break; case 492: type = ErrorType.AuthError; description = L_Error_ClockIncorrect_Text; code = "0-1-" + code; break; case 888: type = ErrorType.DebugInfo; code = "3-0-" + code; description = "verbose debug info"; break; case 999: type = ErrorType.TimeoutError; description = L_Sign_Off_Text; code = "1-1-" + code; break; case 2001: type = ErrorType.XMLHttpRequestError; description = L_Error_XMLHTTPRequest_ChangeState_Text; code = "2-0-" + code; break; case 2005: type = ErrorType.XMLHttpRequestError; description = L_Error_XMLHTTPRequest_SendRequest_Text; code = "2-0-" + code; break; case 2101: type = ErrorType.CrossDomainError; description = "Application website's protocol is different from CWA website."; code = "2-2-" + code; break; case 2102: type = ErrorType.CrossDomainError; description = "In the script including statement, please use CWA server's full FQDN instead of Netbiosname ."; code = "2-2-" + code; break; case 2103: type = ErrorType.CrossDomainError; description = "Please use application server's full FQDN to access this website instead of using Netbiosname."; code = "2-2-" + code; break; case 2110: type = ErrorType.CrossDomainError; description = "Invalid parent domain."; code = "2-2-" + code; break; case 2120: type = ErrorType.CrossDomainError; description = "Time out for creating bridge iframes to generate the cross-domain script environment."; code = "2-2-" + code; break; case 2301: type = ErrorType.DataError; description = L_ErrorPane_Connection_Text; code = "2-1-" + code; break; case 2310: type = ErrorType.DataError; description = L_ErrorPane_Connection_Text; code = "2-1-" + code; break; case 2320: type = ErrorType.GeneralError; description = L_Error_Too_Many_Contacts; code = "2-3-" + code; break; case 2420: type = ErrorType.PolicyError; description = L_PolicyError_CannotSignInAsAppearOffline; code = "2-3-" + code; break; case 2501: type = ErrorType.SessionError; description = L_BE_DetailError7; code = "0-0-" + code; break; default: if (errorCode >= 300 && errorCode < 500) { type = ErrorType.ConnectionError; description = L_ErrorPane_Connection_Text; code = "1-0-" + code; } else if (errorCode >= 500 && errorCode < 600) { type = ErrorType.ServerError; description = L_ErrorPane_Server_Text; code = "1-0-" + code; } else if (errorCode >= 12000 && errorCode < 13000) { type = ErrorType.InternetError; description = L_ErrorPane_Connection_Text; code = "1-0-" + code; } else { type = ErrorType.Unexpected; description = L_ErrorPane_Connection_Text; code = "2-3-" + code; } ;break; } ;var error = new Error(errorCode, type, description, code, detailsInfo); return error; } ;function IdentifyBEError(dataItem) { var code = dataItem.getAttribute("code"); var subCode = dataItem.getAttribute("subCode"); var detail = dataItem.getAttribute("detail"); var detailsInfo = XMLGetXMLString(dataItem); var sipCode = null; var nodes = dataItem.getElementsByTagName("sipResponse"); if (nodes && nodes.length > 0) { var node = nodes[0]; sipCode = node.getAttribute("code"); } ;if (code == null) code = 0; if (subCode == null) subCode = 0; if (sipCode == null) sipCode = 0; var displayCode = "0-0-" + code + "-" + subCode + "-" + sipCode; var errorCode = null; var description = null; var mode = GetCWAMode(); if (code == 18100) { switch(subCode) { case "1": errorCode = 2408; switch (mode) { case CWAMODE.ANONYMOUS: description = L_Error_Anon_CannotFindConversation; break; case CWAMODE.FULL: case CWAMODE.AUTHENTICATED: default: description = L_BE_DetailError7; break; } ;break; case "2": errorCode = 2401; switch (mode) { case CWAMODE.ANONYMOUS: description = L_Error_Anon_CannotFindConversation; break; case CWAMODE.FULL: case CWAMODE.AUTHENTICATED: default: if (sipCode == "403") description = L_BE_DetailError_CVCBlock; else description = L_BE_DetailError1; break; } ;break; case "3": errorCode = 2402; description = L_BE_DetailError2; break; case "4": errorCode = 2403; description = L_BE_DetailError3; break; case "5": errorCode = 2404; description = L_BE_DetailError4; break; case "6": errorCode = 2405; description = L_BE_DetailError5; break; case "7": errorCode = 2406; description = L_BE_DetailError6; break; case "0": errorCode = 2407; description = L_BE_DetailError7; break; case "8": errorCode = 2409; description = L_BE_DetailError7; break; case "9": if (detail) { if (detail.toLowerCase().indexOf("usermoved") >= 0) { errorCode = 2411; } else if (detail.toLowerCase().indexOf("toomanyactiveendpoint") >= 0) { errorCode = 2412; } else if (detail.toLowerCase().indexOf("userchanged") >= 0) { errorCode = 2413; } else { errorCode = 2414; } } else { errorCode = 2414; } ;description = L_BE_DetailError2; break; default: errorCode = 2410; description = L_BE_DetailError7; break; } } else if (code == 18205) { switch(subCode) { case "14": errorCode = 2421; description = L_Error_Anon_CannotFindConversation; break; default: errorCode = 2410; description = L_BE_DetailError7; break; } } else if (code == 18103) { switch(subCode) { case "15": switch (mode) { case CWAMODE.AUTHENTICATED: errorCode = 2422; description = L_Error_CannotSignInPreWave13HomedUser_ConfJoinSignIn.replace(/%0/g, L_Sign_Off_Sign_In_Button); break; case CWAMODE.FULL: default: errorCode = 2423; description = L_Error_CannotSignInPreWave13HomedUser_RegularSignIn; break; } ;break; default: errorCode = 2410; description = L_BE_DetailError7; break; } } else if(code == 18508) { if (mode == CWAMODE.ANONYMOUS) { errorCode = 2425; description = L_Error_Timeout_WaitingAuthenticatedUser; } } else { errorCode = 2410; description = L_BE_DetailError7; } ;var error = new Error(errorCode, ErrorType.SessionError, description, displayCode, detailsInfo); return error; } ;function DomError(domType, description) { this["name"] = ErrorName.DomError; this["message"] = domType; this["description"] = description || domType; } ;function NormalizeScriptError( error ) { return error; } ;function CWA__Exception(name, message, innerException, filename, lineNumber) { this.name = name; this.message = message; this.description = this.message; this.innerException = innerException; this.filename = filename; this.lineNumber = lineNumber; this.toString = function() { var info = this.name + " happens at " + this.filename + "(line " + this.lineNumber + ")" + " Description:" + this.description; var ex = this.innerException; while( ex ) { info = info + "\r\n  " + innerException.toString(); ex = innerException.innerException; } ;return info; } } ;function DebugType() {} ;DebugType.Assert = "Assert"; DebugType.Trace = "Trace"; DebugType.Exception = "Exception"; function TraceType() {} ;TraceType.Default = "General Trace"; TraceType.Ha = "High Ability"; TraceType.Server = "Server Communication"; TraceType.Warnning = "Warnning"; TraceType.Function = "FuncAutoTrace"; TraceType.ChatLogic = "Logic::Chat"; TraceType.OptionManager = "Logic::Option Data Maintain"; TraceType.PrivacyManager = "Logic::Privacy Data Maintain"; TraceType.SubscriberManager = "Logic::Subscribers Maintain"; TraceType.Search = {};; TraceType.Search.RequestBuilder = "Logic::Search::Request Builder"; TraceType.Search.CriteriaManager = "Logic::Search::Criteria Manager"; TraceType.Search.Processor = "Logic::Search::Processor"; TraceType.Search.ResultMaintainer = "Logic::Search::Result Maintainer"; TraceType.Search.Manager = "Logic::Search::Manager"; TraceType.ModalDlgManager = "Logic::Modal Dialog Manager"; TraceType.ModelessDlgManager = "Logic::Modeless Dialog Manager"; TraceType.Container = "Data::Container"; TraceType.RichPresence = "Data::RichPresence"; TraceType.SearchPanel = "UI::CL::SearchPanel"; TraceType.OptionsDialog = "UI::Dialog::Options"; TraceType.NotificationDlg = "UI::Dialog::Notification"; TraceType.DgExpansion = "Data:DgExpansion"; TraceType.Conversation = {};; TraceType.Conversation.Logic = "Logic:Conversation"; TraceType.Conversation.UIConductor = "UI:Conversation UI Conductor"; TraceType.Customization = "Customization Trace"; var Debug = null; function GetDebug() { var winObj = window; while (winObj) { if (winObj.Debugger) { break; } ;winObj = winObj.top.opener; } ;if ((winObj != null) && (winObj.Debugger != null)) { Debug = winObj.Debugger; } } ;function GetCallStack(func) { var res = new Array(); var tmp = new Array(); while (func) { for (var i = 0; i < tmp.length; ++i) { if (func == tmp[i]) { break; } } ;tmp.push(func); res.push(func.FuncName + "(" + GetFuncArguments(func) + ")"); func = func.caller; } ;return res; } ;function GetFuncArguments(func) { var str = ""; if (func == null) { return str; } ;for (var i = 0; i < func.arguments.length; ++i) { str += func.arguments[i] + ", " ; } ;if (str.length > 0) { str = str.substring(0, str.lastIndexOf(",")); } ;return str; } ;function CallStackToString(callStack) { var str = ""; if (callStack != null && callStack.length > 0) { for (var i = 0; i < callStack.length; ++i) { str += callStack[i] + "<br>"; } } ;return str; } ;function Assert(condition, message, fileName, lineNumber){ try{ if(condition){ return; } ;if(!Debug){ GetDebug(); } ;Debug.Output(fileName, lineNumber, DebugType.Assert, "", message, Assert.caller); } catch(ex){ ex.toString = CWA__ToString; } } ;function TRC_ERR (msg, className, level) { if (level == "Error" || level == "Warning" || level == "Debug") { ; } } ;function Trace(type, message, fileName, lineNumber) { try { if (!Debug) { GetDebug(); } ;if (type == TraceType.Function) { var str; if (message.indexOf("Enter") != -1) { var f = Trace.caller; str = f.FuncName + "(" + GetFuncArguments(f) + ")"; } else { str = ""; } ;Debug.Output(fileName, lineNumber, DebugType.Trace, type, message, str); } else { Debug.Output(fileName, lineNumber, DebugType.Trace, type, message, ""); } } catch (ex) { ex.toString = CWA__ToString; } } ;function ShowException(exception, fileName, lineNumber) { try { exception.toString = CWA__ToString; if (!Debug) { GetDebug(); } ;Debug.Output(fileName, lineNumber, DebugType.Exception, "", exception.toString(), ""); } catch (ex) { ex.toString = CWA__ToString; } } ;function ErrorDispatcher() { } ;ErrorDispatcher.ErrorEvent = new Event(); function DispatchError(error) { try { if (!error) return; ; if (window.WebCtrlGlobal) { var runTimeEvent = PublicNameSpace.GetRunTimeErrorEvent(); runTimeEvent.Fire(this, error); } ;ErrorDispatcher.ErrorEvent.Fire(this, error); } catch(e) { ; } } ;function Timer(name) { this.name = name; } ;Timer.prototype.Initialize = function() { this.startTime = null; this.exceptTimes = 0; this._timer = null; this._timeOutInterval = 0; this.TimeOutEvent = new Event(); } ;Timer.prototype.SetTimeOutInterval = function(timeOutInterval) { this._timeOutInterval = timeOutInterval; } ;Timer.prototype.Stop = function() { if(this._timer != null) { clearTimeout(this._timer); } ;this._timer = null; } ;Timer.prototype.Start = function() { this.Stop(); var date = new Date(); this.startTime = date.getTime(); this._timer = setTimeout(Delegate(this, this._TimeOut), this._timeOutInterval); } ;Timer.prototype._TimeOut = function() { if (this._timer != null) { var date = new Date(); var expectedinterVal = (8 * this._timeOutInterval)/10; if ((date.getTime() - this.startTime) >= expectedinterVal) { this.exceptTimes = 0; this._timer = null; this.TimeOutEvent.Fire(this); } else { this.exceptTimes++; if (this.exceptTimes > 3000) { this.exceptTimes = 0; this._timer = null; this.TimeOutEvent.Fire(this); } else { this.Start(); } } } } ;Timer.prototype.Dispose = function() { this.Stop(); } ;function HashTable() { this.dictionary = new Object(); this.count = 0; this.Add = function(key, value) { if ((key == null) || (value == null)) return false; if (this.dictionary[key] == null) { this.dictionary[key] = value; this.count ++; return true; } else { return false; } } ;this.Remove = function(key) { if (key == null) return; if ((this.dictionary[key] != null) && (delete this.dictionary[key] == true)) { this.count --; } } ;this.Clear = function() { var key = null; for (key in this.dictionary) { delete this.dictionary[key]; } ;this.count = 0; } ;this.GetValue = function(key) { if (key != null) return this.dictionary[key]; else return null; } ;this.GetCount = function() { return this.count; } ;this.GetDic = function() { return this.dictionary; } } ;function Collection() { this._array = new Array(); this.GetCount = function( ) { return this._array.length; } ;this.GetValueByIndex = function(index) { return this._array[index]; } ;this.GetValueByKey = function(key, keyName) { if (key == null) return; for( var i = 0; i < this._array.length; i++) { var object = this._array[i]; if(object != null && object[keyName] != null) { if (key.toLowerCase && object[keyName].toLowerCase) { if (object[keyName].toLowerCase() == key.toLowerCase()) { return object; } } else { if (object[keyName] == key) { return object; } } } } ;return null; } ;this.GetArray = function() { return this._array; } ;this.GetArrayByKey = function(key, keyName) { if (key == null) return; var resultArray = new Array(); for( var i = 0; i < this._array.length; i++) { var object = this._array[i]; if(object != null && object[keyName] != null) { if (key.toLowerCase && object[keyName].toLowerCase) { if (object[keyName].toLowerCase() == key.toLowerCase()) { resultArray.push(object); } } else { if (object[keyName] == key) { resultArray.push(object); } } } } ;return resultArray; } ;this.AddUnique = function ( object, keyName ) { if( this.GetValueByKey(object[keyName]) == null ) { return this.Add( object ); } } ;this.Add = function( object ) { this._array[this._array.length ] = object; } ;this.Insert = function(object, index) { if (object == null) { return; } ;if (!index) { index = 0; } else { index = parseInt(index); } ;if (index >= this._array.length) { return this.Add(object); } ;var oldArray = this._array; this._array = new Array(); var i = 0; for (; i < index; ++i) { this._array[i] = oldArray[i]; } ;this._array[i] = object; for (; i < oldArray.length; ++i) { this._array[i + 1] = oldArray[i]; } } ;this.RemoveByKey = function( key, keyName ) { this.Remove( this.GetValueByKey( key, keyName ) ); } ;this.Remove = function( object ) { if( object == null ) { return; } ;var oldArray = this._array; this._array = new Array(); var index = 0; for( var i = 0; i < oldArray.length; i++) { if( oldArray[i] != object ) { this._array[index] = oldArray[i]; index ++; } } } ;this.ClearAll = function() { this._array = new Array(); } ;this.Sort = function() { var temp = null; for( var i = 0; i < this._array.length; i++) { var object = this._array[i]; for (var j = i; j < this._array.length; ++j) { var object2 = this._array[j]; if (object.Compare(object2) > 0) { temp = object2.Clone(null); object.Clone(object2); temp.Clone(object); } } } } ;this.Update = function(object, newObj) { if( object == null ) { return; } ;for( var i = 0; i < this._array.length; i++) { if( this._array[i] == object ) { this._array[i] = newObj; } } } } ;function Connection() { this._httpRequest = this._CreateXMLHttpRequestObject(); this.IsUsed = false; } ;Connection.DefaultUserActive = false; Connection.UserActive = Connection.DefaultUserActive; Connection.postMethod = "POST"; Connection.getMethod = "GET"; Connection.timeoutValue = 10 * 60 * 1000; Connection.ReSendPolicy = new Object(); Connection.ReSendPolicy.ResendInPriority = function() { this.maxResendTimes = 5; this.defaultTimeInterval = 4000; this.Reset(); } ;Connection.ReSendPolicy.ResendInPriority.prototype.Judge = function(error) { if (!error) { this.Reset(); } else { this.error = error; this.timeInterval = this.defaultTimeInterval + Math.round((Math.random() * 2 * this.defaultTimeInterval * (this.resendTimes + 1))); if (this.resendTimes < this.maxResendTimes) { if (this.error.errorCode == 503 || this.error.type == ErrorType.ConnectionError || this.error.type == ErrorType.InternetError) { this.resendTimes++; this.isResend = true; } else { this.Reset(); this.isResend = false; } } else { this.Reset(); this.isResend = false; } } } ;Connection.ReSendPolicy.ResendInPriority.prototype.Reset = function() { this.resendTimes = 0; this.error = null; this.isResend = false; this.timeInterval = 0; } ;Connection.ReSendPolicy.ResendInKeep = function() { this.maxResendTimes = 2; this.defaultTimeInterval = 4000; this.Reset(); } ;Connection.ReSendPolicy.ResendInKeep.prototype.Judge = function(error) { if (!error) { this.Reset(); } else { this.error = error; this.timeInterval = this.defaultTimeInterval + Math.round((Math.random() * 2 * this.defaultTimeInterval * (this.resendTimes + 1))); if (this.resendTimes < this.maxResendTimes) { if (this.error.errorCode == 503 || this.error.type == ErrorType.ConnectionError || this.error.type == ErrorType.InternetError) { this.resendTimes++; this.isResend = true; } else { this.Reset(); this.isResend = false; } } else { this.Reset(); this.isResend = false; } } } ;Connection.ReSendPolicy.ResendInKeep.prototype.Reset = function() { this.resendTimes = 0; this.error = null; this.isResend = false; this.timeInterval = 0; } ;Connection.ReSendPolicy.NotResend = function() { this.isResend = false; } ;Connection.ReSendPolicy.NotResend.prototype.Judge = function(error) { } ;Connection.ReSendPolicy.NotResend.prototype.Reset = function() { } ;Connection.prototype.Initialize = function(requestOwner, resendPolicy, timeOutValue) { try { ; this._requestOwner = requestOwner; ; ; ; this._timer = new Timer(); this._timer.Initialize(); this._timer.TimeOutEvent.Add(Delegate(this, this._TimeOutHandler)); if (timeOutValue) { this._timer.SetTimeOutInterval(timeOutValue); } else { this._timer.SetTimeOutInterval(Connection.timeoutValue); } ;this._isFree = true; if (!resendPolicy) { this._ResendPolicy = new Connection.ReSendPolicy.NotResend(); } else { this._ResendPolicy = resendPolicy; } ;this._requestHeaders = new Map(); this._lastReadyStatus = 0; } catch(e) { ; } } ;Connection.prototype.Dispose = function() { try { this._Reset(); this._httpRequest.onreadystatechange = function(){};; this.IsUsed = false; this._timer.Dispose(); } catch(e) { ; } } ;Connection.prototype.GetAllResponseHeaders = function() { if (this._httpRequest) { return this._httpRequest.getAllResponseHeaders(); } else { return null; } } ;Connection.prototype.GetResponseHeader = function(headerName) { ; try { if (this._httpRequest != null && this._httpRequest.getResponseHeader(headerName)) { return this._httpRequest.getResponseHeader(headerName); } else { return null; } } catch(e) { return null; } } ;Connection.prototype.GetResponseText = function() { if (this._httpRequest != null) { return this._httpRequest.responseText; } else { return null; } } ;Connection.prototype.GetResponseXML = function() { if (this._httpRequest != null) { var text = RemoveC0Chars(this._httpRequest.responseText); var xml = null; if (window.DOMParser) { xml = new DOMParser().parseFromString(text, "application/xml"); } else { xml = this._httpRequest.responseXML; if (xml.childNodes.length == 0 && window.ActiveXObject) { try { xml = new ActiveXObject("Microsoft.XMLDOM"); xml.loadXML(text); } catch(e) { ; } } } ;if(UserAgentInfo.GetInstance().IsSafari()) { xml = new XMLNode(xml); } ;return xml; } else { return null; } } ;Connection.prototype.Post = function( url, data, isAsync ) { ; ; this._isFree = false; window.setTimeout(TimerHandler(this, this._SendHttpRequest, Connection.postMethod, url, data, isAsync), 0); } ;Connection.prototype.Get = function( url, isAsync, isNotHandleCallBack ) { ; this._isFree = false; window.setTimeout(TimerHandler(this, this._SendHttpRequest, Connection.getMethod, url, null, isAsync, isNotHandleCallBack), 0); } ;Connection.prototype.Abort = function() { this._Reset(); } ;Connection.prototype.IsFree = function() { return this._isFree; } ;Connection.prototype.SetResendPolicy = function(resendPolicy) { if (!resendPolicy) { this._ResendPolicy = new Connection.ReSendPolicy.NotResend(); } else { this._ResendPolicy = resendPolicy; } } ;Connection.prototype.SetRequestHeader = function(headerName, value) { if (!this._requestHeaders.Get(headerName)) { return this._requestHeaders.Add(headerName, value); } else { return this._requestHeaders.Update(headerName, value); } } ;Connection.prototype.RemoveHttpRequestHeader = function(headerName) { return this._requestHeaders.Remove(headerName); } ;Connection.prototype._SendHttpRequest = function(type, url, data, isAsync, isNotHandleCallBack) { try { this._httpRequest.open(type, url, isAsync); if (isNotHandleCallBack != true) { this._httpRequest.onreadystatechange = Delegate(this, this._ReadyStateChanged); } ;if (type == Connection.postMethod) { this._httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } ;var isActive = this._requestOwner._isUserActive != null ? this._requestOwner._isUserActive : Connection.UserActive; if (!isActive) { this._httpRequest.setRequestHeader("X-UserActivity", "0"); } ;var headers = this._requestHeaders.GetMap(); for (var it in headers) { this._httpRequest.setRequestHeader(it, headers[it]); } ;this._lastReadyStatus = 0; this._timer.Start(); this._isFree = false; this._httpRequest.send(data); if(isNotHandleCallBack != true && isAsync == false) { this._ReadyStateChanged(); } } catch (e) { ; this._SendFailed(IdentifyError(2005)); } } ;Connection.prototype._CreateXMLHttpRequestObject = function() { try { var httpRequest = null; if( window.XMLHttpRequest ) { httpRequest = new XMLHttpRequest(); } else if( window.ActiveXObject ) { var MSXML_XMLHTTP_PROGIDS = new Array( 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP' ); for (var i=0; i < MSXML_XMLHTTP_PROGIDS.length; i++) { httpRequest = new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]); if( httpRequest != null ) { break; } } } ;if(!httpRequest) { throw new CWA__Exception("Fatal", "Can not create a XmlHttpRequest Object!"); } ;return httpRequest; } catch(e) { ; } } ;Connection.prototype._ReadyStateChanged = function() { var XMLHTTPREQUEST_COMPLETE = 4; var XMLHTTPREQUEST_OK = 200; var currentState = null; var httpCode = null; try { currentState = this._httpRequest.readyState; } catch(e) { ; } ;try { if ((currentState == 0 || currentState == XMLHTTPREQUEST_COMPLETE) && this._lastReadyStatus != XMLHTTPREQUEST_COMPLETE) { try { httpCode = this._httpRequest.status; } catch(e) { httpCode = 377; } ;this._lastReadyStatus = currentState; if (httpCode == XMLHTTPREQUEST_OK) { this._SendSuccess(); } else if (currentState != 0) { if (!httpCode) { httpCode = 404; } ;var error = IdentifyError(httpCode); this._SendFailed(error); } } else { this._lastReadyStatus = currentState; } } catch(e) { ; this._SendFailed(IdentifyError(2001)); } } ;Connection.prototype._TimeOutHandler = function(sender, eventArgs) { try { this._SendFailed(IdentifyError(999)); } catch(e) { ; } } ;Connection.prototype._SendFailed = function(error) { try { this._Reset(); this._ResendPolicy.Judge(error); if (this._ResendPolicy.isResend == true) { this._isFree = false; var errorEvent = IdentifyError(error.errorCode); errorEvent.type = ErrorType.GeneralError; if (error.type == ErrorType.ConnectionError || error.type == ErrorType.InternetError) { errorEvent.description = L_ErrorPane_Connection_Text; } else if (error.type == ErrorType.ServerError) { errorEvent.description = L_ErrorPane_Server_Text; } ;DispatchError(errorEvent); var str = "Error Type: " + error.type; var times = this._ResendPolicy.maxResendTimes - this._ResendPolicy.resendTimes + 1; str += "\n Request will be resend in " + this._ResendPolicy.timeInterval/1000 + "seconds"; str += "\n Remained resend times: " + times; ; setTimeout(TimerHandler(this._requestOwner, this._requestOwner.Send, true), this._ResendPolicy.timeInterval); } else { this._isFree = true; this._requestOwner.OnError(error); } } catch(e) { ; } } ;Connection.prototype._SendSuccess = function() { try { this._Reset(); this._ResendPolicy.Judge(null); this._requestOwner.OnSuccess(); } catch(e) { ; } } ;Connection.prototype._Reset = function() { this._timer.Stop(); this._isFree = true; } ;Connection.prototype._AddRefCount = function() { try { var refCount = GetCookie(AsyncDataChannel.InstanceCountCookieName); if (!refCount) { SetSessionCookie(AsyncDataChannel.InstanceCountCookieName, "1"); } else { var num = parseInt(refCount) + 1; SetSessionCookie(AsyncDataChannel.InstanceCountCookieName, "" + num); } } catch(e) { ; } } ;Connection.prototype._ReleaseRefCount = function() { try { var refCount = GetCookie(AsyncDataChannel.InstanceCountCookieName); if (refCount) { var num = parseInt(refCount) - 1; if (num > 0) { SetSessionCookie(AsyncDataChannel.InstanceCountCookieName, "" + num); } else { RemoveCookie(AsyncDataChannel.InstanceCountCookieName); } } } catch(e) { ; } } ;function DownloadManager() { } ;DownloadManager.prototype.downloadList = new Array(); DownloadManager.TimeOutValue = 80 * 1000; DownloadManager.prototype.Initialize = function() { this.xmlHttpRequest = new Connection(); this.xmlHttpRequest.Initialize(this, null, DownloadManager.TimeOutValue); this.downloadIndex = 0; this.isFree = true; } ;DownloadManager.prototype.DownloadResource = function() { this.isFree = true; this.Send(); } ;DownloadManager.prototype.Send = function() { if (this.isFree && this.downloadIndex < this.downloadList.length) { var url = this.downloadList[this.downloadIndex]; this.xmlHttpRequest.Get(url, true); } } ;DownloadManager.prototype.OnSuccess = function() { this.downloadIndex++; setTimeout(Delegate(this, this.Send), 0); } ;DownloadManager.prototype.OnError = function() { this.downloadIndex++; setTimeout(Delegate(this, this.Send), 0); } ;DownloadManager.prototype.Dispose = function() { try { this.xmlHttpRequest.Dispose(); this.xmlHttpRequest = null; this.isFree = false; } catch(e) { ; } } ;DownloadManager.prototype.Close = function() { try { this.isFree = false; } catch(e) { ; } } ;DownloadManager.prototype.Download = function(url) { return true; } ;function HelpContextId(){} ;HelpContextId["Default"] = 2010; HelpContextId["CLHelpMenu"] = 2010; HelpContextId["CWHelpMenu"] = 2001; HelpContextId["personal"] = 2004; HelpContextId["general"] = 2005; HelpContextId["alerts"] = 2006; HelpContextId["phone"] = 2011; HelpContextId["LogonDefault"] = 2032; HelpContextId["LogonLOA"] = 2014; HelpContextId["LogonHelpSignIn"] = 2015; HelpContextId["AdvC4wDialog"] = 2030; HelpContextId["NewPhone"] = 2031; function HelpManager() { this.helpFolder = "/CWA/Client/Help/" + L_Path_LangId + "/"; this.helpWindowName = "_help"; this.helpPreFix = "CWA_topic"; } ;HelpManager.prototype.HelpFileNames = new Array( "CWA_topic2001_HP10333724.htm", "CWA_topic2004_HP10333729.htm", "CWA_topic2005_HP10333730.htm", "CWA_topic2006_HP10333731.htm", "CWA_topic2010_HP10333738.htm", "CWA_topic2011_HP10333728.htm", "CWA_topic2014_HP10333723.htm", "CWA_topic2015_HP10333726.htm", "CWA_topic2019_HP10333735.htm", "CWA_topic2020_HP10333733.htm", "CWA_topic2021_HP10333727.htm", "CWA_topic2022_HP10333744.htm", "CWA_topic2023_HP10333742.htm", "CWA_topic2024_HP10333741.htm", "CWA_topic2025_HP10333732.htm", "CWA_topic2026_HP10333734.htm", "CWA_topic2027_HP10333745.htm", "CWA_topic2028_HP10333737.htm", "CWA_topic2030_HP10333736.htm", "CWA_topic2031_HP10333725.htm", "CWA_topic2032_HP10333739.htm", "CWA_topic2033_HP10338569.htm", "CWA_topic2034_HP10338568.htm", "CWA_topic2035_HP10338570.htm", "CWA_topic2036_HP10338571.htm", "CWA_topic2037_HP10338572.htm", "CWA_topic2038_HP10338613.htm"); HelpManager.prototype.OpenHelp = function(contextId) { var id = HelpContextId[contextId] || HelpContextId["Default"]; var uri = "CWA_topic2010_HP10333738.htm"; for (var i = 0; i < this.HelpFileNames.length; i++) { if (this.HelpFileNames[i].indexOf(this.helpPreFix + id) >= 0) { uri = this.HelpFileNames[i]; break; } } ;var winObj = CWA__OpenWindow( this.helpFolder + uri, this.helpWindowName ); if (winObj) { try { winObj.focus(); } catch(e) { } } } ;function CWAMODE() {} ;CWAMODE.FULL = "FULL"; CWAMODE.AUTHENTICATED = "AUTHENTICATED"; CWAMODE.ANONYMOUS = "ANONYMOUS"; CWAMODE.RDP = "RDP"; function APPSharingControlLevel() {} ;APPSharingControlLevel.CTRL_LEVEL_MIN = 0x00; APPSharingControlLevel.CTRL_LEVEL_INVALID = 0x00; APPSharingControlLevel.CTRL_LEVEL_NONE = 0x01; APPSharingControlLevel.CTRL_LEVEL_VIEW = 0x02; APPSharingControlLevel.CTRL_LEVEL_INTERACTIVE = 0x03; APPSharingControlLevel.CTRL_LEVEL_REQCTRL_VIEW = 0x04; APPSharingControlLevel.CTRL_LEVEL_REQCTRL_INTERACTIVE = 0x05; APPSharingControlLevel.CTRL_LEVEL_TERMINATED = 0x06; APPSharingControlLevel.CTRL_LEVEL_MAX = 0x06; function AclState(){};; AclState.Allow = "allow"; AclState.Block = "block"; AclState.Notify = "prompt"; AclState.Pending = "pending"; function PresenceType(){};; PresenceType.Unspecified = "Unspecified"; PresenceType.Legacy = "Legacy"; PresenceType.Rich = "Rich"; function EndpointCategory(){};; EndpointCategory.Unspecified = "Unspecified"; EndpointCategory.Web = "Web"; EndpointCategory.Mobility = "Mobility"; function RpState(){};; RpState.Offline = "Offline"; RpState.Online = "Online"; RpState.Away = "Away"; RpState.Busy = "Busy"; RpState.BeRightBack = "BeRightBack"; RpState.DoNotDisturb = "DoNotDisturb"; RpState.AppearOffline = "Appear Offline"; RpState.IdleOnline = "idleOnline"; RpState.IdleBusy = "idleBusy"; RpState.InMeeting = "InMeeting"; RpState.OnPhone = "OnPhone"; RpState.OutOfOffice = "OutOfOffice"; RpState.InConference = "InConference"; RpState.UrgentOnly = "UrgentOnly"; RpState.Custom = "custom"; RpState.Null = "unavailable"; RpState.Auto = "Automatic"; function AvState(){};; AvState.Free = "3000"; AvState.IdleFree = "4500"; AvState.Busy = "6000"; AvState.IdleBusy = "7500"; AvState.DoNotDisturb = "9000"; AvState.TempUnAlertable = "12000"; AvState.UnAlertable = "15000"; AvState.UnAvailable = "18000"; AvState.Null = "Null"; var AvStatePublicationMap = {};; AvStatePublicationMap[ AvState.Free ] = "3500"; AvStatePublicationMap[ AvState.IdleFree ] = "5000"; AvStatePublicationMap[ AvState.Busy ] = "6500"; AvStatePublicationMap[ AvState.DoNotDisturb ] = "9500"; AvStatePublicationMap[ AvState.TempUnAlertable ] = "12500"; AvStatePublicationMap[ AvState.UnAlertable ] = "15500"; AvStatePublicationMap[ AvState.UnAvailable ] = "18500"; var AvToStateMap = new Object(); AvToStateMap[ AvState.Free ] = RpState.Online; AvToStateMap[ AvState.IdleFree ] = RpState.IdleOnline; AvToStateMap[ AvState.Busy ] = RpState.Busy; AvToStateMap[ AvState.IdleBusy ] = RpState.IdleBusy; AvToStateMap[ AvState.DoNotDisturb ] = RpState.DoNotDisturb; AvToStateMap[ AvState.TempUnAlertable ] = RpState.BeRightBack; AvToStateMap[ AvState.UnAlertable ] = RpState.Away; AvToStateMap[ AvState.UnAvailable ] = RpState.Offline; function AvIconMap(){} ;AvIconMap[AvState.Free] = L_Presence_FreeImg; AvIconMap[AvState.IdleFree] = L_Presence_IdleFreeImg; AvIconMap[AvState.Busy] = L_Presence_BusyImg; AvIconMap[AvState.IdleBusy] = L_Presence_IdleBusyImg; AvIconMap[AvState.DoNotDisturb] = L_Presence_DoNotDisturbImg; AvIconMap[AvState.TempUnAlertable] = L_Presence_TempUnAlertableImg; AvIconMap[AvState.UnAlertable] = L_Presence_UnAlertableImg; AvIconMap[AvState.UnAvailable] = L_Presence_UnAvailableImg; AvIconMap[AvState.Null] = L_Presence_NullImg; AvIconMap[AclState.Block] = L_Presence_BlockImg; function RpTextMap(){} ;RpTextMap[RpState.Offline] = L_Presence_Offline; RpTextMap[RpState.Online] = L_Presence_Online; RpTextMap[RpState.IdleOnline] = L_Presence_IdleOnline; RpTextMap[RpState.Away] = L_Presence_Away; RpTextMap[RpState.Busy] = L_Presence_Busy; RpTextMap[RpState.IdleBusy] = L_Presence_IdleBusy; RpTextMap[RpState.BeRightBack] = L_Presence_BeRightBack; RpTextMap[RpState.DoNotDisturb] = L_Presence_DoNotDisturb; RpTextMap[RpState.InMeeting] = L_Presence_InMeeting; RpTextMap[RpState.OnPhone] = L_Presence_OnPhone; RpTextMap[RpState.OutOfOffice] = L_Presence_OutOfOffice; RpTextMap[RpState.InConference] = L_Presence_InConference; RpTextMap[RpState.UrgentOnly] = L_Presence_UrgentOnly; RpTextMap[RpState.Null] = L_Presence_Null; RpTextMap[RpState.Auto] = L_Presence_Auto; RpTextMap[RpState.AppearOffline] = L_Presence_AppearOffline; function NumberLabel(){};; NumberLabel.Work = 0; NumberLabel.Home = 1; NumberLabel.Cell = 2; NumberLabel.Other = 3; NumberLabel.New = 4; NumberLabel.Unrecognized = 5; function AlertReason(){} ;AlertReason.Invite = "Invite"; AlertReason.Presence = "Presence"; AlertReason.Subscriber = "Subscriber"; function MapUnicodeCharToAscChar(ch) { if (ch == null || ch.charAt(0) == null) { return null; } ;var charCode = ch.charCodeAt(0); if (charCode > 0xfee0) { charCode -= 0xfee0; } else if (charCode == 0x3000) { charCode = 0x20; } ;return String.fromCharCode(charCode); } ;function IsCharInRegExp(ch, regExp) { if (ch == null || ch.charAt(0) == null) { return false; } ;if (regExp == null) { return false; } ;return regExp.test(MapUnicodeCharToAscChar(ch)); } ;function NonE164Formatter(){} ;NonE164Formatter.MinLength = 1; NonE164Formatter.MaxLength = 256; NonE164Formatter.DisallowedDisplayCharsRe = new RegExp("[()\\.\\- ]"); NonE164Formatter.AllowedDialingCharsRe = new RegExp("[0-9#*]"); NonE164Formatter.IsAllowedDisplayChar = function(ch) { return !IsCharInRegExp(ch, NonE164Formatter.DisallowedDisplayCharsRe); } ;NonE164Formatter.IsAllowedDialingChar = function(ch) { return IsCharInRegExp(ch, NonE164Formatter.AllowedDialingCharsRe); } ;NonE164Formatter.GetFilteredDisplayNumber = function(displayNum) { ; var displayNum = Trim(displayNum); var filteredDisplayNumber = ""; for (var i = 0; i < displayNum.length; ++i) { var ch = displayNum.charAt(i); if (NonE164Formatter.IsAllowedDisplayChar(ch)) { filteredDisplayNumber += MapUnicodeCharToAscChar(ch); } } ;return filteredDisplayNumber; } ;NonE164Formatter.GetDialingNumber = function(displayNum) { ; var filteredDisplayNum = NonE164Formatter.GetFilteredDisplayNumber(displayNum); if (IsStringNullOrEmpty(filteredDisplayNum)) { return null; } ;var dialingNumber = PhoneNormalizer.GetDialingNumber(filteredDisplayNum); if (!IsStringNullOrEmpty(dialingNumber) && NonE164Formatter.IsValidDialingNumber(dialingNumber)) { return dialingNumber; } else if (NonE164Formatter.IsValidDialingNumber(filteredDisplayNum)) { return filteredDisplayNum; } else { return null; } } ;NonE164Formatter.IsValidDisplayNumber = function(displayNum) { ; return !IsStringNullOrEmpty(NonE164Formatter.GetDialingNumber(displayNum)); } ;NonE164Formatter.IsValidDialingNumber = function(dialingNum) { if (IsStringNullOrEmpty(dialingNum)) { return false; } ;var numLength = dialingNum.length; if (NonE164Formatter.MinLength > numLength || numLength > NonE164Formatter.MaxLength) { return false; } ;for (var i = 0; i < dialingNum.length; ++i) { if (!NonE164Formatter.IsAllowedDialingChar(dialingNum.charAt(i))) { return false; } } ;return true; } ;function E164Formatter() {} ;E164Formatter.MinLength = 1; E164Formatter.MaxLength = 256; E164Formatter.AllowedPrefixCharRe = new RegExp("[+]"); E164Formatter.DisallowedDisplayCharsRe = new RegExp("[()\\.\\- ]"); E164Formatter.AllowedDialingCharsRe = new RegExp("[0-9]"); E164Formatter.IsAllowedDisplayChar = function(ch) { return !IsCharInRegExp(ch, E164Formatter.DisallowedDisplayCharsRe); } ;E164Formatter.IsAllowedDialingChar = function(ch) { return IsCharInRegExp(ch, E164Formatter.AllowedDialingCharsRe); } ;E164Formatter.GetFilteredDisplayNumber = function(displayNum) { ; var displayNum = Trim(displayNum); var prefixChar = MapUnicodeCharToAscChar(displayNum.charAt(0)); if (E164Formatter.AllowedPrefixCharRe.test(prefixChar)) { displayNum = displayNum.substr(1); } else { prefixChar = ''; } ;var filteredDisplayNumber = prefixChar; for (var i = 0; i < displayNum.length; ++i) { var ch = displayNum.charAt(i); if (E164Formatter.IsAllowedDisplayChar(ch)) { filteredDisplayNumber += MapUnicodeCharToAscChar(ch); } } ;return filteredDisplayNumber; } ;E164Formatter.GetDialingNumber = function(displayNum) { ; var filteredDisplayNum = E164Formatter.GetFilteredDisplayNumber(displayNum); if (IsStringNullOrEmpty(filteredDisplayNum)) { return null; } ;var dialingNumber = PhoneNormalizer.GetDialingNumber(filteredDisplayNum); if (!IsStringNullOrEmpty(dialingNumber) && E164Formatter.IsValidDialingNumber(dialingNumber)) { return dialingNumber; } ;return null; } ;E164Formatter.IsValidDisplayNumber = function(displayNum) { ; var filteredDisplayNum = E164Formatter.GetFilteredDisplayNumber(displayNum); if (IsStringNullOrEmpty(filteredDisplayNum)) { return false; } ;if (PhoneNormalizer.IsValidDisplayNumber(filteredDisplayNum)) { var dialingNumber = PhoneNormalizer.GetDialingNumber(filteredDisplayNum); if (!IsStringNullOrEmpty(dialingNumber)) { return E164Formatter.IsValidDialingNumber(dialingNumber); } } ;return false; } ;E164Formatter.IsValidDialingNumber = function(dialingNum) { if (IsStringNullOrEmpty(dialingNum)) { return false; } ;var prefixChar = MapUnicodeCharToAscChar(dialingNum.charAt(0)); if (!E164Formatter.AllowedPrefixCharRe.test(prefixChar)) { return false; } ;var numLength = dialingNum.length - 1; if (dialingNum.indexOf(';') != -1) { numLength = dialingNum.indexOf(';') - 1; } ;if (E164Formatter.MinLength > numLength || numLength > E164Formatter.MaxLength) { return false; } ;for (var i = 0; i < numLength; ++i) { if (!E164Formatter.IsAllowedDialingChar(dialingNum.charAt(i + 1))) { return false; } } ;return true; } ;function PhoneNormalizer() {} ;PhoneNormalizer.NormalizationRules = []; PhoneNormalizer.ProfileName = ""; PhoneNormalizer.DefaultRules = [new PhoneNormalizationRule(), new PhoneNormalizationRule()]; PhoneNormalizer.DefaultRules[0].name = "The hard coded default rule which could parse ext. out"; PhoneNormalizer.DefaultRules[0].pattern = /\++(\d+)([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?\s*([Xx]+(\d{1,15}))[\s]*$/; PhoneNormalizer.DefaultRules[0].translation = "+$1$3$5$7$9$11$13$15$17$19$21;ext=$23"; PhoneNormalizer.DefaultRules[1].name = "The other hard coded default rule"; PhoneNormalizer.DefaultRules[1].pattern = /\++(\d+)([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?([\s()\-\./]+(\d+))?[\s]*/; PhoneNormalizer.DefaultRules[1].translation = "+$1$3$5$7$9$11$13$15$17$19$21"; PhoneNormalizer.OnLocationProfileUpdated = function(sender, xmlNode) { ; var rootElement = xmlNode; var defaultProfileName = Trim(rootElement.getAttribute("ucLocationProfile")); if (IsStringNullOrEmpty(defaultProfileName)) { ; return; } ;PhoneNormalizer.ProfileName = defaultProfileName; ; var elements = xmlNode.getElementsByTagName("provisionGroup"); if (elements.length == 0) { ; return; } ;for (var i = 0; i < elements.length; ++i) { var tmpElement = elements[i]; if (Trim(tmpElement.getAttribute("name")) == "LocationProfiles") { rootElement = tmpElement; break; } } ;var locationProfileElements = rootElement.getElementsByTagName("locationProfiles"); if (locationProfileElements.length != 1) { ; return; } ;var ruleDNs = {};; for (var i = 0; i < locationProfileElements[0].childNodes.length; ++i) { var profileElement = locationProfileElements[0].childNodes[i]; var profileName = XMLGetNodeValueByTagName(profileElement, "profileName"); if (!IsStringNullOrEmpty(profileName) && profileName == defaultProfileName) { ; var ruleDNsElements = profileElement.getElementsByTagName("normalizationRuleDNs"); if (ruleDNsElements.length != 1) { ; return; } ;for (var j = 0; j < ruleDNsElements[0].childNodes.length; ++j) { var name = Trim(XMLGetNodeValue(ruleDNsElements[0].childNodes[j])); if (!IsStringNullOrEmpty(name)) { ruleDNs[name] = true; } } ;break; } } ;var rules = []; var ruleElements = rootElement.getElementsByTagName("normalizationRules"); if (ruleElements.length != 1) { ; return; } ;for (var i = 0; i < ruleElements[0].childNodes.length; ++i) { var instanceNode = ruleElements[0].childNodes[i]; var ruleDN = XMLGetNodeValueByTagName(instanceNode, "ruleDN"); if (ruleDNs[ruleDN]) { var rule = new PhoneNormalizationRule(); rule.name = Trim(XMLGetNodeValueByTagName(instanceNode, "ruleName")); rule.pattern= new RegExp(Trim(XMLGetNodeValueByTagName(instanceNode, "rulePattern"))); rule.translation= Trim(XMLGetNodeValueByTagName(instanceNode, "ruleTranslation")); rules.push(rule); } } ;; PhoneNormalizer.NormalizationRules = rules; } ;PhoneNormalizer.IsValidDisplayNumber = function(displayNum) { ; var displayNum = Trim(displayNum); if (!IsArrayNullOrEmpty(PhoneNormalizer.NormalizationRules) && PhoneNormalizer._Match(displayNum, PhoneNormalizer.NormalizationRules) != -1) { return true; } ;if (PhoneNormalizer._Match(displayNum, PhoneNormalizer.DefaultRules) != -1) { return true; } ;return false; } ;PhoneNormalizer.GetDialingNumber = function(displayNum) { ; var displayNum = Trim(displayNum); var dialingNum = null; if (!IsArrayNullOrEmpty(PhoneNormalizer.NormalizationRules)) { dialingNum = PhoneNormalizer._Translate(displayNum, PhoneNormalizer.NormalizationRules); } ;if (dialingNum != null) { return dialingNum; } ;return PhoneNormalizer._Translate(displayNum, PhoneNormalizer.DefaultRules); } ;PhoneNormalizer._Match = function(num, rules) { ; ; for (i = 0; i < rules.length; ++i) { var rule = rules[i]; if (rule.pattern != null && rule.pattern.test(num)) { ; return i; } } ;return -1; } ;PhoneNormalizer._Translate = function(num, rules) { ; ; function _ParseIntInStr(str, pos) { var res = {};; res[0] = 0; for(; pos < str.length; ++pos) { var ch = str.charAt(pos); if(ch >= '0' && ch <= '9') { res[0] *= 10; res[0] += ch - '0'; } else { break; } } ;res[1] = pos; return res; } ;var i = PhoneNormalizer._Match(num, rules); ; if (i == -1) { return null; } ;var res = num.match(rules[i].pattern); if (IsArrayNullOrEmpty(res) || res[0] != num) { return null; } ;var resStr = ""; for (var j = 0; j < rules[i].translation.length; ++j) { var ch = rules[i].translation.charAt(j); if (ch != "$") { resStr += ch; } else { var intRes = _ParseIntInStr(rules[i].translation, ++j); if (intRes[0] < res.length && res[intRes[0]]) { resStr += res[intRes[0]]; } ;j = intRes[1] - 1; } } ;return resStr; } ;function PhoneNormalizationRule() { this.name = ""; this.pattern = null; this.translation = ""; } ;function IsValidDisplayNumber(displayNum) { ; return (E164Formatter.IsValidDisplayNumber(displayNum) || NonE164Formatter.IsValidDisplayNumber(displayNum)); } ;function GetDialingNumber(displayNum) { if (E164Formatter.IsValidDisplayNumber(displayNum)) { return E164Formatter.GetDialingNumber(displayNum); } else if (NonE164Formatter.IsValidDisplayNumber(displayNum)) { return NonE164Formatter.GetDialingNumber(displayNum); } ;return null; } ;function GetE164FormartDialingNumber(displayNum) { if(!displayNum) { return ""; } else if(E164Formatter.IsValidDisplayNumber(displayNum)) { return E164Formatter.GetDialingNumber(displayNum); } else { var str = ""; for(var i = 0; i < displayNum.length; ++i) { if(displayNum.charAt(i) >= '0' && displayNum.charAt(i) <= '9') { str += displayNum.charAt(i); } } ;if(str && str.charAt(0) != '+') { str = "+" + str; } ;return str; } } ;function GetFilteredDisplayNumber(displayNum) { ; if (IsValidDisplayNumber(displayNum)) { return Trim(displayNum); } ;return null; } ;var WindowToken = new Object(); WindowToken.ContactList = "cl"; WindowToken.Conversation = "cw"; WindowToken.MessageDialog = "md"; WindowToken.OptionDialog = "od"; WindowToken.AboutDialog = "ad"; WindowToken.EnterNumberDialog = "end"; WindowToken.AclDialog = "acd"; WindowToken.CallRoutingDialog = "cd"; function GetMainFrameWindow() { var win = null; try { win = window.top; while((win != null) && (win._CWAMain == null)) { win = win.opener; } } catch( ex ) { win = null; } ;return win; } ;function GetCWAMode() { var win = GetMainFrameWindow(); if (win && win._CWAMain && win._CWAMain.mode) { return win._CWAMain.mode; } else { return CWAMODE.FULL; } } ;function GetMainFrameObj() { var mainWindow = GetMainFrameWindow(); if (mainWindow) return mainWindow.obj; else return null; } ;function HasUnloadEvent() { try { var mainWindow = GetMainFrameWindow(); if (mainWindow != null && mainWindow._hasUnloadEvent != null && !UserAgentInfo.GetInstance().IsSafari()) { return mainWindow._hasUnloadEvent; } else if (document.all) { return false; } else { return true; } } catch (ex) { return true; } } ;function GetMainFrameId() { return "mainFrameWindow"; } ;function GetWindowObj() { var win = window.top; if (win) return win.obj; else return null; } ;function GetWindowPopupManager() { var win = GetWindowObj(); if (win) return win.popupManager; else return null; } ;function GetHelpManager() { var mainFrame = GetMainFrameObj(); if (mainFrame) { return mainFrame.helpManager; } else { return new HelpManager(); } } ;function OpenHelp(contextId) { var helpManager = GetHelpManager(); if (helpManager) { helpManager.OpenHelp(contextId); } } ;function OpenAboutDialog(dialogManager) { var version = L_About_Version.replace(/%0/g, GetMainFrameWindow().clientVersion); var productName = L_Product_RegisterName.replace(/%0/g, "<sup>&reg;</sup>"); var panelImg = L_AboutDialog_Panel; var ua = UserAgentInfo.GetInstance(); var text = "<html><head>"; text += "<title>" + L_Product_About + "</title>"; text += "<style>TABLE, INPUT {font-family:" + L_Font_Family + ";font-size:" + L_Font_Size + ";} </style>"; text += "</head>"; text += "<script>"; text += "function OnClose()"; text += "{"; text += "if (!OnClose.IsExecuted)"; text += "{"; text += "OnClose.IsExecuted = true;"; text += "try {window.dialogManager.OnDialogUnload(window);} catch(ex) {}"; text += "}"; text += "}"; text += "OnClose.IsExecuted = false;"; text += "window.top.document.title = '" + L_Product_About + "';"; text += "</script" + ">"; text += "<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'"; text += " onbeforeunload='OnClose();'"; text += " onunload='OnClose();'"; text += " onerror='return true;'"; text += " onkeypress='if (event.keyCode==27) window.close()'"; text += ">"; text += "<table cellspacing='0' cellpadding='0' width='100%' height='100%'>"; text += "<tr>"; text += "<td style='width:69;background:#EEF4FD url(\"" + panelImg + "\") no-repeat top left;'><div style='width:69'></div></td>"; text += "<td id='content' style='padding-left:20px;padding-right:15px;background-color:#ebe9ed;'>"; text += "<table style='color:#000000' cellspacing='0' cellpadding='0' width='100%' height='100%'>"; text += "<tr><td height='1' valign='bottom' style='padding-top:18px'>" + productName + "</td></tr>"; text += "<tr><td valign='bottom' style='height:30px'>" + version + "</td></tr>"; text += "<tr><td valign='bottom' style='height:30px'>" + L_Product_CopyRight + "</td></tr>"; text += "<tr><td valign='bottom'>" + L_About_Warning + "</td></tr>"; text += "<tr><td valign='bottom' style='height:30px'><a href='http://go.microsoft.com/fwlink/?LinkId=128061' target='_blank'>" + L_VIEW_MS_PRIVACY_STATEMENT + "</td></tr>"; text += "<tr><td height='1' align='right'>"; text += "<input type=button style=\"height:" + L_Size_Dialog_Button_Height + "px;width:" + L_Size_Dialog_Button_Width + "px;margin-top:10px;margin-bottom:7px\" onclick='window.close()' value='" + L_Message_Box_Ok + "'>"; text += "</td></tr>"; text += "</table>"; text += "</td></tr></table>"; text += "</body><script>"; text += "window.dialogManager.OnDialogLoad(window);"; if (ua.IsSafari()) { text += "var rightTd=document.getElementById('content');rightTd.style.height=rightTd.parentNode.offsetHeight;"; } ;text += "</script></html>"; var dialog = null; try { var size = new Size(); size.width = L_Size_About_Width; size.height = L_Size_About_Height; size.left = GetWindowX(window); size.top = GetWindowY(window) + 50; dialog = OpenDialog("", "", size); var WriteContentCallback = function( isError, isFromTimer ) { if( !isError ) { dialog.document.open(); dialog.dialogManager = dialogManager; dialog.document.write(text); dialog.document.close(); } else { if( isFromTimer ) { try { dialogManager.OnDialogUnload( dialog, WindowToken.AboutDialog ); } catch(ex) { ; } } ;dialog = SafelyCloseWindow( dialog ); } } ;SafelyWriteWindowContent( dialog, ua.IsSafari(), WriteContentCallback ); } catch(ex) { dialog = SafelyCloseWindow( dialog ); } ;return dialog; } ;function RecordActiveWindow() { var activeWin = window._activeWindow; try { window._preActiveWindow = activeWin; if (activeWin && activeWin.obj) { window._preActiveInputBox = activeWin.obj.GetFocusedInputBox(); } } catch (ex) { window._preActiveInputBox = null; } } ;function SetPreviousActiveWindow(win, inputBox) { window._preActiveWindow = win; window._preActiveInputBox = inputBox; } ;function FocusPreviousWindowBack() { try { if (window._preActiveWindow && window._preActiveWindow.obj) { window._preActiveWindow.obj.Focus(window._preActiveInputBox); } else { if (window._activeWindow) { window._activeWindow = null; } } } catch (ex) { } } ;function RefreshGroupListSize( isForce ) { if (document.all) { var mainFrameId = GetMainFrameId(); var code = mainFrameId + ".RefreshGroupListSize(" + ( (isForce)? "true" : "" ) + ")"; window.setTimeout( code, 0 ); } else { var mainFrame = GetWindowObj(); mainFrame.RefreshGroupListSize( isForce ); } } ;function RefreshSearchResultsSize() { if (document.all) { var mainFrameId = GetMainFrameId(); window.setTimeout(mainFrameId + ".searchPane.RefreshSize(true)", 0); } else { var mainFrame = GetWindowObj(); mainFrame.searchPane.RefreshSize(true); } } ;function RefreshGroupListUI() { if (UserAgentInfo.GetInstance().IsSafari()) { RefreshSafariUI(window.obj.contactListView.groupsContainer.ref); } } ;function GetStatuses() { if(!GetStatuses._statuses) { GetStatuses._statuses = []; var temp = GetStatuses._statuses; var nullStatus = new Object(); nullStatus["value"] = ""; nullStatus["text"] = L_Presence_Default; temp.push(nullStatus); var online = new Object(); online["value"] = AvState.Free; online["text"] = RpTextMap[AvToStateMap[AvState.Free]]; temp.push(online); var busy = new Object(); busy["value"] = AvState.Busy; busy["text"] = RpTextMap[AvToStateMap[AvState.Busy]]; temp.push(busy); var dnd = new Object(); dnd["value"] = AvState.DoNotDisturb; dnd["text"] = RpTextMap[AvToStateMap[AvState.DoNotDisturb]]; temp.push(dnd); var brb = new Object(); brb["value"] = AvState.TempUnAlertable; brb["text"] = RpTextMap[AvToStateMap[AvState.TempUnAlertable]]; temp.push(brb); var away = new Object(); away["value"] = AvState.UnAlertable; away["text"] = RpTextMap[AvToStateMap[AvState.UnAlertable]]; temp.push(away); } ;return GetStatuses._statuses; } ;function ChangeStyleDef(className, attrib, newValue) { if (className == null || (attrib == null || attrib.length == 0)) { return null; } ;attrib = attrib.toLowerCase().replace(/\-/g, ''); var temp = ''; var ua = UserAgentInfo.GetInstance(); if (ua.IsSafari()) { return; } ;var styleObjs = document.styleSheets; for (var i = 0; i < styleObjs.length; ++i) { var rules = null; if (ua.IsIE()) { rules = styleObjs[i].rules; } else { rules = styleObjs[i].cssRules; } ;for (var j = 0; j < rules.length; ++j) { var styleObj = rules[j]; var cssDef = styleObj.selectorText; var tmp = className; if (cssDef.substring(0, 1) != '.') { cssDef = cssDef.toLowerCase(); tmp = className.toLowerCase(); } ;if (cssDef == tmp) { if (ua.IsIE()) { for (var o in styleObj.style) { if (o.toLowerCase().replace(/\-/g, '') == attrib) { styleObj.style.setAttribute(o, newValue); } } } else { for (var k = 0; k < styleObj.style.length; ++k) { var propertyName = styleObj.style.item(k); if (propertyName.toLowerCase().replace(/\-/g, '') == attrib) { styleObj.style.setProperty(propertyName, newValue, ""); } } } } } } } ;function LocalizableFontPart() {} ;LocalizableFontPart.Logon = "logon"; LocalizableFontPart.CWA = "cwa"; var LogonLocalizableFontTag = new Array(); LogonLocalizableFontTag.push("BODY"); LogonLocalizableFontTag.push("A"); LogonLocalizableFontTag.push("TABLE"); LogonLocalizableFontTag.push("INPUT"); LogonLocalizableFontTag.push("SELECT"); var CwaLocalizableFontTag = new Array(); CwaLocalizableFontTag.push("BODY"); CwaLocalizableFontTag.push("BODY.mainframe"); CwaLocalizableFontTag.push("BODY.conversation"); CwaLocalizableFontTag.push("A"); CwaLocalizableFontTag.push("DIV"); CwaLocalizableFontTag.push("TABLE"); CwaLocalizableFontTag.push("SPAN"); CwaLocalizableFontTag.push("INPUT"); CwaLocalizableFontTag.push("TEXTAREA"); CwaLocalizableFontTag.push("SELECT"); CwaLocalizableFontTag.push("BUTTON"); function LocalizeFont(part) { if (part == null || Trim(part).length == 0) { return; } ;var tagArray = null; switch (part) { case LocalizableFontPart.Logon: tagArray = LogonLocalizableFontTag; break; case LocalizableFontPart.CWA: tagArray = CwaLocalizableFontTag; break; default: return; } ;if (tagArray == null || tagArray.length == 0) { return; } ;for (var i = 0; i < tagArray.length; ++i) { ChangeStyleDef(tagArray[i], "font-family", L_Font_Family); ChangeStyleDef(tagArray[i], "font-size", L_Font_Size); } } ;function GetBlankPageUrl() { return "/cwa/Client/blank.htm"; } ;function IncludeSignedCode() { if (!UserAgentInfo.GetInstance().IsSignedCodeSupported()) { ; return; } ;with (window.location) { var index = href.lastIndexOf("/"); var path = href.substr(0, index + 1); } ;var signedCodeUri = "jar:" + path + "SignedCode.jar!/SignedCode.htm"; document.write("<iframe id='signedCode' src='" + signedCodeUri + "' style='display:none'></iframe>"); window._SignedCode_Window = document.getElementById("signedCode").contentWindow; } ;function SignedOpenWindowAgent(opener, uri, name, option) { if( !opener ) { opener = window; } ;if( !uri ) { uri = GetBlankPageUrl(); } ;var openedWin = null; try { var signedCodeWin = window._SignedCode_Window; if( signedCodeWin && signedCodeWin.SignedOpenWindow ) { openedWin = signedCodeWin.SignedOpenWindow( opener, uri, name, option ); } } catch (ex) { openedWin = null; ; } ;return openedWin? openedWin : (opener.open(uri, name, option)); } ;function GetCentralData() { var mainWin = GetMainFrameWindow(); if (mainWin && mainWin.obj) { return mainWin.obj.centralData; } else { return null; } } ;function GetPolicyData() { var centralData = GetCentralData(); if (centralData) { return centralData.policyData; } else { return null; } } ;function IsDebugVersion() { var mainWin = GetMainFrameWindow(); if (mainWin && mainWin.isDebugVersion == true) { return true; } else { return false; } } ;function IsAppShNativePluginSupported() { if (!IsAppShEnabledByPolicy()) { return false; } ;if (!IsHttpsServer()) { return false; } ;return IsAppShEnabledOnMatrix(); } ;function IsAppShEnabledByPolicy() { var policyData = GetPolicyData(); return (policyData && policyData.Get(PolicyData.EnableAppSharing) == "true"); } ;function IsAppShEnabledOnMatrix() { if (IsAppShEnabledOnMatrix._isMatrixSupported == null) { var userAgent = UserAgentInfo.GetInstance(); var osName = userAgent.GetOSName(); var osVersion = userAgent.GetOSVersion(); var browserName = userAgent.GetBrowserName(); var browserArch = userAgent.GetBrowserArch(); IsAppShEnabledOnMatrix._isMatrixSupported = ( osName == "windows nt" && osVersion >= "5.1" && ((browserName == "ie" && browserArch == "x86") || browserName == "firefox")); } ;return IsAppShEnabledOnMatrix._isMatrixSupported; } ;function IsHttpsServer() { try { if (IsHttpsServer._isHttps == null) { var mainWindow = GetMainFrameWindow(); var protocol = mainWindow.document.location.protocol.toLowerCase(); IsHttpsServer._isHttps = (protocol.indexOf("https") == 0); } ;return IsHttpsServer._isHttps; } catch (ex) { return false; } } ;function GetAppShDisabledHint() { if (!IsAppShEnabledByPolicy()) { return L_CW_APPS_DSBUTTON_DISABLED_HINT_POLICY; } ;if (!IsHttpsServer()) { return L_CW_APPS_DSBUTTON_DISABLED_HINT_NOTHTTPS; } ;if (!IsAppShEnabledOnMatrix()) { return L_CW_APPS_DSBUTTON_DISABLED_HINT_NOTSUPPORT; } ;return ""; } ;function StaticUi() { this._uiElements = {};; } ;StaticUi.prototype._GetUiElement = function(id) { ; if (this._uiElements[id]) { return this._uiElements[id]; } else { var obj = document.getElementById(id); if (obj != null) { this._uiElements[id] = obj; return obj; } else { ; return null; } } } ;StaticUi.prototype._SetUiFont = function(id) { ; var ui = this._GetUiElement(id); if (ui != null) { ui.style.fontFamily = L_Font_Family; ui.style.fontSize = L_Font_Size; } } ;StaticUi.prototype._SetUiWidth = function(id, width) { var ui = this._GetUiElement(id); if (ui != null) { SetUiWidth(ui, width); } } ;StaticUi.prototype._SetUiHeight = function(id, height) { var ui = this._GetUiElement(id); if (ui != null) { SetUiHeight(ui, height); } } ;StaticUi.prototype._SetUiSize = function(id, width, height) { var ui = this._GetUiElement(id); if (ui != null) { SetUiSize(ui, width, height); } } ;StaticUi.prototype._ClearUiElements = function() { for (var key in this._uiElements) { this._uiElements[key] = null; } ;this._uiElements = null; } ;StaticUi.prototype._FlushUiElements = function() { this._ClearUiElements(); this._uiElements = {};; } ;StaticUi.prototype.Dispose = function() { this._ClearUiElements(); } ;function Singletonfy( classObj, initFunc, initFuncArgsArray ) { ; if(!classObj.GetInstance) { classObj.GetInstance = function() { if(!classObj._instance) { var instance = new classObj(); if(initFunc) { initFunc.apply(instance, initFuncArgsArray || []); } ;classObj._instance = instance; } ;return classObj._instance; };; } ;if(!classObj.Dispose) { classObj.Dispose = function() { if(classObj._instance && classObj._instance.Dispose) { classObj._instance.Dispose(); } ;classObj._instance = null; };; } } ;function UserAgentInfo() { this._platform = null; this._osName = null; this._osVersion = null; this._servicePack = null; this._browserName = null; this._browserVersion = null; this._browserArch = null; this._browserEngineName = null; this._browserEngineVersion = null; try { this._Initialize(); } catch (ex) { ; } } ;UserAgentInfo.SafariVersionNumMap = new Object(); UserAgentInfo.SafariVersionNumMap["312"] = "1.3"; UserAgentInfo.SafariVersionNumMap["312.3.1"] = "1.3.1"; UserAgentInfo.SafariVersionNumMap["412.2"] = "2.0"; UserAgentInfo.SafariVersionNumMap["417.9.3"] = "2.0.3"; UserAgentInfo.prototype._Initialize = function() { var info = null; var matchResult = null; info = navigator.platform.toLowerCase(); if (info.match(/win32/)) { this._platform = "win32"; } else if (info.match(/win64/)) { this._platform = "win64"; } else if (info.match(/mac/)) { this._platform = "mac"; } else if (info.match(/linux/)) { this._platform = "linux"; } else { this._platfrom = "other"; } ;info = navigator.userAgent.toLowerCase(); if (this._platform == "win32" || this._platform == "win64") { if (info.indexOf("windows 98") != -1) { this._osName = "win98"; } else if (matchResult = info.match(/windows nt (([0-9]|\.)*)/)) { this._osName = "windows nt"; this._osVersion = matchResult[1]; } ;if (matchResult = info.match(/win64; x64/)) { this._browserArch = "amd64"; } else if (matchResult = info.match(/win64; ia64/)) { this._browserArch = "ia64"; } else { this._browserArch = "x86"; } } else if (this._platform == "mac") { if (info.match(/mac os x/)) { this._osName = "mac os x"; } } else if (this._platform == "linux") { this._osName = "linux"; } ;if (matchResult = info.match(/netscape\/(([0-9]|\.)*)/)) { this._browserName = "ns"; this._browserVersion = matchResult[1]; } else if (matchResult = info.match(/opera (([0-9]|\.)*)/)) { this._browserName = "opera"; this._browserVersion = matchResult[1]; } ;if (matchResult = info.match(/msie (([0-9]|\.)*)/)) { if (this.IsNetscape()) { this._browserEngineName = "ie"; this._browserEngineVersion = matchResult[1]; } else if (this._browserName == null) { this._browserName = "ie"; this._browserVersion = matchResult[1]; } ;if ((index = info.indexOf("sv1")) != -1) { if (this.GetOS() == "windows nt 5.1") { this._servicePack = "sp2"; } else if (this.GetOS() == "windows nt 5.2") { this._servicePack = "sp1"; } } } else if (matchResult = info.match(/safari\/(([0-9]|\.)*)/)) { this._browserName = "safari"; this._browserVersion = matchResult[1]; } else if (matchResult = info.match(/firefox\/(([0-9]|\.)*)/)) { this._browserName = "firefox"; this._browserVersion = matchResult[1]; } else if (matchResult = info.match(/rv:(([0-9]|\.)*)/)) { this._browserName = "mozilla"; this._browserVersion = matchResult[1]; } } ;UserAgentInfo.prototype.GetRawString = function() { return navigator.userAgent; } ;UserAgentInfo.prototype.GetPlatform = function() { return this._platform; } ;UserAgentInfo.prototype.GetBrowserArch = function() { return this._browserArch; } ;UserAgentInfo.prototype.GetOS = function() { return this._osName + (this._osVersion ? (" " + this._osVersion) : ""); } ;UserAgentInfo.prototype.GetOSName = function() { return this._osName; } ;UserAgentInfo.prototype.GetOSVersion = function() { return this._osVersion; } ;UserAgentInfo.prototype.IsOSWithSP = function() { return (this._servicePack != null); } ;UserAgentInfo.prototype.GetServicePackName = function() { return this._servicePack; } ;UserAgentInfo.prototype.GetBrowser = function() { return this._browserName + (this._browserVersion ? (" " + this._browserVersion) : ""); } ;UserAgentInfo.prototype.GetBrowserName = function() { return this._browserName; } ;UserAgentInfo.prototype.GetBrowserVersion = function() { return this._browserVersion; } ;UserAgentInfo.prototype.GetSafariReleaseVersion = function() { if (this.IsSafari() && UserAgentInfo.SafariVersionNumMap[this._browserVersion] != null) { return UserAgentInfo.SafariVersionNumMap[this._browserVersion]; } ;return null; } ;UserAgentInfo.prototype.IsNetscapeWithIEEngine = function() { if (this.IsNetscape() && this._browserEngineName == "ie") { return true; } ;return false; } ;UserAgentInfo.prototype.GetIEEngineVersion = function() { if (this.IsNetscapeWithIEEngine()) { return this._browserEngineVersion; } else if (this.IsIEBrowser()) { return this._browserVersion; } ;return null; } ;UserAgentInfo.prototype.IsIEBrowser = function() { return (this._browserName == "ie"); } ;UserAgentInfo.prototype.IsIE = function() { return (this.IsIEBrowser() || this.IsNetscapeWithIEEngine()); } ;UserAgentInfo.prototype.IsFirefox = function() { return (this._browserName == "firefox"); } ;UserAgentInfo.prototype.IsSafari = function(detectVersion) { var res = this._browserName == "safari"; if(detectVersion == 3) { res = res && parseInt(this._browserVersion) >= 500; } ;return res; } ;UserAgentInfo.prototype.IsNetscape= function() { return (this._browserName == "ns"); } ;UserAgentInfo.prototype.IsMozilla= function() { return (this._browserName == "mozilla"); } ;UserAgentInfo.prototype.IsMacPlatform = function() { return (this._platform == "mac" ); } ;UserAgentInfo.prototype.IsVistaOS = function() { return (this.GetOS() == "windows nt 6.0"); } ;UserAgentInfo.prototype.IsSignedCodeSupported = function() { if (this.IsMozilla() || this.IsFirefox() || (this.IsNetscape() && !this.IsNetscapeWithIEEngine())) { return true; } ;return false; } ;Singletonfy( UserAgentInfo ); function BoolToInt(bool) { if (bool == null) { return 0; } ;if (typeof(bool) == "boolean") { if (bool) { return 1; } else { return 0; } } ;return 0; } ;function IntToBool(val, defRetVal) { if (defRetVal == null) { defRetVal = false; } ;if (val == null) { return defRetVal; } ;if (!isNaN(parseInt(val))) { var intVal = parseInt(val); if (intVal > 0) { return true; } else { return false; } } ;return defRetVal; } ;function BoolToString(bool) { if (bool == null) { return "false"; } ;if (typeof(bool) == "boolean") { if (bool) { return "true"; } else { return "false"; } } ;return "false"; } ;function StringFormat() { var argumentList = StringFormat.arguments; var argsLen = argumentList.length; if(!argsLen) { return ""; } else { var newString = argumentList[0]; var tmp = argsLen - 1; for(var i = 0; i < tmp; ++i) { newString = newString.replace(new RegExp("%" + i, "g"), (argumentList[i + 1] + "").replace(/\$/g, "$$$$")); } ;return newString; } } ;function StringToBool(str) { if (str == null) { return false; } ;if (typeof(str) == "string") { if (str.toLowerCase() == "true") { return true; } else { return false; } } ;return false; } ;function EncodeXML(str) { return str ? str.replace(/</g, "&lt;").replace(/>/g, "&gt;") : ""; } ;function FindElementInArray(element, array, compFunc) { if (element == null) { ; return -1; } ;if (IsArrayNullOrEmpty(array)) { ; return -1; } ;if (compFunc == null) { compFunc = function(lv, rv) { if (lv == rv) return 0; else if (lv < rv) return -1; return 1; } } ;for (var i = 0; i < array.length; ++i) { var tmp = array[i]; if (compFunc(element, tmp) == 0) { return i; } } ;return -1; } ;function CreateHiddenFrame( win ) { try { var frame = win.document.createElement( "iframe" ); if( !UserAgentInfo.GetInstance().IsSafari() ) { var divObj = document.createElement('DIV'); win.document.body.appendChild( divObj ); divObj.style.display = "none"; frame.src = "D73E24ABE956.htm"; divObj.appendChild(frame); frame.style.display = "none"; } else { var divObj = document.createElement('div'); win.document.body.appendChild( divObj ); divObj.style.height = "0"; divObj.style.width = "0"; divObj.style.visibility = "hidden"; divObj.appendChild(frame); frame.style.height = "0"; frame.style.width = "0"; frame.style.visibility = "hidden"; } ;return frame; } catch( ex ) { return null; } } ;function CreateNodeOutside(nodeType, nodeId) { var node = document.createElement(nodeType || "DIV"); document.body.appendChild(node); node.style.position = "absolute"; node.style.width = "1px"; node.style.height = "1px"; node.style.left = "-100px"; node.style.top = "0px"; node.style.overflow = "hidden"; node.style.visibility = "hidden"; if (nodeId != null) { node.id = nodeId; } ;return node; } ;function GetMainWindow() { var win = null; try { win = window.top; while (win.opener) { win = win.opener; } } catch (e) { ; win = null; } ;return win; } ;function CloneObject( src, dst ) { var it = null; for( it in dst ) { if( typeof dst[it] == "function" ) continue; delete dst[it]; } ;for( it in src ) { if( typeof src[it] == "function" ) continue; dst[it] = src[it]; } } ;function CloneObj(dst) { var obj = new Object(); for(var item in dst) { obj[item] = dst[item]; } ;return obj; } ;function Size( width, height, left, top ) { this.width = width; this.height = height; this.left = left; this.top = top; } ;function AdjustWindowHeight(height) { var adjustedHeight = 0; if ( screen.height > 630 ) { adjustedHeight = height; } else if ( screen.height > height - 50 + 70 ) { adjustedHeight = height - 50; } else { adjustedHeight = screen.height - 70; } ;return adjustedHeight; } ;function CWA__OpenWindow(url, name, isWithDefaultOption, size, isResizable) { name = name || "_blank"; var options = ""; if( isWithDefaultOption == false ) { var resizeOption = isResizable? "resizable=yes" : "resizable=no"; options = "height=" + size.height + ",width=" + size.width + ",menubar=no,titlebar=yes," + resizeOption + ",scrollbars=no,status=no,toolbar=no"; } else { options = "location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes"; } ;return window.open( url, name, options ); } ;function SafelyCloseWindow( win ) { try { if( win && !win.closed ) { win.close(); } } catch(ex){} ;return null; } ;function CountDialogSizeMargin(inputDialog) { if (inputDialog == null) { var dialog = window.showModelessDialog(GetBlankPageUrl(), null, "dialogWidth:100px;dialogHeight:105px;dialogTop:10000;dialogLeft:10000;status:no"); } else { var dialog = inputDialog; } ;try { if (dialog.document.body == null) { dialog.document.open(); dialog.document.write(""); dialog.document.close(); } ;window._dialogWidthDelta = parseInt(dialog.dialogWidth) - dialog.document.body.offsetWidth; window._dialogHeightDelta = parseInt(dialog.dialogHeight) - dialog.document.body.offsetHeight; } catch(ex) { window._dialogWidthDelta = null; window._dialogHeightDelta = null; } ;if (inputDialog == null && dialog != null) { dialog.close(); } } ;function OpenDialog(url, name, size, opener) { if (opener == null) opener = window; if ((name == null) || (name == "")) name = "_blank"; if (size == null) size = new Size(); var optionstring = ""; if (opener.showModelessDialog) { if ((url == null) || (url == "") ) { url = GetBlankPageUrl(); } ;if (window._dialogWidthDelta && window._dialogHeightDelta) { size.width += window._dialogWidthDelta; size.height += window._dialogHeightDelta; } ;optionstring = "dialogLeft:" + size.left + "px;dialogTop:" + size.top + "px;dialogWidth:" + size.width + "px;dialogHeight:" + size.height + "px;scroll:no;help:no;status:no"; var win = null; try { win = opener.showModelessDialog(url, null, optionstring); } catch(e) { win = window.showModelessDialog(url, null, optionstring); } ;try { if (window._dialogWidthDelta == null || window._dialogHeightDelta == null) { CountDialogSizeMargin( (url.indexOf("blank.htm") != -1)? win : null ); if( window._dialogWidthDelta != null ) { win.dialogWidth = size.width + window._dialogWidthDelta + "px"; win.dialogHeight = size.height + window._dialogHeightDelta + "px"; } } } catch (ex) { ; } ;return win; } else { if ((url == null) || (url == "") ) url = GetBlankPageUrl(); optionstring = "left=" + size.left + ",top=" + size.top + ",width=" + size.width + ",height=" + size.height + ",scrollbars=no,status=no,resizable=no,dialog=yes,dependent=yes"; return opener.open(url, name, optionstring); } } ;function WriteContentToWindow(win, text, contextObj, url, isFullPath) { contextObj.domWindow = win; win.contextObj = contextObj; win.document.write(text); win.document.close(); win.contextObj = contextObj; win.MouseMoving = new Event(); win.MouseDown = new Event(); win.KeyDown = new Event(); if (isFullPath == true) { url = GetPageAbsolutePath() + url; } ;text = "<iframe id='inner' scrolling='no' height='100%' width='100%' frameborder='0' src='" + GetBlankPageUrl() + "'></iframe>"; win.document.body.innerHTML = text; var iframeWin = GetFrameWindow( win.document.getElementById("inner") ); if (iframeWin) { if (iframeWin.location) iframeWin.location = url; else iframeWin.src = url; } } ;function SafelyWriteWindowContent(win, isToDetectPageLoading, callback) { if( isToDetectPageLoading ) { try { win.document.title = "try"; } catch(ex) { callback( true, false ); return; } } ;var failRetryTime = 0; var isCalledByTimer = false; var WriteContentFunc = function() { try { if( isToDetectPageLoading && win.document.title == "try" ) { isCalledByTimer = true; window.setTimeout( WriteContentFunc, 0 ); return; } ;callback( false, isCalledByTimer ); } catch(ex) { if( win && !win.closed && failRetryTime < 3 ) { failRetryTime ++; isCalledByTimer = true; window.setTimeout( WriteContentFunc, 0 ); } else { callback( true, isCalledByTimer ); } } } ;WriteContentFunc(); } ;function CreateNewWindowWithText(name, title, text, style) { var win = null; if (style) { var win = window.open("about:blank", name, style); } else { var win = CWA__OpenWindow( "about:blank", name ); } ;if (!win) { return null; } ;if (UserAgentInfo.GetInstance().IsSafari()) { win.document.title = "try"; var testLoaded = function() { if (win.document.title != "try") { win.document.open(); win.document.write(text); win.document.close(); win.document.title = title; } else { window.setTimeout(testLoaded, 10); } } ;window.setTimeout(testLoaded, 10); } else { win.document.open(); win.document.write(text); win.document.close(); win.document.title = title; } ;win.focus(); } ;function GetNextSiblingByName(node, name) { var currentNode = node; while( currentNode!=null && currentNode.nodeName != name ) { currentNode = currentNode.nextSibling; } ;return currentNode; } ;function GetClientX(node) { return GetOffsetX(node) - GetScrollOffsetX(node); } ;function GetClientY(node) { return GetOffsetY(node) - GetScrollOffsetY(node); } ;function GetOffsetX(node) { var xCoordinate = 0; while( node ) { if(node.offsetLeft) { xCoordinate += node.offsetLeft; } ;node = node.offsetParent; if(node) { if(document.all && node.clientLeft) { if(node.nodeName != "TABLE" && node.nodeName != "BODY" ) { xCoordinate += node.clientLeft; } } else if(!document.all && window.getComputedStyle) { var objcss = window.getComputedStyle(node, ""); if(objcss) { var clientLeft = parseInt(objcss.borderLeftWidth, 10); if(clientLeft) { if(node.nodeName == "DIV" || window.getComputedStyle(node, "").position == "absolute" ) { xCoordinate += clientLeft; } } } } } } ;return xCoordinate; } ;function GetScrollOffsetX(node) { var offset = 0; while(node) { if(node.scrollLeft) { offset += node.scrollLeft; } ;node = node.parentNode; } ;return offset; } ;function GetOffsetY(node) { var yCoordinate = 0; while( node ) { if(node.offsetTop) { yCoordinate += node.offsetTop; } ;node = node.offsetParent; if(node) { if(document.all && node.clientTop) { if(node.nodeName != "TABLE" && node.nodeName != "BODY" ) { yCoordinate += node.clientTop; } } else if(!document.all && window.getComputedStyle) { var objcss = window.getComputedStyle(node, ""); if(objcss) { var clientTop = parseInt(objcss.borderTopWidth, 10); if(clientTop) { if(node.nodeName == "DIV" || window.getComputedStyle(node, "").position == "absolute" ) { yCoordinate += clientTop; } } } } } } ;return yCoordinate; } ;function GetScrollOffsetY(node) { var offset = 0; while(node) { if(node.scrollTop) { offset += node.scrollTop; } ;node = node.parentNode; } ;return offset; } ;function GetBodyClientWidth() { if( document.all ) { return document.body.clientWidth; } else { return window.innerWidth; } } ;function GetBodyClientHeight() { if( document.all ) { return document.body.clientHeight; } else { return window.innerHeight; } } ;function GetWindowX(win) { if (!win) return 0; if (win.screenLeft) return win.screenLeft; else if (win.screenX) return win.screenX; else return 0; } ;function GetWindowY(win) { if (!win) return 0; if (win.screenTop) return win.screenTop; else if (win.screenY) return win.screenY; else return 0; } ;function GetParentTable(node) { node = node.parentNode; while( node != null && node.nodeName.toUpperCase() != "TABLE" ) { node = node.parentNode; } ;return node; } ;function IsAnonymousUri(uri) { var tagStr = "@anonymous.invalid"; if (uri.indexOf(tagStr) >= 0 && (uri.length == uri.indexOf(tagStr) + tagStr.length)) { return true; } ;return false; } ;function GetFrameWindowById(id) { var frame = document.getElementById(id); ; if (frame.contentWindow) { return frame.contentWindow; } else if (frame.all) { return document.frames(id); } else { return frame; } } ;function GetFrameWindow(frame) { ; if (frame.contentWindow) { return frame.contentWindow; } else if (frame.all) { return document.frames(frame.id); } else { return frame; } } ;function GetFrameDocumentById(id) { if (document.all) { return document.frames(id).document; } else { var frame = document.getElementById(id); ; if (frame.contentDocument) { return frame.contentDocument; } else { return frame.document; } } } ;function IsWithinDomTree( node, rootNode, stopperNode ) { try { if( rootNode == null ) return false; while( node != stopperNode && node != null ) { if( node == rootNode ) return true; node = node.parentNode; } ;return false; } catch(ex) { return false; } } ;function GetWidgetUniqueId( prefix, widgetName ) { if( widgetName.id != null ) { widgetName.id ++; } else { widgetName.id = 0; } ;return prefix + widgetName.id; } ;function GetGUID() { return "_guid_" + GetGUID._id++; } ;GetGUID._id = 0; function ResizeInlineNode(node, toWidth) { if (node == null) return; if (toWidth <= 0) { toWidth = 1; } ;if (node.style.display == "inline") { if (node.offsetWidth > toWidth) { node.style.display = ""; node.style.width = toWidth + "px"; } } else { if (node.scrollWidth > toWidth) { node.style.width = toWidth + "px"; } else { node.style.width = ""; node.style.display = "inline"; } } } ;function ResizeBlockNode(node, toWidth) { if (node == null) return; var margin = node._margin || 0; var tmpWidth = toWidth - margin; if (tmpWidth <= 0) tmpWidth = 1; node.style.width = tmpWidth + "px"; var realWidth = node.offsetWidth; if (realWidth != null && realWidth != 0 && realWidth != tmpWidth + margin) { node._margin = realWidth - tmpWidth; tmpWidth = toWidth - node._margin; if (tmpWidth <= 0) tmpWidth = 1; node.style.width = tmpWidth + "px"; } } ;function AppendInlineBlock( parentNode ) { var node = document.createElement( "SPAN" ); if( node == null ) return null; parentNode.appendChild( node ); var ua = UserAgentInfo.GetInstance(); if( ua.IsIE() ) { if( ua.GetBrowserVersion() > "5.01" ) { node.style.display = "inline-block"; } else { node.style.width = 0; } } else if(ua.IsSafari() && !ua.IsSafari(3)) { node.style.display = "inline-block"; } else { node.style.display = "table-cell"; node.style.verticalAlign = "middle"; } ;return node; } ;function RemoveInlineBlock( parentNode, childNode ) { return parentNode.removeChild(childNode); } ;function RefreshSafariUI(node) { if (node == null) { node = document.body; } ;if (node.scrollTop != null) { node.scrollTop = node.scrollTop; } else { node.style.visibility = "hidden"; var timeoutHandler = function(){node.style.visibility = "visible";} ;window.setTimeout(timeoutHandler, 0); } } ;function CompareStringNoCase(string1, string2) { return CompareObject( string1.toLowerCase(), string2.toLowerCase() ); } ;function CompareObject(obj1, obj2) { if( obj1 == obj2 ) { return 0; } else { return ( obj1 < obj2 )? -1 : 1; } } ;CompareVersion.VersionRegExp = /^([\d]+).([\d]+).([\d]+).([\d]+)$/i; function CompareVersion(version1, version2) { var ver1Array = [0, 0, 0, 0]; var ver2Array = [0, 0, 0, 0]; if (version1 && version1.match(CompareVersion.VersionRegExp)) { ver1Array[0] = parseInt(RegExp.$1); ver1Array[1] = parseInt(RegExp.$2); ver1Array[2] = parseInt(RegExp.$3); ver1Array[3] = parseInt(RegExp.$4); } ;if (version2 && version2.match(CompareVersion.VersionRegExp)) { ver2Array[0] = parseInt(RegExp.$1); ver2Array[1] = parseInt(RegExp.$2); ver2Array[2] = parseInt(RegExp.$3); ver2Array[3] = parseInt(RegExp.$4); } ;for (var i = 0; i < 4; i++) { if (ver1Array[i] < ver2Array[i]) return -1; else if (ver1Array[i] > ver2Array[i]) return 1; } ;return 0; } ;function CompareStringLength(string1, string2) { var len1 = string1.length; var len2 = string2.length; if (len1 < len2) return -1; else if (len1 == len2) return 0; else return 1; } ;function Trim(string) { if (string == null || string.length == 0) return ""; if (Trim.SpaceRegExp == null) { var spaceRegExp = "\\s|" + String.fromCharCode(12288) + "|" + String.fromCharCode(160); Trim.SpaceRegExp = new RegExp("(^(" + spaceRegExp + ")*)|((" + spaceRegExp + ")*$)", "g"); } ;return string.toString().replace(Trim.SpaceRegExp, ""); } ;function BinarySearch( array, inputObj, comparisonFunctor ) { if( array.length == 0 ) return 0; var headIndex = 0; var obj = array[0]; if( comparisonFunctor( obj, inputObj ) >= 0 ) { return 0; } ;var tailIndex = array.length - 1; obj = array[ tailIndex ]; var comparedValue = comparisonFunctor( obj, inputObj ); if( comparedValue < 0 ) { return array.length; } else if( comparedValue == 0 ) { return tailIndex; } ;var curIndex = null; while( tailIndex - headIndex > 1 ) { curIndex = Math.floor( (tailIndex + headIndex)/2 ); obj = array[ curIndex ]; comparedValue = comparisonFunctor( obj, inputObj ); if( comparedValue < 0 ) { headIndex = curIndex; } else if( comparedValue > 0 ) { tailIndex = curIndex; } else { return curIndex; } } ;return tailIndex; } ;function IsObject(obj) { return obj != null && typeof obj == "object"; } ;function IsNumber( number ) { return typeof number == "number"; } ;function IsNumberChar(chr) { switch(chr.charAt(0)) { case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return true; } ;return false; } ;function IsFunction( fun ) { return typeof fun == "function"; } ;function IsString( str ) { return typeof str == "string"; } ;function GetPageParameter(key) { ; var arg = key + "="; var target = window.location.search; var len = target.length; var i = 0; if (target.indexOf('?') == 0) { target = target.substring(1, target.length); } while (i < len) { var j = i + arg.length; if (target.substring(i, j) == arg) { var index = target.indexOf("&", j); if (index == -1) { index = len; } ;var tmp = target.substring(j, index); if (tmp.indexOf("%25") != -1) { tmp = unescape(unescape(tmp)); } else { tmp = unescape(tmp); } ;return tmp; } ;i = target.indexOf("&", i) + 1; if (i == 0) { break; } } ;return null; } ;function OpenChromeWindow(url, name, option, opener, needRaisePrivilege) { var win = null; if (opener == null) { opener = window; } ;if (UserAgentInfo.GetInstance().IsSignedCodeSupported() && needRaisePrivilege != false) { win = SignedOpenWindowAgent(opener, url, name, option); } else { win = opener.open(url, name, option); } ;return win; } ;function FlashFireFoxWindow(win) { if (!UserAgentInfo.GetInstance().IsSignedCodeSupported()) return; if (win._flashFrame == null) { win._flashFrame = CreateHiddenFrame(win); } ;if (win._flashFrame != null) { with (win.location) { var index = href.lastIndexOf("/"); var path = href.substr(0, index + 1); } ;win._flashFrame.src = "jar:" + path + "ffWndFlasher.jar!/ffWndFlasher.htm"; } } ;function CleanupFlashFireFox(win) { if (win != null && win._flashFrame != null) { win._flashFrame = null; } } ;function ExtractDisplayNameFromSipUri(sipUri) { var displayName = ""; if(IsAnonymousUri(sipUri)) { displayName = L_ANON_USER_GENERAL_DISPLAY_NAME; } else { displayName = ParsePhoneUri(sipUri); } ;return displayName || NormalizeSipUri(sipUri); } ;function GetDisplayNameOfParticipantOrUri(participantOrUri) { if(typeof participantOrUri == "string") { return ExtractDisplayNameFromSipUri(participantOrUri); } else { return participantOrUri.name || ExtractDisplayNameFromSipUri(participantOrUri.uri); } } ;function FocusChromeWindow(win, isTempFocus) { if ((win == null) || (win.closed == true)) return; try { win.top.isTempFocus = (isTempFocus == true); win.focus(); if (win.getAttention) { win.getAttention(); } } catch(e) { } } ;function StopEventBubble(e) { if (e.stopPropagation) { e.stopPropagation(); } else { e.cancelBubble = true; } } ;function GetEventOrigTarget(e) { if (e.srcElement) { var node = e.srcElement; } else { var node = e.originalTarget; } ;if (node.nodeName == "#text") { node = node.parentNode; } ;return node; } ;function AddDomEventHandler( node, eventName, handler ) { var eventDispatcher = node[ eventName ]; if( eventDispatcher == null || eventDispatcher._handlerChain == null ) { var func = function(e) { var newArguments = new Array( e || event, this ); var array = arguments.callee._handlerChain; for( var i = 0; i < array.length; i ++ ) { if( array[ i ]._isLegacy ) { array[ i ].apply( this, arguments ); } else { array[ i ].apply( this, newArguments ); } } } ;if( eventDispatcher ) { eventDispatcher._isLegacy = true; func._handlerChain = [eventDispatcher, handler]; } else { func._handlerChain = [handler]; } ;node[ eventName ] = func; } else { eventDispatcher._handlerChain.push( handler ); } } ;function IsPointInRect(x, y, rectTop, rectLeft, rectWidth, rectHeight) { if(x < rectLeft || x > rectLeft + rectWidth || y < rectTop || y > rectTop + rectHeight) { return false; } else { return true; } } ;function AttachToDomEvent(object, eventNameForFF, eventNameForIE, callBackFunc) { if(object.addEventListener) { object.addEventListener(eventNameForFF, callBackFunc, false); } else if(object.attachEvent) { object.attachEvent(eventNameForIE, callBackFunc); } else { return false; } ;return true; } ;function ReleaseFromDomEvent(object, eventNameForFF, eventNameForIE, callBackFunc) { if(object.removeEventListener) { object.removeEventListener(eventNameForFF, callBackFunc, false); } else if(object.detachEvent) { object.detachEvent(eventNameForIE, callBackFunc); } else { return false; } ;return true; } ;function EnableDefaultContextMenu(node) { node.oncontextmenu = function(e) { if (e) { e.stopBubble = true; } else { event.cancelBubble = true; } } } ;function IsDefaultContextMenuEnabled(e) { return e.stopBubble == true; } ;function DisableDefaultContextMenu(node) { node.oncontextmenu = function(e) { if (e) { if (e.stopBubble != true) return false; } else { return false; } } } ;function Inner_ReturnFalse() { return false; } ;function DisableSelect(node) { node.style.MozUserSelect = "none"; node.onselectstart = Inner_ReturnFalse; } ;function EnableSelect(node) { node.style.MozUserSelect = ""; node.onselectstart = ""; } ;function CleanCookieContent(cookieName) { if (GetCookie(cookieName)) { document.cookie = cookieName + "=; path=/;"; } } ;function ShowHide(obj, sh) { if (obj != null) { var visible = IsVisible(obj); if (visible != sh) { obj.style.display = sh ? "block" : "none"; } } } ;function IsVisible(obj) { var result = false; if (obj != null && obj.style != null) { var d = obj.style.display; result = (d != null && d != 'none'); } ;return result; } ;function OpenHiddenWindow(url, name) { if (url == null || url == "") url = GetBlankPageUrl(); var left = 0; var top = 0; var ua = UserAgentInfo.GetInstance(); if (ua.IsSafari()) { left = window.screen.availWidth - 1; top = window.screen.availHeight; } else { left = 10000; top = 10000; } ;var win = null; var option = "width=1, height=1, left=" + left + ", top=" + top; try { if (ua.IsSignedCodeSupported()) { win = SignedOpenWindowAgent(window, url, name, option); } else { win = window.open(url, name, option); } } catch (ex) { win = null; } ;return win; } ;function IsWindowMinimized(win) { if (win.screenTop) { var screenTop = win.screenTop; } else { var screenTop = win.screenY; } ;if (screenTop + window.screen.height <= 0) { return true; } else { return false; } } ;function GetXDPIRatio() { if (screen.logicalXDPI != null && screen.deviceXDPI != null) { return screen.logicalXDPI/screen.deviceXDPI; } else { return 1; } } ;function GetYDPIRatio() { if (screen.logicalYDPI != null && screen.deviceYDPI != null) { return screen.logicalYDPI/screen.deviceYDPI; } else { return 1; } } ;function BlockHandler() { try { window.alert(L_Logon_Popup_Blocker); window.obj.HardSignOff(); } catch(ex) { } } ;function IsPopupBlockerWorking() { var rv = false; var detectorWnd = null; var blankPageUrl = GetBlankPageUrl(); try { do { var detectorWndName = "CWA_PBD_WND_" + new Date().getSeconds().toString(); detectorWnd = OpenHiddenWindow(blankPageUrl, detectorWndName); if (null == detectorWnd || true == detectorWnd.closed) { rv = true; break; } } while (false); } catch (ex) { rv = true; } ;if (null != detectorWnd) { try { detectorWnd.close(); } catch (ex) { } } ;return rv; } ;function SetSessionCookie(name, value) { if (IsStringNullOrEmpty(name) || IsStringNullOrEmpty(value)) { return; } ;document.cookie = name + "=" + escape(value) + "; path=/"; } ;function SetCookie(name, value, date) { if (IsStringNullOrEmpty(name) || value == null) { return; } ;if (date == null) { date = new Date(); date.setUTCFullYear(date.getUTCFullYear() + 50); } ;if (escape(value).length >= 3072) { throw "CookieFullException"; } else { if (IsCookieDisabled()) { throw "CookieDisabledException"; } else { document.cookie = name + "=" + escape(value) + "; expires=" + date.toUTCString() + "; path=/"; } } } ;function IsCookieDisabled() { var rv = false; if (!window.navigator.cookieEnabled) { rv = true; } ;var testValue = "CookieEnabled"; var gotValue = null; try { document.cookie = "CookieTest=" + escape(testValue); gotValue = GetCookie("CookieTest"); } catch (exception) { rv = true; } ;if ((gotValue == null) || (gotValue != testValue)) { rv = true; } ;RemoveCookie("CookieTest"); return rv; } ;function GetCookie(name) { var value = null; if (IsStringNullOrEmpty(name)) { return value; } ;if (document.cookie.length == 0) { return value; } ;var cookies = document.cookie.split("; "); for (var i = 0; i < cookies.length; ++i) { if (cookies[i].indexOf('=') != -1) { var pair = cookies[i].split('='); if (name == pair[0]) { value = unescape(pair[1]); break; } } else if (name == cookies[i]) { value = ""; } } ;return value; } ;function RemoveCookie(name) { if (IsStringNullOrEmpty(name)) { return null; } ;var date = new Date(); date.setUTCFullYear(1980); document.cookie = name + "=; path=/; expires=" + date.toUTCString(); } ;function SetGroupCookie(grouName, keyName, keyValue, isSessionCookie) { var groupValue = GetCookie(grouName); var isFound = false; var valueArray = new Array(); if (groupValue) { valueArray = groupValue.split("&"); for (var i = 0; i < valueArray.length; i++) { var pairArray = valueArray[i].split(" "); var key = unescape(pairArray[0]); if (key == keyName) { isFound = true; pairArray[1] = escape(keyValue); valueArray[i] = pairArray.join(" "); break; } } } ;if (isFound == false) { valueArray.push(escape(keyName) + " " + escape(keyValue)); } ;if (isSessionCookie == true) { SetSessionCookie(grouName, valueArray.join("&")); } else { SetCookie(grouName, valueArray.join("&")); } } ;function GetGroupCookie(grouName, keyName) { var groupValue = GetCookie(grouName); if (groupValue) { var valueArray = groupValue.split("&"); for (var i = 0; i < valueArray.length; i++) { var pairArray = valueArray[i].split(" "); var key = unescape(pairArray[0]); if (key == keyName) { return unescape(pairArray[1]); } } } ;return null; } ;function DisableWindow(windowObj, purpose) { try { var blockerDiv = windowObj.document.getElementById('_' + purpose + 'EventBlockerDiv'); if (blockerDiv == null) { blockerDiv = MakeBlockerDiv(windowObj.document, purpose); windowObj.document.body.style.overflow = 'hidden'; windowObj.document.body.appendChild(blockerDiv); } ;DisableBlockerDivEvents(blockerDiv, purpose); blockerDiv.style.display = 'block'; } catch( ex ) {} } ;function EnableWindow(windowObj, purpose) { try { var blockerDiv = windowObj.document.getElementById('_' + purpose + 'EventBlockerDiv'); if (blockerDiv != null) { EnableBlockerDivEvents(blockerDiv); blockerDiv.style.display = 'none'; } } catch( ex ) {} } ;function MakeBlockerDiv(docObj, purpose) { var ua = UserAgentInfo.GetInstance(); var div = null; if (ua.IsSafari()) { div = document.createElement('div'); } else { div = docObj.createElement('DIV'); } ;div.id = '_' + purpose + 'EventBlockerDiv'; div.style.position = 'absolute'; div.style.top = 0; div.style.left = 0; div.style.width = window.screen.width; div.style.height = window.screen.height; DisableSelect( div ); if (ua.IsIE()) { div.style.backgroundColor = 'white'; div.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=20, Style=0)'; } else { div.style.backgroundColor = 'transparent'; } ;return div; } ;function DisableBlockerDivEvents(div, purpose) { if (div == null || purpose == null) { return; } ;if (purpose == 'all') { div.style.zIndex = 512; div.onclick = WindowManager.prototype.FocusTopMessageDialog; div.ondbclick = WindowManager.prototype.FocusTopMessageDialog; div.onfocus = WindowManager.prototype.FocusTopMessageDialog; } else { div.style.zIndex = 256; div.onclick = ModalDialogManager.prototype.FocusTopModalDialog; div.ondblclick = ModalDialogManager.prototype.FocusTopModalDialog; div.onfocus = ModalDialogManager.prototype.FocusTopModalDialog; } } ;function Dom(idOrNode) { return typeof(idOrNode) == "string" ? document.getElementById(idOrNode) : idOrNode; } ;function ShowDomNode(idOrNode, showIt) { if(!Dom(idOrNode)) { return; } ;var style = Dom(idOrNode).style; if(showIt && style.display == "none") { style.display = ""; return true; } else if(!showIt && style.display != "none") { style.display = "none"; return true; } ;return false; } ;function ShowDomBG(idOrNode, bgsrc) { Dom(idOrNode).style.backgroundImage = "url('" + bgsrc + "')"; } ;function SetDomFont(idOrNode) { var domNode = Dom(idOrNode); domNode.style.fontFamily = L_Font_Family; domNode.style.fontSize = L_Font_Size; } ;function SetDomCss(idOrNode, cssName) { Dom(idOrNode).className = cssName; } ;function SetDomStyle(idOrNode, styleKey, value) { Dom(idOrNode).style[styleKey] = value; } ;function SetDomHint(idOrNode, hintString) { Dom(idOrNode).title = hintString; } ;function SetNodeTransparency(node, opacityLevel) { if (node && opacityLevel != null && opacityLevel >=0 && opacityLevel <= 1) { node.style.opacity = opacityLevel; node.style.filter = "alpha(opacity=" + (opacityLevel * 100) + ")"; } } ;function EnableBlockerDivEvents(div) { if (div == null) { return; } ;div.onclick = null; div.ondbclick = null; div.onfocus = null; } ;function GetModalDialogManager() { var windowObj = window; if (windowObj.top.obj != null && windowObj.top.obj.modalDialogManager != null) { return windowObj.top.obj.modalDialogManager; } while (windowObj.obj == null || windowObj.obj.modalDialogManager == null) { if (windowObj.top.opener != null) { windowObj = windowObj.top.opener; } else { break; } } ;if (windowObj.obj.modalDialogManager != null) { return windowObj.obj.modalDialogManager; } else { return null; } } ;function GetModelessDialogManager() { var windowObj = window; if (windowObj.top.obj != null && windowObj.top.obj.modelessDialogManager != null) { return windowObj.top.obj.modelessDialogManager; } while (windowObj.obj == null || windowObj.obj.modelessDialogManager == null) { if (windowObj.top.opener != null) { windowObj = windowObj.top.opener; } else { break; } } ;if (windowObj.obj.modelessDialogManager != null) { return windowObj.obj.modelessDialogManager; } else { return null; } } ;function GetSoundManager() { var windowObj = window; if (windowObj.top.obj != null && windowObj.top.obj.soundManager != null) { return windowObj.top.obj.soundManager; } while (windowObj.obj == null || windowObj.obj.soundManager == null) { if (windowObj.top.opener != null) { windowObj = windowObj.top.opener; } else { break; } } ;if (windowObj.obj != null && windowObj.obj.soundManager != null) { return windowObj.obj.soundManager; } else { return null; } } ;function GetOptionManager() { var windowObj = window; if (windowObj.top.obj != null && windowObj.top.obj.optionManager != null) { return windowObj.top.obj.optionManager; } while (windowObj.obj == null || windowObj.obj.optionManager == null) { if (windowObj.top.opener != null) { windowObj = windowObj.top.opener; } else { break; } } ;if (windowObj.obj != null && windowObj.obj.optionManager != null) { return windowObj.obj.optionManager; } else { return null; } } ;function GetOptionData() { var optionManager = GetOptionManager(); if (optionManager != null) { return optionManager.GetOptionData(); } else { return null; } } ;function GetQueryString(queryString) { if (queryString == null || Trim(queryString).length == 0) { return; } ;var tmpMap = new Map(); queryString = Trim(queryString).substr(1); var arr = queryString.split("&"); for (var i = 0; i < arr.length; ++i) { var tmp = arr[i].split("="); tmpMap.Add(tmp[0], unescape(tmp[1])); } ;return tmpMap; } ;function ClearSelection(selObj) { if (selObj == null) { return; } ;if (document.all) { while(selObj.options.length > 0) { var o = selObj.options[0]; selObj.remove(o); } } else { while(selObj.options.length > 0) { var o = selObj.options[0]; selObj.removeChild(o); } } } ;function EncodeC0Chars(str) { var str = str + ""; if(!str) { return ""; } else { for(var i = 1; i < 32; i++) { str = str.replace(EncodeC0Chars._stringFromCharCode[i], "&#x" + EncodeC0Chars._hex[i] + ";"); } ;return str; } } ;(function() { EncodeC0Chars._stringFromCharCode = []; EncodeC0Chars._hex =[]; for(var i = 1; i < 32; ++i) { EncodeC0Chars._stringFromCharCode[i] = new RegExp(String.fromCharCode(i), "g"); EncodeC0Chars._hex[i] = i.toString(16).toUpperCase(); } })(); function EscapeXmlSensitveChar(str) { var str = str + ""; if(!str) { return ""; } ;str = str.replace(/&/ig, "&amp;"); str = str.replace(/</ig, "&lt;"); str = str.replace(/>/ig, "&gt;"); str = str.replace(/\'/ig, "&apos;"); str = str.replace(/\"/ig, "&quot;"); return EncodeC0Chars(str); } ;function FillSelection(selObj, dataArray) { if (selObj == null || IsArrayNullOrEmpty(dataArray)) { return; } ;var options = null; if (selObj.options.add) { options = selObj.options; } else { options = selObj; } ;for (var i = 0; i < dataArray.length; ++i) { var item = dataArray[i]; var option = new Option(item.text, item.value); option.title = item.text; options.add(option); } } ;function MessageBox(text, caption, type, delegateForClosed, hasCheckBox, checkBoxLabel, opener) { var msgDlgContextObj = new MessageDialogContext(); msgDlgContextObj.delegateForInitialized = null; msgDlgContextObj.delegateForClosed = delegateForClosed; msgDlgContextObj.text = text; msgDlgContextObj.caption = caption; msgDlgContextObj.type = type; msgDlgContextObj.hasCheckBox = hasCheckBox; msgDlgContextObj.checkBoxLabel = checkBoxLabel; msgDlgContextObj.opener = opener || window; var modalDialogMgr = GetModalDialogManager(); var win = null; if (modalDialogMgr != null) { win = modalDialogMgr.OpenDialog(WindowToken.MessageDialog, msgDlgContextObj); } ;msgDlgContextObj = null; return win; } ;function CloseMessageBox(msgBox) { if (msgBox != null) { var modalDialogMgr = GetModalDialogManager(); if (modalDialogMgr != null) { modalDialogMgr.CloseDialog(msgBox); } } } ;function ValidateDomainNameFormat(str) { if (IsStringNullOrEmpty(str)) { return false; } ;if (str.match(ValidateDomainNameFormat.DomainRegExp)) { return true; } ;return false; } ;ValidateDomainNameFormat.DomainRegExp = /^([a-zA-Z0-9-]+)((\.[a-zA-Z0-9-]+)*)$/i; function ValidateSipUriFormat(str) { if(typeof(str) != "string") { return false; } ;if (IsStringNullOrEmpty(str)) { return false; } ;if (str.match(ValidateSipUriFormat.SipUriRegExp)) { return ValidateDomainNameFormat(RegExp.$3); } ;return false; } ;ValidateSipUriFormat.SipUriRegExp = /^(sip:)?([^@]+)@([^@]+)$/i; function LowerCaseSipUriDomainPart(uri) { ; var uri = Trim(uri); if (uri.match(ValidateSipUriFormat.SipUriRegExp)) { return RegExp.$1 + RegExp.$2 + '@' + (RegExp.$3).toLowerCase(); } else { return uri; } } ;function NormalizeSipUri(uri) { ; var uri = Trim(uri); if (uri.toLowerCase().indexOf("sip:") == 0) { return uri.substring(4, uri.length); } else { return uri; } } ;function FormalizeSipUri(uri) { ; var uri = Trim(uri); ; if (uri.toLowerCase().indexOf("sip:") != 0) { uri = "sip:" + uri; } ;return uri; } ;function ParsePhoneUri( phoneUri ) { if (IsStringNullOrEmpty(phoneUri)) return ""; var reg1 = new RegExp(/((tel:|sip:)?)([^\@]*)((;phone-context=(\w+))(@((\w|\W)+);user=phone)?)/); var reg2 = new RegExp(/((tel:|sip:)?)([^\@]*)((@((\w|\W)+);user=phone)?)/); var matchResult = phoneUri.match(reg1); if (!IsArrayNullOrEmpty(matchResult)) { return Trim(matchResult[3]); } else { matchResult = phoneUri.match(reg2); if(!IsArrayNullOrEmpty(matchResult)) { return Trim(matchResult[3]); } } ;return ""; } ;function GetUriDomain( uri ) { if( uri != null && uri.length > 0 ) { var matchResult = uri.match( /@([^@]+)$/ ); if( matchResult ) { return uri.substring( matchResult.index + 1, uri.length ); } } ;return null; } ;function GetHttpUriDomain(httpUri) { if(httpUri) { var uri = httpUri.toLowerCase(); var reg = new RegExp("^https?://([^/]+)/", "g"); var matchedArr = reg.exec(uri); if(matchedArr && matchedArr.length > 1) { uri = matchedArr[1]; var index = uri.indexOf("."); return uri.substring(index + 1, uri.length); } } ;return ""; } ;function IsEqualSipUri(leftUri, rightUri) { if (leftUri == null && rightUri == null) return true; if (leftUri == null || rightUri == null) return false; if (NormalizeSipUri(leftUri).toLowerCase() == NormalizeSipUri(rightUri).toLowerCase()) { return true; } else { return false; } } ;function GetExtensibleXMLString(xmlNode, knownElementsArray) { if (!xmlNode || !xmlNode.childNodes || xmlNode.childNodes.length <= 0) { return ""; } ;var str = ""; for (var i = 0; i < xmlNode.childNodes.length; i++) { var node = xmlNode.childNodes[i]; var isKnown = false; for (var j = 0; j < knownElementsArray.length; j++) { if (node.nodeName == knownElementsArray[j]) { isKnown = true; break; } } ;if (isKnown == false) str += XMLGetXMLString(node); } ;return str; } ;function IsSipUriBelongingToDomain(sipUri, domain) { ; ; var domainOfSipUri = sipUri.substr(sipUri.indexOf('@') + 1).toLowerCase(); return IsDomainBelongingToDomain(domainOfSipUri, domain); } ;function IsDomainBelongingToDomain(domain, rootDomain) { ; ; domain = Trim(domain); rootDomain = Trim(rootDomain); if (rootDomain.length <= domain.length) { var rootDomainName = rootDomain.toLowerCase(); var domainName = domain.toLowerCase(); var index = domainName.indexOf(rootDomainName); if (index != -1) { if ((domainName.length == rootDomainName.length) || ((domainName.length == rootDomainName.length + index) && (domainName.charAt(domainName.length - rootDomainName.length - 1) == '.'))) { return true; } } } ;return false; } ;function IsStringNullOrEmpty(str) { if (str == null || str.length == 0) { return true; } ;return false; } ;function IsArrayNullOrEmpty(array) { if (array == null || array.length == 0) { return true; } ;return false; } ;function CheckPhoneNumber( phoneNum ) { if( phoneNum != null && phoneNum.length > 0 ) { phoneNum = Trim( phoneNum ); if( phoneNum.match( /^((\+)?)((\d|\s|\(|\)|-)+)$/ ) ) { return phoneNum; } } ;return null; } ;function GetHrFromNPApiException(ex) { if (ex) { if (typeof(ex) == "string") { var errorPrefix = "HRESULT: "; var index = ex.indexOf(errorPrefix); if (index >= 0) { var errorCode = ex.substr(index + errorPrefix.length, 8); if (errorCode) { return errorCode.toLowerCase(); } } } ;return (ex.name || ex.message || ""); } else { return ""; } } ;function GetHrFromException(ex) { if (ex) { return (document.all)? (ex.number + "") : GetHrFromNPApiException(ex); } else { return ""; } } ;function ReplaceEntity(str) { if (IsStringNullOrEmpty(str)) { return ""; } ;var tmp = str; tmp = tmp.replace(/&gt;/ig, '>'); tmp = tmp.replace(/&lt;/ig, '<'); tmp = tmp.replace(/&nbsp;/ig, ' '); tmp = tmp.replace(/&amp;/ig, '&'); tmp = tmp.replace(/&quot;/ig, '"'); return tmp; } ;function IsContainC0Chars( str ) { if( IsStringNullOrEmpty(str) ) return false; var regExp = IsContainC0Chars.regExp; if( regExp == null ) { var regExpStr = String.fromCharCode(1); for( var i = 2; i < 32; i ++ ) { if( i == 10 || i == 13 ) continue; regExpStr += "|" + String.fromCharCode(i); } ;regExp = new RegExp( regExpStr ); IsContainC0Chars.regExp = regExp; } ;return ( str.match(regExp) != null ); } ;var C0PatternString = "&#("; for (var i = 0; i < 32; i++) { if (i == 10 || i == 13) { continue; } ;var str = "x" + i.toString(16) + "|" + i; if (i == 0) { C0PatternString = C0PatternString + str; } else { C0PatternString = C0PatternString + "|" + str; } } ;C0PatternString = C0PatternString + ");"; var C0RegExp = new RegExp(C0PatternString, "ig"); function RemoveC0Chars(str) { var str = str.replace(C0RegExp, " "); return str; } ;function ComposeMainFrameWindowName(str) { var rv = ""; if (str == null) { str = "" + Math.round((Math.random() * 1000)); } ;rv = str + window.location.hostname; rv = rv.replace(/(\@|\:)/g, ''); rv = rv.replace(new RegExp("&", "g"), "0"); rv = rv.replace(new RegExp("=", "g"), "1"); rv = rv.replace(new RegExp("\\+", "g"), "2"); rv = rv.replace(new RegExp("\\$", "g"), "3"); rv = rv.replace(new RegExp("\\?", "g"), "4"); rv = rv.replace(new RegExp("/", "g"), "5"); rv = rv.replace(new RegExp("-", "g"), "6"); rv = rv.replace(new RegExp("_", "g"), "7"); rv = rv.replace(new RegExp("\\.", "g"), "8"); rv = rv.replace(new RegExp("!", "g"), "9"); rv = rv.replace(new RegExp("~", "g"), "A"); rv = rv.replace(new RegExp("'", "g"), "B"); rv = rv.replace(new RegExp("\\(", "g"), "C"); rv = rv.replace(new RegExp("\\)", "g"), "D"); rv = rv.replace(new RegExp(";", "g"), "E"); rv = rv.replace(new RegExp("\\*", "g"), "F"); rv = rv.replace(new RegExp("\\s", "g"), "_"); return rv; } ;function SplitString(string, regExp) { ; ; var rv = new Array(); if (UserAgentInfo.GetInstance().IsIE() || UserAgentInfo.GetInstance().IsSafari()) { var lastIndex = 0; var arr = null; while ((arr = regExp.exec(string)) != null) { var key = arr[0]; rv.push(string.substring(lastIndex, arr.index)); lastIndex = arr.index + key.toString().length; } ;if (lastIndex < string.length) { rv.push(string.substring(lastIndex, string.length)); } } else { rv = string.split(regExp); } ;return rv; } ;function CountBinaryOne(number) { if (isNaN(number)) { return 0; } ;var tmp = parseInt(number); var count = 0; while (tmp > 0) { if (tmp & 0x1 != 0) { ++count; } ;tmp = tmp >> 1; } ;return count; } ;function SetUiWidth(obj, width) { ; ; obj.style.width = parseInt(width) + "px"; } ;function SetUiHeight(obj, height) { ; ; obj.style.height = parseInt(height) + "px"; } ;function SetUiSize(obj, width, height) { ; ; ; obj.style.width = parseInt(width) + "px"; obj.style.height = parseInt(height) + "px"; } ;function SetCursorPosition(inputField, start, end) { if (inputField.setSelectionRange) { inputField.setSelectionRange(start, end); } else if (inputField.createTextRange) { var range = inputField.createTextRange(); range.collapse(true); range.moveStart('character', start); range.moveEnd('character', end); range.select(); } } ;function GetSafeIconUri(uri) { var protocolDelimeter = ":"; var protocol = document.location.protocol; var newUri = uri; if (uri) { newUri = uri.replace(/\\/g, "/"); } ;if (protocol && newUri) { protocol = protocol.toLowerCase(); newUri = newUri.toLowerCase(); var position = newUri.indexOf(protocolDelimeter); if (protocol == "https" || protocol == "https:" || protocol == "https://") { if (position < 0) { newUri = "https://" + newUri; } else { newUri = "https" + newUri.substring(position); } } else if (protocol == "http" || protocol == "http:" || protocol == "http://") { if (position < 0) { newUri = "http://" + newUri; } else { newUri = "http" + newUri.substring(position); } } else { } } ;return newUri; } ;function LoadImage(url) { if (url == null) return null; var img = new Image(); img.src = url; return img; } ;function Inner_ImageLoaded() { try { if (this._realNode) { SetImgSrc(this._realNode, this.src, true); } else { this.style.visibility = "visible"; } ;this.onload = null; if (Inner_LoadDisplayImage._availImgMap == null) { Inner_LoadDisplayImage._availImgMap = {};; } ;var iconUri = GetImgSrc(this); Inner_LoadDisplayImage._availImgMap[iconUri] = true; } catch (ex) { ; } } ;function Inner_LoadDisplayImage(img, iconUri, size, altIconUri) { if (size) { img.style.width = size.width + "px"; img.style.height = size.height + "px"; } ;if (Inner_LoadDisplayImage._availImgMap != null && Inner_LoadDisplayImage._availImgMap[iconUri] != null) { img.style.visibility = "visible"; SetImgSrc(img, Trim(iconUri), true); } else { if (!altIconUri) { if (img.src != null) { img.style.visibility = "hidden"; } ;var loadTestImg = img; } else { SetImgSrc(img, altIconUri, true); var loadTestImg = new Image(); loadTestImg.src = ""; loadTestImg._realNode = img; } ;loadTestImg.onload = Inner_ImageLoaded; SetImgSrc(loadTestImg, Trim(iconUri), true); } } ;function LoadDisplayImage(img, iconUri, size, altIconUri) { if (img == null || iconUri == null) return; if (altIconUri == iconUri) { altIconUri = ""; } ;if (LoadDisplayImage.protocol == null) { try { var protocol = document.location.protocol.toLowerCase(); if (protocol.indexOf("https") == 0) { LoadDisplayImage.protocol = "https"; } else { LoadDisplayImage.protocol = "http"; } } catch (ex) { var mainWindow = GetMainFrameWindow(); if (mainWindow && mainWindow.LoadDisplayImage) { LoadDisplayImage.protocol = mainWindow.LoadDisplayImage.protocol; } } } ;if (LoadDisplayImage.protocol == "http") { Inner_LoadDisplayImage(img, iconUri, size, altIconUri); } else { iconUri = iconUri.toLowerCase(); var position = iconUri.indexOf("http:"); if (position == 0) { if (size) { img.style.width = size.width + "px"; img.style.height = size.height + "px"; } ;var timeoutHandler = function() { Inner_LoadDisplayImage(img, iconUri, size, altIconUri); } ;window.setTimeout(timeoutHandler, 0); } else { Inner_LoadDisplayImage(img, iconUri, size, altIconUri); } } } ;function IsFilterNeeded( image, isPng ) { return ( document.all != null && parseInt(UserAgentInfo.GetInstance().GetIEEngineVersion(), 10) < 7 && (isPng == true || image.toLowerCase().lastIndexOf( ".png" ) == image.length - 4) ); } ;function GetImgHTML( src, isPng, isScaleToSize, isSetImgSrc, id, extraAttrHtml, needImg ) { if( src != null ) { var attrHTML = (id? (" id='" + id + "'") : "") + (extraAttrHtml || ""); if( IsFilterNeeded(src, isPng) ) { if(needImg) { return "<img" + attrHTML + " style='width:1px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + (( isSetImgSrc == false )? "" : src) + "\"" + (( isScaleToSize == true )? ", sizingMethod=\"scale\"" : "") + ")'" + " _imgSrc='" + src + "' />"; } else { return "<div" + attrHTML + " style='width:1px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + (( isSetImgSrc == false )? "" : src) + "\"" + (( isScaleToSize == true )? ", sizingMethod=\"scale\"" : "") + ")'" + " _imgSrc='" + src + "'></div>"; } } else { return "<img" + attrHTML + " src='" + ((isSetImgSrc == false)? "" : src) + "' />"; } } } ;function GetImgSrc(node) { if (!node) return ""; return (node.src != null)? node.src : (node._imgSrc || ""); } ;function SetImgSrc( node, src, isScaleToSize ) { if( node == null || src == null ) return; if( node.src != null ) { node.src = src; } else { node.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "'" + ((isScaleToSize == true)? ", sizingMethod='scale'" : "") + ")"; node._imgSrc = src; } } ;function GetBgImgHTML( src ) { if( src != null ) { if( IsFilterNeeded(src) ) { return "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + src + "\")"; } else { if(src == "") { return "background-image:none"; } ;return "background-image:url(" + src + ")"; } } } ;function SetBgImgSrc( node, src ) { if( node == null || src == null ) return; var bgImage = node.style.backgroundImage; if( (bgImage != null && bgImage != "") || !IsFilterNeeded(src) ) { if(src == "") { node.style.backgroundImage = "none"; } else { node.style.backgroundImage = "url(" + src + ")"; } } else { node.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + src + "\")"; } } ;function CloneToVisibleHelperDiv( targetNode ) { var helperDiv = document.getElementById( "_HelperDiv" ); if( helperDiv == null ) { helperDiv = document.createElement( "DIV" ); helperDiv = document.body.appendChild( helperDiv ); helperDiv.id = "_HelperDiv"; helperDiv.style.position = "absolute"; helperDiv.style.zIndex = "-100"; helperDiv.style.width = "1px"; helperDiv.style.height = "1px"; helperDiv.style.left = "-100"; helperDiv.style.top = "-100"; } ;if( helperDiv.firstChild ) { helperDiv.removeChild( helperDiv.firstChild ); } ;var newNode = helperDiv.appendChild( targetNode.cloneNode(true) ); ; return newNode; } ;function GetPageAbsolutePath() { var pathname = window.location.pathname; var index = pathname.lastIndexOf( "/" ); return ( index == -1 )? "" : pathname.substr( 0, index + 1 ); } ;function SafeDisposeEvent(obj) { if (obj == null) { return; } ;for (var key in obj) { try { if (obj[key] && obj[key].Add && obj[key].Fire && obj[key].args && obj[key].Dispose) { obj[key].Dispose(); } } catch (ex) {} finally { obj[key] = null; } } } ;function SafeDisposeMember(obj, memberName) { var member = obj[memberName]; if (member) { if (member.Dispose) { try { member.Dispose(); } catch (ex){} } ;obj[memberName] = null; } } ;function FontToString(font) { if (font == null) { return ""; } ;var tmp = "X-MMS-IM-Format: FN=" + font._face; var ef = ""; if ((font._style & 1) != 0) { ef += 'B'; } ;if ((font._style & 2) != 0) { ef += 'I'; } ;if ((font._style & 4) != 0) { ef += 'U'; } ;tmp += "; EF=" + ef; tmp += "; CO=" + ReverseRGBOrder(font._colorValue.substring(1, 7)).toLowerCase(); tmp += "; CS=1; PF=00\r\n\r\n"; return tmp; } ;function OpenErrorWindow() { try { var win = GetMainFrameWindow(); if(win) { if(win.isDebugVersion) { win.Debugger.OpenWindow(); } else if(win.L_appSettings.EnableExtendedClientErrorReporting && win.L_appSettings.EnableExtendedClientErrorReporting.toLowerCase()== "true") { win.obj.errorPane.OnViewDetailClicked(); } } } catch(ex) { ; } } ;function RecordError(type, errorMsg) { try { var win = GetMainFrameWindow(); if(win && win.isDebugVersion != true) { var error = IdentifyError(888); error.detailsInfo = errorMsg; win.obj.errorPane.RecordError(error); } else { ; } } catch(ex) { ; } } ;function SoundSourceForIE(fileName, length) { this.file = document.createElement('BGSOUND'); this.file.src = fileName; this.length = length; } ;function SoundSourceForSafari(fileName, length) { this.file = new Image(); this.file.src = fileName; this.length = length; } ;function SoundManager() { this.SoundSourceMap = []; this._timer = null; this._currentSound = null; this._isUsingDefaultTimeout = true; this._timeout = -1; this.PlaySound = function() {};; } ;SoundManager.SoundKey = {};; SoundManager.SoundKey.Busy = 0; SoundManager.SoundKey.CallForwarding = 1; SoundManager.SoundKey.ContactOnline = 2; SoundManager.SoundKey.EndCall = 3; SoundManager.SoundKey.Error = 4; SoundManager.SoundKey.Invite = 5; SoundManager.SoundKey.Offline = 6; SoundManager.SoundKey.ReceiveIM = 7; SoundManager.SoundKey.RingBack = 8; SoundManager.SoundKey.RingIn = 9; SoundManager.SoundKey.Toast = 10; SoundManager.prototype.Initialize = function() { var ua = UserAgentInfo.GetInstance(); if (ua.IsIE()) { this._timer = new Timer("StopIEPlayerTimer"); this._timer.Initialize(); this._timer.TimeOutEvent.Add(Delegate(this, this.StopPlayOnIE)); this.InitSoundSourceMapForIE(); this.InitPlayerOnIE(); this.PlaySound = function(srcKey) { if (this.SetSoundKey(srcKey)) { window.setTimeout(Delegate(this, this.PlaySoundOnIE), 0); } } } else { } } ;SoundManager.prototype.Dispose = function() { try { this._timer.Dispose(); this._timer = null; var player = document.getElementById("cwa_IESoundPlayer"); if (player != null) { player.src = null; document.body.removeChild(player); } } catch (ex) { ; } } ;SoundManager.prototype.SetSoundKey = function(key) { if (key == null) { return false; } ;var src = this.SoundSourceMap[key]; if (src == null) { return false; } else { this._currentSound = src; return true; } } ;SoundManager.prototype.InitSoundSourceMapForIE = function() { var map = this.SoundSourceMap; var keys = SoundManager.SoundKey; map[keys.ContactOnline] = new SoundSourceForIE("Loc/Sound/contactonline.wav", 1000); map[keys.Offline] = new SoundSourceForIE("Loc/Sound/offline.wav", 1000); map[keys.ReceiveIM] = new SoundSourceForIE("Loc/Sound/receiveim.wav", 2000); map[keys.RingIn] = new SoundSourceForIE("Loc/Sound/ringin.wav", 3000); map[keys.Toast] = new SoundSourceForIE("Loc/Sound/toast.wav", 2000); } ;SoundManager.prototype.InitPlayerOnIE = function() { var player = document.createElement("BGSOUND"); player.id = "cwa_IESoundPlayer"; document.body.appendChild(player); } ;SoundManager.prototype.SetTimeout = function(timeout) { ; this._isUsingDefaultTimeout = false; this._timeout = parseInt(timeout) * 1000; } ;SoundManager.prototype.PlaySoundOnIE = function() { if (this._currentSound == null) { return; } ;var player = document.getElementById("cwa_IESoundPlayer"); if (player != null) { try { player.src = this._currentSound.file.src; if (this._isUsingDefaultTimeout) { player.loop = 1; this._timer._timeOutInterval = this._currentSound.length; } else { player.loop = -1; this._timer._timeOutInterval = this._timeout; } ;this._timer.Start(); } catch (ex) { } } } ;SoundManager.prototype.StopPlayOnIE = function() { var player = document.getElementById("cwa_IESoundPlayer"); if (player != null) { player.src = null; } } ;function GetMapMemberObj( map, key, objType ) { var memberObj = map[ key ]; if( memberObj == null ) { if( objType == null ) { objType = Object; } ;memberObj = new objType(); map[ key ] = memberObj; } ;return memberObj; } ;function IsMapNull( map ) { var isMapNull = true; if( map ) { for( var key in map ) { isMapNull = false; break; } } ;return isMapNull; } ;function URLTransfer() {} ;URLTransfer.DividCharacter = "#"; URLTransfer.prototype.GetParameter = function(iframeId) { var url = ""; if (!iframeId) { url = window.location; } else { url = document.getElementById(iframeId).src; } ;url = url.toString(); if (url.indexOf(URLTransfer.DividCharacter) > -1) { var url_elements = url.split(URLTransfer.DividCharacter); return url_elements[url_elements.length - 1]; } else { return ""; } } ;function IsDevEnv() { var location = window.location.toString(); return (location.indexOf("ClientVersion") > 0) || ( location.indexOf("utest") > 0); } ;function GetWbrStr(str) { if (!str || str.length <= 1) return str; var wbrTag = "<wbr/>"; var newStr = ""; for (var i = 0; i < str.length; i++) { if (i != (str.length - 1)) newStr += str[i] + wbrTag; else newStr += str[i]; } ;return newStr; } ;function XMLNode(xmlNode) { this.xmlRootNode = xmlNode; this.nodeName = xmlNode.nodeName; this.nodeValue = xmlNode.nodeValue; this.childNodes = this.getchildNodes(); this.firstChild = this.childNodes[0]; } ;XMLNode.prototype.getElementsByTagName = function(name) { var getArray = this.xmlRootNode.getElementsByTagName(name); if (!getArray || getArray.length == 0) { return getArray; } else { var array = new Array(); for (var i = 0; i < getArray.length; i++) { array.push(new XMLNode(getArray[i])); } ;array.item = function(index) { return array[index]; } ;return array; } } ;XMLNode.prototype.getchildNodes = function() { var getArray = this.xmlRootNode.childNodes; if (!getArray || getArray.length == 0) { return getArray; } else { var array = new Array(); for (var i = 0; i < getArray.length; i++) { array.push(new XMLNode(getArray[i])); } ;array.item = function(index) { return array[index]; } ;return array; } } ;XMLNode.prototype.getAttribute = function(name) { var value = this.xmlRootNode.getAttribute(name); if (value) { value = value.replace(/&#38;/g, "&"); } ;return value; } ;function XMLGetNodeValueByTagName(xmlNode, tagName) { if (!xmlNode || !tagName) { return null; } ;try { var node = xmlNode.getElementsByTagName(tagName)[0]; if( node ) { if (UserAgentInfo.GetInstance().IsFirefox()) { var text = ""; for (var i = 0; i < node.childNodes.length; i++) { var subNode = node.childNodes[i]; if (subNode.nodeName.toLowerCase() == "#text") { text += subNode.nodeValue; } } ;return text; } else { var subNode = node.childNodes[0]; if( subNode ) { return subNode.nodeValue; } else { return ""; } } } else { return null; } } catch(e) { ; return null; } } ;function XMLGetXMLString(xmlNode) { if (!xmlNode) return ""; var str = ""; try { if (xmlNode.xml) { str = xmlNode.xml; } else { if (xmlNode.xmlRootNode != null) { str = new XMLSerializer().serializeToString(xmlNode.xmlRootNode); if (str == null) { str = XMLGetElementString(xmlNode.xmlRootNode); } } else { str = new XMLSerializer().serializeToString(xmlNode); } } } catch(e) { ; } ;return str; } ;function XMLGetInnerXMLString(node) { var _result = ""; if (node == null) { return _result; } ;for (var i = 0; i < node.childNodes.length; i++) { var thisNode = node.childNodes[i]; switch (thisNode.nodeType) { case 1: case 5: _result += XMLGetElementString(thisNode); break; case 3: case 2: case 4: _result += EscapeXmlSensitveChar(thisNode.nodeValue); break; default: break; } } ;return _result; } ;function XMLGetElementString(thisNode) { var _result = ""; if (thisNode == null) { return _result; } ;_result += '<' + thisNode.nodeName; if (thisNode.attributes && thisNode.attributes.length > 0) { for (var i = 0; i < thisNode.attributes.length; i++) { _result += " " + thisNode.attributes[i].name + "=\"" + EscapeXmlSensitveChar(thisNode.attributes[i].value) + "\""; } } ;_result += '>'; _result += XMLGetInnerXMLString(thisNode); _result += '</' + thisNode.nodeName + '>'; return _result; } ;function XMLGetNodeValue( xmlNode ) { if( !xmlNode ) return null; var textNode = xmlNode.firstChild; if( textNode && textNode.nodeValue ) { return textNode.nodeValue; } else { return ""; } } ;function XMLGetChildTagName(xmlNode, order) { if (!xmlNode) return null; var realChildCount = 0; for (var i = 0; i < xmlNode.childNodes.length; i++) { var name = xmlNode.childNodes[i].nodeName; if (name.toLowerCase() != "#text") { if (realChildCount == order) { return name; } else { realChildCount++; } } } ;return null; } ;var DomEvent = new Object(); DomEvent.ObjectList = ["BODY", "TABLE", "DIV", "TD", "TBODY", "INPUT", "SELECT", "TR", "SPAN", "IMG", "TEXTAREA", "BODY", "OPTION", "IFRAME"]; DomEvent.EventType = ["onerror", "onmousedown", "onmouseup", "onmousemove", "onmouseover", "onmouseout", "onload", "onunload", "oncontextmenu", "onselectstart", "onreadystatechange", "onkeydown", "onkeyup", "onkeypress", "onfocus", "onblur", "onpaste", "ondblclick", "onresize", "onpropertychange", "onscroll", "onclick", "onbeforeunload", "onselect", "onselectionchange", "ondragstart", "ondragend", "onmousewheel", "onchange"]; function BreakCircleReference() { for(var i = 0; i < DomEvent.ObjectList.length; i++) { ClearNodeEventByTagName(DomEvent.ObjectList[i]); } ;ClearNodeEvent(window); ClearNodeEvent(document); window._hasUnloadEvent = null; window._outerWidth = null; window.budapest = null; window.blocked = null; window.modalDialog = null; window.messageDialog = null; window.modelessDialogManager = null; window.MouseMoving = null; window.MouseDown = null; window.KeyDown = null; window.WindowFocus = null; window.WindowBlur = null; window._activeWindow = null; window.windowObj = null; window.obj = null; } ;function ClearNodeEvent(node) { var eventType = DomEvent.EventType; for(var i = DomEvent.EventType.length - 1; i >= 0; --i) { if(node[eventType[i]]) { node[eventType[i]] = null; } } ;if(node.clearAttributes) { node.clearAttributes(); } } ;function ClearNodeEventByTagName(tag) { var divs = document.getElementsByTagName(tag); for (var i = 0; i < divs.length; i++) { var node = divs[i]; ClearNodeEvent(node); } } ;function DecodeBase64(base64Str) { var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; if(!base64Str || !base64Str.length || base64Str.length % 4) { return ""; } ;var ret = new Array; for(var i = 0; i < base64Str.length; i += 4) { var e1 = keyStr.indexOf(base64Str.charAt(i)); var e2 = keyStr.indexOf(base64Str.charAt(i + 1)); var e3 = keyStr.indexOf(base64Str.charAt(i + 2)); var e4 = keyStr.indexOf(base64Str.charAt(i + 3)); ret.push(((e1 << 2) & 0xff) | (e2 >> 4)); ret.push(((e2 << 4) & 0xff) | (e3 >> 2)); ret.push(((e3 << 6) & 0xff) | (e4)); } ;return ret; } ;function ParseInt( str ) { if( str == null || str.length == 0 ) return null; for( var i = 0; i < str.length - 1; i ++ ) { if( str.charAt(i) != "0" ) { break; } } ;return ( i > 0 )? parseInt( str.substring( i, str.length ) ) : parseInt( str ); } ;function ConvertDate(dateStr) { var startIndex = 0; var index = dateStr.indexOf("-", startIndex); if (index == -1) return new Date(); var year = ParseInt(dateStr.substring(startIndex, index)); startIndex = index + 1; index = dateStr.indexOf("-", startIndex); if (index == -1) return new Date(); var month = ParseInt(dateStr.substring(startIndex, index)); startIndex = index + 1; index = dateStr.indexOf("T", startIndex); if (index == -1) return new Date(); var date = ParseInt(dateStr.substring(startIndex, index)); startIndex = index + 1; index = dateStr.indexOf(":", startIndex); if (index == -1) return new Date(); var hour = ParseInt(dateStr.substring(startIndex, index)); startIndex = index + 1; index = dateStr.indexOf(":", startIndex); if (index == -1) return new Date(); var minute = ParseInt(dateStr.substring(startIndex, index)); var d = new Date(); d.setTime(Date.UTC(year, month - 1, date, hour, minute, 0, 0)); return d; } ;function CompareDate( leftDateStr, rightDateStr ) { if( !leftDateStr ) return (rightDateStr)? -1 : 0; if( !rightDateStr ) return 1; if( leftDateStr.charAt(leftDateStr.length - 1) == "Z" && rightDateStr.charAt(rightDateStr.length - 1) == "Z" ) { return CompareObject( (leftDateStr.charAt(0) == "-")? leftDateStr.substring(1, leftDateStr.length) : leftDateStr, (rightDateStr.charAt(0) == "-")? rightDateStr.substring(1, rightDateStr.length) : rightDateStr ); } else { return CompareObject( ConvertDate(leftDateStr).getTime(), ConvertDate(rightDateStr).getTime() ); } } ;function IsSafari() { return UserAgentInfo.GetInstance().IsSafari(); } ;function IsCrossDomainURL(url) { if (!url) return false; var targetURL = ConnectionFactory.FormatServerUrl(url); if (!targetURL) { return false; } else { var pageURL = ConnectionFactory.FormatServerUrl(window.location.toString()); if (pageURL != targetURL) { return true; } else { return false; } } } ;function Test_FindDomEvent(domRoot) { var text = ""; var func = function (root) { for(var key in root.attributes) { try { if(key.indexOf("on") == 0 && root.getAttribute(key)) { text += root.nodeName + " : " + key + " : " + root.getAttribute(key) + "\r\n"; } } catch(ex) { } } ;if(root.childNodes) { for(var i = 0; i < root.childNodes.length; ++i) { Test_FindDomEvent_Do(root.childNodes[i]); } } };; func(domRoot); return text; } ;function IsNotEmptyArray(array) { return array && array.length && true || false; } ;function IsPhoneOnlyUser(sipUri) { if(!sipUri || sipUri.indexOf('sip:') != 0) { return false; } ;sipUri = sipUri.substring(4); if(sipUri.indexOf('+') == 0 || IsNumberChar(sipUri.charAt(0))) { return true; } else { return false; } } ;function Microsoft(){};; Microsoft.Rtc = function(){};; Microsoft.Rtc.WebControl = function(){};; var PublicNameSpace = Microsoft.Rtc.WebControl; function ConnectionFactory() {} ;ConnectionFactory.SetDomainCreater = new SetDomainCreater(); ConnectionFactory.SetUrlCreater = new SetUrlCreater(); ConnectionFactory.SameServerCreater = new SameServerCreater(); ConnectionFactory.CreateConnection = function(serverURL, callbackFunction) { var isCrossDomain = false; var apiServer = null; var appServer = ConnectionFactory.FormatServerUrl(window.location.toString()); if (serverURL) { apiServer = ConnectionFactory.FormatServerUrl(serverURL); } ;if (!apiServer || apiServer == appServer) { ConnectionFactory.SameServerCreater.CreateConnection(serverURL, callbackFunction); } else { isCrossDomain = true; var domain = ConnectionFactory.GetParentDomain(apiServer, appServer); if (domain) { ConnectionFactory.SetDomainCreater.CreateConnection(serverURL, domain, callbackFunction); } else { } } ;return isCrossDomain; } ;ConnectionFactory.Dispose = function() { ConnectionFactory.SetDomainCreater.Dispose(); ConnectionFactory.SetUrlCreater.Dispose(); ConnectionFactory.SameServerCreater.Dispose(); } ;ConnectionFactory.FormatServerUrl = function(url) { var url = Trim(url.toLowerCase()); var protocol = ConnectionFactory.GetUrlProtocol(url); var position = url.indexOf("://"); if (position >= 0 ) { url = url.substr(position + 3, url.length); } else { return null; } ;position = url.indexOf("/"); if (position >= 0) { url = url.substr(0, position); } ;url = protocol + "://" + url; return url; } ;ConnectionFactory.GetUrlProtocol = function(url) { var protocol = null; var url = Trim(url.toLowerCase()); if (url.indexOf("https://") >= 0) { protocol = "https"; } else if (url.indexOf("http://") >= 0) { protocol = "http"; } ;return protocol; } ;ConnectionFactory.GetUrlPort = function(url) { var port = null; var url = ConnectionFactory.FormatServerUrl(url); var position = url.indexOf("://"); if (position >= 0 ) { url = url.substr(position + 3, url.length); } ;position = url.indexOf(":"); if (position >= 0) { port = url.substr(position + 1, url.length); } ;return port; } ;ConnectionFactory.GetHostName = function(url) { ; var url = url.toLowerCase(); var position = url.indexOf("://"); if (position >= 0 ) { url = url.substr(position + 3, url.length); } ;position = url.indexOf("/"); if (position >= 0) { url = url.substr(0, position); } ;position = url.indexOf(":"); if (position >= 0) { url = url.substr(0, position); } ;return url; } ;ConnectionFactory.GetParentDomain = function(url1, url2) { ; ; var domain = null; var seperator = "."; var protocol1 = ConnectionFactory.GetUrlProtocol(url1); var protocol2 = ConnectionFactory.GetUrlProtocol(url2); var server1 = ConnectionFactory.FormatServerUrl(url1); var server2 = ConnectionFactory.FormatServerUrl(url2); var port1 = ConnectionFactory.GetUrlPort(url1); var port2 = ConnectionFactory.GetUrlPort(url2); var serverName1 = ConnectionFactory.GetHostName(server1); var serverName2 = ConnectionFactory.GetHostName(server2); if (protocol1 != protocol2) { domain = null; } else { var position1 = serverName1.indexOf(seperator); var position2 = serverName2.indexOf(seperator); if (position1 >= 0 && position2 >= 0) { var parentDomain1 = serverName1.substr(position1 + 1, serverName1.length); var parentDomain2 = serverName2.substr(position2 + 1, serverName2.length); var nameList1 = parentDomain1.split(seperator); var nameList2 = parentDomain2.split(seperator); var length = nameList1.length < nameList2.length ? nameList1.length : nameList2.length; if (length > 1) { var pos1 = nameList1.length - 1; var pos2 = nameList2.length - 1; while (nameList1[pos1] == nameList2[pos2]) { if (domain) { domain = nameList1[pos1] + "." + domain; } else { domain = nameList1[pos1]; } ;if (pos1 <= 0 || pos2 <= 0) { break; } else { pos1--; pos2--; } } } else { domain = null; } } else { domain = null; } } ;return domain; } ;function SameServerCreater() { } ;SameServerCreater.prototype.CreateConnection = function(serverURL, callbackFunction) { if ( callbackFunction ) { try { var connection = new Connection(); callbackFunction(this, connection); } catch(e) { ; } } } ;function SetUrlCreater() { } ;SetUrlCreater.prototype.CreateConnection = function() { alert("SetUrlCreater has not been supported."); } ;function SetDomainCreater() { this.childIframeObject = null; this.serverURL = null; this._bridgePath = null; this._callbackList = new Array(); this._status = 0; this._userAgent = UserAgentInfo.GetInstance(); this._parentDomain = null; } ;SetDomainCreater.IframeName = "EntryIframeName"; SetDomainCreater.IframeId = "95A8CCE9_D81A_4989_ACA6_339F641959C2"; SetDomainCreater.IframeURL = "SetDomainentryiframe.htm"; SetDomainCreater.prototype.CreateConnection = function(serverURL, domain, callbackFunction) { this._callbackList.push(callbackFunction); if (this._status == 2) { this.Finish(); } else if (this._status == 0) { this._status = 1; this._parentDomain = domain; this.serverURL = serverURL; this.Initialize(); } } ;SetDomainCreater.prototype.Initialize = function() { var divObj = null; if (this._userAgent.IsSafari()) { divObj = document.createElement('div'); document.body.appendChild(divObj); divObj.style.height = "0"; divObj.style.width = "0"; divObj.style.visibility = "hidden"; } else { divObj = document.createElement('DIV'); document.body.appendChild(divObj); divObj.style.display = "none"; } ;var subframe = document.createElement('iframe'); if (!this._userAgent.IsSafari()) { subframe.src = SetDomainCreater.IframeURL; } ;divObj.appendChild(subframe); if (!this._userAgent.IsSafari()) { subframe.style.display = "none"; } else { subframe.style.height = "0"; subframe.style.width = "0"; subframe.style.visibility = "hidden"; } ;if (this._userAgent.IsSafari()) { subframe.src = SetDomainCreater.IframeURL; } ;subframe.name = SetDomainCreater.IframeName; subframe.id = SetDomainCreater.IframeId; var text = "<html><head>"; text += CWA__CwaServerScriptFiles; text += "</head><body><script>"; text += "window.onload = function(){window.obj = new CWA__SetDomainEntryIframe();window.obj._parentDomain=\"" + this._parentDomain +"\";window.setTimeout(\"window.obj.Initialize();\",100);};"; text += "</" + "script></body></html>"; this.WriteContentToIFrame(SetDomainCreater.IframeId, text); } ;SetDomainCreater.prototype.Finish = function() { this._status = 2; ; for (var i = 0; i < this._callbackList.length; i++) { var connection = this.childIframeObject.CreateConnection.call(this.childIframeObject); var callbackFunction = this._callbackList[i]; try { callbackFunction(this, connection); } catch(e) { ; } } ;this._callbackList = new Array(); } ;SetDomainCreater.prototype.WriteContentToIFrame = function(frameId, text) { var win = GetFrameWindowById(frameId); var parentDomain = this._parentDomain; ; if (this._userAgent.IsSafari()) { var testLoaded = function() { if (win.document.title && win.document.title.toLowerCase().indexOf("cannot be found") >= 0) { win.document.open(); win.document.write(text); win.document.close(); document.domain = parentDomain; } else { window.setTimeout(testLoaded, 10); } } ;window.setTimeout(testLoaded, 10); } else { win.document.open(); win.document.write(text); win.document.close(); } } ;function SignOutSender() { this._communicator = null; this.xmlHttpRequest = null; this._customAuthLogoffUrl = null; this.SignOutDecCookieEvent = new Event("SignOutSender::SignOutDecCookie"); } ;SignOutSender.SSOSignoutRequest = "/cwa/?Cmd=logoff"; SignOutSender.prototype.Initialize = function(communicator, connection) { this._communicator = communicator; this.xmlHttpRequest = connection; this.xmlHttpRequest.Initialize(this); } ;SignOutSender.prototype.SignOut = function(url, data) { try { if( this.xmlHttpRequest != null ) { var isAsync = false; var ua = UserAgentInfo.GetInstance(); if (ua.IsSafari() && ua.GetBrowserVersion() < "312") { isAsync = true; } else if (ua.IsFirefox()) { isAsync = true; } ;; this._communicator.TrafficEvent.args["channel"] = "CommandChannel"; this._communicator.TrafficEvent.args["type"] = "Request"; this._communicator.TrafficEvent.args["url"] = url; this._communicator.TrafficEvent.args["content"] = data; this._communicator.TrafficEvent.Fire(this, this._communicator.TrafficEvent.args); if (this._communicator._isCrossDomain == true && ua.IsFirefox() && ua.GetBrowserVersion() < "1.0.7" ) { this.xmlHttpRequest.Post(url, data, isAsync , true); } else { this.xmlHttpRequest._SendHttpRequest(Connection.postMethod, url, data, isAsync , true); } ;if (this._communicator._isCWA == true && this._customAuthLogoffUrl) { ; if (!IsCrossDomainURL(this._customAuthLogoffUrl)) { this.xmlHttpRequest._SendHttpRequest(Connection.getMethod, this._customAuthLogoffUrl, null, true , true); } else { if (window.opener == null) { CWA__OpenWindow( this._customAuthLogoffUrl, '_blank' ); } else { try { if (window.opener.closed == true) { CWA__OpenWindow( this._customAuthLogoffUrl, '_blank' ); } else { try { window.opener.location.href = this._customAuthLogoffUrl; } catch (ex) { } } } catch(e) { CWA__OpenWindow( this._customAuthLogoffUrl, '_blank' ); } } } } ;if (this._communicator) { this._communicator.Stop(); this._communicator.SetAuthTicket("NULL"); this._communicator.SessionId = null; } ;; } } catch( ex ) { } finally { this.CleanCookies(); } } ;SignOutSender.prototype.CleanCookies = function() { var clwe = GetCookie("clwe"); if(clwe) { clwe = parseInt(clwe) - 1; if(clwe == 0) { RemoveCookie( "clwe" ); } else { SetSessionCookie("clwe", clwe); } } ;this.SignOutDecCookieEvent.Fire(this, null); } ;SignOutSender.prototype.OnSuccess = function() { ; } ;SignOutSender.prototype.OnError = function(error) { ; } ;SignOutSender.prototype.Dispose = function() { this.xmlHttpRequest.Dispose(); } ;SignOutSender.prototype.Send = function() { } ;SignOutSender.prototype.SetCustomAuthLogoffUrl = function(url) { this._customAuthLogoffUrl = url; } ;function LogonSender() { this._communicator = null; this.xmlHttpRequest = null; this._userAgent = null; this._logonCallbackFunction = null; this._requestType = null; } ;LogonSender.IWAAuthentication = "IWA"; LogonSender.IWAJoinAuthentication = "IWAJOIN"; LogonSender.FormsAuthentication = "FORMS"; LogonSender.SSOAuthentication = "SSO"; LogonSender.AnonAuthentication = "ANON"; LogonSender.IWALogonUrl = "iwa/logon.html"; LogonSender.SSOLogonUrl = "iwa/logon.html"; LogonSender.IWAJoinLogonUrl = "iwa/joinlogon.html"; LogonSender.AnonLogonUrl = "anon/logon.html"; LogonSender.FormLogonUrl = "forms/logon.html"; LogonSender.FormLogonRequest = "<cwaRequests><logon><user>%0</user><password>%1</password></logon></cwaRequests>"; LogonSender.prototype.Initialize = function(communicator, connection) { this._communicator = communicator; this.xmlHttpRequest = connection; this.xmlHttpRequest.Initialize(this); this._userAgent = UserAgentInfo.GetInstance(); } ;LogonSender.prototype.Dispose = function() { this.xmlHttpRequest.Dispose(); } ;LogonSender.prototype.LogonByIWA = function(callback, uri) { this._requestType = LogonSender.IWAAuthentication; this._logonCallbackFunction = callback; this.Send(uri); } ;LogonSender.prototype.LogonByFORM = function(username, password, callback) { this._requestType = LogonSender.FormsAuthentication; this._logonCallbackFunction = callback; this.Send(username, password); } ;LogonSender.prototype.LogonBySSO = function(callback) { this._requestType = LogonSender.SSOAuthentication; this._logonCallbackFunction = callback; this.Send(); } ;LogonSender.prototype.LogonByAnon = function(callback) { this._requestType = LogonSender.AnonAuthentication; this._logonCallbackFunction = callback; this.Send(); } ;LogonSender.prototype.LogonByIWAJoin = function(callback, uri) { this._requestType = LogonSender.IWAJoinAuthentication; this._logonCallbackFunction = callback; this.Send(uri); } ;LogonSender.prototype.Send = function(username, password) { var logonUrl = null; var logonRequest = null; if (this._requestType == LogonSender.IWAAuthentication) { logonUrl = this._communicator._serverUrl + LogonSender.IWALogonUrl; if (username) { logonUrl += "?uri=" + escape(username); } } else if (this._requestType == LogonSender.SSOAuthentication) { logonUrl = this._communicator._serverUrl + LogonSender.SSOLogonUrl; } else if (this._requestType == LogonSender.FormsAuthentication) { logonUrl = this._communicator._serverUrl + LogonSender.FormLogonUrl; var username = EscapeXmlSensitveChar(username); var password = (IsStringNullOrEmpty(password) ? '' : EscapeXmlSensitveChar(password)); logonRequest = StringFormat(LogonSender.FormLogonRequest, username, password); } else if (this._requestType == LogonSender.AnonAuthentication) { logonUrl = this._communicator._serverUrl + LogonSender.AnonLogonUrl; } ;if (this._requestType == LogonSender.IWAJoinAuthentication) { logonUrl = this._communicator._serverUrl + LogonSender.IWAJoinLogonUrl; if (username) { logonUrl += "?uri=" + escape(username); } } ;if (logonUrl.indexOf("?") >= 0) { logonUrl += "&"; } else { logonUrl += "?"; } ;var date = new Date(); var timeStamp = date.getTime(); logonUrl += "timeStamp=" + timeStamp; this._communicator.TrafficEvent.args["channel"] = "Logon"; this._communicator.TrafficEvent.args["type"] = "Request"; this._communicator.TrafficEvent.args["url"] = logonUrl; this._communicator.TrafficEvent.args["content"] = logonRequest; this._communicator.TrafficEvent.Fire(this, this._communicator.TrafficEvent.args); if (logonRequest == null) { this.xmlHttpRequest.Get(logonUrl, true); } else { this.xmlHttpRequest.Post(logonUrl, logonRequest, true); } } ;LogonSender.prototype.OnSuccess = function() { window.setTimeout(Delegate(this, this._ProcessResponse), 0); } ;LogonSender.prototype.OnError = function(error) { try { if ((this._requestType == LogonSender.IWAAuthentication || this._requestType == LogonSender.IWAJoinAuthentication) && error.errorCode == 401) { window.setTimeout(Delegate(this, this._ProcessResponse), 0); } else { this._logonCallbackFunction(null, error, null); } } catch (ex) { ; } } ;LogonSender.prototype._ProcessResponse = function() { try { this._communicator.TrafficEvent.args["channel"] = "Logon"; this._communicator.TrafficEvent.args["type"] = "Response"; this._communicator.TrafficEvent.args["url"] = null; this._communicator.TrafficEvent.args["content"] = this.xmlHttpRequest.GetResponseText(); this._communicator.TrafficEvent.Fire(this, this._communicator.TrafficEvent.args); var authTicket = null; var error = null; var xml = this.xmlHttpRequest.GetResponseXML(); var xmlItem = xml.getElementsByTagName("cwaResponses"); if (xmlItem == null || xmlItem.length == 0) { error = new Error(); error.errorCode = 2003; error.discription = "Can not parse response"; } else { var xmlItems = xmlItem[0].childNodes; var xmlItem = null; for (var i = 0; i < xmlItems.length; i++) { if (xmlItems[i].nodeName.toLowerCase()!= "#text") { xmlItem = xmlItems[i]; } } ;if (xmlItem) { var responseName = xmlItem.nodeName; var errorId = xmlItem.getAttribute("eid"); if (responseName && Trim(responseName).toLowerCase() == "requestsucceeded") { authTicket = this.xmlHttpRequest.GetResponseHeader(ServerCommunicator.AuthTicketName); } else { if (errorId) { errorId = parseInt(errorId); } else { errorId = 2003; } ;error = new Error(); error.errorCode = errorId; } } } ;if (authTicket) { this._communicator.SetAuthTicket(authTicket); } ;this._logonCallbackFunction(authTicket, error, xml); } catch(e) { ; } } ;function AsyncDataChannel() { } ;AsyncDataChannel.DefaultTimeInterval = 5000; AsyncDataChannel.DefaultAjaxViewerTimeInterval = 1000; AsyncDataChannel.ServerPage = "../../AsyncDataChannel.ashx"; AsyncDataChannel.APPServerPage = "../../AppSharingDataChannel.ashx"; AsyncDataChannel.userActiveName = "UA"; AsyncDataChannel.InstanceCountCookieName = "SC_IntanceCount"; AsyncDataChannel.prototype.Initialize = function(communicator, connection) { ; this.ackID = "0"; this.ackIDName = "AckID"; this.sessionIDName = "Sid"; this.dataVersion = "LCW.1"; this.sessionIDName = "Sid"; this.xmlHttpRequest = connection; this.resendPolicy = new Connection.ReSendPolicy.ResendInPriority(); this.xmlHttpRequest.Initialize(this, this.resendPolicy); this._timer = new Timer(); this._timer.Initialize(); this._timer.TimeOutEvent.Add(Delegate(this, this.Send)); this._timer.SetTimeOutInterval(AsyncDataChannel.DefaultTimeInterval); this._communicator = communicator; this._userAgent = UserAgentInfo.GetInstance(); this._isActive = false; this._xmlCache = new Array(); this._isUserActive = false; this._isSelfDriven = true; } ;AsyncDataChannel.prototype.Close = function() { this.xmlHttpRequest.SetResendPolicy(null); this.xmlHttpRequest.Abort(); this._timer.Stop(); if (this._isActive == true) { this._isActive = false; this.xmlHttpRequest._ReleaseRefCount(); } } ;AsyncDataChannel.prototype.Dispose = function() { this.Close(); this.xmlHttpRequest.Dispose(); this.xmlHttpRequest = null; this._timer.Dispose(); this._timer = null; this._xmlCache = new Array(); } ;AsyncDataChannel.prototype.OnError = function(error) { if (error.errorCode != 0 && !this._communicator.isIgnoreError) { DispatchError(error); } } ;AsyncDataChannel.prototype.OnSuccess = function(error) { window.setTimeout(Delegate(this, this._AfterSuccess), 0); } ;AsyncDataChannel.prototype._AfterSuccess = function() { if (this._timer && this.xmlHttpRequest) { this._timer.Stop(); this._RefreshAuthTicket(); this._ProcessData(); if (!this._communicator._isStopped && this._isSelfDriven == true) { this._timer.Start(); } } } ;AsyncDataChannel.prototype.Send = function() { this._communicator.TrafficEvent.args["channel"] = "DataChannel"; this._communicator.TrafficEvent.args["type"] = "Request"; this._communicator.TrafficEvent.args["url"] = this._Url(); this._communicator.TrafficEvent.args["content"] = null; this._communicator.TrafficEvent.Fire(this, this._communicator.TrafficEvent.args); this._timer.Stop(); this.xmlHttpRequest.Get(this._Url(), true); Connection.UserActive = Connection.DefaultUserActive; } ;AsyncDataChannel.prototype.Activate = function(delay) { if (this._isActive == false) { this._isActive = true; this.xmlHttpRequest._AddRefCount(); } ;this.xmlHttpRequest.SetResendPolicy(this.resendPolicy); this._timer.Stop(); if (delay != null) { this._timer.SetTimeOutInterval(delay); } else { this._timer.SetTimeOutInterval(AsyncDataChannel.DefaultTimeInterval); } ;this._timer.Start(); } ;AsyncDataChannel.prototype.Reset = function() { this.ackID = "0"; this._isSelfDriven = true; } ;AsyncDataChannel.prototype._Url = function() { var date = new Date(); var timeStamp = date.getTime(); this._isUserActive = Connection.UserActive; var url = this._communicator._bridgePagePath; if (this._communicator.mode == CWAMODE.RDP) { url += AsyncDataChannel.APPServerPage; } else { url += AsyncDataChannel.ServerPage; } ;url += "?" + this.sessionIDName + "=" + this._communicator.SessionId; url += "&" + this.ackIDName + "=" + this.ackID; url += "&" + AsyncDataChannel.userActiveName + "=" + this._isUserActive; url += "&" + "TimeStamp=" + timeStamp; return url; } ;AsyncDataChannel.prototype._ProcessData = function() { try { var responseText = this.xmlHttpRequest.GetResponseText(); this._communicator.TrafficEvent.args["channel"] = "DataChannel"; this._communicator.TrafficEvent.args["type"] = "Response"; this._communicator.TrafficEvent.args["url"] = null; this._communicator.TrafficEvent.args["content"] = responseText; this._communicator.TrafficEvent.Fire(this, this._communicator.TrafficEvent.args); var responseXmlDoc = this.xmlHttpRequest.GetResponseXML(); if (this._userAgent.IsSafari()) { this._xmlCache.push(responseXmlDoc); if (this._xmlCache.length > 100) { this._xmlCache.shift(); } } ;var eventsNodes = responseXmlDoc.getElementsByTagName("cwaEvents"); if (!eventsNodes || eventsNodes.length == 0) { ; var error = IdentifyError(2301); error.detailsInfo = responseText; DispatchError(error); return; } ;var xmlItem = eventsNodes[0]; if(xmlItem && xmlItem.childNodes && xmlItem.childNodes.length) { ; } ;; var ackID = xmlItem.getAttribute("ackId"); var queryTimeout = parseInt(xmlItem.getAttribute("pollWaitTime")); try { if (ackID != null && this.ackID == "0" && ackID != "0") { this._communicator._PublishData(responseXmlDoc, true); } else { this._communicator._PublishData(responseXmlDoc, false); } } catch(e) { ; } ;if (ackID != null) { this.ackID = ackID; } ;if (!queryTimeout) { queryTimeout = AsyncDataChannel.DefaultTimeInterval; } ;if (this._communicator.mode == CWAMODE.RDP && queryTimeout > AsyncDataChannel.DefaultAjaxViewerTimeInterval) { queryTimeout = AsyncDataChannel.DefaultAjaxViewerTimeInterval; } ;if (this._isSelfDriven == true) { this._timer.SetTimeOutInterval(queryTimeout); } } catch(e) { ; DispatchError(IdentifyError(2301)); } } ;AsyncDataChannel.prototype._RefreshAuthTicket = function() { try { if (this.xmlHttpRequest) { var authTicket = this.xmlHttpRequest.GetResponseHeader(ServerCommunicator.AuthTicketName); if (authTicket && authTicket != this._communicator._authTicket) { ; this._communicator.SetAuthTicket(authTicket); } } } catch(e) { ; } } ;AsyncDataChannel.prototype.SetSelfDriven = function(isSelf) { this._isSelfDriven = isSelf; } ;function RequestFactory(paraList, requestId) { var isConferenceRequest = false; var requestName = paraList[0]; var requestAttribute = ""; var xmlElementArray = RequestFactory._requestMap[requestName]; var contentXmlString = ""; if(!xmlElementArray) { xmlElementArray = RequestFactory._conferenceRequestMap[requestName]; if(xmlElementArray) isConferenceRequest = true; } ;if(!xmlElementArray) { xmlElementArray = RequestFactory._initiateSessionMap[requestName]; if(xmlElementArray) requestName = "initiateSession"; } ;var s = isConferenceRequest ? 2 : 1; var paraLen = paraList.length; for(var i = s; i < paraLen - 1; ++i) { var templateStr = xmlElementArray[i - s]; var parameter = paraList[i]; if(parameter != null) { var parameterLen; if(templateStr.charAt(0) == '|' && IsObject(parameter) && (parameterLen = parameter.length)) { var tagList = templateStr.split('|'); var parent = tagList[1]; var child = tagList[2]; var str = ""; for(var j = 0; j < parameterLen; ++j) { var content = EscapeXmlSensitveChar(parameter[j]); str += StringFormat(child, content); } ;contentXmlString += StringFormat(parent, str); } else { var content = ""; var shell = templateStr; switch(templateStr.charAt(0)) { case '~': shell = shell.substr(1, shell.length); content = parameter; break; case '^': shell = shell.substr(1, shell.length); requestAttribute = " " + parameter; break; default: content = EscapeXmlSensitveChar(parameter); } ;contentXmlString += StringFormat(shell, content); } } } ;if(requestName == "initiateAppsSession") { requestName = "initiateImSession"; } else if(requestName == "terminateModalitySession") { requestName = "terminateImSession"; } ;if(!isConferenceRequest) { return StringFormat( RequestFactory.singleRequestShell, requestName, requestId, requestAttribute, contentXmlString ); } else { var confId = paraList[1]; contentXmlString = StringFormat( RequestFactory.elementShell, requestName, requestAttribute, contentXmlString ); return StringFormat( RequestFactory.conferenceRequestShell, requestId, confId ? 'confId="' + confId + '"' : "", contentXmlString ); } } ;RequestFactory._initiateSessionMap = { initiateSession: ['<securityMode>%0</securityMode>', '<userStateAvailability>%0</userStateAvailability>', '<options autoSubscribePresenceForContacts="true" autoPublishMachineState="%0" />', '<signInData>%0</signInData>'], initiateJoinSession: ['<securityMode>%0</securityMode>', '<userStateAvailability>%0</userStateAvailability>', '<options autoSubscribePresenceForContacts="true" autoPublishMachineState="%0" />', '<signInData>%0</signInData>', '<displayName>%0</displayName>', '<joinConference><confUri>%0</confUri>', '<confKey>%0</confKey></joinConference>'] };; RequestFactory._requestMap = { addContact: ['<contact uri="%0" ', 'name="%0" ', 'groups="%0" ', 'subscribed="%0" ', 'tag="%0" />'], addGroup: ['<group name="%0" ', 'externalUri="%0" />'], deleteContact: ['<uri>%0</uri>'], deleteGroup: ['<group id="%0" />'], search: ['<firstName>%0</firstName>', '<lastName>%0</lastName>', '<displayName>%0</displayName>', '<emailAlias>%0</emailAlias>', '<function>%0</function>'], updateContact: ['<contact uri="%0" ', 'name="%0" ', 'groups="%0" ', 'subscribed="%0" ', 'tag="%0" />'], updateGroup: ['<group id="%0" ', 'name="%0" />'], updateContainer: ['~%0'], subscribePresence: ['|<uris>%0</uris>|<uri>%0</uri>'], unSubscribePresence: ['|<uris>%0</uris>|<uri>%0</uri>'], publishSelfPresence: ['~%0'], acknowledgeSubscriber: ['<uri>%0</uri>'], queryPresence: ['|<uris>%0</uris>|<uri>%0</uri>'], terminateSession: [], dgExpansion: ['^%0', '<email>%0</email>'], contactCard4Info: ['^%0'] };; RequestFactory._conferenceRequestMap = { initiateImSession: ['<confUri>%0</confUri>', '|<uris>%0</uris>|<uri>%0</uri>', '<message><format>%0</format>', '<content>%0</content></message>', '<media>%0</media>'], initiateAppsSession: ['<confUri>%0</confUri>', '|<uris>%0</uris>|<uri>%0</uri>', '<message><format>%0</format>', '<content>%0</content></message>', '<media>%0</media><media>chat</media>'], acceptImSession: [], terminateImSession: [], escalateToConference: [], terminateModalitySession: ['<media>%0</media>'], sendMessage: ['<format>%0</format>', '<content>%0</content>'], notifyComposing: ['%0'], inviteParticipants: ['|<uris>%0</uris>|<uri>%0</uri>'], ejectParticipant: ['%0'], lock: ['%0'], promoteParticipant: ['%0'], voIPReplyWithIM: [], voIPRedirect: ['<uri>%0</uri>'], voIPTerminate: ['<action>%0</action>'], inviteParticipantEndpoint: ['^%0', '~%0'], modifyParticipantEndpoint: ['^%0', '~%0'], negotiateMedia: ['^%0', '~%0'], appSharingSendData: ['%0'], sendMediaData: ['<data>%0</data>'] };; RequestFactory.requestsHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; RequestFactory.requestsShell = "<cwaRequests sid=\"%0\" xmlns=\"http://schemas.microsoft.com/2006/09/rtc/cwa\">%1\n\r</cwaRequests>"; RequestFactory.singleRequestShell = "\n\r  <%0 rid=\"%1\"%2>%3\n\r  </%0>"; RequestFactory.conferenceRequestShell = "<conference rid=\"%0\" %1>%2\n\r</conference>"; RequestFactory.elementShell = "<%0%1>%2</%0>"; function CommandItem(argList) { var id = CommandItem._id++; return {id: id, argList: argList, command: argList[0], commandString: RequestFactory(argList, id), callbackFunction: argList[argList.length - 1], isWaitingForResponse: false};; } ;CommandItem._id = 0; ResultItem = JT.Class( { ctor: function(args) { this.RequestId = null; this.Return = null; this.Error = null; this.IsSuccess = null; this.IsFromDataChannel = false; } }); CommandSender = JT.Class( { ctor: function(args) { this.commandCache = new HashTable(); this.commandList =[]; this._communicator = args.communicator; this.xmlHttpRequest = args.connection; if (this._communicator.isIgnoreError == true) { this.xmlHttpRequest.Initialize(this, null, CommandSender._timeOutValue); } else { this.xmlHttpRequest.Initialize(this, new Connection.ReSendPolicy.ResendInKeep(), CommandSender._timeOutValue); } ;switch (this._communicator.mode) { case CWAMODE.ANONYMOUS: this._url = "../../AnonMainCommandHandler.ashx"; this.immediatelyCommand = "terminateImSession"; break; case CWAMODE.RDP: this._url= "../../AppSharingCommandChannel.ashx"; break; case CWAMODE.AUTHENTICATED: case CWAMODE.FULL: default: this._url = "../../AuthMainCommandHandler.ashx"; this.immediatelyCommand = "terminateSession"; break; } ;this._userAgent = UserAgentInfo.GetInstance(); }, dector: function() { this.xmlHttpRequest.Dispose(); this.xmlHttpRequest = null; this.commandCache = null; this.commandList = null; }, prototype:{ HandleAllCommandFailed: function(error) { for (var i = 0; i < this.commandList.length; i++) { var command = this.commandList[i]; this.PostProcessCommand(command, null, error); } ;this.commandList = []; }, IsRequestFromDataChannel: function(xmlDoc) { switch(xmlDoc.nodeName.toLowerCase()) { case "requestsucceeded": case "requestfailed": return true; default: return false; } }, IsRequestSuccess: function(xmlDoc) { switch(xmlDoc.nodeName.toLowerCase()) { case "requestaccepted": case "requestsucceeded": return true; default: return false; } }, OnError: function(error) { this.HandleAllCommandFailed(error); }, OnSuccess: function() { window.setTimeout(Delegate(this, this._ProcessData), 0); }, PostProcessCommand: function(command, xmlItem, error) { var cmdResultItem = new ResultItem(); cmdResultItem["RequestId"] = command.id; cmdResultItem["command"] = command; if(error) { cmdResultItem["IsSuccess"] = false; cmdResultItem["Return"] = null; cmdResultItem["IsFromDataChannel"] = false; cmdResultItem["Error"] = error; } else { cmdResultItem["IsSuccess"] = this.IsRequestSuccess(xmlItem); cmdResultItem["IsFromDataChannel"] = this.IsRequestFromDataChannel(xmlItem); cmdResultItem["Return"] = xmlItem; if (cmdResultItem["IsSuccess"] == false) { var items = xmlItem.getElementsByTagName("error"); if (items && items.length > 0) { var item = items[0]; var error = IdentifyBEError(item); cmdResultItem["Error"] = error; } } } ;var callbackFunction = command["callbackFunction"]; var isNeedGeneralErrorHandling = true; var execDone = !cmdResultItem.IsSuccess || cmdResultItem.IsFromDataChannel; if(callbackFunction && (command.command == "initiateSession" || command.command == "initiateJoinSession" || command.command == "initiateCreateSession" || execDone) ) { try { isNeedGeneralErrorHandling = callbackFunction(this, cmdResultItem); } catch(e) { isNeedGeneralErrorHandling = false; ; } } ;if (isNeedGeneralErrorHandling == true && cmdResultItem["IsSuccess"] == false) { var commandName = cmdResultItem["command"].command; var errorCode = 2310; var displayCode = "2-1-2310"; var detailsInfo = ""; var error = cmdResultItem["Error"]; if (error != null) { errorCode = error.errorCode; displayCode = error.displayCode; detailsInfo = error.detailsInfo ? error.detailsInfo : ""; } ;var error = new Error(errorCode, ErrorType.GeneralError, StringFormat(L_ErrorPane_CommandFailed_Text, commandName), displayCode, detailsInfo, cmdResultItem["command"].commandString); DispatchError(error); } ;if(execDone) { this.commandCache.Remove(command.id); } }, ProcessCommandXMLItem: function(sender, xmlItem) { var rid = xmlItem.getAttribute("rid"); if (rid) { var command = this.commandCache.GetValue(rid); if (command) { this.PostProcessCommand(command, xmlItem); } } }, Send: function(isRetry) { var postData = this._MakeCommandPackage(isRetry); var url = this._Url(); if (!this._communicator.isIgnoreError) { ; this._communicator.TrafficEvent.Fire(this, {channel: "CommandChannel", type: "Request", url: url, content: postData}); } ;this.xmlHttpRequest.Post(url, postData, true); }, SendWebCommand: function(argumentsList) { if (!this._communicator.isIgnoreError || this._MergeRDPCommand(argumentsList) == true) { var commandItem = CommandItem(argumentsList); if (!this._communicator.isIgnoreError) { this.commandCache.Add(commandItem.id, commandItem); } ;if (argumentsList[0] == this.immediatelyCommand) { this.commandList.push(commandItem); var postData = this._MakeCommandPackage(false , true ); this.commandList = []; this._communicator._signoutSender.SignOut(this._Url(), postData); } else { this.commandList.push(commandItem); window.setTimeout(Delegate(this, this._TrySendCommand), 0); return commandItem.id; } } }, _MergeRDPCommand: function(argumentsList) { var RDPPollgraphicsPatten = "requestType=poll&subType=graphics"; var RDPPolleventPatten = "requestType=poll&subType=event&id="; var isSendNecessary = true; if (argumentsList[0] == "sendMediaData") { if (argumentsList[2].indexOf(RDPPollgraphicsPatten) >=0) { var commandsLen = this.commandList.length; for(var i = 0; i < commandsLen; ++i) { if (this.commandList[i].argList[0] == "sendMediaData" && this.commandList[i].argList[2].indexOf(RDPPollgraphicsPatten) >=0 ) { isSendNecessary = false; break; } } } else if (argumentsList[2].indexOf(RDPPolleventPatten) >=0) { var commandsLen = this.commandList.length; for(var i = 0; i < commandsLen; ++i) { if (this.commandList[i].argList[0] == "sendMediaData" && this.commandList[i].argList[2].indexOf(RDPPolleventPatten) >=0 ) { var currentID = parseInt(argumentsList[2].substr(argumentsList[2].indexOf(RDPPolleventPatten) + RDPPolleventPatten.length)); var oldID = parseInt(this.commandList[i].argList[2].substr(this.commandList[i].argList[2].indexOf(RDPPolleventPatten) + RDPPolleventPatten.length)); if (currentID > oldID) { var commandItem = CommandItem(argumentsList); this.commandList[i] = commandItem; } ;isSendNecessary = false; break; } } } } ;return isSendNecessary; }, _MakeCommandPackage: function(isRetry, isContainsAll) { var commandPackage = []; var commandsLen = this.commandList.length; for(var i = 0; i < commandsLen; ++i) { var commandItem = this.commandList[i]; if(!commandItem.isWaitingForResponse || isRetry) { commandPackage.push(commandItem.commandString); commandItem.isWaitingForResponse = true; if(!isContainsAll) { switch(commandItem.command) { case "addContact": case "addGroup": case "deleteContact": case "deleteGroup": case "updateContact": case "updateGroup": i = commandsLen; } } } } ;return RequestFactory.requestsHeader + StringFormat( RequestFactory.requestsShell, this._communicator.SessionId, commandPackage.join("") ); }, _ParseResult: function() { try { var xml = this.xmlHttpRequest.GetResponseXML(); if(! xml ) { var error = IdentifyError(2310); this.HandleAllCommandFailed(error); return; } ;var resultItems = xml.getElementsByTagName("cwaResponses"); if (!resultItems || resultItems.length == 0) { var error = IdentifyError(2310); this.HandleAllCommandFailed(error); return; } ;var resultItems = resultItems[0].childNodes; for(var i = 0; i < resultItems.length; i++ ) { var xmlItem = resultItems.item(i); if (xmlItem.nodeName.toLowerCase() == "error") { var errorCode = xmlItem.getAttribute("code"); var error = null; if (errorCode == null) { errorCode = 2310; error = IdentifyError(2310); } else { error = IdentifyBEError(xmlItem); } ;this.HandleAllCommandFailed(error); break; } else if (xmlItem.nodeName.toLowerCase() != "#text") { this.ProcessCommandXMLItem(this, xmlItem); } } } catch(e) { ; } }, _ProcessData: function() { if (this.xmlHttpRequest) { if (!this._communicator.isIgnoreError) { ; } ;this._RefreshAuthTicket(); this._ParseResult(); this._UpdateCommandList(); window.setTimeout(Delegate(this, this._TrySendCommand), 0); } else { ; } }, _RefreshAuthTicket: function() { try { var authTicket = this.xmlHttpRequest.GetResponseHeader(ServerCommunicator.AuthTicketName); if (authTicket && authTicket != this._communicator._authTicket) { ; this._communicator.SetAuthTicket(authTicket); } } catch(e) { ; } }, _TrySendCommand: function() { if(this.xmlHttpRequest.IsFree() && this.commandList.length) { this.Send(); } }, _UpdateCommandList: function() { var newList = []; for(var i = 0; i < this.commandList.length; ++i) { var command = this.commandList[i]; if(!command.isWaitingForResponse) { newList.push(command); } } ;this.commandList = newList; }, _Url: function() { return this._communicator._bridgePagePath + this._url + "?TimeStamp=" + CommandSender._stampId++; } }}); CommandSender._timeOutValue = 5 * 1000 * 60; CommandSender._stampId = 0; function GetFrameWindowById(id) { var frame = document.getElementById(id); if (frame.contentWindow) { return frame.contentWindow; } else if (frame.all) { return document.frames(id); } else { return frame; } } ;function CWA__SetDomainEntryIframe() { this._childFrame = null; this._bridgePath = null; this._parentFrameObject = null; this._parentDomain = null; this.userAgent = UserAgentInfo.GetInstance(); } ;CWA__SetDomainEntryIframe.IframeName = "BridgeIframeName"; CWA__SetDomainEntryIframe.IframeId = "91D5180E_A488_436d_813D_33F47B8EB235"; CWA__SetDomainEntryIframe.IframeURL = "SetDomainbridgeiframe.htm"; CWA__SetDomainEntryIframe.prototype.Initialize = function() { if (this.userAgent.IsSafari()) { document.domain = this._parentDomain; } ;this._parentFrameObject = window.parent.ConnectionFactory.SetDomainCreater; this._parentDomain = this._parentFrameObject._parentDomain; this._bridgePath = this._parentFrameObject.serverURL; this._parentFrameObject.childIframeObject = this; if (!this.userAgent.IsSafari()) { document.domain = this._parentDomain; } ;var url = this._bridgePath + CWA__SetDomainEntryIframe.IframeURL + "#" + this._parentDomain; var subframe = document.createElement('iframe'); if (!this.userAgent.IsSafari()) { subframe.src = url; } ;document.body.appendChild(subframe); if (this.userAgent.IsSafari()) { subframe.src = url; } ;subframe.name = CWA__SetDomainEntryIframe.IframeName; subframe.id = CWA__SetDomainEntryIframe.IframeId; this._childFrame = GetFrameWindowById(CWA__SetDomainEntryIframe.IframeId); } ;CWA__SetDomainEntryIframe.prototype.OnLoaded = function() { this._parentFrameObject.Finish.call(this._parentFrameObject); } ;CWA__SetDomainEntryIframe.prototype.CreateConnection = function() { if (!this._childFrame) { this._childFrame = GetFrameWindowById(CWA__SetDomainEntryIframe.IframeId); } ;return this._childFrame.obj.CreateConnection.call(this._childFrame.obj); } ;CWA__SetDomainEntryIframe.prototype.Dispose = function() { if (!this._childFrame) { this._childFrame = GetFrameWindowById(CWA__SetDomainEntryIframe.IframeId); } ;return this._childFrame.obj.Dispose.call(this._childFrame.obj); } ;function CWA__SetDomainBridgeIframe() { this._childFrame = null; this._parentDomain = null; this.IframeObject = null; this.userAgent = UserAgentInfo.GetInstance(); } ;CWA__SetDomainBridgeIframe.IframeURL = "SetDomainchildiframe.htm"; CWA__SetDomainBridgeIframe.IframeName = "childIframeName"; CWA__SetDomainBridgeIframe.IframeId = "127D05B8_3E75_42ba_9433_BC175922417B"; CWA__SetDomainBridgeIframe.prototype.Initialize = function() { this._parentDomain = URLTransfer.prototype.GetParameter(); var url = CWA__SetDomainBridgeIframe.IframeURL + URLTransfer.DividCharacter + this._parentDomain; var subframe = document.createElement('iframe'); if (!this.userAgent.IsSafari()) { subframe.src = url; } ;document.body.appendChild(subframe); if (this.userAgent.IsSafari()) { subframe.src = url; } ;subframe.name = CWA__SetDomainBridgeIframe.IframeName; subframe.id = CWA__SetDomainBridgeIframe.IframeId; this._childFrame = GetFrameWindowById(CWA__SetDomainBridgeIframe.IframeId); } ;CWA__SetDomainBridgeIframe.prototype.OnLoaded = function() { window.setTimeout(Delegate(this, this.Finish), 0); } ;CWA__SetDomainBridgeIframe.prototype.Finish = function() { document.domain = this._parentDomain; window.parent.obj.OnLoaded(); } ;CWA__SetDomainBridgeIframe.prototype.CreateConnection = function() { return this.IframeObject.CreateConnection.call(this.IframeObject); } ;CWA__SetDomainBridgeIframe.prototype.Dispose = function() { return this.IframeObject.Dispose.call(this.IframeObject); } ;function CWA__SetDomainChildIframe() { this._parentDomain = null; this._connectionPool = new Array(); } ;CWA__SetDomainChildIframe.prototype.Initialize = function() { this._parentDomain = window.parent.obj._parentDomain; this.userAgent = UserAgentInfo.GetInstance(); for (var i = 0; i < 100; i++) { var con = new Connection(); con.IsUsed = false; this._connectionPool.push(con); } } ;CWA__SetDomainChildIframe.prototype.OnLoaded = function() { window.parent.obj.IframeObject = this; window.parent.obj.OnLoaded(); if (this.userAgent.IsSafari()) { document.domain = this._parentDomain; } } ;CWA__SetDomainChildIframe.prototype.CreateConnection = function() { var connection = null; for (var i = 0; i < this._connectionPool.length; i++) { var con = this._connectionPool[i]; if (con.IsUsed == false) { con.IsUsed = true; connection = con; break; } } ;return connection; } ;CWA__SetDomainChildIframe.prototype.Dispose = function() { } ;ServerCommunicator.LogonCallback = function(authTicket, error) { } ;function ServerCommunicator() { this.DataReceivedEvent = null; this.ConnectionReadyEvent = null; this.AuthTicketChangedEvent = null; this.SessionId = null; this.TrafficEvent = null; this._isCrossDomain = null; this._serverUrl = null; this._bridgePagePath = null; this._authTicket = null; this._dataChannel = null; this._commandSender = null; this._logonSender = null; this._signoutSender = null; this._isStopped = true; this._isConnectionReady = false; this._signIncallbackFunction = null; this._delayOfDataChannel = 5000; this._timer = null; this._isCWA = false; } ;ServerCommunicator.AuthTicketName = "CWA-Ticket"; ServerCommunicator.prototype.Initialize = function( serverUrl, _isCWA, mode, ignoreError) { try { this.mode = mode; this.isIgnoreError = ignoreError; if (_isCWA == true) { this._isCWA = true; this._serverUrl = ConnectionFactory.FormatServerUrl(window.location.toString()); } else if (!serverUrl) { this._serverUrl = this._GetUIControlRootUrl(); if (this._serverUrl == null) this._serverUrl = L_cwaServerUrl; } else { this._serverUrl = serverUrl; } ;if (this._serverUrl.charAt(this._serverUrl.length - 1) != "/") { this._serverUrl += "/"; } ;var postFix = L_cwaServerVersionUrl.substr(L_cwaServerUrl.length, L_cwaServerVersionUrl.length); this._bridgePagePath = this._serverUrl + postFix; this.DataReceivedEvent = new Event(); this.ConnectionReadyEvent = new Event(); this.AuthTicketChangedEvent = new Event(); this.TrafficEvent = new Event(); this.URIUPdateEvent = new Event(); this._timer = new Timer(); this._timer.Initialize(); this._timer.TimeOutEvent.Add(Delegate(this, this._ConnectionCreateTimeout)); this._timer.SetTimeOutInterval(60 * 1000); this.SessionId = 1; if (this._IsValidServerUrl(this._bridgePagePath)) { this._timer.Start(); this._isCrossDomain = ConnectionFactory.CreateConnection(this._bridgePagePath, Delegate(this, this._CreateConnectionCallback)); ConnectionFactory.CreateConnection(this._bridgePagePath, Delegate(this, this._CreateConnectionCallback)); ConnectionFactory.CreateConnection(this._bridgePagePath, Delegate(this, this._CreateConnectionCallback)); ConnectionFactory.CreateConnection(this._bridgePagePath, Delegate(this, this._CreateConnectionCallback)); } } catch(e) { ; } } ;ServerCommunicator.prototype.IsConnectionReady = function( ) { return this._isConnectionReady; } ;ServerCommunicator.prototype.SetAuthTicket = function( authTicket ) { this._authTicket = authTicket; if (authTicket != null && this._dataChannel && this._commandSender && this._signoutSender) { if (this._dataChannel.xmlHttpRequest) { this._dataChannel.xmlHttpRequest.SetRequestHeader( ServerCommunicator.AuthTicketName, authTicket); } ;if (this._commandSender.xmlHttpRequest) { this._commandSender.xmlHttpRequest.SetRequestHeader( ServerCommunicator.AuthTicketName, authTicket); } ;if (this._signoutSender.xmlHttpRequest) { this._signoutSender.xmlHttpRequest.SetRequestHeader( ServerCommunicator.AuthTicketName, authTicket); } } } ;ServerCommunicator.prototype.GetAuthTicket = function() { return this._authTicket; } ;ServerCommunicator.prototype.LogonByIWA = function(callback) { var token = new Object(); token.callback = callback; token.type = LogonSender.IWAAuthentication; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.LogonByFORM = function(username, password, callback) { var token = new Object(); token.callback = callback; token.type = LogonSender.FormsAuthentication; token.username = username; token.password = password; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.LogonByAnon = function(callback) { var token = new Object(); token.callback = callback; token.type = LogonSender.AnonAuthentication; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.LogonBySSO = function(callback) { var token = new Object(); token.callback = callback; token.type = LogonSender.SSOAuthentication; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.CWALogonByIWA = function(callback, sipUri) { var token = new Object(); token.callback = callback; token.sipUri = sipUri; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.CWALogonByIWAJoin = function(callback, sipUri) { var token = new Object(); token.callback = callback; token.sipUri = sipUri; token.type = LogonSender.IWAJoinAuthentication; this._LogonImpl(this, null, token); } ;ServerCommunicator.prototype.SendWebCommand = function() { if (!this._isStopped) { var argumentsList = this.SendWebCommand.arguments; if (argumentsList[0] == "initiateSession" || argumentsList[0] == "initiateJoinSession") { this._signIncallbackFunction = argumentsList[argumentsList.length - 1]; argumentsList[argumentsList.length - 1] = Delegate(this, this._InitiateSessionCallback); } ;return this._commandSender.SendWebCommand(argumentsList); } else { ; } } ;ServerCommunicator.prototype.Stop = function() { this._isStopped = true; this._dataChannel.Close(); } ;ServerCommunicator.prototype.Reset = function(delay) { this._isStopped = false; this._dataChannel.Reset(delay); } ;ServerCommunicator.prototype.Activate = function(delay) { this._isStopped = false; this._dataChannel.Activate(delay); } ;ServerCommunicator.prototype.Dispose = function() { try { this.Stop(); if (this.DataReceivedEvent) { this.DataReceivedEvent.Dispose(); } ;this.DataReceivedEvent = null; if (this.TrafficEvent) { this.TrafficEvent = null; } ;this.TrafficEvent = null; if (this.ConnectionReadyEvent) { this.ConnectionReadyEvent.Dispose(); } ;this.ConnectionReadyEvent = null; if (this.AuthTicketChangedEvent) { this.AuthTicketChangedEvent.Dispose(); } ;this.AuthTicketChangedEvent = null; this._dataChannel.Dispose(); this._dataChannel = null; this._commandSender.Dispose(); this._commandSender = null; this._signoutSender.Dispose(); this._signoutSender = null; this._logonSender.Dispose(); this._logonSender = null; this._timer.Dispose(); this._timer = null; } catch(e) { ; } } ;ServerCommunicator.prototype._InitiateSessionCallback = function(sender, eventArgs) { if (eventArgs["IsFromDataChannel"] == false) { if (eventArgs["IsSuccess"]) { var xmlDoc = eventArgs["Return"]; var sid = XMLGetNodeValueByTagName(xmlDoc, "sid"); if (sid) { this.SessionId = sid; } ;var uri = XMLGetNodeValueByTagName(xmlDoc, "uri"); if (uri) { this.URIUPdateEvent.args["uri"] = FormalizeSipUri(uri); this.URIUPdateEvent.Fire(this, this.URIUPdateEvent.args); } ;var delay = XMLGetNodeValueByTagName(xmlDoc, "PollWaitTime"); if (!delay) delay = this._delayOfDataChannel; this.Activate(delay); } else { ; } } ;if ( this._signIncallbackFunction ) { try { return this._signIncallbackFunction( this, eventArgs); } catch(e) { ; } } } ;ServerCommunicator.prototype._CreateConnectionCallback = function(sender, connection) { if (!connection) { throw "Can not generate new connection"; } else { if (!this._logonSender) { this._logonSender = new LogonSender(); this._logonSender.Initialize(this, connection); } else if (!this._signoutSender) { this._signoutSender = new SignOutSender(); this._signoutSender.Initialize(this, connection); } else if (!this._dataChannel) { this._dataChannel = new AsyncDataChannel(); this._dataChannel.Initialize(this, connection); } else if (!this._commandSender) { this._commandSender = new CommandSender({communicator: this, connection: connection}); this._isStopped = false; this._isConnectionReady = true; this.SetAuthTicket(this._authTicket); this._timer.Stop(); this.ConnectionReadyEvent.Fire(this); } } } ;ServerCommunicator.prototype._PublishData = function(data, isFirst) { if (!this._isStopped) { this.DataReceivedEvent.args.isFirst = isFirst; this.DataReceivedEvent.args.dataDiv = data; this.DataReceivedEvent.Fire(this, this.DataReceivedEvent.args); } else { ; } } ;ServerCommunicator.prototype._LogonImpl = function(sender, eventArgs, token) { try { if(!this.IsConnectionReady()) { this.ConnectionReadyEvent.Add(Delegate(this, this._LogonImpl), "LogonEvent", token); } else { if (token.type == LogonSender.IWAAuthentication) { this._logonSender.LogonByIWA(token.callback); } else if (token.type == LogonSender.FormsAuthentication) { this._logonSender.LogonByFORM(token.username, token.password, token.callback); } else if (token.type == LogonSender.SSOAuthentication) { this._logonSender.LogonBySSO(token.callback); } else if (token.type == LogonSender.AnonAuthentication) { this._logonSender.LogonByAnon(token.callback); } else if (token.type == LogonSender.IWAJoinAuthentication) { this._logonSender.LogonByIWAJoin(token.callback, token.sipUri); } else { this._logonSender.LogonByIWA(token.callback, token.sipUri); } } } catch(e) { ; } } ;ServerCommunicator.prototype._IsValidServerUrl = function(serverURL) { try { var appServer = ConnectionFactory.FormatServerUrl(window.location.toString()); var apiServer = null; if (serverURL) { apiServer = ConnectionFactory.FormatServerUrl(serverURL); } ;if (!apiServer || apiServer == appServer) { return true; } else { var domain = ConnectionFactory.GetParentDomain(apiServer, appServer); if (domain) { return true; } else { var error = null; if (ConnectionFactory.GetUrlProtocol(apiServer) != ConnectionFactory.GetUrlProtocol(appServer)) { error = IdentifyError(2101); error.description = "Application website's protocol(" + ConnectionFactory.GetUrlProtocol(appServer) + ") is different from CWA website(" + ConnectionFactory.GetUrlProtocol(apiServer) + ")."; } else if (ConnectionFactory.GetHostName(apiServer).indexOf(".") < 0) { error = IdentifyError(2102); } else if (ConnectionFactory.GetHostName(appServer).indexOf(".") < 0) { error = IdentifyError(2103); } else { error = IdentifyError(2110); error.description = "Invalid parent domain for " + appServer + " and " + apiServer + "."; } ;DispatchError(error); return false; } } } catch(e) { ; } } ;ServerCommunicator.prototype._ConnectionCreateTimeout = function() { if (!this.IsConnectionReady()) { DispatchError(IdentifyError(2120)); } } ;ServerCommunicator.prototype._GetUIControlRootUrl = function() { var markFile = "/code.aspx"; var relativePath = "/../../"; var list = document.getElementsByTagName("SCRIPT"); var path = null; for (var i = 0; i < list.length; i++) { if (list[i].src) { var src = Trim(list[i].src).toLowerCase(); var position = src.lastIndexOf(markFile); if ( position >= 0 && (position + markFile.length == src.length)) { var path = src.substr(0, position); path = path + relativePath; break; } } } ;return path; } ;ServerCommunicator.prototype.OnPolicyChangeHandler = function(sender, xmlData) { if (xmlData) { var logoffURL = XMLGetNodeValueByTagName(xmlData, "customAuthLogoffUrl"); if (logoffURL) { this._signoutSender.SetCustomAuthLogoffUrl(logoffURL); } } } ;ServerCommunicator.prototype.OnRequestStatusHandler = function(sender, xmlData) { if (xmlData) { try { this._commandSender.ProcessCommandXMLItem(sender, xmlData); } catch(e) { ; } } } ;function AbstractUIComponent() { this._uniqueId = null; } ;AbstractUIComponent.prototype.GetHTML = function(){} ;AbstractUIComponent.prototype.Initialize = function(){} ;AbstractUIComponent.prototype.RenderTo = function( containerNode, anchorNode, initArgs ) { var body = document.body; ; if( containerNode == null ) { containerNode = body; } ;; var hiddenContainer = window._hiddenContainer; if( hiddenContainer == null ) { hiddenContainer = window._hiddenContainer = document.createElement( "DIV" ); var style = hiddenContainer.style; style.position = "absolute"; style.width = "1px"; style.height = "1px"; style.left = "-100px"; style.visibility = "hidden"; body.insertBefore( hiddenContainer, body.firstChild ); } ;hiddenContainer.innerHTML = this.GetHTML( initArgs? initArgs.GetHTML : null ); this.ref = hiddenContainer.firstChild; this.Initialize( initArgs? initArgs.Initialize : null, initArgs? initArgs.argsObj : null); var childNodes = hiddenContainer.childNodes; for(var i = childNodes.length - 1; i >= 0; --i) { containerNode.insertBefore(hiddenContainer.removeChild(childNodes[i]), anchorNode); } } ;AbstractUIComponent.prototype.Resize = function(width, height) { if (height) { this.ResizeHeight(height); } ;if (width) { this.ResizeWidth(width); } } ;AbstractUIComponent.prototype.ResizeWidth = function(width) { return this.GetWidth(); } ;AbstractUIComponent.prototype.ResizeHeight = function(height) { return this.GetHeight(); } ;AbstractUIComponent.prototype.GetRef = function(){} ;AbstractUIComponent.prototype.GetClientX = function(){} ;AbstractUIComponent.prototype.GetClientY = function(){} ;AbstractUIComponent.prototype.GetHeight = function(){} ;AbstractUIComponent.prototype.GetDesiredHeight = function() { return ( this.height != null )? this.height : this.GetHeight(); } ;AbstractUIComponent.prototype.GetWidth = function(){} ;AbstractUIComponent.prototype.GetDesiredWidth = function() { return ( this.width != null )? this.width : this.GetWidth(); } ;AbstractUIComponent.prototype.SetToolTip = function( toolTip ){} ;AbstractUIComponent.prototype.SetId = function( id ){} ;AbstractUIComponent.prototype.Action = function(){} ;AbstractUIComponent.prototype.Hide = function(){} ;AbstractUIComponent.prototype.Show = function(){} ;AbstractUIComponent.prototype.IsHidden = function(){} ;AbstractUIComponent.prototype.CompareTo = function(target){} ;AbstractUIComponent.prototype.ShowContextMenu = function(e, contextMenu, x, y) { if (contextMenu) { contextMenu.ShowAtEventSrc(e, x, y); } } ;AbstractUIComponent.prototype.Dispose = function(){} ;function NodeComponent(html) { this.ref = null; this.Disposing = null; this._html = html; } ;NodeComponent.prototype = new AbstractUIComponent(); NodeComponent.prototype.GetHTML = function() { if (IsString(this._html)) { return this._html; } else { return ""; } } ;NodeComponent.prototype.ResizeWidth = function(width) { return this.GetWidth(); } ;NodeComponent.prototype.GetRef = function() { return this.ref; } ;NodeComponent.prototype.GetClientX = function() { return GetClientX( this.ref ); } ;NodeComponent.prototype.GetClientY = function() { return GetClientY( this.ref ); } ;NodeComponent.prototype.GetHeight = function() { return ( this.ref.style.display == "none" )? 0 : this.ref.offsetHeight; } ;NodeComponent.prototype.GetWidth = function() { return ( this.ref.style.display == "none" )? 0 : this.ref.offsetWidth; } ;NodeComponent.prototype.SetId = function(id) { this.ref.id = id; } ;NodeComponent.prototype.SetToolTip = function(toolTip) { if (toolTip != null) { this.ref.title = toolTip; } } ;NodeComponent.prototype.Hide = function() { this.ref.style.display = "none"; } ;NodeComponent.prototype.Show = function() { this.ref.style.display = ""; } ;NodeComponent.prototype.IsHidden = function() { return this.ref.style.display == "none"; } ;NodeComponent.prototype.Dispose = function() { if (this.ref == null) return; this.ref.obj = null; this.ref.onclick = null; this.ref.ondblclick = null; this.ref.oncontextmenu = null; this.FireDisposeEvent(); } ;NodeComponent.prototype.FireDisposeEvent = function() { if( this.Disposing != null ) { var args = this.Disposing.args; args["widget"] = this; args["widgetNode"] = this.ref; this.Disposing.Fire( this, args ); } } ;NodeComponent.prototype.IsDisposed = function() { return this.ref.obj == null; } ;function StackPanel(isRow, cmpArray) { this.ref = null; this._isRow = (isRow != false) ? true : false; this._components = cmpArray; this._resizePolicy = ResizePolicy.EquationPolicy; this._resizePolicyArgs = new Array(); this._resizePolicyArgs[1] = this._components; this._lengthArray = new Array(); this._desiredWidth = 0; this._contentWidth = 0; this._desiredHeight = 0; this._contentHeight = 0; this._initialized = false; } ;StackPanel.prototype = new AbstractUIComponent(); StackPanel.prototype.GetHTML = function() { this._uniqueId = GetWidgetUniqueId("_stackPanel", StackPanel); var text = "<table id='" + this._uniqueId + "' cellspacing='0' cellpadding='0' width='100%'><tr>"; var count = this._components.length; for(var i = 0; i < count; ++i) { text += "<td align='left'>" + this._components[i].GetHTML() + "</td>"; if(!this._isRow && i < count - 1) { text += "</tr><tr>"; } } ;text += "</tr></table>"; return text; } ;StackPanel.prototype.CanResizeHeight = function(height) { return height > 50; } ;StackPanel.prototype.Initialize = function() { try { if(this.ref == null) { this.ref = document.getElementById(this._uniqueId); } ;var contentLength = 0; var count = this._components.length; for(var i = 0; i < count; ++i) { if(!this._initialized) { this._lengthArray[i] = 1; } ;var component = this._components[i]; if(this._isRow) { component.ref = this.ref.rows[0].cells[i].firstChild; component.Initialize(); contentLength += component.ResizeWidth(this._lengthArray[i]); } else { component.ref = this.ref.rows[i].cells[0].firstChild; component.Initialize(); contentLength += component.ResizeHeight(this._lengthArray[i]); } } ;if(!this._initialized) { if(this._isRow) { this._contentWidth = contentLength; } else { this._contentHeight = contentLength; } ;this._initialized = true; } } catch (ex) { ; throw ex; } } ;StackPanel.prototype.SetResizePolicy = function(policy, componentsToResize, resizableCount) { this._resizePolicy = policy || ResizePolicy.EquationPolicy; if(this._resizePolicyArgs.length > 5) { this._resizePolicyArgs = new Array(); } ;this._resizePolicyArgs[1] = componentsToResize || this._components; this._resizePolicyArgs[2] = resizableCount; if(arguments.length > 3) { for(var i = 3; i < arguments.length; ++i) { this._resizePolicyArgs[i + 2] = arguments[i]; } } } ;StackPanel.prototype.ResizeWidth = function(width, isExplicit) { var count = this._components.length; var i = 0; if(this._isRow) { if(this._desiredWidth != width || isExplicit == true) { for(i = 0; i < count; ++i) { this._components[i].ref = this.ref.rows[0].cells[i].firstChild; } ;this._resizePolicyArgs[0] = true; this._resizePolicyArgs[3] = width; this._resizePolicyArgs[4] = this._contentWidth; this._contentWidth = this._resizePolicy.apply(null, this._resizePolicyArgs); for(i = 0; i < count; ++i) { this._lengthArray[i] = this._components[i].GetWidth() || this._components[i].GetDesiredWidth(); } } else { for(i = 0; i < count; ++i) { this._components[i].ref = this.ref.rows[0].cells[i].firstChild; this._components[i].ResizeWidth(this._lengthArray[i]); } } } else { for(i = 0; i < count; ++i) { this._components[i].ref = this.ref.rows[i].cells[0].firstChild; } ;this._contentWidth = ResizePolicy.SimplePolicy(true, this._components, null, width); } ;this._desiredWidth = width; } ;StackPanel.prototype.ResizeHeight = function( height, isExplicit ) { var count = this._components.length; var i = 0; if( !this._isRow ) { if( this._desiredHeight != height || isExplicit == true ) { for( i = 0; i < count; i ++ ) { this._components[i].ref = this.ref.rows[i].cells[0].firstChild; } ;this._resizePolicyArgs[0] = false; this._resizePolicyArgs[3] = height; this._resizePolicyArgs[4] = this._contentHeight; this._contentHeight = this._resizePolicy.apply( null, this._resizePolicyArgs ); for( i = 0; i < count; i ++ ) { this._lengthArray[i] = this._components[i].GetHeight() || this._components[i].GetDesiredHeight(); } } else { for( i = 0; i < count; i ++ ) { this._components[i].ref = this.ref.rows[i].cells[0].firstChild; this._components[i].ResizeHeight( this._lengthArray[i] ); } } } else { for( i = 0; i < count; i ++ ) { this._components[i].ref = this.ref.rows[0].cells[i].firstChild; } ;this._contentHeight = ResizePolicy.SimplePolicy( true, this._components, null, height ); } ;this._desiredHeight = height; } ;StackPanel.prototype.Reset = function() { this._desiredWidth = 0; this._desiredHeight = 0; } ;StackPanel.prototype.GetComponentRef = function( index ) { var cmptContainer = this.GetCmptContainer(index); return cmptContainer? cmptContainer.firstChild : null; } ;StackPanel.prototype.GetCmptContainer = function(index) { if (index >= 0 && index < this._components.length) { return this._isRow? this.ref.rows[0].cells[index] : this.ref.rows[index].cells[0]; } else { return null; } } ;StackPanel.prototype.GetWidth = function() { return ( this._desiredWidth > this._contentWidth )? this._desiredWidth : this._contentWidth; } ;StackPanel.prototype.GetHeight = function() { return ( this._desiredHeight > this._contentHeight)? this._desiredHeight : this._contentHeight; } ;StackPanel.prototype.Dispose = function() { if( this.ref == null ) return; var count = this._components.length; for( i = 0; i < count; i ++ ) { this._components[i].ref = ( this._isRow )? this.ref.rows[0].cells[i].firstChild : this.ref.rows[i].cells[0].firstChild; this._components[i].Dispose(); } } ;function TextControl(type, isBr) { this.type = type || 0; this.isBr = (isBr == true); this.width = 0; this.widthStyle = 0; this.minWidth = 1; this.maxWidth = null; this.SetText = function(text) { ; ; if (this.isBr == false) { this.ref.firstChild.innerHTML = text; } else { this.ref.firstChild.innerHTML = text; } ;if ((this.type != 0) && (this.width != 0)) { var style = this.ref.style; style.width = ""; style.display = "inline"; ResizeInlineNode(this.ref, this.width); } } ;this.GetText = function() { ; ; if (this.isBr == false) { return this.ref.firstChild.innerHTML; } else { return this.ref.firstChild.innerHTML; } } ;this.GetHTML = function(overflowType, text, fontSize) { overflowType = overflowType || "hidden"; text = text || ""; var fontSizeStyle = fontSize? ("font-size:" + fontSize + ";") : ""; if (this.type == 0) { var html = "<div style='" + fontSizeStyle + "overflow:" + overflowType + "'>"; } else { var html = "<div style='" + fontSizeStyle + "overflow:" + overflowType + ";display:inline'>"; } ;if (this.isBr == false) { html += "<nobr>" + text + "</nobr>"; } else { html += "<div>" + text + "</div>"; } ;html += "</div>"; return html; } ;this.SetWidthLimit = function(minWidth, maxWidth) { this.minWidth = minWidth || 1; if (maxWidth > this.minWidth) { this.maxWidth = maxWidth; } else { this.maxWidth = null; } } ;this.ResizeWidth = function(width) { if (width < this.minWidth) { width = this.minWidth; } else if (this.maxWidth != null && this.maxWidth < width) { width = this.maxWidth; } ;if (this.type == 0) { if (this.width != width) { ResizeBlockNode(this.ref, width); this.widthStyle = this.ref.style.width; this.width = width; } else if (this.widthStyle != 0) { this.ref.style.width = this.widthStyle; } ;return width; } else { ResizeInlineNode(this.ref, width); this.width = width; return this.ref.offsetWidth; } } ;this.Resize = function(width, height) { this.ResizeWidth(width); } ;this.GetScrollWidth = function() { if( this.ref.style.display == "none" ) { return 0; } else { return this.ref.scrollWidth; } } ;this.RefreshHeight = function() { var height = this.ref.firstChild.offsetHeight; if( height > 0 ) { this.ref.style.height = height + "px"; } } ;this.Dispose = function() { if (this.ref) this.ref.obj = null; } } ;TextControl.prototype = new NodeComponent(); function BaseRowControl(type) { this.type = type || 0; this.maxWidth = 0; this.width = 0; this.className = null; this.bgImage = null; this.bodyClassName = null; this.bodyCellCtl = null; this.marginWidth = -1; } ;BaseRowControl.prototype = new NodeComponent(); BaseRowControl.prototype.GetHeadHTML = function() { return ""; } ;BaseRowControl.prototype.GetBodyCellHTML = function() { if (this.bodyCellCtl) { return this.bodyCellCtl.GetHTML(); } else { return ""; } } ;BaseRowControl.prototype.GetTailHTML = function() { return ""; } ;BaseRowControl.prototype.GetBodyCell = function() { return this.ref._cells[0]; } ;BaseRowControl.prototype._InitializeNodes = function() { this.ref._cells = this.ref.firstChild.firstChild.childNodes; if( this.bodyCellCtl || this.type != 2 ) { this.ref._bodyCell = this.GetBodyCell(); } } ;BaseRowControl.prototype.CountMarginWidth = function() { if( this.type == 0 ) { var isCloned = false; var rootNode = this.ref; var bodyNode = null; if( rootNode.offsetWidth == 0 && rootNode.offsetHeight == 0 ) { rootNode = CloneToVisibleHelperDiv( rootNode ); rootNode._cells = rootNode.firstChild.firstChild.childNodes; var origRef = this.ref; this.ref = rootNode; bodyNode = this.GetBodyCell(); this.ref = origRef; isCloned = true; } else { bodyNode = this.ref._bodyCell; var origHTML = bodyNode.innerHTML; } ;bodyNode.innerHTML = "<div>fake</div>"; if( rootNode.offsetWidth != 0 ) { this.marginWidth = rootNode.offsetWidth - bodyNode.firstChild.offsetWidth; } ;if( !isCloned ) { bodyNode.innerHTML = origHTML; } } else { } } ;BaseRowControl.prototype.ResizeBodyCell = function(width) { if (this.bodyCellCtl) { var cell = this.ref._bodyCell; this.bodyCellCtl.ref = cell.firstChild; return this.bodyCellCtl.ResizeWidth(width); } } ;BaseRowControl.prototype.OnClick = function(e) { this.OnUIEvent( "onclick", e ); } ;BaseRowControl.prototype.OnContextMenu = function(e) { this.OnUIEvent( "oncontextmenu", e ); return false; } ;BaseRowControl.prototype.OnDblClick = function(e) { this.OnUIEvent( "ondblclick", e ); } ;BaseRowControl.prototype.OnUIEvent = function( eventName, e ) { } ;BaseRowControl.prototype.SetBodyCellCtl = function(bodyCellCtl) { this.bodyCellCtl = bodyCellCtl; } ;BaseRowControl.prototype.GetHTML = function(id) { this.id = id? id : "_rowcontrol" + GetGUID(); var text = "<table id='" + this.id + "' cellspacing='0' cellpadding='0' width='100%' class='" + (this.className || "") + "'"; if (this.bgImage) text += " style='background-image:url(" + this.bgImage + ")'"; text += " onclick='if(this.obj){this.obj.ref=this;this.obj.OnClick(event);}'"; text += " ondblclick='if(this.obj){this.obj.ref=this;this.obj.OnDblClick(event);}'"; text += " oncontextmenu='if(this.obj){this.obj.ref=this;return this.obj.OnContextMenu(event);}'"; text += "><tbody><tr>"; text += this.GetHeadHTML(); switch( this.type ) { case 0: text += "<td class='" + (this.bodyClassName || "") + "'>" + this.GetBodyCellHTML() + "</td>"; break; case 1: text += "<td style='width:1' class='" + (this.bodyClassName || "") + "'>" + this.GetBodyCellHTML() + "</td>"; break; case 2: text += this.GetBodyCellHTML(); } ;text += this.GetTailHTML(); text += "</tr></tbody></table>"; return text; } ;BaseRowControl.prototype.Initialize = function(x) { try { var ref = this.ref; if (!ref) { this.ref = ref = document.getElementById(this.id); } ;ref.obj = this; this._InitializeNodes(); if (this.marginWidth == -1) { this.CountMarginWidth(); } ;if (this.bodyCellCtl) { this.bodyCellCtl.ref = ref._bodyCell.firstChild; this.bodyCellCtl.Initialize(); } } catch (ex) { ; throw ex; } } ;BaseRowControl.prototype.Action = function() { this.OnDblClick(); } ;BaseRowControl.prototype.ResizeWidth = function(width) { var toWidth = width; if ((this.maxWidth != 0) && (this.maxWidth <= width)) { if (this.width >= width) { this.width = width; return this.ref.offsetWidth; } else { toWidth = this.maxWidth; } } ;var bodyWidth = toWidth - this.marginWidth; if (bodyWidth <= 0) { bodyWidth = 1; } ;this.ResizeBodyCell(bodyWidth); this.width = width; return this.ref.offsetWidth; } ;BaseRowControl.prototype.Resize = function(width, height) { this.ResizeWidth(width); } ;BaseRowControl.prototype.Dispose = function() { if (this.ref == null) return; NodeComponent.prototype.Dispose.call(this); if (this.bodyCellCtl) { this.bodyCellCtl.ref = this.ref._bodyCell.firstChild; this.bodyCellCtl.Dispose(); } } ;CWButton = JT.Class( { superClass: NodeComponent, ctor: function(arg) { this._id = "cwbutton_" + CWButton._id++; this._imgid = this._id + "_img_cell"; this._textid = this._id + "_textid_cell"; this._callback = arg.callback; this._disableSrc = arg.disableSrc || ""; this._imgSrc = arg.imgSrc || ""; this._BeforeCreateButton(arg); this._state = "enable"; this._button = new ButtonDecorator(this._content, 0x0C, this._normal, this._hover, this._click, true, this._callback, null, null, this._selected); } }); CWButton._id = 0; CWButton.GetSplitButtonHTML = function() { return GetImgHTML(L_BUTTON_22_SPLIT); } ;CWButton.prototype.Initialize = function() { this._button.Initialize(); var ref = Dom(this._id); if(ref && ref.parentNode) { ref.parentNode.align = "center"; } ;if(this._height) { this._button.Get9GridDecorator().ResizeHeight(this._height); } } ;CWButton.prototype.GetHTML = function() { return this._button.GetHTML(); } ;CWButton.prototype.GetState = function() { return this._state; } ;CWButton.prototype.SetHint = function(text) { this._button.SetHint(text); } ;CWButton.prototype.SetImg = function(imgSrc) { if(Dom(this._imgid)) { SetImgSrc(Dom(this._imgid), imgSrc); } } ;CWButton.prototype.SetText = function(text, noEncode) { if(Dom(this._textid)) { Dom(this._textid).innerHTML = noEncode ? "<nobr>" + text + "</nobr>" : "<nobr>" + TextParser.prototype.ReplaceEntity(text) + "</nobr>"; } } ;CWButton.prototype.SetEnable = function(isEnable) { this.SetState(isEnable ? "enable" : "disable"); } ;CWButton.prototype.SetState = function(state) { switch(state) { case "disable": this._button.SetEnable(false); this._button.SetState(ClickableNodeState.Normal); this._disableSrc && this.SetImg(this._disableSrc); break; case "enable": this._button.SetEnable(true); this._button.SetState(ClickableNodeState.Normal); this._imgSrc && this.SetImg(this._imgSrc); break; case "active": this._button.SetEnable(true); this._button.SetState(ClickableNodeState.Selected); this._imgSrc && this.SetImg(this._imgSrc); break; default: return; } ;this._state = state; } ;CWButton.prototype._BeforeCreateButton = function(arg) { } ;CW22Button = JT.Class( { superClass: CWButton }); CW22Button.prototype._BeforeCreateButton = function(arg) { this._height = 22; if(!arg.imgSrc) { arg.imgSrc = ""; } ;if(!arg.text) { arg.text = ""; } ;this._content = "<table id='" + this._id + "' border='0' cellpadding='0' cellspacing='0'><tr>" + "<td>" + GetImgHTML(arg.imgSrc, null, null, null, this._imgid, " HSPACE='1' VSPACE='1'") + "</td>" + (arg.text ? "<td><div style='width: 2px;'></div></td><td id='" + this._textid + "'>" + arg.text + "</td><td><div style='width: 2px;'></div></td>" : "") + "</tr></table>"; if(arg.showNormalBG) { this._normal = new NineGridAssets(null, null, null, L_BUTTON_22_LEFT, L_BUTTON_22_MID, null, L_BUTTON_22_RIGHT, null, null, null); } else { this._normal = new NineGridAssets(null, null, null, L_BUTTON_22_LEFT, "", null, L_BUTTON_22_RIGHT, null, null, null, 0); } ;this._hover = new NineGridAssets(null, null, null, L_BUTTON_22_HOVER_LEFT, L_BUTTON_22_HOVER_MID, null, L_BUTTON_22_HOVER_RIGHT); this._click = new NineGridAssets(null, null, null, L_BUTTON_22_CLICK_LEFT, L_BUTTON_22_CLICK_MID, null, L_BUTTON_22_CLICK_RIGHT); this._selected = new NineGridAssets(null, null, null, L_BUTTON_22_SELECT_LEFT, L_BUTTON_22_SELECT_MID, null, L_BUTTON_22_SELECT_RIGHT); } ;CW32Button = JT.Class( { superClass: CWButton }); CW32Button.prototype._BeforeCreateButton = function(arg) { this._height = 32; this._content = "<table id='" + this._id + "' border='0' cellpadding='0' cellspacing='0'><tr>"; if(arg.imgSrc) { this._content += "<td>" + GetImgHTML(arg.imgSrc, null, null, null, this._imgid) + "</td>"; } ;if(arg.text) { this._content += "<td id='" + this._textid + "'>" + arg.text + "</td>"; } ;if(arg.showDrop) { this._content += "<td><div style='width: 5px;'></div></td><td style='width: 1px;'><img src='" + L_Down_Triangle + "'/></td>"; } ;this._content += "</tr></table>"; this._normal = new NineGridAssets(null, null, null, L_BUTTON_32_HOVER_LEFT, "", null, L_BUTTON_32_HOVER_RIGHT, null, null, null, 0); this._hover = new NineGridAssets(null, null, null, L_BUTTON_32_HOVER_LEFT, L_BUTTON_32_HOVER_MID, null, L_BUTTON_32_HOVER_RIGHT); this._click = new NineGridAssets(null, null, null, L_BUTTON_32_CLICK_LEFT, L_BUTTON_32_CLICK_MID, null, L_BUTTON_32_CLICK_RIGHT); this._selected = new NineGridAssets(null, null, null, L_BUTTON_32_SELECT_LEFT, L_BUTTON_32_SELECT_MID, null, L_BUTTON_32_SELECT_RIGHT); } ;CW32DropButton = JT.Class( { ctor: function(arg) { this._id = "cw32dropbtn_" + CW32DropButton.id++; this._imgid = this._id + "_img"; this._normal = new NineGridAssets(null, null, null, L_BUTTON_32_HOVER_LEFT, "", null, L_BUTTON_32_HOVER_RIGHT, null, null, null, 0); this._hover = new NineGridAssets(null, null, null, L_BUTTON_32_HOVER_LEFT, L_BUTTON_32_HOVER_MID, null, L_BUTTON_32_HOVER_RIGHT); this._click = new NineGridAssets(null, null, null, L_BUTTON_32_CLICK_LEFT, L_BUTTON_32_CLICK_MID, null, L_BUTTON_32_CLICK_RIGHT); this._select = new NineGridAssets(null, null, null, L_BUTTON_32_SELECT_LEFT, L_BUTTON_32_SELECT_MID, null, L_BUTTON_32_SELECT_RIGHT); this._callback = arg.callback; this._disableSrc = arg.disableSrc; var html = "<table border='0' cellpadding='0' cellspacing='0'><tr>"; if(arg.imgSrc) { html += "<td>" + GetImgHTML(arg.imgSrc, null, null, null, this._imgid) + "</td>"; } ;html += "<td>" + (arg.text ? arg.text : "") + "</td>"; html += "<td style='width: 3px;'><div style='width: 3px;'></div></td>"; html += "</tr></table>"; this._button = new ButtonDecorator(html, 0x0C, this._normal, this._select, this._click, true, Delegate(this, this._OnButtonClicked), null, null, this._select); this._drop = new ButtonDecorator("<img src='" + L_Down_Triangle + "'/>", 0x0C, this._normal, this._select, this._click, true, Delegate(this, this._OnDropClicked), null, null, this._select); this._buttonId = this._id + "_button"; this._dropId = this._id + "_drop"; } }); CW32DropButton.id = 0; CW32DropButton.prototype.GetHTML = function() { return "<table border='0' cellpadding='0' cellspacing='0'><tr><td id='" + this._buttonId + "'>" + this._button.GetHTML() + "</td><td id='" + this._dropId + "'>" + this._drop.GetHTML() + "</td></tr></table>"; } ;CW32DropButton.prototype.Initialize = function() { this._state = "enable"; this._button.Initialize(); this._drop.Initialize(); Dom(this._buttonId).onmouseover = Delegate(this, this._OnButtonMouseOver); Dom(this._buttonId).onmouseout = Delegate(this, this._OnButtonMouseOut); Dom(this._dropId).onmouseover = Delegate(this, this._OnDropMouseOver); Dom(this._dropId).onmouseout = Delegate(this, this._OnDropMouseOut); } ;CW32DropButton.prototype.SetHint = function(hintString) { this._button.SetHint(hintString); this._drop.SetHint(hintString); } ;CW32DropButton.prototype.SetImg = function(imgSrc) { if(Dom(this._imgid)) { SetImgSrc(Dom(this._imgid), imgSrc); } } ;CW32DropButton.prototype.SetState = function(state) { this._state = state; switch(state) { case "disable-without-drop": this._button.SetEnable(false); this._drop.SetEnable(true); this._button.SetState(ClickableNodeState.Normal); this._drop.SetState(ClickableNodeState.Normal); this._disableSrc && (Dom(this._imgid).src = this._disableSrc); break; case "disable": this._button.SetEnable(false); this._drop.SetEnable(false); this._button.SetState(ClickableNodeState.Normal); this._drop.SetState(ClickableNodeState.Normal); this._disableSrc && this.SetImg(this._disableSrc); break; case "enable": this._button.SetEnable(true); this._drop.SetEnable(true); this._button.SetState(ClickableNodeState.Normal); this._drop.SetState(ClickableNodeState.Normal); this._imgSrc && this.SetImg(this._imgSrc); break; case "active": this._button.SetEnable(true); this._drop.SetEnable(true); this._button.SetState(ClickableNodeState.Selected); this._drop.SetState(ClickableNodeState.Selected); this._imgSrc && this.SetImg(this._imgSrc); break; } } ;CW32DropButton.prototype._OnButtonClicked = function(sender, e) { this._callback && this._callback(this, {isDrop: false, e: e}); } ;CW32DropButton.prototype._OnButtonMouseOut = function() { if(this._state != "active" && this._state != "disable" && this._state != "disable-without-drop") { this._drop.SetAssets(this._normal); } } ;CW32DropButton.prototype._OnButtonMouseOver = function() { if(this._state != "active" && this._state != "disable" && this._state != "disable-without-drop") { this._drop.SetAssets(this._hover); } } ;CW32DropButton.prototype._OnDropClicked = function(sender, e) { this._callback && this._callback(this, {isDrop: true, e: e}); } ;CW32DropButton.prototype._OnDropMouseOut = function() { if(this._state != "active" && this._state != "disable" && this._state != "disable-without-drop") { this._button.SetAssets(this._normal); } } ;CW32DropButton.prototype._OnDropMouseOver = function() { if(this._state != "active" && this._state != "disable" && this._state != "disable-without-drop") { this._button.SetAssets(this._hover); } } ;CW22DropButton = JT.Class( { superClass: CWButton }); CW22DropButton.prototype._BeforeCreateButton = function(arg) { this._height = 22; var html = "<table border='0' cellpadding='0' cellspacing='0'><tr>"; if(arg.imgSrc) { html += "<td style='width: 1px;'>" + GetImgHTML(arg.imgSrc, null, null, null, this._imgid) + "</td>"; } ;html += (arg.text ? "<td><div style='width: 2px;'></div></td><td style='width: 1px;' id='" + this._textid + "'>"+ arg.text + "</td>" : ""); html += "<td><div style='width: 5px;'></div></td>"; html += "<td style='width: 1px;'><img src='" + L_Down_Triangle + "'/></td>"; html += "</tr></table>"; this._content = html; this._normal = new NineGridAssets(null, null, null, L_BUTTON_22_HOVER_LEFT, "", null, L_BUTTON_22_HOVER_RIGHT, null, null, null, 0); this._hover = new NineGridAssets(null, null, null, L_BUTTON_22_HOVER_LEFT, L_BUTTON_22_HOVER_MID, null, L_BUTTON_22_HOVER_RIGHT); this._click = new NineGridAssets(null, null, null, L_BUTTON_22_CLICK_LEFT, L_BUTTON_22_CLICK_MID, null, L_BUTTON_22_CLICK_RIGHT); } ;CW16Button = JT.Class( { superClass: CW22Button }); CW16Button.prototype._BeforeCreateButton = function(arg) { this._height = 22; this._normal = new NineGridAssets(null, null, null, L_BUTTON_22_HOVER_LEFT, "", null, L_BUTTON_22_HOVER_RIGHT, null, null, null, 0); this._hover = new NineGridAssets(null, null, null, L_BUTTON_22_HOVER_LEFT, L_BUTTON_22_HOVER_MID, null, L_BUTTON_22_HOVER_RIGHT); this._click = new NineGridAssets(null, null, null, L_BUTTON_22_CLICK_LEFT, L_BUTTON_22_CLICK_MID, null, L_BUTTON_22_CLICK_RIGHT); } ;IframeShim = JT.Class( { superClass: NodeComponent, ctor: function() { this._targetNode = null; this._iframe = null; } }); IframeShim.prototype.AttachToNode = function(node, position) { if (node == null || node.parentNode == null || position == null) return; if (this._iframe == null) { this._CreateIframe(); } ;node.parentNode.insertBefore(this._iframe, node); this._iframe.style.zIndex = node.style.zIndex; this._iframe.style.left = position.left + "px"; this._iframe.style.top = position.top + "px"; this._targetNode = node; this._MapSizeToNode(); } ;IframeShim.prototype.OnNodeSizeChanged = function() { if (this._iframe && this._targetNode) { this._MapSizeToNode(); } } ;IframeShim.prototype._CreateIframe = function() { var iframe = document.createElement("DIV"); iframe.innerHTML = "<iframe allowTransparency='true' scrolling='no' frameborder='0'></iframe>"; iframe.style.position = "absolute"; this._iframe = iframe; } ;IframeShim.prototype._MapSizeToNode = function() { ; ; this._iframe.firstChild.style.width = this._targetNode.offsetWidth + "px"; this._iframe.firstChild.style.height = this._targetNode.offsetHeight + "px"; } ;function MenuType(){};; MenuType.Normal = "normal"; MenuType.Check = "check"; MenuType.Radio = "radio"; MenuType.SubMenu = "menu"; MenuType.Separator = "separator"; MenuType.ActionButtonMenu = "with_action_button"; Menu._id = 0; function Menu() { this.Click = null; this.Select = null; this.Popup = null; this.items = null; this.isMouseOver = false; this._id = null; this._selectedItem = null; this._activeSubMenu = null; this._checkedRadioItem = null; this._hidingTimer = 0; this._hidingTimerDelegate = null; this._showingTimer = 0; this._showingTimerDelegate = null; this._itemShowingSubMenu = null; this._isSupportScroll = null; this._scrollUpDiv = null; this._scrollDownDiv = null; this._scrollingTimer = 0; this._scrollUpTimerDelegate = null; this._scrollDownTimerDelegate = null; this._menuSize = null; this._itemSize = null; this._tmpDockSize = null; } ;Menu.prototype = new NodeComponent(); Menu.prototype.submenuArrowIconUri = ""; Menu.prototype.checkIconUri = ""; Menu.prototype.radioCheckIconUri = ""; Menu.prototype.zIndex = 1; Menu.prototype.cssMenu = ""; Menu.prototype.cssTextPart = ""; Menu.prototype.cssTextPartOn = null; Menu.prototype.cssTextNode = ""; Menu.prototype.cssIconPart = ""; Menu.prototype.cssIconPartOn = null; Menu.prototype.cssIconPartBody = ""; Menu.prototype.cssIconNode = ""; Menu.prototype.cssIconNodeChecked = ""; Menu.prototype.iconNodeValign = "middle"; Menu.prototype.cssSpr = ""; Menu.prototype.cssLeftMargin = null; Menu.prototype.cssRightMargin = null; Menu.prototype.margin = 0; Menu.prototype.topMargin = 1; Menu.prototype.bottomMargin = 1; Menu.prototype.nowrap = true; Menu.prototype.scrollDivHeight = 15; Menu.prototype.slowScrollingTimerValue = 300; Menu.prototype.fastScrollingTimerValue = 100; Menu.prototype.GetHTML = function( id ) { if (this.cssLeftMargin == null) { this.cssLeftMargin = this.cssIconPart; } ;if (this.cssRightMargin == null) { this.cssRightMargin = this.cssTextPart; } ;this._id = ( id != null )? id : ( "_menu" + Menu._id ); Menu._id++; var string = "<table id='" + this._id + "' style='position:absolute;display:none;cursor:default;-moz-user-select:none' cellpadding='0' cellspacing='0'"; string += " oncontextmenu='return this.obj._OnContextMenu(event)'"; string += " onmouseover='this.obj._OnMouseEnterMenu(this, event)'"; string += " onmouseout='this.obj._OnMouseOutMenu(this, event)'"; string += " onselectstart='return false'>"; string += this._GetMarginRowHTML( this.topMargin ); string += this._GetMarginRowHTML( this.bottomMargin ); string += "</table>"; string += "<table id='" + this._id + "_scrollup' cellpadding='0' cellspacing='0' style='position:absolute;display:none;background-color:#D2DCEC'"; string += " onmouseover='StopEventBubble(event);this.obj._OnMouseOverScrollUpDiv()'"; string += " onmouseout='this.obj._OnMouseOutScrollDiv()'"; string += " onmousedown='this.obj._OnMouseDownScrollDiv(false)'"; string += " onmouseup='this.obj._OnMouseUpScrollDiv(false)'"; string += " onclick='StopEventBubble(event)'>"; string += "<tr>"; string += "<td align='center' style='height:" + this.scrollDivHeight + "px'><img src='" + L_Menu_UpArrow + "'></td>"; string += "</tr>"; string += "</table>"; string += "<table id='" + this._id + "_scrolldown' cellpadding='0' cellspacing='0' style='position:absolute;display:none;background-color:#D2DCEC'"; string += " onmouseover='StopEventBubble(event);this.obj._OnMouseOverScrollDownDiv()'"; string += " onmouseout='this.obj._OnMouseOutScrollDiv()'"; string += " onmousedown='this.obj._OnMouseDownScrollDiv(true)'"; string += " onmouseup='this.obj._OnMouseUpScrollDiv(true)'"; string += " onclick='StopEventBubble(event)'>"; string += "<tr>"; string += "<td align='center' style='height:" + this.scrollDivHeight + "px'><img src='" + L_Menu_DownArrow + "'></td>"; string += "</tr>"; string += "</table>"; return string; } ;Menu.prototype.Initialize = function( isSupportScroll ) { try { this.ref = document.getElementById(this._id); ; this.ref.obj = this; this.ref.style.zIndex = this.zIndex; this._isSupportScroll = ( isSupportScroll != false ); if (this.cssMenu != "") { this.ref.className = this.cssMenu; } else { this.ref.style.border = "1px solid gray"; this.ref.style.backgroundColor = "ghostwhite"; } ;this._scrollUpDiv = document.getElementById(this._id + "_scrollup"); this._scrollUpDiv.obj = this; this._scrollUpDiv.style.zIndex = this.zIndex; this._scrollDownDiv = document.getElementById(this._id + "_scrolldown"); this._scrollDownDiv.obj = this; this._scrollDownDiv.style.zIndex = this.zIndex; this.Click = new Event(); this.Select = new Event(); this.Popup = new Event(); this.items = new Object(); this._scrollUpTimerDelegate = Delegate(this, this._OnMouseOverScrollUpDiv); this._scrollDownTimerDelegate = Delegate(this, this._OnMouseOverScrollDownDiv); this._hidingTimerDelegate = Delegate(this, this._OnHideTimeOut); this._showingTimerDelegate = Delegate(this, this._OnShowTimeOut); this._itemSize = new Size(); this._menuSize = new Size(); this._menuSize.width = 0; this._menuSize.height = 0; this._tmpDockSize = new Size(); this._tmpDockSize.width = 0; this._tmpDockSize.height = 0; } catch (ex) { ; throw ex; } } ;Menu.prototype.Generate = function( id, isSupportScroll, argsObj) { var body = document.body; this.RenderTo(body, body.firstChild, {GetHTML: id, Initialize: isSupportScroll, argsObj: argsObj}); } ;Menu.prototype.InsertItem = function(targetItem, type, id, text, content, image, isMute, isGray, actionButtonHtml) { if (type == null) type = MenuType.Normal; try { if (type != MenuType.Separator) { var item = this._InsertNormalItem( targetItem, text, image, isMute ); if( isGray == true ) this.Gray(item, true); } else { var item = this._InsertSeparator(targetItem); } ;item.obj = this; if (id != null) { item.id = this.ref.id + "_" + id; item.itemId = id; this.items[id] = item; } ;item.setAttribute("itemType", type); switch (type) { case MenuType.SubMenu: item.submenu = content; var cell = item.rows[0].cells[2].firstChild.rows[0].cells[2]; ; if (this.submenuArrowIconUri != "") { cell.firstChild.innerHTML = "<img src='" + this.submenuArrowIconUri + "'>"; } else { cell.firstChild.innerHTML = ">>"; } ;break; case MenuType.Check: item.actionHandler = content; var iconContainer = this._GetIconContainer( item ); iconContainer.innerHTML = this._GetIconNodeHTML( this.checkIconUri ); this._SetCheckIconCSS( iconContainer, true ); this.CheckItem( item, false ); break; case MenuType.Separator: break; case MenuType.ActionButtonMenu: var cell = item.rows[0].cells[2].firstChild.rows[0].cells[2]; cell.innerHTML = actionButtonHtml || ""; break; default: item.actionHandler = content; } ;this._OnSizeChanged(); return item; } catch (ex) { ; throw ex; } } ;Menu.prototype.AppendItem = function(type, id, text, content, image, isMute, isGray, actionButtonHtml) { return this.InsertItem(null, type, id, text, content, image, isMute, isGray, actionButtonHtml); } ;Menu.prototype.AppendItems = function(itemInfos) { if (itemInfos == null) return; var itemInfo = null; for (var i = 0; i < itemInfos.length; i ++) { itemInfo = itemInfos[i]; this.AppendItem(itemInfo[0], itemInfo[1], itemInfo[2], itemInfo[3], itemInfo[4], itemInfo[5], itemInfo[6], itemInfo[7]); } } ;Menu.prototype.RemoveItem = function(item) { if ((item == null) || (item.nodeName.toUpperCase() != "TABLE")) return; try { if (this._checkedRadioItem == item) { this._checkedRadioItem = null; } ;item.obj = null; item.actionHandler = null; item.onmouseout = null; if( item.submenu ) { item.submenu.Dispose(); item.submenu = null; } ;var index = item.parentNode.parentNode.rowIndex; this.ref.deleteRow(index); var itemId = item.itemId; if (itemId != null) { delete this.items[itemId]; } ;this._OnSizeChanged(); } catch (ex) { ; throw ex; } } ;Menu.prototype.RemoveItemById = function(id) { try { if (id != null && this.items[id] != null) { ; this.RemoveItem( this.items[id] ); } } catch (ex) { ; throw ex; } } ;Menu.prototype.ClearAllItems = function() { try { var i = this.ref.rows.length - 2; for (; i >= 1; i--) { var node = this.ref.rows[i].cells[0].firstChild; node.obj = null; node.actionHandler = null; node.onmouseout = null; if (node.submenu) { node.submenu.Dispose(); node.submenu = null; } ;this.ref.deleteRow(i); } ;this._checkedRadioItem = null; this.items = new Object(); this._OnSizeChanged(); } catch (ex) { ; throw ex; } } ;Menu.prototype.Gray = function(itemOrItemId, isGray) { if(!itemOrItemId) { return; } ;var item = (typeof itemOrItemId == "string") ? this.items[itemOrItemId] : itemOrItemId; if (item.nodeName.toUpperCase() != "TABLE") { return; } ;try { if (item.getAttribute("grayed") == 0) { if (isGray) { item.setAttribute("grayed", 1); var cell = item.rows[0].cells[2].firstChild.rows[0].cells[1]; cell.style.color = "gray"; } } else { if (!isGray) { item.setAttribute("grayed", 0); var cell = item.rows[0].cells[2].firstChild.rows[0].cells[1]; cell.style.color = ""; } } } catch (ex) { ; throw ex; } } ;Menu.prototype.IsGrayed = function(item) { return item.getAttribute("grayed") != 0; } ;Menu.prototype.CheckItem = function(itemOrItemId, isCheckOn) { var item = (typeof itemOrItemId == "string") ? this.items[itemOrItemId] : itemOrItemId; if( item == null || item.getAttribute("itemType") != MenuType.Check ) return; isCheckOn = ( isCheckOn != false ); var iconContainer = this._GetIconContainer( item ); iconContainer.style.visibility = ( isCheckOn )? "" : "hidden"; item.checked = isCheckOn; } ;Menu.prototype.IsChecked = function(item) { if( item == null || item.getAttribute("itemType") != MenuType.Check ) return false; var iconContainer = this._GetIconContainer( item ); return ( iconContainer.style.visibility != "hidden" ); } ;Menu.prototype.CheckRadioItem = function(item) { if ((item == null) || (item == this._checkedRadioItem)) return; this.UncheckRadioItem(); var iconContainer = this._GetIconContainer( item ); if( iconContainer._hasRadioIcon != true ) { if( iconContainer.firstChild.nodeName == "#text" ) { iconContainer.innerHTML = this._GetIconNodeHTML( this.radioCheckIconUri ); iconContainer._hasRadioIcon = true; } } else { iconContainer.style.visibility = ""; } ;this._SetCheckIconCSS( iconContainer, true ); item._isRadioChecked = true; this._checkedRadioItem = item; } ;Menu.prototype.UncheckRadioItem = function() { if( this._checkedRadioItem ) { var iconContainer = this._GetIconContainer( this._checkedRadioItem ); if( iconContainer._hasRadioIcon == true ) { iconContainer.style.visibility = "hidden"; } ;this._SetCheckIconCSS( iconContainer, false ); this._checkedRadioItem._isRadioChecked = null; this._checkedRadioItem = null; } } ;Menu.prototype.GetCheckedRadioItem = function() { return this._checkedRadioItem; } ;Menu.prototype.SetShowItem = function( item, isShow ) { var parentNode = item.parentNode; if( parentNode && parentNode.parentNode ) { parentNode.parentNode.style.display = ( isShow == false )? "none" : ""; this._OnSizeChanged(); } } ;Menu.prototype.GetCount = function() { return this.ref.rows.length - 2; } ;Menu.prototype.GetItemByIndex = function(index) { try { if ((index >= 0) && (index < this.ref.rows.length - 2)) { return this.ref.rows[index + 1].cells[0].firstChild; } else { return null; } } catch (ex) { ; throw ex; } } ;Menu.prototype.GetItemText = function(item) { if (!item) return null; var cell = item.rows[0].cells[2].firstChild.rows[0].cells[1]; ; return cell.innerHTML; } ;Menu.prototype.GetItemIdByIndex = function(index) { try { var item = this.GetItemByIndex( index ); if (item) { return item.itemId; } else { return null; } } catch (ex) { ; throw ex; } } ;Menu.prototype.SetItemInfo = function(item, id, text, image) { if ((item == null) || (item.nodeName.toUpperCase() != "TABLE")) return; try { if (id != null) { delete this.items[item.itemId]; item.itemId = id; this.items[id] = item; } ;if (text != null && text != "") { var textCell = item.rows[0].cells[2].firstChild.rows[0].cells[1]; textCell.innerHTML = text; this._OnSizeChanged(); } ;if (image != null) { var iconContainer = this._GetIconContainer( item ); if (image == "") { iconContainer.innerHTML = "&nbsp;"; } else if (iconContainer.firstChild.nodeName == "#text") { iconContainer.innerHTML = this._GetIconNodeHTML( image ); } else { this._SetIconSrc( iconContainer, image ); } } } catch (ex) { ; throw ex; } } ;Menu.prototype.SetItemCss = function( item, textCss ) { var iconCell = item.rows[0].cells[1]; iconCell.style.display = "none"; var textCell = item.rows[0].cells[2]; textCell.firstChild.rows[0].cells[0].style.display = "none"; textCell.className = textCss; } ;Menu.prototype.ShowAtCoordinate = function(clientX, clientY, isSelfAdapted) { this._tmpDockSize.left = clientX; this._tmpDockSize.top = clientY; this.Show(this._tmpDockSize, "right", isSelfAdapted); } ;Menu.prototype.Show = function(dockSize, direction, isSelfAdapted) { try { if (this.Popup.IsHooked() == true) { this._FirePopupEvent(); this._OnSizeChanged(); } ;var style = this.ref.style; if (this._menuSize.width == 0) { style.width = ""; style.left = "-1000px"; style.top = "-1000px"; style.display = ""; var offsetWidth = this.ref.offsetWidth; style.width = ( offsetWidth < 100 )? "100px" : offsetWidth + "px"; this._menuSize.width = this.ref.offsetWidth; this._menuSize.height = this.ref.offsetHeight; style.display = "none"; } ;CountPopupPos(dockSize, direction, this._menuSize, isSelfAdapted); style.left = this._menuSize.left + "px"; style.top = this._menuSize.top + "px"; style.display = ""; if( this._isSupportScroll == true && this._menuSize.top + this._menuSize.height > GetBodyClientHeight() ) { this._ShowHideScrollDownDiv(true); } } catch (ex) { ; throw ex; } } ;Menu.prototype.Hide = function() { try { if (this._activeSubMenu) { this._activeSubMenu.Hide(); this._activeSubMenu = null; } ;this._ClearShowingTimer(); this._ClearHidingTimer(); this._DeselectActiveItem(); this.ref.style.display = "none"; this._OnMouseOutScrollDiv(); this._scrollDownDiv.style.display = "none"; this._scrollUpDiv.style.display = "none"; } catch (ex) { ; throw ex; } } ;Menu.prototype.Close = function() { this.Hide(); } ;Menu.prototype.IsHidden = function() { if (this.ref.style.display == "none") { return true; } else { return false; } } ;Menu.prototype.Withdraw = function() { if (this._activeSubMenu) { var isLastLevel = this._activeSubMenu.Withdraw(); if (isLastLevel == true) { this._activeSubMenu.Hide(); this._activeSubMenu = null; this._ClearShowingTimer(); this._ClearHidingTimer(); } ;return false; } else { return true; } } ;Menu.prototype.Dispose = function() { if (this.ref == null) return; var i = this.ref.rows.length - 2; var node = null; for (; i >= 1; i--) { node = this.ref.rows[i].cells[0].firstChild; node.obj = null; node.actionHandler = null; node.onmouseout = null; if (node.submenu) { node.submenu.Dispose(); node.submenu = null; } } ;this._scrollUpDiv.obj = null; this._scrollDownDiv.obj = null; this.ref.obj = null; this.ref = null; } ;Menu.prototype._GetMarginRowHTML = function( marginHeight ) { var string = "<tr><td><table width='100%' cellpadding='0' cellspacing='0'>" + "<tr height=" + marginHeight + ">" + "<td class='" + this.cssLeftMargin + "' width='" + this.margin + "' style='border:0px'></td>" + "<td class='" + this.cssIconPart +"' width='1' style='border-top:0px;border-bottom:0px'>" + "<div style='overflow:hidden;height:" + marginHeight + "px' class='" + this.cssIconPartBody + "'>&nbsp;</div>" + "</td>" + "<td colspan='2'></td>" + "</tr>" + "</table></td></tr>"; return string; } ;Menu.prototype._GetIconNodeHTML = function( src ) { if( src ) { return "<table cellpadding='0' cellspacing='0'><tr><td align='center' class='" + this.cssIconNode + "'>" + GetImgHTML( src ) + "</td></tr></table>"; } else { return "&nbsp;"; } } ;Menu.prototype._InsertNormalItem = function( targetItem, text, image, isMute ) { try { var string = "<table width='100%' cellpadding='0' cellspacing='0'"; if( isMute != true ) { string += " grayed=0" + " onmouseover='this.obj._OnMouseOver(this)'" + " onmouseout='this.obj._OnMouseOut(this)'" + " onclick='this.obj._OnDefaultClick(this, event)'><tr>"; } else { string += " onclick='StopEventBubble(event)'><tr>"; } ;string += "<td class='" + this.cssLeftMargin + "' width='" + this.margin + "'><div style='width:" + this.margin + "px'></div></td>"; string += "<td class='" + this.cssIconPart +"' width='1' align='center' valign='" + this.iconNodeValign + "'><div class='" + this.cssIconPartBody + "'>" + this._GetIconNodeHTML( image ) + "</div></td>"; string += "<td class='" + this.cssTextPart + "'>" + "<table cellpadding='0' cellspacing='0' width='100%'><tr>" + "<td width='1'><div style='width:6px'></div></td>" + "<td " + ((this.nowrap)?"nowrap ":"") + "class='" + this.cssTextNode + "'>" + text + "</td>" + "<td width='1' align='center'><div style='width:15px'></div></td>" + "</tr></table>" + "</td>"; string += "<td class='" + this.cssRightMargin + "' width='" + this.margin + "'><div style='width:" + this.margin + "px'></div></td>" + "</tr></table>"; var item = this._DoInsertRow(targetItem, string); if (this.margin == 0) { item.rows[0].cells[0].style.display = "none"; item.rows[0].cells[3].style.display = "none"; } ;return item; } catch (ex) { ; throw ex; } } ;Menu.prototype._InsertSeparator = function(targetItem) { try { var string = "<table width='100%' cellpadding='0' cellspacing='0'" + " onclick='this.obj._OnDefaultClick(this, event)'>" + "<tr height='7'>" + "<td class='" + this.cssLeftMargin + "' width='" + this.margin + "' style='border:0px'></td>" + "<td class='" + this.cssIconPart +"' width='1' style='border-top:0px;border-bottom:0px'>" + "<div style='overflow:hidden;height:7px' class='" + this.cssIconPartBody + "'>&nbsp;</div>" + "</td>" + "<td width='5'></td>" + "<td colspan='3'><table width='100%' cellpadding='0' cellspacing='0'><tr><td></td></tr></table></td>" + "</tr>" + "</table>"; var item = this._DoInsertRow(targetItem, string); if (item) { var tableSet = item.rows[0].cells[3].getElementsByTagName("TABLE"); var innerTable = tableSet[0]; ; if (this.cssSpr == "") { innerTable.style.borderBottom = "1px solid gray"; } else { innerTable.className = this.cssSpr; } ;if (this.margin == 0) { item.rows[0].cells[0].style.display = "none"; } } ;return item; } catch (ex) { ; throw ex; } } ;Menu.prototype._DoInsertRow = function(item, innerHTML) { if (item) { try { var rowIndex = item.parentNode.parentNode.rowIndex; } catch (ex) { var rowIndex = this.ref.rows.length - 1; } } else { var rowIndex = this.ref.rows.length - 1; } ;var row = this.ref.insertRow(rowIndex); if (!row) { var error = new DomError(DomError.Type["InsertRow"]); ; throw error; } ;var cell = row.insertCell(-1); if (!cell) { this.ref.removeChild(row); var error = new DomError(DomError.Type["InsertCell"]); ; throw error; } ;try { cell.innerHTML = innerHTML; return cell.firstChild; } catch (ex) { this.ref.removeChild(row); ; throw ex; } } ;Menu.prototype._GetIconContainer = function( item ) { return item.rows[0].cells[1].firstChild; } ;Menu.prototype._SetIconSrc = function( iconContainer, src ) { var child = iconContainer.firstChild; ; SetImgSrc( child.rows[0].cells[0].firstChild, src ); } ;Menu.prototype._SetCheckIconCSS = function( iconContainer, isCheck ) { var child = iconContainer.firstChild; ; if( isCheck ) { child.rows[0].cells[0].className = this.cssIconNodeChecked || this.cssIconNode; } else { child.rows[0].cells[0].className = this.cssIconNode; } } ;Menu.prototype._SelectItem = function(item) { this._DeselectActiveItem(); try { if (item.getAttribute("grayed") != 1) { if (this.cssTextPartOn != null) { item.rows[0].cells[2].className = this.cssTextPartOn; } else { item.style.backgroundColor = "cornflowerblue"; } ;item.rows[0].cells[1].className = this.cssIconPartOn; this._selectedItem = item; } } catch(ex) { ; throw ex; } } ;Menu.prototype._DeselectActiveItem = function() { try { if (this._selectedItem) { if (this.cssTextPartOn != null) { this._selectedItem.rows[0].cells[2].className = this.cssTextPart; } else { this._selectedItem.style.backgroundColor = ""; } ;this._selectedItem.rows[0].cells[1].className = this.cssIconPart; this._selectedItem = null; } } catch(ex) { ; throw ex; } } ;Menu.prototype._DelayedShowSubMenu = function(item) { if (item.getAttribute("grayed") != 1) { var subMenu = item.submenu; ; if (subMenu == this._activeSubMenu) { this._ClearShowingTimer(); this._ClearHidingTimer(); } else { if (this._showingTimer != 0) { this._ClearShowingTimer(); } else { this._DelayedHideActiveSubMenu(); } ;this._itemShowingSubMenu = item; this._showingTimer = window.setTimeout( this._showingTimerDelegate, 500 ); } } else { this._DelayedHideActiveSubMenu(); } } ;Menu.prototype._DelayedHideActiveSubMenu = function() { if ((this._hidingTimer == 0) && (this._activeSubMenu != null)) { this._hidingTimer = window.setTimeout( this._hidingTimerDelegate, 500 ); } } ;Menu.prototype._ClearShowingTimer = function() { if (this._showingTimer != 0) { window.clearTimeout(this._showingTimer); this._showingTimer = 0; } } ;Menu.prototype._ClearHidingTimer = function() { if (this._hidingTimer != 0) { window.clearTimeout(this._hidingTimer); this._hidingTimer = 0; } } ;Menu.prototype._ShowSubMenu = function(item) { this._ClearShowingTimer(); this._ClearHidingTimer(); var subMenu = item.submenu; ; if (subMenu != this._activeSubMenu) { if (this._activeSubMenu) { this._activeSubMenu.Hide(); } ;with (this._itemSize) { left = GetClientX(item); top = GetClientY(item); width = item.offsetWidth; height = item.offsetHeight; } ;subMenu.ref.style.zIndex = this.ref.style.zIndex + 2; subMenu.Show(this._itemSize, "right"); this._activeSubMenu = subMenu; } } ;Menu.prototype._ShowHideScrollDownDiv = function(isShow) { if (isShow == true) { var firstMenuItem = this.ref.rows[0].cells[0]; this._scrollDownDiv.style.left = GetClientX(firstMenuItem); this._scrollDownDiv.style.top = GetBodyClientHeight() - this.scrollDivHeight; this._scrollDownDiv.style.width = firstMenuItem.offsetWidth + "px"; this._scrollDownDiv.style.zIndex = this.ref.style.zIndex + 1; this._scrollDownDiv.style.display = ""; } else { this._scrollDownDiv.style.display = "none"; } } ;Menu.prototype._ShowHideScrollUpDiv = function(isShow) { if (isShow == true) { var firstMenuItem = this.ref.rows[0].cells[0]; this._scrollUpDiv.style.left = GetClientX(firstMenuItem); this._scrollUpDiv.style.top = 0; this._scrollUpDiv.style.width = firstMenuItem.offsetWidth + "px"; this._scrollUpDiv.style.zIndex = this.ref.style.zIndex + 1; this._scrollUpDiv.style.display = ""; } else { this._scrollUpDiv.style.display = "none"; } } ;Menu.prototype._OnHideTimeOut = function() { try { this._hidingTimer = 0; if (this._activeSubMenu) { this._activeSubMenu.Hide(); this._activeSubMenu = null; } } catch (ex) { ; } } ;Menu.prototype._OnShowTimeOut = function() { try { this._showingTimer = 0; ; this._ShowSubMenu(this._itemShowingSubMenu); this._itemShowingSubMenu = null; } catch (ex) { ; } } ;Menu.prototype._OnSizeChanged = function() { this._menuSize.width = 0; } ;Menu.prototype._OnDefaultClick = function(item, e) { try { StopEventBubble(e); if (item.getAttribute("grayed") == 1) return; var itemType = item.getAttribute("itemType"); switch (itemType) { case MenuType.SubMenu: this._ShowSubMenu(item); break; case MenuType.Check: this.CheckItem( item, !item.checked ); this._FireClickEvent(item); break; case MenuType.Radio: if (item != this._checkedRadioItem) { this.CheckRadioItem(item); } ;this._FireClickEvent(item); break; case MenuType.Separator: break; default: this._FireClickEvent(item); } } catch (ex) { ; } } ;Menu.prototype._OnMouseOver = function(item) { try { this._SelectItem(item); if (item.getAttribute("itemType") == "menu") { this._DelayedShowSubMenu(item); } else { this._DelayedHideActiveSubMenu(); } } catch (ex) { ; } } ;Menu.prototype._OnMouseOut = function(item) { if( item.getAttribute("grayed") == 1 ) return; try { if (item.getAttribute("itemType") == "menu") { var subMenu = item.submenu; ; if (this._activeSubMenu != subMenu) { this._DeselectActiveItem(); ; this._ClearShowingTimer(); } } else { this._DeselectActiveItem(); } } catch (ex) { ; } } ;Menu.prototype._OnMouseEnterMenu = function(item, e) { this.isMouseOver = true; } ;Menu.prototype._OnMouseOutMenu = function(item, e) { this.isMouseOver = false; } ;Menu.prototype._OnContextMenu = function(e) { StopEventBubble(e); return false; } ;Menu.prototype._OnMouseOverScrollUpDiv = function() { if (this.ref.style.display == "none") return; if (this._scrollingTimer == 0) { this._scrollingTimer = window.setInterval(this._scrollUpTimerDelegate, this.slowScrollingTimerValue); } ;var firstMenuItem = this.ref.rows[1].cells[0]; var spacing = firstMenuItem.offsetHeight; this._menuSize.top += spacing; this.ref.style.top = this._menuSize.top; if (this._scrollDownDiv.style.display == "none" && this._menuSize.top + this.ref.offsetHeight > GetBodyClientHeight()) { this._ShowHideScrollDownDiv(true); } ;if (this._menuSize.top >= 0) { this._ShowHideScrollUpDiv(false); window.clearInterval( this._scrollingTimer ); this._scrollingTimer = 0; } } ;Menu.prototype._OnMouseOverScrollDownDiv = function() { if (this.ref.style.display == "none") return; if (this._scrollingTimer == 0) { this._scrollingTimer = window.setInterval(this._scrollDownTimerDelegate, this.slowScrollingTimerValue); } ;var firstMenuItem = this.ref.rows[1].cells[0]; var spacing = firstMenuItem.offsetHeight; this._menuSize.top -= spacing; this.ref.style.top = this._menuSize.top; if (this._scrollUpDiv.style.display == "none" && this._menuSize.top < 0) { this._ShowHideScrollUpDiv(true); } ;if (this._menuSize.top + this.ref.offsetHeight <= GetBodyClientHeight() + spacing/2) { this._ShowHideScrollDownDiv(false); window.clearInterval( this._scrollingTimer ); this._scrollingTimer = 0; } } ;Menu.prototype._OnMouseDownScrollDiv = function(isScrollDownDiv) { if (this._scrollingTimer == 0) return; window.clearInterval( this._scrollingTimer ); if (isScrollDownDiv) { this._scrollingTimer = window.setInterval(this._scrollDownTimerDelegate, this.fastScrollingTimerValue); } else { this._scrollingTimer = window.setInterval(this._scrollUpTimerDelegate, this.fastScrollingTimerValue); } } ;Menu.prototype._OnMouseUpScrollDiv = function(isScrollDownDiv) { if (this._scrollingTimer == 0) return; window.clearInterval( this._scrollingTimer ); if (isScrollDownDiv) { this._scrollingTimer = window.setInterval(this._scrollDownTimerDelegate, this.slowScrollingTimerValue); } else { this._scrollingTimer = window.setInterval(this._scrollUpTimerDelegate, this.slowScrollingTimerValue); } } ;Menu.prototype._OnMouseOutScrollDiv = function() { if (this._scrollingTimer != 0) { window.clearInterval( this._scrollingTimer ); this._scrollingTimer = 0; } } ;Menu.prototype._FireClickEvent = function(item) { try { this.Click.args["itemId"] = item.itemId; this.Click.args["item"] = item; if (item.actionHandler) { item.actionHandler( this, this.Click.args ); } ;this.Click.Fire( this, this.Click.args ); } catch (ex) { ; throw ex; } } ;Menu.prototype._FireSelectEvent = function(item) { try { this.Select.args["itemId"] = item.itemId; this.Select.args["item"] = item; this.Select.Fire( this, this.Select.args ); } catch (ex) { ; throw ex; } } ;Menu.prototype._FirePopupEvent = function() { try { this.Popup.Fire( this, this.Popup.args ); } catch (ex) { ; throw ex; } } ;function MenuBar( isClassic ) { this.ref = null; this.isTable = null; this.innerRow = null; this.isClassic = ( isClassic != false ); this.mouseOutHandler = null; this.mouseOverHandler = null; this.clickHandler = null; this.activeItem = null; this.isDropDown = false; this.isMouseHovering = false; this.hoverBaned = false; this.blocked = false; this.popupManager = null; this.itemSize = null; } ;MenuBar.prototype.cNameMenuBar = ""; MenuBar.prototype.cNameMenu = ""; MenuBar.prototype.cNameDrop = ""; MenuBar.prototype.cNameHover = ""; MenuBar.prototype.gridAssetsBitmask = 0x0C; MenuBar.prototype.gridAssetsNormal = null; MenuBar.prototype.gridAssetsHover = null; MenuBar.prototype.gridAssetsClick = null; MenuBar.prototype.AppendItem = function( isMenu, content, menuOrCallback, isAddFirst ) { if( menuOrCallback == null ) return null; var node = this._DoAppendItem( content, isAddFirst ); if( node == null ) return null; node.isMenu = isMenu; node.menuOrCallback = menuOrCallback; if( isMenu && menuOrCallback.Click ) { menuOrCallback.Click.Add( Delegate( this, this.HideMenu ) ); } ;return node; } ;MenuBar.prototype.BanHover = function( isBan ) { this.hoverBaned = isBan; } ;MenuBar.prototype.Block = function( isBlock ) { this.hoverBaned = isBlock; this.blocked = isBlock; } ;MenuBar.prototype.Dispose = function() { if( this.ref == null ) return; if( this.isTable ) { for( var i = 0; i < this.innerRow.cells.length; i ++ ) { this._DisposeItem( this.innerRow.cells[i] ); } } else { var itemNode = this.ref.firstChild; while( itemNode ) { if( itemNode.nodeName.toUpperCase() == "SPAN" ) { this._DisposeItem( itemNode ); } ;itemNode = itemNode.nextSibling; } } } ;MenuBar.prototype.GetHeight = function() { return this.ref.offsetHeight; } ;MenuBar.prototype.GetHTML = function( id ) { this._id = ( id == null )? "_menubar" : id; var string = "<div style='overflow:hidden'><div id='" + this._id + "' style='cursor:default;-moz-user-select:none' onselectstart='return false'>"; var ua = UserAgentInfo.GetInstance(); if( this.isClassic == false || ua.IsSafari() || ( ua.IsFirefox() && ua.GetBrowserVersion() >= "1.5" ) ) { string += "<table cellpadding='0' cellspacing='0'><tr></tr></table>"; this.isTable = true; } else { this.isTable = false; } ;string += "</div></div>"; return string; } ;MenuBar.prototype.Hide = function() { this.ref.style.display = "none"; } ;MenuBar.prototype.HideMenu = function() { if( this.activeItem ) { this._DoDropDown( this.activeItem, false ); this.activeItem = null; this.isDropDown = false; } } ;MenuBar.prototype.Initialize = function( popupManager, align ) { try { if( popupManager ) { this.popupManager = popupManager; this.popupManager.SetMenuBar( this ); } ;this.ref = document.getElementById( this._id ); ; this.ref.align = ( align != null )? align : "left"; this.ref.className = this.cNameMenuBar; if( this.isTable ) { this.ref.firstChild.className = this.cNameMenuBar; this.innerRow = this.ref.firstChild.rows[0]; } ;this.mouseOutHandler = Delegate( this, this._OnButtonDecoratorEvent, "mouseOut" ); this.mouseOverHandler = Delegate( this, this._OnButtonDecoratorEvent, "mouseOver" ); this.clickHandler = Delegate( this, this._OnButtonDecoratorEvent, "click" ); this.itemSize = new Size(); return true; } catch( ex ) { ; throw ex; } } ;MenuBar.prototype.RemoveItem = function (menuItem) { if (menuItem == null) return; this._DoRemoveItem(menuItem); } ;MenuBar.prototype.ResizeWidth = function( width ) { if( width <= 0 ) { width = 1; } ;this.ref.parentNode.style.width = width + "px"; } ;MenuBar.prototype.Show = function() { this.ref.style.display = ""; } ;MenuBar.prototype.Withdraw = function() { if( this.isDropDown == true ) { if( this.activeItem.menuOrCallback.Withdraw() == true ) { this._DoDropDown( this.activeItem, false ); this.isDropDown = false; this._DoHoverItem( this.activeItem, true ); } } else if( this.activeItem != null && this.isMouseHovering == false ) { this._DoHoverItem( this.activeItem, false ); this.activeItem = null; return true; } ;return false; } ;MenuBar.prototype._DisposeItem = function( itemNode ) { if( itemNode._buttonDecorator ) { itemNode._buttonDecorator.Dispose(); itemNode._buttonDecorator = null; } else { itemNode.obj = null; itemNode.onmouseover = null; itemNode.onmouseout = null; itemNode.onclick = null; } ;if( itemNode.isMenu ) { itemNode.menuOrCallback.Dispose(); } ;itemNode.menuOrCallback = null; } ;MenuBar.prototype._DoAppendItem = function(content, isAddFirst) { try { var index = -1; if(isAddFirst == true) { index = 0; } ;if(!this.isClassic && this.innerRow.cells.length > 0) { var separator = this.innerRow.insertCell(index); separator.innerHTML = "<div>l</div>"; } ;if(this.isTable) { var itemNode = this.innerRow.insertCell(index); } else { var itemNode = AppendInlineBlock(this.ref); } ;if(itemNode) { content = "<nobr>" + content + "</nobr>"; if(!this.isClassic) { var buttonDecorator = new ButtonDecorator( content, this.gridAssetsBitmask, this.gridAssetsNormal, this.gridAssetsHover, this.gridAssetsClick, false, this.clickHandler, this.mouseOverHandler, this.mouseOutHandler ); itemNode._buttonDecorator = buttonDecorator; itemNode.innerHTML = buttonDecorator.GetHTML(); buttonDecorator.Initialize(); } else { itemNode.obj = this; itemNode.onmouseover = function(){ this.obj._OnMouseOver( this ); } ;itemNode.onmouseout = function(){ this.obj._OnMouseOut( this ); } ;itemNode.onclick = function(e){ this.obj._OnClick( this, e || event ); } ;itemNode.innerHTML = content; itemNode.className = this.cNameMenu; } } ;return itemNode; } catch(ex) { ; throw ex; } } ;MenuBar.prototype._DoDropDown = function(nodeRef, isDrop) { try { if(nodeRef.isMenu) { var menu = nodeRef.menuOrCallback; if(isDrop) { with(this.itemSize) { width = nodeRef.offsetWidth; height = nodeRef.offsetHeight; if(UserAgentInfo.GetInstance().IsSafari()) { left = GetClientX(nodeRef) + document.body.offsetLeft; top = GetClientY(nodeRef) + document.body.offsetTop; } else { left = GetClientX(nodeRef); top = GetClientY(nodeRef); } } ;menu.Show(this.itemSize, "down"); } else { menu.Hide(); } } ;var decorator = nodeRef._buttonDecorator; if(decorator) { decorator.SetState(isDrop ? ClickableNodeState.Click : ClickableNodeState.Normal); } else { nodeRef.className = isDrop ? this.cNameDrop : this.cNameMenu; } } catch(ex) { ; throw ex; } } ;MenuBar.prototype._DoHoverItem = function(nodeRef, isHover) { var decorator = nodeRef._buttonDecorator; if(decorator) { decorator.SetState(isHover ? ClickableNodeState.Hover : ClickableNodeState.Normal); } else { nodeRef.className = isHover ? this.cNameHover : this.cNameMenu; } } ;MenuBar.prototype._DoRemoveItem = function(node) { if(!this.isClassic && this.innerRow.cells.length > 0) { var index = -1; for(var i = 0; i < this.innerRow.cells.length; i++) { if(this.innerRow.cells[i] == node) { index = i; break; } } ;if(index >= 0) { this.innerRow.deleteCell(index); } ;if(index >= 1) { this.innerRow.deleteCell(index - 1); } } else { var seperatorNode = node.previousSibling; RemoveInlineBlock(this.ref, node); if(seperatorNode != null) { RemoveInlineBlock(this.ref, seperatorNode); } } ;if(node.isMenu) { node.menuOrCallback.ClearAllItems(); } ;this._DisposeItem(node); } ;MenuBar.prototype._OnButtonDecoratorEvent = function(node, e, eventType) { switch( eventType ) { case "click": this._OnClick( node.parentNode, e ); break; case "mouseOver": this._OnMouseOver( node.parentNode ); break; case "mouseOut": this._OnMouseOut( node.parentNode ); } } ;MenuBar.prototype._OnClick = function( nodeRef, e ) { StopEventBubble( e ); if( this.isDropDown ) { this._DoDropDown( nodeRef, false ); this._DoHoverItem( nodeRef, true ); this.isDropDown = false; if( this.popupManager ) { this.popupManager.DropDownInd( false ); } } else if( !this.blocked ) { if( this.activeItem ) { ; if( nodeRef.isMenu ) { this._DoHoverItem( this.activeItem, false ); } } else { this.activeItem = nodeRef; if( !nodeRef.isMenu ) { this._DoHoverItem( nodeRef, true ); } } ;if( nodeRef.isMenu ) { this._DoDropDown( nodeRef, true ); this.isDropDown = true; if( this.popupManager ) { this.popupManager.DropDownInd( true ); } } else { var clickHandler = nodeRef.menuOrCallback; if( clickHandler ) { clickHandler(e); } } } } ;MenuBar.prototype._OnMouseOut = function( nodeRef ) { if( this.isDropDown == false && this.activeItem != null ) { this._DoHoverItem( nodeRef, false ); this.activeItem = null; } ;this.isMouseHovering = false; } ;MenuBar.prototype._OnMouseOver = function( nodeRef ) { if( this.isDropDown ) { this._DoDropDown( this.activeItem, false ); if( nodeRef.isMenu ) { this._DoDropDown( nodeRef, true ); } else { this._DoHoverItem( nodeRef, true ); this.isDropDown = false; } ;this.activeItem = nodeRef; } else if( !this.hoverBaned ) { if( this.activeItem ) { this._DoHoverItem( this.activeItem, false ); } ;this._DoHoverItem( nodeRef, true ); this.activeItem = nodeRef; } ;this.isMouseHovering = true; } ;function ToolBar( id, align, isVertical, toolTip) { this.cNameToolBar = ""; this.cNameItem = ""; this.cNameItemHover = ""; this.cNameItemClick = ""; this.cNameDropHead = ""; this.cNameDropHeadHover = ""; this.cNameDropHeadClick = ""; this.cNameDropArrow = ""; this.cNameDropArrowHover = ""; this.cNameDropArrowClick = ""; this.cNameSpr = ""; this.dropArrowIcon = ""; this.ref = null; if(toolTip) { this.toolTip = toolTip; } else { this.toolTip = ""; } ;if (id) { this._id = id; } else { this._id = ToolBar._idPrefix + ToolBar._idPostfixNum; ToolBar._idPostfixNum ++; } ;this._hoverBaned = false; this._blocked = false; this._align = align || "left"; this._isVertical = (isVertical == true) ? true : false; } ;ToolBar._idPrefix = "_toolbar_"; ToolBar._idPostfixNum = 0; ToolBar.prototype.GetHTML = function() { var text = "<div style='overflow:hidden'><div id='" + this._id + "' style='cursor:default;-moz-user-select:none' onselectstart='return false' align='" + this._align + "' title='" + this.toolTip + "'></div></div>"; return text; } ;ToolBar.prototype.Initialize = function() { this.ref = document.getElementById( this._id ); ; this.ref.className = this.cNameToolBar; if( this.cNameItemClick == "" ) { this.cNameItemClick = this.cNameItemHover; } ;if( this.cNameDropHeadClick == "" ) { this.cNameDropHeadClick = this.cNameDropHeadHover; } ;if( this.cNameDropArrowClick == "" ) { this.cNameDropArrowClick = this.cNameDropArrowHover; } ;return true; } ;ToolBar.prototype.Active = function(itemNode) { itemNode.isAlwaysHover = true; this._SetItemCss(itemNode, "hover"); } ;ToolBar.prototype.AppendRichItem = function( innerHTML, handlerName, isDropItem, token, needGray ) { if( innerHTML == null || innerHTML == "" ) return null; var itemNode = this._AppendItem( innerHTML, isDropItem ); itemNode.obj = this; itemNode.handlerName = handlerName; itemNode.token = token; itemNode.grayed = 1; if( IsString( token ) ) { itemNode.id = this._id + "_" + token; } ;this._SetItemCss( itemNode, "normal" ); this.Gray( itemNode, needGray ); return itemNode; } ;ToolBar.prototype.AppendImgItem = function( imgSrc, handlerName, isDropItem, token, needGray ) { if( imgSrc == null || imgSrc == "" ) return null; var innerHTML = GetImgHTML( imgSrc ); return this.AppendRichItem( innerHTML, handlerName, isDropItem, token, needGray ); } ;ToolBar.prototype.AppendSeparator = function() { var innerHTML = "<table cellspacing='0' cellpadding='0' style='display:inline'><tr><td></td></tr></table>"; var itemNode = this._AppendItem( innerHTML ); itemNode.firstChild.className = this.cNameSpr; } ;ToolBar.prototype.RemoveAllItems = function() { for (var i = this.ref.childNodes.length - 1; i >= 0; i--) { this.ref.removeChild(this.ref.childNodes[i]); } } ;ToolBar.prototype.GetDropHeadNode = function( itemNode ) { return itemNode.firstChild; } ;ToolBar.prototype.GetDropArrowNode = function( itemNode ) { return itemNode.lastChild; } ;ToolBar.prototype.Gray = function( itemNode, needGray ) { if( itemNode == null ) return; try { itemNode.isAlwaysHover = false; needGray = ( needGray == true )? true : false; var oldGrayState = itemNode.grayed; if( itemNode.grayed == 0 ) { if( needGray ) { itemNode.grayed = 1; itemNode.onclick = null; itemNode.onmouseover = null; itemNode.onmouseout = null; this._SetItemCss(itemNode, "normal"); } } else { if( !needGray ) { itemNode.grayed = 0; itemNode.onclick = function(e){if(!e) e=event; this.obj.OnDefaultClick(e,this);} ;itemNode.onmouseover = function(){this.obj.OnMouseOver(this);} ;itemNode.onmouseout = function(){this.obj.OnMouseOut(this);} } } ;return oldGrayState == 1; } catch( ex ) { ; throw ex; } } ;ToolBar.prototype.BanHover = function( isBan ) { this._hoverBaned = isBan; } ;ToolBar.prototype.Block = function( isBlock ) { this._blocked = isBlock; this._hoverBaned = isBlock; } ;ToolBar.prototype.ResizeWidth = function( width ) { if( this._isVertical == false ) { if( width <= 0 ) { width = 1; } ;this.ref.parentNode.style.width = width + "px"; } } ;ToolBar.prototype.GetWidth = function() { return this.ref.offsetWidth; } ;ToolBar.prototype.AdjustHeight = function() { this.ref.parentNode.style.height = this.ref.offsetHeight + "px"; } ;ToolBar.prototype.Dispose = function() { if( this.ref == null ) return; var itemNode = this.ref.firstChild; var nodeName = null; while( itemNode ) { nodeName = itemNode.nodeName.toUpperCase(); if( nodeName == "SPAN" || nodeName == "DIV" ) { itemNode.obj = null; itemNode.handlerName = null; itemNode.token = null; itemNode.onclick = null; itemNode.onmouseover = null; itemNode.onmouseout = null; } ;itemNode = itemNode.nextSibling; } } ;ToolBar.prototype.OnMouseOut = function( itemNode ) { if( this._hoverBaned == false ) { this._SetItemCss( itemNode, "normal" ); } } ;ToolBar.prototype.OnMouseOver = function( itemNode ) { if( this._hoverBaned == false ) { this._SetItemCss( itemNode, "hover" ); } } ;ToolBar.prototype.OnDefaultClick = function( e, itemNode ) { try { if( this._blocked == false ) { this._SetItemCss( itemNode, "click" ); var handlerName = itemNode.handlerName; if( handlerName != null && handlerName != "" ) { var isClickDropDown = false; if( itemNode._isDropItem ) { var arrowNode = this.GetDropArrowNode( itemNode ); ; var eventSrcNode = GetEventOrigTarget( e ); if( eventSrcNode == arrowNode || eventSrcNode == arrowNode.firstChild ) { isClickDropDown = true; } } ;eval( handlerName + "( e, itemNode, itemNode.token, isClickDropDown )" ); } } } catch( ex ) { ; } } ;ToolBar.prototype._AppendItem = function( innerHTML, isDropItem ) { try { var itemNode = null; if( !this._isVertical ) { itemNode = AppendInlineBlock( this.ref ); if( itemNode == null ) throw new Object(); } else { itemNode = document.createElement( "DIV" ); if( itemNode == null ) throw new Object(); this.ref.appendChild( itemNode ); } ;if( isDropItem == true ) { var headNode = AppendInlineBlock( itemNode ); var arrowNode = AppendInlineBlock( itemNode ); if( headNode == null || arrowNode == null ) { throw new Object(); } ;headNode.innerHTML = innerHTML; arrowNode.innerHTML = GetImgHTML( this.dropArrowIcon ); itemNode._isDropItem = true; itemNode.headNode = headNode; itemNode.arrowNode = arrowNode; } else { itemNode.innerHTML = innerHTML; } ;itemNode.isAlwaysHover = false; return itemNode; } catch( ex ) { ; throw ex; } } ;ToolBar.prototype._SetItemCss = function( itemNode, state) { if( itemNode._isDropItem ) { var headNode = this.GetDropHeadNode( itemNode ); var arrowNode = this.GetDropArrowNode( itemNode ); ; switch( state ) { case "normal": if(!itemNode.isAlwaysHover) { headNode.className = this.cNameDropHead; arrowNode.className = this.cNameDropArrow; } ;break; case "hover": headNode.className = this.cNameDropHeadHover; arrowNode.className = this.cNameDropArrowHover; break; case "click": if(!itemNode.isAlwaysHover) { headNode.className = this.cNameDropHeadClick; arrowNode.className = this.cNameDropArrowClick; } ;break; } } else { switch( state ) { case "normal": if(!itemNode.isAlwaysHover) { itemNode.className = this.cNameItem; } ;break; case "hover": itemNode.className = this.cNameItemHover; break; case "click": if(!itemNode.isAlwaysHover) { itemNode.className = this.cNameItemClick; } ;break; } } } ;function PopupManager() { this.menuBar = null; this.toolBarArray = new Array(); this.toolBarNum = 0; this.contextMenu = null; this.popup = null; this.popupCloseFunc = null; this.curMode = "none"; this.ToolBarBanHover = function(needBan) { var i = 0; var toolBar = null; for ( ; i < this.toolBarNum; i ++) { toolBar = this.toolBarArray[i]; toolBar.BanHover(needBan); } } ;this.Restore = function() { switch (this.curMode) { case "menubar": this.menuBar.HideMenu(); this.ToolBarBanHover(false); break; case "menu": this.contextMenu.Hide(); this.contextMenu = null; if (this.menuBar) { this.menuBar.BanHover(false); } ;this.ToolBarBanHover(false); break; case "popup": this._DoClosePopup(); } ;this.curMode = "none"; } ;this.SetMenuBar = function(menuBar) { this.menuBar = menuBar; } ;this.AddToolBar = function(toolBar) { this.toolBarArray[this.toolBarNum] = toolBar; this.toolBarNum ++; } ;this.DropDownInd = function(isDrop) { if (isDrop) { switch (this.curMode) { case "menu": this.contextMenu.Hide(); this.contextMenu = null; this.menuBar.BanHover(false); break; case "popup": this._DoClosePopup(); case "none": this.ToolBarBanHover(true); } ;this.curMode = "menubar"; } else { this.ToolBarBanHover(false); this.curMode = "none"; } } ;this.ShowContextMenu = function(contextMenu, e, x, y) { if ((contextMenu == null) || (e == null)) return; StopEventBubble(e); switch (this.curMode) { case "menubar": this.menuBar.HideMenu(); this.menuBar.BanHover(true); break; case "menu": this.contextMenu.Hide(); break; case "popup": this._DoClosePopup(); case "none": this.ToolBarBanHover(true); if (this.menuBar) { this.menuBar.BanHover(true); } } ;this.curMode = "menu"; if (x == null) x = e.clientX + 2; if (y == null) y = e.clientY; contextMenu.ShowAtCoordinate(x, y); this.contextMenu = contextMenu; } ;this.OpenPopup = function(popup, e, size, contextObj, closeFunc) { if (popup == null) return; if (e) { StopEventBubble(e); } ;this.Restore(); this.curMode = "popup"; popup.SetPosition(size); popup.Open(contextObj); this.popup = popup; this.popupCloseFunc = closeFunc; } ;this.PopupOpened = function(e, popup, closeFunc) { if (popup == null || this.popup == popup) return; if (e) { StopEventBubble(e); } ;this.Restore(); this.curMode = "popup"; this.popup = popup; this.popupCloseFunc = closeFunc; } ;this.ClosePopup = function() { if (this.curMode == "popup") { this._DoClosePopup(); this.curMode = "none"; } } ;this.PopupClosed = function() { if (this.curMode == "popup") { this.popup = null; this.popupCloseFunc = null; this.curMode = "none"; } } ;this.HideContextMenu = function() { ; if (this.menuBar) { this.menuBar.BanHover(false); } ;this.ToolBarBanHover(false); this.contextMenu.Hide(); this.contextMenu = null; this.curMode = "none"; } ;this.OnWindowResized = function() { this.Restore(); } ;this.OnBodyClicked = function(e) { this.Restore(); } ;this.OnBodyContextMenu = function(e) { this.Restore(); } ;this.OnEscKeyPressed = function(e) { switch (this.curMode) { case "menubar": if (this.menuBar.Withdraw() == true) { this.ToolBarBanHover(false); this.curMode = "none"; } ;break; case "menu": if (this.contextMenu.Withdraw() == true) { this.contextMenu.Hide(); this.contextMenu = null; if (this.menuBar) { this.menuBar.BanHover(false); } ;this.ToolBarBanHover(false); this.curMode = "none"; } ;break; case "popup": this._DoClosePopup(); this.curMode = "none"; } } ;this.Dispose = function() { this.menuBar = null; this.toolBarArray = null; this.contextMenu = null; this.popup = null; this.popupCloseFunc = null; } ;this._DoClosePopup = function() { if( this.popup ) { if( this.popupCloseFunc ) { this.popupCloseFunc( this.popup ); this.popupCloseFunc = null; } else { this.popup.Close(); } ;this.popup = null; } } } ;function CountPopupPos(openerSize, direction, popupSize, isSelfAdapted) { if( isSelfAdapted == false ) { switch( direction ) { case "down": popupSize.left = openerSize.left; popupSize.top = openerSize.top + openerSize.height; break; case "up": popupSize.left = openerSize.left; popupSize.top = openerSize.top - popupSize.height; break; case "right": popupSize.left = openerSize.left + openerSize.width; popupSize.top = openerSize.top; break; case "left": popupSize.left = openerSize.left - popupSize.width; popupSize.top = openerSize.top; } ;return popupSize; } ;var popupLeft = 0; var popupTop = 0; if ((direction == "right") || (direction == "left")) { var openerLeft = openerSize.left; var openerTop = openerSize.top; var openerWidth = openerSize.width; var openerHeight = openerSize.height; var popupWidth = popupSize.width; var popupHeight = popupSize.height; var winWidth = GetBodyClientWidth(); var winHeight = GetBodyClientHeight(); } else { var openerLeft = openerSize.top; var openerTop = openerSize.left; var openerWidth = openerSize.height; var openerHeight = openerSize.width; var popupWidth = popupSize.height; var popupHeight = popupSize.width; var winWidth = GetBodyClientHeight(); var winHeight = GetBodyClientWidth(); } ;var rightMargin = winWidth - openerLeft - openerWidth; var leftMargin = openerLeft; if ((direction == "right") || (direction == "down")) { if (rightMargin >= popupWidth) { popupLeft = openerLeft + openerWidth; } else { if (leftMargin >= popupWidth) { popupLeft = leftMargin - popupWidth; } else if (leftMargin > rightMargin || winWidth <= popupWidth) { popupLeft = 0; } else { popupLeft = winWidth - popupWidth; } ;if (popupLeft < 10 && popupLeft + popupWidth + 10 > winWidth) { popupLeft = 10; } } } else { if (leftMargin >= popupWidth) { popupLeft = leftMargin - popupWidth; } else { if (rightMargin >= popupWidth) { popupLeft = openerLeft + openerWidth; } else if (rightMargin > leftMargin && winWidth >= popupWidth) { popupLeft = winWidth - popupWidth; } else { popupLeft = 0; } } } ;var bottomMargin = winHeight - openerTop; var topMargin = openerTop + openerHeight; if (bottomMargin >= popupHeight) { popupTop = openerTop; } else { if ((direction == "right") || (direction == "left")) { if (topMargin >= popupHeight) { popupTop = topMargin - popupHeight; } else if (topMargin > bottomMargin || winHeight <= popupHeight) { popupTop = 0; } else { popupTop = winHeight - popupHeight; } } else { if (winHeight <= popupHeight) { popupTop = 0; } else { popupTop = winHeight - popupHeight; } } } ;if ((direction == "right") || (direction == "left")) { popupSize.left = popupLeft + document.body.scrollLeft; popupSize.top = popupTop + document.body.scrollTop; } else { popupSize.left = popupTop + document.body.scrollLeft; popupSize.top = popupLeft + document.body.scrollTop; } ;return popupSize; } ;var ServerError = new Object(); ServerError.None = 0; ServerError.Timeout = 1; ServerError.AuthFailed = 2; ServerError.SessionGone = 3; ServerError.InvalidRequest = 4; ServerError.ServerError = 5; ServerError.ReloginNeeded = 6; ServerError.PasswordExpired = 7; ServerError.ACLCheck = 8; ServerError.RedirectLegacyServer = 9; ServerError.ContactListExists = 10; ServerError.Throttled = 11; ServerError.UserNotEnabled = 12; ServerError.ExternalNotEnabled = 13; ServerError.DomainRequiredInURI = 14; ServerError.LCSUnavailable = 15; ServerError.IWANotAllowed = 16; ServerError.FormsNotAllowed = 17; ServerError.LegacyServerUnavailable = 18; var DurationType = new Object(); DurationType.External = 3; DurationType.Internal = 4; L_Logon_ACLCheck = L_Logon_ACLCheck.replace(/%0/g, L_Product_Name); L_Logon_UserNotEnabled = L_Logon_UserNotEnabled.replace(/%0/g, L_Product_Name); L_Logon_ExternalNotEnabled = L_Logon_ExternalNotEnabled.replace(/%0/g, L_Product_Name); L_Logon_LCSUnavailable = L_Logon_LCSUnavailable.replace(/%0/g, L_Product_Name); L_Logon_LegacyServerNotSupported = L_Logon_LegacyServerNotSupported.replace(/%0/g, L_Product_NameWithVersion); L_Logon_PreWave13HomedUserConfJoinError = L_Logon_CannotSignInPreWave13HomedUser_ConfJoinSignIn.replace(/%0/g, L_Product_Name); L_Logon_PreWave13HomedUserConfJoinError = L_Logon_PreWave13HomedUserConfJoinError.replace(/%1/g, L_Logon_Join_Corp_Acct_No_Button); L_Sign_In_Welcome = L_Sign_In_Welcome.replace(/%0/g, L_Product_Name); var L_Logon_ShowSignInNameFldText = "Change the current sign-in name (optional)."; var ServerErrorStrings = new Array( "", L_Logon_Timeout, L_Logon_AuthFailed, L_Logon_SessionGone, L_Logon_FormatWrong, L_Logon_ServerError, L_Logon_ReloginNeeded, L_Logon_PasswordExpired, L_Logon_ACLCheck, L_Logon_LegacyServerNotSupported, L_Logon_IWAMultiLogon, L_Logon_Throttled, L_Logon_UserNotEnabled, L_Logon_ExternalNotEnabled, L_Logon_DomainRequiredInURI, L_Logon_LCSUnavailable, L_Logon_AuthBrowserNotSupported, L_Logon_AuthBrowserNotSupported, L_Logon_LegacyServerNotSupported ); var ClientError = new Object(); ClientError.None = 0; ClientError.BrowserNotSupported = 1; ClientError.PopUpBlocker = 2; ClientError.NoEnoughInfo = 4; ClientError.NoCookie = 8; ClientError.NetTransportBroken = 16; ClientError.ActiveXDisabled = 32; ClientError.InvalidDisplayName = 64; ClientError.PreWave13HomedUser = 128; ClientError.All = 255; var LogonStatuses = new Object(); LogonStatuses.Norm = 1; LogonStatuses.Post = 2; LogonStatuses.JoinNorm = 3; LogonStatuses.JoinAnon = 4; var AuthFlags = new Object(); AuthFlags.AuthIncapable = 0x1; AuthFlags.FormAuthLogon = 0x2; AuthFlags.IWAAuthLogon = 0x4; AuthFlags.AnonAuthLogon = 0x800; var LogonDestination = new Object(); LogonDestination.LogonClient = 0x1; LogonDestination.LogonJoin = 0x2; var ClientErrorStrings = new Array( "", L_Logon_ClientBrowserNotSupported, L_Logon_PopUpBlocker, L_Logon_NoEnoughInfo, L_Logon_NoCookie, L_Logon_UnExpectedError, L_Logon_ActiveXDisabled, L_Logon_InvalidDisplayName, L_Logon_PreWave13HomedUserConfJoinError ); function UserLogonData() { this.Uri = null; this.UserName = null; this.SignInAs = null; this.Language = null; this.IsPrivatePc = true; this.LogonDest = null; this.RequestType = null; this.DisplayName = null; this.SignInData = null; this.EpId = null; this.CwaTicket = null; } ;function LogonWindow() { this._contactListWnd = null; this._userLogonData = new UserLogonData(); this._queryString = new Object(); this._serverError = ServerError.None; this._clientError = ClientError.None; this._requestType = 0; this._authRequestType = 0; this._logonDest = 0; this._confKey = null; this._confUri = null; this._duration = 0; this._clientVersionFolder = null; this._serverCommunicator = null; this._logonForm = null; this._uriFld = null; this._showUriBtn = null; this._userNameFld = null; this._passwordFld = null; this._dispNameFld = null; this._phoneNumFld = null; this._signInAsSel = null; this._langSel = null; this._signInBtn = null; this._anonJoinBtn = null; this._authJoinBtn = null; this._signInAgainBtn = null; this._signInAgainTab = null; this._signInTab = null; this._corpAcctYesRadioBtn = null; this._corpAcctNoRadioBtn = null; this._corpAcctQuestion = null; this._corpAcctExplainLink = null; this._corpAcctExplainYesRow = null; this._corpAcctExplainNoRow = null; this._anonLangSel = null; this._anonLangSelRow = null; this._isPrivatePcChk = null; this._signInText = null; this._uriRow = null; this._uriSpanRow = null; this._uriTextRow = null; this._uriTextSpanRow = null; this._userNameRow = null; this._userNameSpanRow = null; this._passwordRow = null; this._passwordSpanRow = null; this._errorTextTbl = null; this._serverErrorLbl = null; this._clientErrorLbl = null; this._logonTab = null; this._postLogonTab = null; this._langRow = null; this._joinTab = null; this._anonTab = null; this._authTab = null; this._errorTab = null; this._headerFrameUrl = null; this._footerFrameUrl = null; } ;LogonWindow.DisplayNameCookieName = "AnonDisplayName"; LogonWindow.FormsUserCookieName = "DomainAndName"; LogonWindow.IWAUserCookieName = "SIPURI"; LogonWindow.AccessiblityCookieName = "Accessiblity"; LogonWindow.PreWave13HomedUserErrorCookieName = "PreWave13HomedUserError"; LogonWindow.prototype.Initialize = function(serverError, requestType, duration, logonDest, clientVersionFolder, serverPath, headerFrameUrl, footerFrameUrl) { this._ParseQueryString(); if (serverError != null && serverError != ServerError.None) { this._serverError = serverError; } else if (this._queryString["reason"] != null) { var errorCode = parseInt(this._queryString["reason"]); if (errorCode > ServerError.None && errorCode <= ServerError.FormsNotAllowed) { this._serverError = errorCode; } } ;; this._requestType = requestType; this._authRequestType = requestType; ; this._duration = duration; ; this._logonDest = logonDest; if (this._logonDest == LogonDestination.LogonJoin) { var confUri = this._queryString["uri"]; ; if (confUri != null) this._confUri = confUri; var confKey = this._queryString["key"]; ; if (confKey != null) this._confKey = confKey; document.title = L_Logon_Join_Text; } else { document.title = L_Product_Name; } ;; this._clientVersionFolder = clientVersionFolder; this._serverCommunicator = new ServerCommunicator(); this._signInAsmenu = new Menu(); Menu.prototype.cssMenu = "menu2"; Menu.prototype.cssTextPart = "menuitem2"; Menu.prototype.cssTextPartOn = "menuitemon2"; Menu.prototype.cssTextNode = "menuitemtext"; Menu.prototype.cssIconPart = "menupre2"; Menu.prototype.cssIconPartOn = "menupreon2"; Menu.prototype.cssIconPartBody = "menuiconpartbody"; Menu.prototype.cssIconNodeChecked = "menuiconnodechecked"; Menu.prototype.cssSpr = "menuspr"; Menu.prototype.cssLeftMargin = "menuleftmargin2"; Menu.prototype.cssRightMargin = "menurightmargin2"; Menu.prototype.margin = 1; Menu.prototype.bottomMargin = 2; this._signInAsmenu.Generate( "signInasMenu", false ); this._signInAsmenu.AppendItems( [ [null, AvState.Free, RpTextMap[RpState.Online], null, AvIconMap[AvState.Free]], [null, AvState.Busy, RpTextMap[RpState.Busy], null, AvIconMap[AvState.Busy]], [null, AvState.DoNotDisturb, RpTextMap[RpState.DoNotDisturb], null, AvIconMap[AvState.DoNotDisturb]], [null, AvState.TempUnAlertable, RpTextMap[RpState.BeRightBack], null, AvIconMap[AvState.TempUnAlertable]], [null, AvState.UnAlertable, RpTextMap[RpState.Away], null, AvIconMap[AvState.UnAlertable]] ] ); this._signInAsmenu.Click.Add(Delegate(this, this.OnSigninAsMenuClicked)); window.onresize = function(e) { window.obj.OnResize(e); } ;this._headerFrameUrl = headerFrameUrl; this._footerFrameUrl = footerFrameUrl; } ;LogonWindow.prototype.OnLoad = function() { this._InitAllElements(); this._RenderElements(); if(this._logonDest == LogonDestination.LogonClient) { this._iwasignindifferentuserlink.innerText = L_Logon_SignIn_DifferentUser; this._SwitchUI(LogonStatuses.Norm); } else if(this._logonDest == LogonDestination.LogonJoin) { this.InitCorpAcctUI(); if(IsStringNullOrEmpty(this._confKey) && this._requestType == AuthFlags.IWAAuthLogon && GetCookie("clwe")) ShowHide(this._joindifferentuserText, false); else this._iwasignindifferentuserlink.innerText = L_Logon_Join_DifferentUser; if(GetCookie(LogonWindow.PreWave13HomedUserErrorCookieName)) { RemoveCookie(LogonWindow.PreWave13HomedUserErrorCookieName); this._requestType = AuthFlags.AnonAuthLogon; this._corpAcctNoRadioBtn.checked = true; this._clientError |= ClientError.PreWave13HomedUser; ShowHide(this._joindifferentuserText, false); this._SwitchUI(LogonStatuses.JoinAnon); } else { if(this._requestType == AuthFlags.IWAAuthLogon && !IsStringNullOrEmpty(this._confKey)) { ShowHide(this._joindifferentuserText, true); } ;this._SwitchUI(LogonStatuses.JoinNorm); } } ;this._SwitchAuthMode(); this._passwordDisplay.disabled = false; if (this._IsPopupBlockerWorking()) { this._DisableSignInButton(); } ;if (this._IsCookieDisabled()) { this._DisableSignInButton(); } ;if (this._IsActiveXDisabled()) { this._DisableSignInButton(); } ;this._ProcessErrors(); this._serverCommunicator.Initialize(null, true); if (isLogonCustomizeDisabled == false) { this._headerFrame.src = this._headerFrameUrl; this._footerFrame.src = this._footerFrameUrl; } ;if (this._logonDest == LogonDestination.LogonJoin && this._signInBtn.disabled != true && this._requestType == AuthFlags.IWAAuthLogon && this.status == LogonStatuses.JoinNorm) { this.OnSubmitNorm(); } } ;LogonWindow.prototype.InitCorpAcctUI = function() { var hostName = window.location.hostname; network = hostName.substring(hostName.search(/\.(\S)+$/) + 1); var question = L_Logon_Join_Network_Text; question = question.replace(/%0/g, network); this._corpAcctQuestion.innerHTML = question; var yesRow = L_Logon_Join_Corp_Acct_Explain_Yes_Row; yesRow = yesRow.replace(/%0/g, network); yesRow = yesRow.replace(/%1/g, L_Logon_Join_Button); this._corpAcctExplainYesRow.innerHTML = yesRow + "<br/><br/>"; var noRow = L_Logon_Join_Corp_Acct_Explain_No_Row; noRow = noRow.replace(/%0/g, network); noRow = noRow.replace(/%1/g, L_Logon_Join_Button); this._corpAcctExplainNoRow.innerHTML = noRow + "<br/><br/>"; } ;LogonWindow.prototype.OnResize = function(e) { if (!this._signInAsmenu.IsHidden()) { this.OnChangeSignInAs(e); } } ;LogonWindow.prototype.OnBodyClick = function() { this._signInAsmenu.Hide(); } ;LogonWindow.prototype.OnSigninAsMenuClicked = function(sender, eventArgs) { var itemId = eventArgs["itemId"]; this._ChangeSignInAsStatus(itemId); this._signInAsmenu.Hide(); } ;LogonWindow.prototype._ChangeSignInAsStatus = function(AvStatus) { var state = AvToStateMap[AvStatus]; if (state) { this._signInAsSel.value = AvStatePublicationMap[AvStatus]; var str = RpTextMap[state]; if (state == RpState.Offline) { str = RpTextMap["Appear Offline"]; } ;this._signInBtn.innerHTML = "<nobr>" + StringFormat(L_Logon_Sign_In_As_Button, str); } } ;LogonWindow.prototype._ParseQueryString = function() { var target = null; try { target = window.location.search; } catch(e) { window.location = "/"; return; } ;if (IsStringNullOrEmpty(target)) { return; } ;if (target.indexOf('?') == 0) { target = target.substring(1, target.length); } ;var values = target.split('&'); for (var i = 0; i < values.length; ++i) { var pair = values[i].split('='); if (pair.length == 2) { var key = unescape(pair[0]).toLowerCase(); var value = null; if (pair[1].indexOf("%25") != -1) { value = unescape(unescape(pair[1])); } else { value = unescape(pair[1]); } ;this._queryString[key] = value; } } } ;LogonWindow.prototype.OnCallBack = function(authTicket, error, responseXml) { if (this._isTimeoutPrompt == true) { this._OnCallBackHandler = TimerHandler(this, this.OnCallBack, authTicket, error, responseXml); return; } ;this._EnableSignInButton(); this._signInBtn.innerHTML = L_Logon_Sign_In_Button; this._anonJoinBtn.innerHTML = L_Logon_Join_Button; this._authJoinBtn.innerHTML = L_Logon_Join_Button; if (this._ignoreAuthResult == true) { return; } ;if (this._authTimer != null) { window.clearTimeout(this._authTimer); } ;if (error == null) { this._userLogonData.CwaTicket = authTicket; this._ProcessResponseXml(responseXml); } else { if (error.errorCode < 200) { this._serverError = error.errorCode; } else { this._clientError |= ClientError.NetTransportBroken; } ;this._ProcessErrors(responseXml); } } ;LogonWindow.prototype.OnKeydown = function(evt) { if (!evt) { evt = window.event; } ;if (evt.keyCode == 13 && (this.status == LogonStatuses.Norm || this.status == LogonStatuses.JoinNorm || this.status == LogonStatuses.JoinAnon)) { if(evt.stopProgation) { evt.stopPropagation(); } else { evt.cancelBubble = true; } ;if(evt.preventDefault) { evt.preventDefault(); } else { evt.returnValue = false; } ;if(this.status == LogonStatuses.JoinAnon) this.OnSubmitAnon(); else this.OnSubmitNorm(); } } ;LogonWindow.prototype.OnSignInTimeOut = function() { this._isTimeoutPrompt = true; this._authTimer = null; var result = window.confirm(L_Logon_Warning_Ignore_Auth_Result); this._ignoreAuthResult = !result; if (this._ignoreAuthResult == true) { this._EnableSignInButton(); this._signInBtn.innerHTML = L_Logon_Sign_In_Button; this._anonJoinBtn.innerHTML = L_Logon_Join_Button; this._authJoinBtn.innerHTML = L_Logon_Join_Button; } ;this._isTimeoutPrompt = false; if (this._OnCallBackHandler) { window.setTimeout(this._OnCallBackHandler, 0); } ;this._OnCallBackHandler = null; } ;LogonWindow.prototype.OnSubmitNorm = function() { if(this._logonDest == LogonDestination.LogonJoin && this._requestType == AuthFlags.IWAAuthLogon && IsVisible(this._uriRow) && GetCookie("clwe")) { this._serverError = ServerError.ContactListExists; this._ShowErrors(); return; } ;if ((this._logonDest != LogonDestination.LogonJoin && this._signInBtn.disabled == true) || (this._logonDest == LogonDestination.LogonJoin && this._authJoinBtn.disabled == true)) { return; } ;if (this._Validate()) { this._PrepareUserData(); this._clientError = ClientError.None; this._DisableSignInButton(); this._signInBtn.innerHTML = "<nobr>" + L_Logon_Sign_In_In_Progress_Button; this._authJoinBtn.innerHTML = "<nobr>" + L_Logon_Join_In_Progress_Button; SetCookie(LogonWindow.AccessiblityCookieName, this._duration); if (this._requestType == AuthFlags.IWAAuthLogon) { var uri = this._uriFld.value; if (uri == L_Logon_Input_UserSipURI) { uri = ""; } ;uri = Trim(uri); if (uri) { SetCookie(LogonWindow.IWAUserCookieName, uri); } else { RemoveCookie(LogonWindow.IWAUserCookieName); } ;if(this.status == LogonStatuses.JoinNorm) { this._serverCommunicator.CWALogonByIWAJoin(Delegate(this, this.OnCallBack), uri); } else { this._serverCommunicator.CWALogonByIWA(Delegate(this, this.OnCallBack), uri); } } else if (this._requestType == AuthFlags.FormAuthLogon) { var userName = Trim(this._userNameFld.value); if (this._duration != DurationType.External || this._isPrivatePcChk.checked) { SetCookie(LogonWindow.FormsUserCookieName, userName); } else { RemoveCookie(LogonWindow.FormsUserCookieName); } ;this._serverCommunicator.LogonByFORM(userName, this._passwordFld.value, Delegate(this, this.OnCallBack)); } ;this._ignoreAuthResult = false; if (this._authTimer != null) { window.clearTimeout(this._authTimer); } ;this._authTimer = window.setTimeout(TimerHandler(this, this.OnSignInTimeOut), 60000); } else { this._ProcessErrors(); } } ;LogonWindow.prototype.OnSubmitAnon = function() { if (this._anonJoinBtn.disabled == true) { return; } ;if (this._Validate()) { this._PrepareUserData(); this._clientError = ClientError.None; this._DisableSignInButton(); this._anonJoinBtn.innerHTML = "<nobr>" + L_Logon_Join_In_Progress_Button; if (this._duration != DurationType.External || this._isPrivatePcChk.checked) { if (this._dispNameFld.value.length > 0) { SetCookie(LogonWindow.DisplayNameCookieName, this._dispNameFld.value); } } else { RemoveCookie(LogonWindow.DisplayNameCookieName); } ;this._serverCommunicator.LogonByAnon(Delegate(this, this.OnCallBack)); this._ignoreAuthResult = false; if (this._authTimer != null) { window.clearTimeout(this._authTimer); } ;this._authTimer = window.setTimeout(TimerHandler(this, this.OnSignInTimeOut), 60000); } else { this._ProcessErrors(); } } ;LogonWindow.prototype.OnYesCorpAccount = function() { if (this._authJoinBtn.disabled) { return; } ;this._requestType = this._authRequestType; this._SwitchUI(LogonStatuses.JoinNorm); this._SwitchAuthMode(); } ;LogonWindow.prototype.OnNoCorpAccount = function() { if (this._anonJoinBtn.disabled) { return; } ;this._requestType = AuthFlags.AnonAuthLogon; this._userLogonData.IsPrivatePc = this._isPrivatePcChk.checked; this._SwitchUI(LogonStatuses.JoinAnon); this._SwitchAuthMode(); } ;LogonWindow.prototype._InitAllElements = function() { this._headerFrame = document.getElementById("HeaderFrame"); ; this._footerFrame = document.getElementById("FooterFrame"); ; this._logonForm = document.getElementById("logonForm"); ; this._uriFld = document.getElementById("userUri"); ; this._userNameFld = document.getElementById("user"); ; this._passwordFld = document.getElementById("pw"); ; this._dispNameFld = document.getElementById("displayName"); ; this._signInAsSel = document.getElementById("signinas"); ; this._langSel = document.getElementById("language"); ; this._langSelRow = document.getElementById("languageSelectionRow"); ; this._signInBtn = document.getElementById("signInBtn"); ; this._signInBtnAs = document.getElementById("signInBtnAs"); ; this._signInAgainBtn = document.getElementById("signInAgainBtn"); ; this._signInAgainTab = document.getElementById("signInAgainTab"); ; this._isPrivatePcChk = document.getElementById("isPrivatePc"); ; this._signInTab = document.getElementById("signInTab"); ; this._authJoinBtn = document.getElementById("authJoinBtn"); ; this._authTab = document.getElementById("authTab"); ; this._corpAcctYesRadioBtn = document.getElementById("corpAcctYesRadioBtn"); ; this._corpAcctNoRadioBtn = document.getElementById("corpAcctNoRadioBtn"); ; this._corpAcctQuestion = document.getElementById("corpAcctQuestion"); ; this._corpAcctExplainLink = document.getElementById("corpAcctExplainLink"); ; this._corpAcctExplainYesRow = document.getElementById("corpAcctExplainYesRow");; ; this._corpAcctExplainNoRow = document.getElementById("corpAcctExplainNoRow"); ; this._anonLangSel = document.getElementById("anonLanguage"); ; this._anonLangSelRow = document.getElementById("anonLanguageSelectionRow"); ; this._anonNameFld = document.getElementById("anonName"); ; this._anonJoinBtn = document.getElementById("anonJoinBtn"); ; this._displayName = document.getElementById("displayName"); ; this._passwordDisplay = document.getElementById("pwdisplay"); ; this._signInText = document.getElementById("signInText"); ; this._uriRow = document.getElementById("uriRow"); ; this._formsigninTextRow = document.getElementById("formsigninTextRow"); ; this._userNameRow = document.getElementById("domainAliasRow"); ; this._passwordRow = document.getElementById("passwordRow"); ; this._durationRow = document.getElementById("pubOrPriRow"); ; this._iwasignindifferentuserText = document.getElementById("iwasignindifferentuser"); ; this._joindifferentuserText = document.getElementById("joindifferentuser"); ; this._iwasignindifferentuserlink = document.getElementById("iwasignindifferentuserlink"); ; this._securityExplainLink = document.getElementById("securityexplainlink"); ; this._privateDetails = document.getElementById("privateexplain"); this._publicDetails = document.getElementById("sharedexplain"); this._errorTextTbl = document.getElementById("errorTextTable"); ; this._serverErrorLbl = document.getElementById("serverErrorArea"); ; this._clientErrorLbl = document.getElementById("clientErrorArea"); ; this._logonTab = document.getElementById("logonTab"); ; this._joinTab = document.getElementById("joinTab"); ; this._anonTab = document.getElementById("anonTab"); ; this._errorTab = document.getElementById("errorTab"); ; this._postLogonTab = document.getElementById("postLogonTab"); ; this._langRow = document.getElementById("langRow"); ; this._uriFld.value = L_Logon_Input_UserSipURI; this._uriFld.title = L_Logon_Input_UserSipURI; this._userNameFld.value = L_Logon_Input_UserNameAndDomain; this._userNameFld.title = L_Logon_Input_UserNameAndDomain; this._passwordDisplay.value = L_Logon_Input_UserPassword; this._passwordDisplay.title = L_Logon_Input_UserPassword; this._dispNameFld.value = L_Logon_Join_Anon_Display_Name_Entry_Text; this._dispNameFld.title = L_Logon_Join_Anon_Display_Name_Entry_Text; this._logonForm.onkeydown = Delegate(this, this.OnKeydown); this._signInBtn.onclick = Delegate(this, this.OnSubmitNorm); this._signInBtnAs.onclick = Delegate(this, this.OnChangeSignInAs); this._anonJoinBtn.onclick = Delegate(this, this.OnSubmitAnon); this._authJoinBtn.onclick = Delegate(this, this.OnSubmitNorm); this._corpAcctYesRadioBtn.onclick = Delegate(this, this.OnYesCorpAccount); this._corpAcctNoRadioBtn.onclick = Delegate(this, this.OnNoCorpAccount); this._corpAcctExplainLink.onclick = Delegate(this, this.OnCorpAccountExplainLinkOnClick); this._passwordDisplay.onfocus = Delegate(this, this.OnPasswordOnFocus); this._passwordFld.onblur = Delegate(this, this.OnPasswordOnBlur); this._passwordFld.title = L_Logon_Input_UserPassword; this._uriFld.onfocus = Delegate(this, this.OnURIOnFocus); this._uriFld.onclick = Delegate(this, this.OnURIOnClick); this._uriFld.onblur = Delegate(this, this.OnURIOnBlur); this._userNameFld.onfocus = Delegate(this, this.OnUserNameOnFocus); this._userNameFld.onclick = Delegate(this, this.OnUserNameOnClick); this._userNameFld.onblur = Delegate(this, this.OnUserNameOnBlur); this._dispNameFld.onfocus = Delegate(this, this.OnDisplayNameOnFocus); this._dispNameFld.onclick = Delegate(this, this.OnDisplayNameOnClick); this._dispNameFld.onblur = Delegate(this, this.OnDisplayNameOnBlur); this._privateDetails.style.display = "none"; this._publicDetails.style.display= "none"; this._securityExplainLink.onclick = Delegate(this, this.OnSecurityExplainLinkOnClick); this._iwasignindifferentuserText.onclick = Delegate(this, this.ShowSignInNameField); this._joindifferentuserText.onclick = Delegate(this, this.ShowJoinTab); Dom("signAsDiffUserFromPostLogonPageBtn").onclick = Delegate(this, this._OnJoinDiffUserFromPostLogonPageBtnClick); this._signInAgainBtn.onclick = function() { window.location = "/"; };; } ;LogonWindow.prototype._OnJoinDiffUserFromPostLogonPageBtnClick = function() { this.ShowJoinTab(); this.ShowSignInNameField(); } ;LogonWindow.prototype._RenderElements = function() { if (this._queryString["userUri"] != null) { var uri = this._queryString["userUri"]; if (this._requestType == AuthFlags.IWAAuthLogon) { this._uriFld.value = uri; } else { this._userNameFld.value = uri; } } ;if (_languagePacks.length == 0) { var tmp = new Object(); tmp.text = "English"; tmp.value = "en"; _languagePacks.push(tmp); } ;this._FillSelection(this._langSel, _languagePacks); this._SetDefaultSelected(this._langSel, _defaultLanguage); this._FillSelection(this._anonLangSel, _languagePacks); this._SetDefaultSelected(this._anonLangSel, _defaultLanguage); if (GetCookie('SIA') != null) { var sia = GetCookie('SIA'); this._ChangeSignInAsStatus(sia); } } ;LogonWindow.prototype.OnPasswordOnFocus = function() { this._passwordDisplay.style.display = "none"; this._passwordFld.style.display = ""; this._passwordFld.focus(); } ;LogonWindow.prototype.OnPasswordOnBlur = function() { if (this._passwordFld.value == "") { this._passwordDisplay.style.display = ""; this._passwordFld.style.display = "none"; } } ;LogonWindow.prototype.ClearPasswordBox = function() { this._passwordFld.value = ""; this._passwordDisplay.style.display = ""; this._passwordFld.style.display = "none"; } ;LogonWindow.prototype.OnURIOnFocus = function() { if (this._uriFld.value == L_Logon_Input_UserSipURI) { this._uriFld.select(); this._uriFld.focus(); } } ;LogonWindow.prototype.OnURIOnClick = function() { if (this._uriFld.value == L_Logon_Input_UserSipURI) { this._uriFld.value = ""; this._uriFld.focus(); } } ;LogonWindow.prototype.OnURIOnBlur = function() { if (this._uriFld.value == "") { this._uriFld.value = L_Logon_Input_UserSipURI; } } ;LogonWindow.prototype.OnUserNameOnFocus = function() { if (this._userNameFld.value == L_Logon_Input_UserNameAndDomain) { this._userNameFld.select(); this._userNameFld.focus(); } } ;LogonWindow.prototype.OnUserNameOnClick = function() { if (this._userNameFld.value == L_Logon_Input_UserNameAndDomain) { this._userNameFld.value = ""; this._userNameFld.focus(); } } ;LogonWindow.prototype.OnUserNameOnBlur = function() { if (this._userNameFld.value == "") { this._userNameFld.value = L_Logon_Input_UserNameAndDomain; } } ;LogonWindow.prototype.OnDisplayNameOnFocus = function() { if (this._dispNameFld.value == L_Logon_Join_Anon_Display_Name_Entry_Text) { this._dispNameFld.select(); this._dispNameFld.focus(); } } ;LogonWindow.prototype.OnDisplayNameOnClick = function() { if (this._dispNameFld.value == L_Logon_Join_Anon_Display_Name_Entry_Text) { this._dispNameFld.value = ""; this._dispNameFld.focus(); } } ;LogonWindow.prototype.OnDisplayNameOnBlur = function() { if (this._dispNameFld.value == "") { this._dispNameFld.value = L_Logon_Join_Anon_Display_Name_Entry_Text; } } ;LogonWindow.prototype._SwitchUI = function(status) { if (status == LogonStatuses.Norm) { this.status = LogonStatuses.Norm; ShowHide(this._logonTab, true); ShowHide(this._errorTab, true); ShowHide(this._langRow, true); ShowHide(this._joinTab, false); ShowHide(this._postLogonTab, false); ShowHide(this._signInAgainTab, false); ShowHide(this._signInTab, true); ShowHide(this._authTab, false); ShowHide(this._anonTab, false); } else if (status == LogonStatuses.Post) { this.status = LogonStatuses.Post; if(this._logonDest != LogonDestination.LogonJoin) { ShowHide(this._signInAgainTab, true); ShowHide(this._signInAgainBtn, true); } else { ShowHide(this._signInAgainTab, false); } ;ShowHide(this._postLogonTab, true); ShowHide(this._logonTab, false); ShowHide(this._joinTab, false); ShowHide(this._errorTab, false); ShowHide(this._langRow, false); ShowHide(this._signInTab, true); ShowHide(this._authTab, false); ShowHide(this._anonTab, false); Dom("signAsDiffUserFromPostLogonPageBtn").style.display = (this._requestType == AuthFlags.IWAAuthLogon && this._logonDest == LogonDestination.LogonJoin ? "" : "none"); } else if (status == LogonStatuses.JoinNorm) { this.status = LogonStatuses.JoinNorm; if (this._confKey && !IsVisible(this._joindifferentuserText)) { ShowHide(this._joinTab, true); ShowHide(this._joindifferentuserText, false); } else { ShowHide(this._joinTab, false); } ;ShowHide(this._logonTab, true); ShowHide(this._errorTab, true); ShowHide(this._langRow, true); ShowHide(this._postLogonTab, false); ShowHide(this._signInAgainTab, false); ShowHide(this._signInTab, false); ShowHide(this._authTab, true); ShowHide(this._anonTab, false); } else if (status == LogonStatuses.JoinAnon) { this.status = LogonStatuses.JoinAnon; ShowHide(this._joinTab, true); ShowHide(this._errorTab, true); ShowHide(this._anonTab, true); ShowHide(this._langRow, true); ShowHide(this._postLogonTab, false); ShowHide(this._signInAgainTab, false); ShowHide(this._logonTab, false); ShowHide(this._signInTab, false); ShowHide(this._authTab, false); } } ;LogonWindow.prototype._SwitchAuthMode = function() { ShowHide(this._logonForm, true); if (this._requestType != AuthFlags.FormAuthLogon && this._requestType != AuthFlags.IWAAuthLogon && this._requestType != AuthFlags.AnonAuthLogon) { this._clientError |= ClientError.BrowserNotSupported; } ;if (this._requestType == AuthFlags.IWAAuthLogon) { if(!IsVisible(this._joindifferentuserText) && !IsVisible(this._uriRow)) { this._iwasignindifferentuserText.style.display = ""; } ;this._errorTextTbl.style.display = ""; } else if (this._requestType == AuthFlags.AnonAuthLogon) { if (GetCookie(LogonWindow.DisplayNameCookieName)) { if (this._duration == DurationType.External) { this._isPrivatePcChk.checked = true; } } } else { this._formsigninTextRow.style.display = ""; this._userNameRow.style.display = ""; this._passwordRow.style.display = ""; if (GetCookie(LogonWindow.FormsUserCookieName)) { this._userNameFld.value = GetCookie(LogonWindow.FormsUserCookieName); if (this._duration == DurationType.External) { this._isPrivatePcChk.checked = true; } } ;this._userNameFld.focus(); if (this._duration == DurationType.External) { this._durationRow.style.display = ""; } } } ;LogonWindow.prototype.ShowSignInNameField = function() { ShowHide(this._iwasignindifferentuserText, false); this._errorTextTbl.style.visibility = "hidden"; this._uriRow.style.display = ""; this._signInText.style.display = ""; var inputBoxWidth = this._uriFld.offsetWidth - (this._uriRow.offsetWidth - 300); this._uriFld.style.width = inputBoxWidth + "px"; this._uriFld.focus(); } ;LogonWindow.prototype.ShowJoinTab = function() { ShowHide(this._joindifferentuserText, false); if (this._requestType == AuthFlags.IWAAuthLogon && !GetCookie("clwe")) ShowHide(this._iwasignindifferentuserText, true); this._errorTextTbl.style.visibility = "hidden"; this._corpAcctYesRadioBtn.checked = "checked"; this._corpAcctNoRadioBtn.checked = ""; this._SwitchUI(LogonStatuses.JoinNorm); } ;LogonWindow.prototype._FillSelection = FillSelection; LogonWindow.prototype._SetDefaultSelected = function(sel, value) { if (sel == null || (sel.options && sel.options.length == 0)) { return; } ;if (value == null || Trim(value) == "") { return; } ;value = value.toLowerCase(); var tmp = ""; for (var i = 0; i < sel.options.length; ++i) { tmp = sel.options[i].value.toLowerCase(); if (tmp == value) { sel.options[i].selected = true; return; } } ;if (value.indexOf('-') == -1) { return; } ;value = value.substr(0, value.indexOf('-')); for (var i = 0; i < sel.options.length; ++i) { tmp = sel.options[i].value.toLowerCase(); if (tmp.indexOf('-') != -1) { tmp = tmp.substr(0, tmp.indexOf('-')); if (tmp == value) { sel.options[i].selected = true; return; } } } } ;LogonWindow.prototype._DisableSignInButton = function() { this._signInBtn.disabled = true; this._signInBtn.style.color = "#808080"; this._signInBtnAs.disabled = true; this._signInBtnAs.style.color = "#808080"; this._anonJoinBtn.disabled = true; this._anonJoinBtn.style.color = "#808080"; this._authJoinBtn.disabled = true; this._authJoinBtn.style.color = "#808080"; } ;LogonWindow.prototype._EnableSignInButton = function() { this._signInBtn.disabled = false; this._signInBtn.style.color = "#232D50"; this._signInBtnAs.disabled = false; this._signInBtnAs.style.color = "#232D50"; this._anonJoinBtn.disabled = false; this._anonJoinBtn.style.color = "#232D50"; this._authJoinBtn.disabled = false; this._authJoinBtn.style.color = "#232D50"; } ;LogonWindow.prototype.OnChangeSignInAs = function(e) { if (this._signInBtnAs.disabled == true) { return; } ;StopEventBubble(e || event); this._signInAsmenu.ShowAtCoordinate(-1000, -1000); var width = this._signInAsmenu.GetWidth(); var x = GetOffsetX(this._signInBtnAs) - width + this._signInBtnAs.offsetWidth; var y = GetOffsetY(this._signInBtnAs) + L_Size_LP_SignIn_Button_Height; this._signInAsmenu.ShowAtCoordinate(x, y, false); } ;LogonWindow.prototype._ProcessResponseXml = function(responseXml) { ; var resultItems = responseXml.getElementsByTagName("cwaResponses"); ; ; var xmlItems = resultItems[0].childNodes; var xmlItem = null; for (var i = 0; i < xmlItems.length; i++) { if (xmlItems[i].nodeName.toLowerCase()!= "#text") { xmlItem = xmlItems[i]; } } ;var response = xmlItem; var responseName = response.nodeName; ; var errorId = response.getAttribute("eid"); ; resposneName = Trim(responseName); errorId = parseInt(errorId); if (this._requestType == AuthFlags.FormAuthLogon) { this.ClearPasswordBox(); } ;if (responseName == "requestSucceeded") { ; var uld = this._userLogonData; ; ; if(this._requestType != AuthFlags.AnonAuthLogon) { uld.Uri = response.getElementsByTagName("uri")[0].childNodes[0].nodeValue; } ;; if (response.getElementsByTagName("signInData")[0].childNodes.length > 0) { uld.SignInData = response.getElementsByTagName("signInData")[0].childNodes[0].nodeValue; } else { uld.SignInData = ""; } ;this._OpenClientWindow(); this._SwitchUI(LogonStatuses.Post); } else if (responseName == "requestFailed") { this._serverError = errorId; this._ProcessErrors(responseXml); } } ;LogonWindow.prototype._OpenClientWindow = function() { var uld = this._userLogonData; var displayName = uld.RequestType == AuthFlags.AnonAuthLogon ? uld.DisplayName : uld.Uri + (this._logonDest == LogonDestination.LogonJoin ? "_join" : ""); if (uld.RequestType == AuthFlags.AnonAuthLogon) { var wndName = (new Date().getTime()).toString(); } else { var wndName = ComposeMainFrameWindowName(displayName); } ;SetSessionCookie("SipUri", escape(uld.Uri)); SetSessionCookie("SignInAs", escape(uld.SignInAs)); SetSessionCookie("Language", escape(uld.Language)); if (this._duration == DurationType.External) { SetSessionCookie("IsPrivatePc", escape(uld.IsPrivatePc ? 1 : 0)); } else { SetSessionCookie("IsPrivatePc", escape(1)); } ;if (uld.EpId) SetSessionCookie("EpId", escape(uld.EpId)); if (uld.CwaTicket) SetSessionCookie("CwaTicket", escape(uld.CwaTicket)); if (uld.SignInData) SetSessionCookie("signInData", escape(uld.SignInData)); if (uld.DisplayName) SetSessionCookie("DisplayName", escape(uld.DisplayName)); if (uld.LogonDest) SetSessionCookie("LogonDest", escape(uld.LogonDest)); SetSessionCookie("AnonAuth", escape(uld.RequestType == AuthFlags.AnonAuthLogon)); if (this._confKey) SetSessionCookie("ConfKey", escape(this._confKey)); if (this._confUri) SetSessionCookie("ConfUri", escape(this._confUri)); var mainFrameUrl = "cwa/Client/" + this._clientVersionFolder + "/MainFrame.htm"; this._contactListWnd = MainFrameWindow.prototype.OpenWindow(mainFrameUrl, "", wndName); } ;LogonWindow.prototype._PrepareUserData = function() { var uld = this._userLogonData; if (this._requestType == AuthFlags.IWAAuthLogon) { uld.Uri = this._uriFld.value; } else if (this._requestType == AuthFlags.FormAuthLogon) { uld.UserName = this._userNameFld.value; } else if (this._requestType == AuthFlags.AnonAuthLogon) { uld.DisplayName = this._dispNameFld.value; } ;uld.RequestType = this._requestType; uld.LogonDest = this._logonDest; uld.SignInAs = this._signInAsSel.value; if (IsVisible(logonTab)) { uld.Language = this._langSel.value; } else { uld.Language = this._anonLangSel.value; } ;if (this._requestType != AuthFlags.AnonAuthLogon) { uld.IsPrivatePc = this._isPrivatePcChk.checked; } ;if (this._queryString["epid"] != null) { uld.EpId = this._queryString["epid"]; } else { uld.Epid = ""; } } ;LogonWindow.prototype._ProcessErrors = function(xmlItem) { if (this._serverError == ServerError.RedirectLegacyServer && this._logonDest != LogonDestination.LogonJoin) { var formTable = document.getElementById("legacyServer"); var legacyURL = XMLGetNodeValueByTagName(xmlItem, "legacyURL"); document.location = legacyURL; return; } ;if ((this._serverError == ServerError.BrowserNotSupported) || (this._clientError & ClientError.BrowserNotSupported)) { this._DisableSignInButton(); } ;if (this._serverError != ServerError.None || this._clientError != ClientError.None) { ; ; if (this._serverError == ServerError.AuthFailed && this._requestType == AuthFlags.FormAuthLogon) { this.ClearPasswordBox(); } ;this._ShowErrors(); } } ;LogonWindow.prototype._ShowErrors = function() { this._errorTextTbl.style.display = ""; this._errorTextTbl.style.visibility = "visible"; var serverErrorString = this._GetServerErrorString(); var clientErrorString = this._GetClientErrorString(); if ((this._serverError == ServerError.AuthFailed && (this._clientError & ClientError.NoEnoughInfo) != 0) || ((this._serverError == ServerError.IWANotAllowed || this._serverError == ServerError.FormsNotAllowed) && (this._clientError & ClientError.BrowserNotSupported) != 0)) { this._serverErrorLbl.innerHTML = ""; this._clientErrorLbl.innerHTML = serverErrorString; } else if((this._clientError & ClientError.InvalidDisplayName) != 0) { this._serverErrorLbl.innerHTML = ""; this._clientErrorLbl.innerHTML = clientErrorString; } else { this._serverErrorLbl.innerHTML = serverErrorString; this._clientErrorLbl.innerHTML = clientErrorString; if (this._serverError != ServerError.None && this._clientError != ClientError.None) { this._clientErrorLbl.innerHTML = "<hr noshad size='1' width='100%' />" + this._clientErrorLbl.innerHTML; } } } ;LogonWindow.prototype._IsPopupBlockerWorking = function() { if (IsPopupBlockerWorking()) { this._clientError |= ClientError.PopUpBlocker; return true; } else { this._clientError &= ~ClientError.PopUpBlocker; return false; } } ;LogonWindow.prototype._IsActiveXDisabled = function() { if( window.XMLHttpRequest ) { this._clientError &= ~ClientError.ActiveXDisabled; return false; } ;if( !window.ActiveXObject ) { this._clientError |= ClientError.ActiveXDisabled; return true; } ;var httpRequest = null; var MSXML_XMLHTTP_PROGIDS = new Array( 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP' ); for (var i=0; i < MSXML_XMLHTTP_PROGIDS.length; i++) { try { httpRequest = new ActiveXObject(MSXML_XMLHTTP_PROGIDS[i]); } catch(e) { continue; } ;if( httpRequest != null ) { break; } } ;if (httpRequest != null) { this._clientError &= ~ClientError.ActiveXDisabled; return false; } else { this._clientError |= ClientError.ActiveXDisabled; return true; } } ;LogonWindow.prototype._IsCookieDisabled = function() { if (IsCookieDisabled()) { this._clientError |= ClientError.NoCookie; return true; } else { this._clientError &= ~ClientError.NoCookie; return false; } } ;LogonWindow.prototype._Validate = function() { if (this._IsCookieDisabled() || this._IsActiveXDisabled()) { this._DisableSignInButton(); return false; } ;if (this.status == LogonStatuses.Norm || this.status == LogonStatuses.JoinNorm) { if (this._requestType == AuthFlags.FormAuthLogon && (IsStringNullOrEmpty(this._userNameFld.value) || this._userNameFld.value == L_Logon_Input_UserNameAndDomain)) { this._clientError |= ClientError.NoEnoughInfo; this._userNameFld.focus(); return false; } } else if(this.status == LogonStatuses.JoinAnon) { this._dispNameFld.value = Trim(this._dispNameFld.value); if(IsStringNullOrEmpty(this._dispNameFld.value) || this._dispNameFld.value == L_Logon_Join_Anon_Display_Name_Entry_Text || this._InvalidDisplayNameChar(this._dispNameFld.value)) { this._clientError |= ClientError.InvalidDisplayName; this._dispNameFld.focus(); return false; } } ;return true; } ;LogonWindow.prototype._InvalidDisplayNameChar = function(displayName) { for (i = 0; i < displayName.length; i++) { switch (displayName.charAt(i)) { case '`': case '~': case '!': case '@': case '#': case '$': case '%': case '^': case '&': case '*': case '(': case ')': case '-': case '=': case '_': case '+': case '[': case ']': case '\\': case '{': case '}': case '|': case ';': case '\'': case ':': case '"': case ',': case '.': case '/': case '<': case '>': case '?': return true; break; default: break; } } ;return false; } ;LogonWindow.prototype._GetServerErrorString = function() { if (this._serverError < ServerError.None || this._serverError >= ServerError.length) { return ""; } ;return ServerErrorStrings[this._serverError]; } ;LogonWindow.prototype._GetClientErrorString = function() { if (this._clientError < ClientError.None || this._clientError > ClientError.All) { return ""; } ;var tmp = ""; var index = 1; for (var i = 1; i < ClientErrorStrings.length; ++i) { if ((this._clientError & index) != 0) { if (tmp.length == 0) { tmp = ClientErrorStrings[i]; } else { tmp += "<br/>" + ClientErrorStrings[i]; } } ;index = index << 1; } ;return tmp; } ;LogonWindow.prototype.OnCorpAccountExplainLinkOnClick = function() { if (this._corpAcctExplainLink.innerHTML == L_Logon_Join_Corp_Acct_Show_Explain_Link) { this._corpAcctExplainLink.innerHTML = L_Logon_Join_Corp_Acct_Hide_Explain_Link; ShowHide(this._corpAcctExplainYesRow, true); ShowHide(this._corpAcctExplainNoRow, true); } else if (this._corpAcctExplainLink.innerHTML == L_Logon_Join_Corp_Acct_Hide_Explain_Link) { this._corpAcctExplainLink.innerHTML = L_Logon_Join_Corp_Acct_Show_Explain_Link; ShowHide(this._corpAcctExplainYesRow, false); ShowHide(this._corpAcctExplainNoRow, false); } } ;LogonWindow.prototype.OnSecurityExplainLinkOnClick = function() { if (this._securityExplainLink.innerHTML == L_Logon_Security_ShowExplain) { this._securityExplainLink.innerHTML = L_Logon_Security_HideExplain; this._privateDetails.style.display = ""; this._publicDetails.style.display = ""; } else if (this._securityExplainLink.innerHTML == L_Logon_Security_HideExplain) { this._securityExplainLink.innerHTML = L_Logon_Security_ShowExplain; this._privateDetails.style.display = "none"; this._publicDetails.style.display = "none"; } } ;LogonWindow.prototype.Dispose = function() { try { this._serverCommunicator.Dispose(); } catch(ex) { ; } ;if (UserAgentInfo.GetInstance().IsIE()) { try { BreakCircleReference(); } catch(ex) { ; } } } ;function SSOWindow() { this._contactListWnd = null; this._userLogonData = new UserLogonData(); this._serverError = ServerError.None; this._clientError = ClientError.None; this._requestType = 0; this._clientVersionFolder = null; this._signInAgainBtn = null; } ;SSOWindow.prototype.Initialize = function(serverError, clientVersionFolder, uri, ticket, signInData) { if (serverError != null && serverError != ServerError.None) { this._serverError = serverError; } ;; this._clientVersionFolder = clientVersionFolder; var uld = this._userLogonData; ; uld.Uri = uri; ; uld.CwaTicket = ticket; ; uld.SignInData = signInData; } ;SSOWindow.prototype.OnLoad = function() { this._signInAgainBtn = document.getElementById("signInAgainBtn"); ; this._signInAgainBtn.onclick = function() { window.location = "/"; };; if (this._IsPopupBlockerWorking()) { } else { this._OpenContactListWindow(); } } ;SSOWindow.prototype._OpenContactListWindow = function() { var uld = this._userLogonData; var wndName = ComposeMainFrameWindowName(uld.Uri); SetSessionCookie("SipUri", escape(uld.Uri)); SetSessionCookie("Language", escape(uld.Language)); SetSessionCookie("CwaTicket", escape(uld.CwaTicket)); SetSessionCookie("signInData", escape(uld.SignInData)); var mainFrameUrl = "cwa/Client/" + this._clientVersionFolder + "/MainFrame.htm"; this._contactListWnd = MainFrameWindow.prototype.OpenWindow(mainFrameUrl, "", wndName); } ;SSOWindow.prototype._IsPopupBlockerWorking = function() { if (IsPopupBlockerWorking()) { this._clientError |= ClientError.PopUpBlocker; return true; } else { this._clientError &= ~ClientError.PopUpBlocker; return false; } } ;SSOWindow.prototype._GetServerErrorString = function() { if (this._serverError < ServerError.None || this._serverError >= ServerError.length) { return ""; } ;return ServerErrorStrings[this._serverError]; } ;SSOWindow.prototype._GetClientErrorString = function() { if (this._clientError < ClientError.None || this._clientError > ClientError.All) { return ""; } ;var tmp = ""; var index = 1; for (var i = 1; i < ClientErrorStrings.length; ++i) { if ((this._clientError & index) != 0) { if (tmp.length == 0) { tmp = ClientErrorStrings[i]; } else { tmp += "<br/>" + ClientErrorStrings[i]; } } ;index = index << 1; } ;return tmp; } ;function MainFrameWindow() { this.centralData = null; this.contactsData = null; this.userData = null; this.uri = null; this.pickerPane = null; this.menuBar = null; this.contactContextMenu = null; this.aceContextMenu = null; this.groupContextMenu = null; this.aceGroupContextMenu = null; this.presenceMenu = null; this.callRulesMenu = null; this.myStatusCtl = null; this.errorPane = null; this.searchPane = null; this.contactListView = null; this.detailCard = null; this.searchAndContactListPanel = null; this.contactListAndTabControl = null; this.tabControlArea = null; this._textSizeTestArea = null; this.userNodeUIHandler = null; this.groupNodeUIHandler = null; this.contactNodeUIHandler = null; this.specialGroupUIHandler = null; this.pickerUIHandler = null; this.searchUIHandler = null; this.callRulesUIHandler = null; this.userStatusDetector = null; this.presenceToastHandler = null; this.downloadManager = null; this.customizationManager = null; this.pid = null; this.isWindowFocused = false; this.isInputBoxFocused = false; this.focusedInputBox = null; this.isFocused = false; this.keyDownSrcElement = null; this._decClweSessionCookieOnUnload = true; this.OnBodyClick = function(e) { if(e.button != 2) { this.popupManager.OnBodyClicked(e); } } ;this.OnMouseUp = function(e) { var node = this.keyDownSrcElement; if (node != null && node.nodeName != "INPUT" && node.nodeName != "TEXTAREA") { if (this.isWindowFocused == false) { window.focus(); } } ;this.keyDownSrcElement = null; } ;this.OnMouseDown = function(e) { this.keyDownSrcElement = GetEventOrigTarget(e); if (window.MouseDown) window.MouseDown.Fire(window, null); } ;this.OnFocus = function(source, control) { try { switch (source) { case "Window": this.isWindowFocused = true; break; case "InputBox": this.isInputBoxFocused = true; this.focusedInputBox = control; this.isWindowFocused = false; } ;var currStatus = this.isWindowFocused || this.isInputBoxFocused; if (this.isFocused == false && currStatus == true) { var Focus = window.WindowFocus; Focus.args["windowType"] = "CL"; Focus.args["window"] = window; Focus.Fire(this, Focus.args); this.isFocused = currStatus; } } catch (ex) { } } ;this.OnBlur = function(source, control) { try { switch (source) { case "Window": this.isWindowFocused = false; break; case "InputBox": if (this.focusedInputBox == control) { this.isInputBoxFocused = false; this.focusedInputBox = null; } } ;var currStatus = this.isWindowFocused || this.isInputBoxFocused; if (this.isFocused == true && currStatus == false) { var Blur = window.WindowBlur; Blur.args["windowType"] = "CL"; Blur.args["window"] = window; Blur.Fire(this, Blur.args); this.isFocused = currStatus; } } catch (ex) { } } ;this.OnResize = function() { try { BrowserFactory.windowResizingImp.OnCLResized(this); } catch (ex) { ; } } ;this.RefreshGroupListSize = function( isForce ) { if (this.contactListView.RefreshSize( isForce ) != 0) { this.searchPane.RefreshSize(true); } } ;this.NewMenuBar = function() { try { this.menuBar = new MainMenuBar(); var objId = GetMainFrameId() + ".menuBar"; this.menuBar.Generate(objId); } catch(ex) { ; } } ;this.DoCustomization = function () { try { this.customizationManager.SetMainFrame(this); } catch(ex) { ; } } ;this.OnCustomizationAppendMenu = function(menuTitle, menuObj) { return this.menuBar._menuBar.AppendItem(true, menuTitle, menuObj); } ;this.OnCustomizationRemoveMenu = function(menuNode) { this.menuBar._menuBar.RemoveItem(menuNode); } ;this.OnCustomizationAddTabs = function(tabsArray) { if (tabsArray.length > 0) { this.contactListAndTabControl.Enable(true); for (var i = 0; i < tabsArray.length; i++) { this.tabControlArea.AddTabItem(tabsArray[i].imgUrl, tabsArray[i].itemToolTip, tabsArray[i].itemUrl, tabsArray[i].isContactIdEnabled, tabsArray[i].isContactIdEnabled); } ;this.focusManager.FocusStateChanged.Add( Delegate(this.tabControlArea, this.tabControlArea.OnCLFocusChanged) ); this.tabControlArea.InitializeInternalObj(this.focusManager, this.userData); this.contactListAndTabControl.toggler.splitterClickEvent.Add(Delegate(this, this.OnToggleTabFrame), MainFrameWindow.TabTogglerGUID ); this.OnResize(); this.tabControlArea.UpdateTabControlImages(); if (tabsArray.length > 0) { this.tabControlArea.SelectTabItem("CwaTabNo0"); } ;if (!this.tabControlArea.CanResizeHeight(this.tabControlArea.ref.offsetHeight)) { var tabFrameHeight = parseInt(GetBodyClientHeight() / 4 + 1); this.contactListAndTabControl.SwitchWeigtHeight(-tabFrameHeight); } } } ;this.OnCustomizationRemoveTabs = function() { this.tabControlArea.RemoveAllTabItems(); this.contactListAndTabControl.toggler.splitterClickEvent.Remove(MainFrameWindow.TabTogglerGUID); } ;this.OnToggleTabFrame = function(sender, eventArgs) { var status = eventArgs["status"]; if (status == "expand") { this.contactListAndTabControl.SwitchWeigtHeight(-this.tabControlArea.tabFrameWndHeightBk); } else if (status == "collapse") { this.contactListAndTabControl.SwitchWeigtHeight(this.tabControlArea.tabFrameWndHeightBk); } else { throw "Invalid toggle status"; } } ;this.NewPickerTopPane = function() { try { this.pickerPane = new PickerReusePane(); this.pickerPane.GenerateTopPane(); } catch(ex) { ; } } ;this.NewPickerButtonPane = function() { try { this.pickerPane.GenerateButtonPane(); } catch(ex) { ; } } ;this.NewMyStatusView = function() { try { this.myStatusCtl = new MyStatusCtl(); this.myStatusCtl.Generate(BrowserFactory.myStatusCtlImp); this.presenceMenu = new PresenceMenu(); this.presenceMenu.Generate("clPresenceMenu", this.popupManager); this.callRulesMenu = new CRRulesMenu(); this.callRulesMenu.Generate( this.popupManager ); } catch(ex) { ; } } ;this.NewErrorPane = function() { try { this.errorPane = new ErrorPane(); this.errorPane.Generate(); } catch(ex) { ; } } ;this.NewContactListView = function(url) { try { this.contactContextMenu = new BuddyContextMenu(); this.contactContextMenu.Generate( null, this.popupManager ); this.aceContextMenu = new AceContextMenu(); this.aceContextMenu.Generate( null, this.popupManager ); this.groupContextMenu = new GroupContextMenu(); this.groupContextMenu.Generate( null, this.popupManager ); this.aceGroupContextMenu = new AceGroupContextMenu(); this.aceGroupContextMenu.Generate( null, this.popupManager ); this.NewDetailCard(); } catch(ex) { ; } } ;this.NewDetailCard = function() { try { this.detailCard = new AppDetailCard(); this.detailCard.Generate( this.popupManager, L_CL_DC_LaunchButton_Click, L_CL_DC_LaunchButton_Hover ); } catch(ex) { ; } } ;this.NewStatusBar = function() { var text = "<div id='_statusbar' class='statusbar'></div>"; document.write(text); this.statusBar = document.getElementById("_statusbar"); } ;this.GetMenuBar = function() { return this.menuBar; } ;this.GetMyStatusCtl = function() { return this.myStatusCtl; } ;this.GetContactListView = function() { return this.contactListView; } ;this.SearchResultCleared = function() { if(this.detailCard) { this.detailCard.SetShow(false); } } ;this.OnUnload = function() { try { if (this.errorPane) this.errorPane.Close(); } catch(e) { ; } ;try { this.DisposeControls(); } catch(e) { ; } ;if (UserAgentInfo.GetInstance().IsIE()) { try { BreakCircleReference(); } catch(ex) { ; } } ;if(this._decClweSessionCookieOnUnload) { var clwe = GetCookie("clwe"); if(clwe) { clwe = parseInt(clwe) - 1; if(clwe == 0) { RemoveCookie( "clwe" ); } else { SetSessionCookie("clwe", clwe); } } } ;window.close(); } ;this.DisposeControls = function() { if (this.menuBar) this.menuBar.Dispose(); if (this.presenceMenu) this.presenceMenu.Dispose(); if (this.callRulesMenu) this.callRulesMenu.Dispose(); if (this.contactContextMenu) this.contactContextMenu.Dispose(); if (this.aceContextMenu) this.aceContextMenu.Dispose(); if (this.groupContextMenu) this.groupContextMenu.Dispose(); if (this.aceGroupContextMenu) this.aceGroupContextMenu.Dispose(); if (this.myStatusCtl) this.myStatusCtl.Dispose(); if (this.pickerPane) this.pickerPane.Dispose(); if (this.errorPane) this.errorPane.Dispose(); if (this.searchPane) this.searchPane.Dispose(); if (this.contactListView) this.contactListView.Dispose(); if (this.detailCard) this.detailCard.Dispose(); if (this.popupManager) this.popupManager.Dispose(); if (this.pickerManager) this.pickerManager.Dispose(); if (this.contactNodeUIHandler) this.contactNodeUIHandler.Dispose(); window.MouseMoving = null; window.MouseDown = null; window.KeyDown = null; window.WindowFocus = null; window.WindowBlur = null; document.body.onmousemove = null; document.body.onmousedown = null; document.body.onmouseup = null; document.onkeydown = null; document.onkeypress = null; document.body.onclick = null; document.body.oncontextmenu = null; window.onresize = null; window.onunload = null; window.onbeforeunload = null; window.onfocus = null; window.onblur = null; window.mainFrameWindow = null; window.obj = null; try { if (window.CollectGarbage) { window.CollectGarbage(); } } catch (ex){} } ;this.Focus = function(inputBox) { try { window.focus(); if (inputBox && inputBox.focus && inputBox.disabled == false) { inputBox.focus(); } } catch (ex) { } } ;this.GetFocusedInputBox = function() { if (this.isInputBoxFocused == true) { return this.focusedInputBox; } else { return null; } } ;this.IsFocused = function() { return this.isFocused; } ;this.ShowMainUI = function() { if (this.errorPane) { this.errorPane.Close(); } ;document.getElementById("signin").style.display = "none"; document.getElementById("mainUI").style.display = "block"; document.getElementById("mainUI").style.height = "100%"; window.setTimeout("window.obj.OnResize();window.obj.searchPane.Reset()", 0); window.setTimeout("PluginManager.GetInstance().CheckHostUpdate()", 1000); this.userStatusDetector.Start(); } ;this.ResetControls = function() { if (PickerManager.pickerMode == true) { this.pickerManager.ClosePicker(); } ;this.contactListView.Reset(); this.detailCard.SetShow( false ); this.popupManager.Restore(); this.userStatusDetector.Stop(); } ;this.OnSignInSuccessHandler = function(sender) { this.ShowMainUI(); this.chatAgentManager.ReSignIn(); } ;this.OnSignOutHandler = function(sender, eventArgs) { try { var error = eventArgs["error"]; var timeInterval = eventArgs["timeInterval"]; if (this.communicator) { this.communicator.Stop(); } ;if (this.downloadManager) { this.downloadManager.Close(); } ;if (this.pickerManager) { this.pickerManager.ClosePicker(); } ;if (this.chatAgentManager) { if (error) this.chatAgentManager.OnSoftSignOff(); else this.chatAgentManager.OnHardSignOff(); } ;this.ShowSignInUI(error, timeInterval); if (this.modelessDialogManager) { this.modelessDialogManager.CloseAll(); } ;if (this.modalDialogManager) { this.modalDialogManager.CloseAll(); } ;if (this.centralData) { this.centralData.Clear(); } ;if (this.aclManager) { this.aclManager.Clear(); } ;if (this.richPresenceManager) { this.richPresenceManager.Reset(); } ;if (this.dgCacheManager) { this.dgCacheManager.Reset(); } ;if (this.contactListView) { this.contactListView.Reset(); } ;if (this.customizationManager) { this.customizationManager.Reset(); } } catch(e) { ; } } ;this.HardSignOff = function() { this.userSession.SignOut(); } ;this.OnStartSignInHandler = function(sender, eventArgs) { try { this.downloadManager.DownloadResource(); this.ShowSplash(); var errorPane = document.getElementById("signOffInfoPane"); if (errorPane != null) { errorPane.innerHTML = ""; } ;errorPane = document.getElementById("resigninNoticePane"); if (errorPane != null) { errorPane.innerHTML = ""; } } catch(e) { ; } } } ;MainFrameWindow.TabTogglerGUID = "28BEB5F3-D005-43AF-B264-0714874638B9"; MainFrameWindow.prototype._ErrorHandler = function(sender, error) { ; try { if (!error.type) { error.type = ErrorType.GeneralError; } ;this.ShowErrorPane(error); if (error.type != ErrorType.GeneralError) { this.userSession.SmartSignOut(error); } } catch(e) { ; } } ;MainFrameWindow.prototype.Initialize = function(componentStore) { BrowserFactory.Initialize(); MenuBar.prototype.cNameMenuBar = "menubar"; MenuBar.prototype.gridAssetsNormal = new NineGridAssets( null, null, null, L_MenuBar_Left_Hover, "", "menubaritem", L_MenuBar_Right_Hover, null, null, null, 0x00 ); MenuBar.prototype.gridAssetsHover = new NineGridAssets( null, null, null, L_MenuBar_Left_Hover, L_MenuBar_Center_Hover, null, L_MenuBar_Right_Hover ); MenuBar.prototype.gridAssetsClick = new NineGridAssets( null, null, null, L_MenuBar_Left_Click, L_MenuBar_Center_Click, null, L_MenuBar_Right_Click ); Menu.prototype.zIndex = 2; Menu.prototype.cssMenu = "menu2"; Menu.prototype.cssTextPart = "menuitem2"; Menu.prototype.cssTextPartOn = "menuitemon2"; Menu.prototype.cssTextNode = "menuitemtext"; Menu.prototype.cssIconPart = "menupre2"; Menu.prototype.cssIconPartOn = "menupreon2"; Menu.prototype.cssIconPartBody = "menuiconpartbody"; Menu.prototype.cssIconNodeChecked = "menuiconnodechecked"; Menu.prototype.cssSpr = "menuspr"; Menu.prototype.cssLeftMargin = "menuleftmargin2"; Menu.prototype.cssRightMargin = "menurightmargin2"; Menu.prototype.margin = 1; Menu.prototype.bottomMargin = 2; Menu.prototype.submenuArrowIconUri = L_MENU_TRIARROW; Menu.prototype.checkIconUri = L_MENU_CHECK; Menu.prototype.radioCheckIconUri = L_MENU_RADIO; this.centralData = componentStore.GetComponent("centralData"); this.contactsData = this.centralData.contactsData; this.userData = this.centralData.userData; this.tagData = this.centralData.tagData; this.policyData = this.centralData.policyData; this.componentStore = componentStore; this.userSession = componentStore.GetComponent("userSession"); this.communicator = componentStore.GetComponent("communicator"); this.downloadManager = componentStore.GetComponent("downloadManager"); this.modalDialogManager = componentStore.GetComponent("modalDialogManager"); this.modelessDialogManager = componentStore.GetComponent("modelessDialogManager"); this.focusManager = componentStore.GetComponent("focusManager"); this.pickerManager = componentStore.GetComponent("pickerManager"); this.chatWindowManager = componentStore.GetComponent("chatWindowManager"); this.soundManager = componentStore.GetComponent("soundManager"); this.toastWindowManager = componentStore.GetComponent("toastWindowManager"); this.contactManager = componentStore.GetComponent("contactManager"); this.groupManager = componentStore.GetComponent("groupManager"); this.localUserManager = componentStore.GetComponent("localUserManager"); this.aclManager = componentStore.GetComponent("aclManager"); this.searchManager = componentStore.GetComponent("searchManager"); this.optionManager = componentStore.GetComponent("optionManager"); this.privacyManager = componentStore.GetComponent("privacyManager"); this.richPresenceManager = componentStore.GetComponent("richPresenceManager"); this.callRulesManager = componentStore.GetComponent("callRulesManager"); this.dgCacheManager = componentStore.GetComponent("dgCacheManager"); this.chatAgentManager = componentStore.GetComponent("chatAgentManager"); this.helpManager = componentStore.GetComponent("helpManager"); this.customizationManager = componentStore.GetComponent("customizationManager"); this.popupManager = new PopupManager(); this.pluginManager = PluginManager.GetInstance(); this.pickerUIHandler = new PickerUIHandler(); this.searchUIHandler = new SearchUIHandler(); this.specialGroupUIHandler = new SpecialGroupUIHandler(); this.userNodeUIHandler = new UserNodeUIHandler(); this.groupNodeUIHandler = new GroupNodeUIHandler(); this.contactNodeUIHandler = new ContactNodeUIHandler(); this.callRulesUIHandler = new CRRulesUIHandler(); document.body.style.cursor = "default"; document.body.className = "mainframe"; window.budapest = 1; window.token = WindowToken.ContactList; window.obj = this; window.blocked = false; window.modalDialog = null; } ;MainFrameWindow.prototype.SetSelfUri = function(uri) { this.uri = uri; } ;MainFrameWindow.prototype.OnLoaded = function() { LocalizeFont(LocalizableFontPart.CWA); var ua = UserAgentInfo.GetInstance(); if (!(ua.IsIE() || ua.IsSafari())) { document.getElementById("mainUIbody").height = "93%"; } ;window.document.title = L_Product_Name; ErrorDispatcher.ErrorEvent.Add(Delegate(this, this._ErrorHandler)); this.pickerPane.OnBodyLoaded(); this.myStatusCtl.callRulesManager = this.callRulesManager; this.myStatusCtl.OnBodyLoaded(); this.myStatusCtl.SetContextMenu(this.presenceMenu, this.popupManager); this.callRulesMenu.OnBodyLoaded( this.userData ); this.errorPane.OnBodyLoaded(); this.searchPane.OnBodyLoaded(); this.contactListView.OnBodyLoaded(this.chatAgentManager, this.richPresenceManager, this.dgCacheManager, this.centralData); AudioDialoutMenu.GetInstance().SetData(this.userData, this.modalDialogManager); this.detailCard.OnBodyLoaded(); this.searchPane.HideBody(); this.downloadManager.DownloadResource(); this.userSession.communicator._signoutSender.SignOutDecCookieEvent.Add(Delegate(this, this.SignOutDecCookieHandler)); this.pickerManager.Initialize(this.pickerPane, this.menuBar, this.myStatusCtl, this.errorPane, this.searchPane, this.detailCard, this.contactListView, this.focusManager); this.userSession.SignInSuccessEvent.Add(Delegate(this, this.OnSignInSuccessHandler)); this.userSession.SignOutEvent.Add(Delegate(this, this.OnSignOutHandler)); this.userSession.StartSigninEvent.Add(Delegate(this, this.OnStartSignInHandler)); this.pickerUIHandler.Initialize(this.focusManager, this.pickerManager); this.searchUIHandler.Initialize(this.searchPane, this.centralData, this.focusManager); this.specialGroupUIHandler.Initialize(this.aclManager); this.userNodeUIHandler.Initialize(this.localUserManager, this.chatAgentManager); this.groupNodeUIHandler.Initialize(this.centralData, this.groupContextMenu, this.aceGroupContextMenu, this.contactListView.normalGroupList, this.pickerUIHandler, this.focusManager, this.privacyManager); this.contactNodeUIHandler.Initialize( this.groupManager, this.contactManager, this.privacyManager, this.chatAgentManager, this.focusManager, this.richPresenceManager, this.contactContextMenu, this.aceContextMenu, this.pickerUIHandler, this.detailCard, this.centralData); this.callRulesUIHandler.Initialize( this.userData, this.callRulesManager, this.callRulesMenu, this.pickerManager, this.modalDialogManager, this.modelessDialogManager ); this.contactListAndTabControl.Initialize(); this.pickerPane.ButtonClicked.Add( Delegate(this.pickerUIHandler, this.pickerUIHandler.ButtonClickedHandler) ); this.searchPane.SearchButtonClicked.Add( Delegate(this.searchUIHandler, this.searchUIHandler.ButtonClickedHandler) ); this.searchPane.ItemClicked.Add( Delegate(this.focusManager, this.focusManager.SearchContactResultClicked), null, false ); this.searchPane.ItemClicked.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ClickedHandler) ); this.searchPane.ItemRightClicked.Add( Delegate(this.focusManager, this.focusManager.SearchContactResultClicked), null, true ); this.searchPane.ItemRightClicked.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.RightClickedHandler) ); this.searchPane.ItemActioned.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ActionedHandler) ); this.searchPane.DGItemClicked.Add( Delegate(this.focusManager, this.focusManager.SearchDGResultClicked) ); this.searchPane.DGItemClicked.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.RightClickedHandler), null, true ); this.searchPane.DGItemActioned.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.NestDGActionedHandler) ); this.searchPane.Toggled.Add( Delegate(this.focusManager, this.focusManager.SearchPaneToggled) ); this.searchPane.ResultListCtlCleared.Add( Delegate(this.focusManager, this.focusManager.SearchResultListCleared) ); this.searchPane.ResultListCtlCleared.Add( Delegate(this, this.SearchResultCleared) ); this.searchManager.CriteriaUpdated.Add(Delegate(this.searchPane, this.searchPane.OnSearchCriteriaUpdated)); this.searchManager.StatusUpdated.Add(Delegate(this.searchPane, this.searchPane.OnSearchManagerStatusUpdated)); this.searchManager.ResultUpdated.Add(Delegate(this.searchPane, this.searchPane.OnResultUpdated)); this.searchManager.PresenceUpdated.Add(Delegate(this.searchPane, this.searchPane.OnResultPresenceUpdated)); this.searchManager.PresenceUpdated.Add(Delegate(this.detailCard, this.detailCard.ContactUpdatedHandler)); this.searchPane.SetSearchManager(this.searchManager); this.userSession.LocationProfileEvent.Add(Delegate(this, PhoneNormalizer.OnLocationProfileUpdated)); this.searchPane.ResultListClearing.Add(Delegate(this.searchManager, this.searchManager.OnClearResultBtnClicked)); this.chatAgentManager.ContactInfoUpdated.Add(Delegate(this.searchPane, this.searchPane.OnResultPresenceUpdated)); this.contactListView.curConvGroup.GroupClicked.Add( Delegate(this.focusManager, this.focusManager.SpecialGroupClickedHandler) ); this.contactListView.curConvGroup.ItemClicked.Add( Delegate(this.focusManager, this.focusManager.SpecialGroupClickedHandler) ); this.contactListView.pendingAclGroup.GroupClicked.Add( Delegate(this.focusManager, this.focusManager.SpecialGroupClickedHandler) ); this.contactListView.pendingAclGroup.GroupActioned.Add( Delegate(this.specialGroupUIHandler, this.specialGroupUIHandler.GroupActionedHandler) ); this.contactListView.pendingAclGroup.ItemClicked.Add( Delegate(this.focusManager, this.focusManager.SpecialGroupClickedHandler) ); this.contactListView.pendingAclGroup.ItemActioned.Add( Delegate(this.specialGroupUIHandler, this.specialGroupUIHandler.PendingAclActionedHandler) ); this.contactListView.normalGroupList.GroupClicked.Add ( Delegate(this.focusManager, this.focusManager.GroupClickedHandler) ); this.contactListView.normalGroupList.GroupClicked.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.RightClickedHandler), null, false ); this.contactListView.normalGroupList.GroupEditBoxClosed.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.EditBoxClosedHandler) ); this.contactListView.normalGroupList.GroupDisposing.Add( Delegate(this.focusManager, this.focusManager.WidgetDisposingHandler) ); this.contactListView.normalGroupList.ContactClicked.Add( Delegate(this.focusManager, this.focusManager.ContactClickedHandler), null, false ); this.contactListView.normalGroupList.ContactClicked.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ClickedHandler) ); this.contactListView.normalGroupList.ContactRightClicked.Add( Delegate(this.focusManager, this.focusManager.ContactClickedHandler), null, true ); this.contactListView.normalGroupList.ContactRightClicked.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.RightClickedHandler) ); this.contactListView.normalGroupList.ContactActioned.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ActionedHandler) ); this.contactListView.normalGroupList.ContactDisposing.Add( Delegate(this.focusManager, this.focusManager.WidgetDisposingHandler) ); this.contactListView.normalGroupList.ContactDisposing.Add( Delegate(this.detailCard, this.detailCard.ContactWidgetDisposingHandler) ); this.contactListView.normalGroupList.NestDGClicked.Add ( Delegate(this.focusManager, this.focusManager.NestDGClickedHandler) ); this.contactListView.normalGroupList.NestDGClicked.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.RightClickedHandler), null, true ); this.contactListView.normalGroupList.NestDGActioned.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.NestDGActionedHandler) ); this.contactListView.normalGroupList.NestDGDisposing.Add( Delegate(this.focusManager, this.focusManager.WidgetDisposingHandler) ); this.contactListView.normalGroupList.AceClicked.Add( Delegate(this.focusManager, this.focusManager.AceClickedHandler) ); this.contactListView.normalGroupList.AceClicked.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.AceClickedHandler) ); this.contactListView.normalGroupList.AceEditBoxClosed.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.AceEditBoxClosedHandler) ); this.contactListView.normalGroupList.AceDisposing.Add( Delegate(this.focusManager, this.focusManager.WidgetDisposingHandler) ); this.aclManager.SubscribersAdded.Add(Delegate(this.contactListView, this.contactListView.SubscribersAddedHandler)); this.aclManager.SubscribersDeleted.Add(Delegate2(this.contactListView, this.contactListView.SubscribersDeletedHandler, UserAgentInfo.GetInstance().IsSafari())); this.detailCard.ActionEvent.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.DetailCardActionHandler) ); this.focusManager.FocusStateChanged.Add( Delegate(this.pickerUIHandler, this.pickerUIHandler.SelectedCtlChangedHandler) ); this.groupContextMenu.ItemSelected.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.ContextMenuSelectedHandler) ); this.aceGroupContextMenu.ItemSelected.Add( Delegate(this.groupNodeUIHandler, this.groupNodeUIHandler.ContextMenuSelectedHandler) ); this.contactContextMenu.ItemSelected.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ContextMenuSelectedHandler) ); this.contactContextMenu.ItemSelected.Add( Delegate(this.pickerUIHandler, this.pickerUIHandler.ContactContextMenuSelected) ); this.aceContextMenu.ItemSelected.Add( Delegate(this.contactNodeUIHandler, this.contactNodeUIHandler.ContextMenuSelectedHandler) ); this.presenceMenu.ItemSelected.Add( Delegate(this.userNodeUIHandler, this.userNodeUIHandler.ContextMenuSelectedHandler) ); this.myStatusCtl.noteEditBox.Closed.Add( Delegate(this.userNodeUIHandler, this.userNodeUIHandler.EditBoxClosedHandler) ); this.myStatusCtl.PhoneClicked.Add( Delegate( this.callRulesUIHandler, this.callRulesUIHandler.PhoneButtonClicked ) ); this.callRulesMenu.Clicked.Add( Delegate( this.callRulesUIHandler, this.callRulesUIHandler.CRRulesMenuClicked ) ); this.callRulesManager.RulesUpdated.Add( Delegate(this.myStatusCtl, this.myStatusCtl.CallRulesUpdatedHandler) ); this.userData.Updated.Add( Delegate(this.myStatusCtl, this.myStatusCtl.UserDataUpdatedHandler) ); this.userData.Updated.Add( Delegate(this.optionManager, this.optionManager.OnUserDataUpdated) ); this.userData.Updated.Add( Delegate(this.callRulesManager, this.callRulesManager.OnUserPhoneUpdated) ); this.userSession.EndTransferData.Add( Delegate(this.richPresenceManager, this.richPresenceManager.InitialDataReceived) ); this.userSession.EndTransferData.Add( Delegate(this.contactListView.normalGroupList, this.contactListView.normalGroupList.InitialDataReceived) ); this.userSession.EndTransferData.Add( Delegate(this.callRulesManager, this.callRulesManager.OnInitialDataHandled) ); this.contactsData.ContactUpdated.Add( Delegate(this.detailCard, this.detailCard.ContactUpdatedHandler) ); this.chatAgentManager.AgentWindowCreated.Add( Delegate(this.contactListView, this.contactListView.ChatAgentCreatedHandler), null, false ); this.chatAgentManager.AgentWindowClosing.Add( Delegate(this.contactListView, this.contactListView.ChatAgentDeletingHandler), null, false ); this.chatAgentManager.AgentWindowClosing.Add( Delegate(BrowserFactory.windowFocusImp, BrowserFactory.windowFocusImp.ChatWindowClosing) ); this.chatAgentManager.MissedCWCreatedEvent.Add( Delegate(this.contactListView, this.contactListView.ChatAgentCreatedHandler), null, true ); this.chatAgentManager.MissedCWClosingEvent.Add( Delegate(this.contactListView, this.contactListView.ChatAgentDeletingHandler), null, true ); this.presenceToastHandler = new PresenceToastHandler(); this.presenceToastHandler.Initialize(this.centralData, this.toastWindowManager, this.contactManager); this.centralData.contactsData.ContactAvChanged.Add( Delegate( this.presenceToastHandler, this.presenceToastHandler.ContactAvChangedHandler) ); this.centralData.policyData.Updated.Add(Delegate(this.presenceMenu, this.presenceMenu.OnPolicyUpdated)); this.callRulesManager.RulesUpdated.Add( Delegate( this.callRulesMenu, this.callRulesMenu.CRRulesUpdated ) ); this.menuBar.OnBodyLoaded(this.userNodeUIHandler, this.centralData, this.pickerManager, this.contactManager, this.contactNodeUIHandler, this.groupManager, this.groupNodeUIHandler, this.chatAgentManager, this.contactContextMenu, this.popupManager); this.userStatusDetector = new UserStatusDetector(); this.userStatusDetector.Initialize(this.localUserManager); this.optionManager.FuzzyAwayIntervalChanged.Add( Delegate(this.userStatusDetector, this.userStatusDetector.FuzzyAwaySettingChanded) ); this.optionManager.FuzzyAwayIntervalChanged.Add( Delegate(this.localUserManager, this.localUserManager.IdleTimeoutSettingChanged) ); this._textSizeTestArea = top.document.getElementById("_textSizeTestArea"); this.pluginManager.Initialize(); var windowManager = GetWindowManager(); windowManager.UserActing.Add( Delegate(this.userStatusDetector.actionOrIdleDetector, this.userStatusDetector.actionOrIdleDetector.UserActionHandler) ); windowManager.UserActing.Add( Delegate(this.localUserManager, this.localUserManager.UserActingHandler) ); windowManager.WindowFocused.Add( Delegate(BrowserFactory.windowFocusImp, BrowserFactory.windowFocusImp.WindowFocused) ); window.MouseMoving = new Event(); window.MouseDown = new Event(); window.KeyDown = new Event(); window.WindowFocus = new Event(); window.WindowBlur = new Event(); document.body.onmousemove = function(e) { try { window.MouseMoving.Fire(window, null); } catch (ex) { } } ;document.body.onmousedown = function(e) { try { if (e == null) e = event; window.obj.OnMouseDown(e); } catch (ex) { } } ;document.body.onmouseup = function(e) { try { if (e == null) e = event; window.obj.OnMouseUp(e); } catch (ex) { } } ;document.onkeydown = function(e) { try { if (!e) { e = window.event; } ;if (e.keyCode == 123) { OpenErrorWindow(); } ;window.KeyDown.Fire(window, null); } catch (ex) { } } ;document.onkeypress = function(e) { try { if (!e) { e = window.event; } ;if (e.keyCode == 116) { var ua = UserAgentInfo.GetInstance(); if (ua.IsMozilla() || ua.IsFirefox() || ua.IsNetscape()) { return false; } } else if (e.keyCode == 27) { window.obj.popupManager.OnEscKeyPressed(); return false; } } catch (ex) { } } ;document.body.onclick = function(e) { try { if( e ) { window.obj.OnBodyClick(e); } else { window.obj.OnBodyClick(event); } } catch (ex) { } } ;window.onresize = function() { if (window.obj) window.obj.OnResize(); } ;window.onfocus = function() { try { if (window.obj) window.obj.OnFocus("Window"); } catch (ex) { } } ;window.onblur = function() { try { if (window.obj) window.obj.OnBlur("Window"); } catch (ex) { } } ;windowManager.Register(window); if (window._hasUnloadEvent == null) { } ;DisableDefaultContextMenu(document.body); var scrollDelegate = Delegate( this.popupManager, this.popupManager.Restore ); AddDomEventHandler(document.getElementById("contactListScroll"), "onscroll", scrollDelegate); AddDomEventHandler(document.getElementById("searchResultScroll"), "onscroll", scrollDelegate); { this.contactListAndTabControl.Enable(false); } ;return true; } ;MainFrameWindow.prototype.SearchPaneShowBodyed = function() { this.searchAndContactListPanel.Enable(true); } ;MainFrameWindow.prototype.SearchPaneHideBodyed = function() { this.searchAndContactListPanel.Enable(false); } ;MainFrameWindow.prototype.GennerateSearchAndContactListPanel = function() { this.searchPane = new SearchPane(); this.contactListView = new ContactListPane(); this.searchPane.ShowBodyed.Add(Delegate(this, this.SearchPaneShowBodyed)); this.searchPane.HideBodyed.Add(Delegate(this, this.SearchPaneHideBodyed)); this.searchAndContactListPanel = new ResizeableTable("_searchAndContactListPanel", this.searchPane, this.contactListView); this.tabControlArea = new TabFrameWindow(); this.contactListAndTabControl = new SplitterResizableTable("_mainFrameWindows", this.searchAndContactListPanel, this.tabControlArea, 2); var text = this.contactListAndTabControl.GetHTML(); this.NewContactListView("ContactList.aspx"); document.write(text); } ;MainFrameWindow.prototype.GetDefaultSize = function() { var size = new Size(); size.width = L_Size_CL_Width; size.height = AdjustWindowHeight( L_Size_CL_Height ); return size; } ;MainFrameWindow.prototype.ShowErrorPane = function(error) { this.errorPane.AddErrorMsg(error); } ;MainFrameWindow.prototype.ShowSplash = function() { var statusField = document.getElementById("currentstatus"); if (statusField != null) { statusField.innerHTML = L_Sign_In_Status_Text; } ;document.getElementById("signin").style.display = ""; document.getElementById("mainUI").style.display = "none"; document.getElementById("signin").scrollTop = 0; document.getElementById("signin").scrollLeft = 0; document.getElementById("animationImg").style.display = ""; document.getElementById("signInBtn").disabled = true; } ;MainFrameWindow.prototype.ShowSignInUI = function(error, nextLogonTimeInterval) { document.getElementById("signin").style.display = "block"; document.getElementById("mainUI").style.display = "none"; document.getElementById("signin").scrollTop = 0; document.getElementById("signin").scrollLeft = 0; document.getElementById("animationImg").style.display = "none"; var signInBtn = document.getElementById("signInBtn"); if (signInBtn != null) { signInBtn.disabled = false; signInBtn.style.color = "#232D50"; signInBtn.focus(); } ;var displayNameField = document.getElementById("displayNameField"); if (displayNameField != null) { var tmp = this.userData.name; if (tmp) { displayNameField.innerHTML = TextParser.prototype.ReplaceEntity(tmp); } } ;var statusField = document.getElementById("currentstatus"); if (statusField != null) { statusField.innerHTML = L_Sign_Off_Status_Text; } ;var errorPane = document.getElementById("signOffInfoPane"); var resigninNoticePane = document.getElementById("resigninNoticePane"); if (errorPane != null) { if (error != null) { if (!error.description) { error.description = L_Sign_Off_Text; } ;errorPane.style.display = "block"; var errorMessage = error.description; if (error.displayCode) { errorMessage += L_Error_Code_Display_Text.replace("%0", error.displayCode); } ;if (nextLogonTimeInterval) { var date = new Date(); date.setUTCMilliseconds(date.getMilliseconds() + nextLogonTimeInterval); resigninNoticePane.innerHTML = L_NextLogonTime_Notice_Text.replace("%0", GetTimeStr(date)); } ;errorPane.innerHTML = errorMessage; } else { errorPane.innerHTML = ""; } } ;var helpLinkPane = document.getElementById("signOffHelp"); if (helpLinkPane != null) { helpLinkPane.innerHTML = "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>" + GetImgHTML(L_Logon_Info) + "</td><td><a href='#'>" + L_Logon_Log_In_Again_Text + "</a></td></tr></table>"; } } ;MainFrameWindow.prototype.ReSignIn = function() { ; var signInBtn = document.getElementById("signInBtn"); if (signInBtn.disabled == true) { return; } ;var logOnUrl = LOG_ON_URL; if (window.opener == null) { CWA__OpenWindow( logOnUrl, '_blank' ); } else { try { if (window.opener.closed == true) { CWA__OpenWindow( logOnUrl, '_blank' ); } else { try { window.opener.location.href = logOnUrl; window.opener.focus(); } catch (ex) { } } } catch(e) { CWA__OpenWindow( logOnUrl, '_blank' ); } } } ;MainFrameWindow.prototype.OpenWindow = function(pageUrl, queryString, sipUri) { var size = this.GetDefaultSize(); var fullURL; if( queryString != null && queryString != "" ) { fullURL = pageUrl + "?" + queryString; } else { fullURL = pageUrl; } ;var lock = GetCookie("lock"); if (!lock) { var date = new Date(); date.setTime(date.getTime() + 5000); SetCookie("lock", "1", date); } else { return null; } ;var pid = GetCookie("pid"); if (!pid) { var date = new Date(); pid = date.getTime(); SetSessionCookie("pid", pid); } ;var clwe = GetCookie("clwe"); clwe = !clwe ? 1 : 2; SetSessionCookie("clwe", clwe); windowObj = CWA__OpenWindow('', sipUri, false, size, true); if (windowObj != null) { if (windowObj._CWAMain != null) { if (windowObj._CWAMain.pid && windowObj._CWAMain.pid == pid) { if (windowObj._CWAMain.userSession.status == null) { windowObj.setTimeout("window._CWAMain.Resume()", 100); } } else { if (windowObj._CWAMain.userSession.status == null) { windowObj.close(); windowObj = CWA__OpenWindow( fullURL, sipUri, false, size, true); } } } else { var oldWin = windowObj; windowObj = CWA__OpenWindow( fullURL, sipUri, false, size, true); if(oldWin != windowObj) { oldWin.close(); } } ;windowObj.focus(); window.setTimeout("if (windowObj.closed==false) windowObj._hasUnloadEvent = window._hasUnloadEvent", 0); } ;RemoveCookie("lock"); return windowObj; } ;MainFrameWindow.prototype.SignOutDecCookieHandler = function( sender, eventArgs ) { this._decClweSessionCookieOnUnload = false; } 
