
//From file Common.js
function generatePasswordHash(password,seed){if(typeof(seed)=="undefined"||seed==null)seed="";var hashValue=hex_sha1(password+""+seed);return hashValue};function formatCurrency(num,symbol){num=num.toString().replace(/\$|\,/g,'');if(isNaN(num))num="0";sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);cents=num%100;num=Math.floor(num/100).toString();if(cents<10)cents="0"+cents;for(var i=0;i<Math.floor((num.length-(1+i))/3);i++)num=num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));var CurrSymbol=(typeof symbol=='undefined')?"":symbol;return CurrSymbol+(((sign)?'':'-')+num+'.'+cents)};function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()}else var expires="";document.cookie=name+"="+value+expires+"; path=/;"}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)}return null}function deleteCookie(name){createCookie(name,"",-1)}function showLoading(){var prefix=FeedbackID+"_";if($get(prefix+"RequiredFieldValidator1").style.display=="none"&&$get(prefix+"RegularExpressionValidator1").style.display=="none"&&$get(prefix+"RequiredFieldValidator2").style.display=="none"){$get(prefix+"Feedback_Sending").style.display="block";$get(prefix+"Feedback_Form").style.display="none"}}function showFeedbackForm(){var prefix=FeedbackID+"_";if($get(prefix+"Feedback_Form")!=null)$get(prefix+"Feedback_Form").style.display="block";if($get(prefix+"Feedback_Show")!=null)$get(prefix+"Feedback_Show").style.display="none";if($get("Feedback_Hide")!=null)$get("Feedback_Hide").style.display="";return false}function hideFeedbackForm(){var prefix=FeedbackID+"_";if($get(prefix+"Feedback_Form")!=null)$get(prefix+"Feedback_Form").style.display="none";if($get(prefix+"Feedback_Show")!=null)$get(prefix+"Feedback_Show").style.display="block";if($get("Feedback_Hide")!=null)$get("Feedback_Hide").style.display="none";if($get(prefix+"Feedback_Sending")!=null)$get(prefix+"Feedback_Sending").style.display="none";return false}function resetFeedback(){var prefix=FeedbackID+"_";$get(prefix+"Feedback_Sending").style.display="none";$get(prefix+"Feedback_Form").style.display="none";$get(prefix+'Feedback_Response').style.display="none";$get(prefix+'Feedback_Response_Text').style.display="none";$get(prefix+'Feedback_Show').style.display="block";$get(prefix+'Feedback_Name').value="";$get(prefix+'Feedback_Email').value="";$get(prefix+'Feedback_Type').value="general";$get(prefix+'Feedback_Comments').value="";return false}function getHeatmapContracts(country){var heatmapFeedParams={};heatmapFeedParams.contractType="Equity";heatmapFeedParams.contractExchange=(country=="UK"||country=="US")?((country=="US")?country:"LSE"):"EURO";heatmapFeedParams.CountryCode=(country=="UK"||(country=="EU"))?null:country;heatmapFeedParams.Filter=null;heatmapFeedParams.numberToReturn=5;mModel.LoadContractsByCountryCode(heatmapFeedParams);cFeeds.set_FeedParams(heatmapFeedParams);cFeeds.StartMainFeed();return"loaded"}function thisMovie(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName]}else{return document[movieName]}}function getGlobalContracts(){var params={};params.Type="Index";params.Exchange=null;mModel.LoadActiveContractsByTypeAndExchange(params)}function deactivateEnterKey(e){var pK=e?e.which:window.event.keyCode;if(e){if(e.target.tagName!="TEXTAREA")return pK!=13}else{if(window.event.srcElement.tagName!="TEXTAREA")return pK!=13}return true}document.onkeypress=deactivateEnterKey;function autoJump(elmnt,content){if(content.length==elmnt.maxLength){next=-1;for(var i=0;i<document.forms[0].elements.length;i++){if(document.forms[0].elements[i]==elmnt&&i<document.forms[0].elements.length)next=i+1}if(next>0&&next<document.forms[0].elements.length)document.forms[0].elements[next].focus()}}
//From file ControlerBase.js
Type.registerNamespace("TradIndexWebAPI.Controlers");TradIndexWebAPI.Controlers.ControlerBase=function(data){TradIndexWebAPI.Controlers.ControlerBase.initializeBase(this);this._Model=null};TradIndexWebAPI.Controlers.ControlerBase.prototype={get_Model:function(){return this._Model},set_Model:function(value){this._Model=value},GetControl:function(id){var c=$get(this._ElementID+"_"+id);return(c===null)?$get(id):c;},dispose:function(){TradIndexWebAPI.Controlers.ControlerBase.callBaseMethod(this,'dispose')}};TradIndexWebAPI.Controlers.ControlerBase.registerClass('TradIndexWebAPI.Controlers.ControlerBase',Sys.Component);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file ViewBase.js
Type.registerNamespace("TradIndexWebAPI.Views");TradIndexWebAPI.Views.ViewBase=function(data){TradIndexWebAPI.Views.ViewBase.initializeBase(this);this._Model=null;this._ClientID="";this._FeedsIDs="";this._Element=null;this._Feeds=null;this._State="";this.OldData=new Array()};TradIndexWebAPI.Views.ViewBase.prototype={get_ClientID:function(){return this._ClientID},set_ClientID:function(value){this._ClientID=value},get_FeedsIDs:function(){return this._FeedsIDs},set_FeedsIDs:function(value){this._FeedsIDs=value},get_Element:function(){return this._Element},set_Element:function(value){this._Element=value},get_Model:function(){return this._Model},set_Model:function(value){this._Model=value},get_State:function(){return this._State},set_State:function(value){this._State=value;this.raisePropertyChanged('State')},get_Feeds:function(){return this._Feeds},set_Feeds:function(value){this._Feeds=value;this.raisePropertyChanged('Feeds')},add_ViewRenderedHandler:function(handler){this.get_events().addHandler("renderedview",handler)},remove_ViewRenderedHandler:function(handler){this.get_events().removeHandler("renderedview",handler)},raise_RenderedView:function(){var handler=this.get_events().getHandler("renderedview");if(handler)handler(this,Sys.EventArgs.Empty)},GetControl:function(id){var c=$get(this._ClientID+"_"+id);return(c===null)?$get(id):c;},InsertRowAfter:function(RowBefore,RowToInsert){var RI=RowToInsert;if(!RowBefore.nextSibling){RowBefore.parentNode.appendChild(RI)}else{RowBefore.parentNode.insertBefore(RI,RowBefore.nextSibling)}},initialize:function(){TradIndexWebAPI.Views.ViewBase.callBaseMethod(this,'initialize');this._Model.RegisterView(this);if(this._FeedsIDs.length>0)this._Feeds.add_FeedsHandler(this)},updateFeed:function(){var oldDataIndex=0;for(var j=0;j<this._FeedsIDs.length;j++){var List=this._Feeds.feeds[this._FeedsIDs[j]];if(!List)continue;if(this.OldData[oldDataIndex]==null||(this.OldData[oldDataIndex]!=null&&List.length!=this.OldData[oldDataIndex].length)){this.OldData[oldDataIndex]=List;oldDataIndex++;return false}var l=List.length;for(var i=0;i<l;i++){current=List[i];this[this._FeedsIDs[j]](current,i,this.OldData[oldDataIndex])}this.OldData[oldDataIndex]=List;oldDataIndex++}},UnsubscribeToFeed:function(){for(var i=0;i<this._FeedsIDs.length;i++){this.get_Feeds().UnSubscribeToFeed(this._FeedsIDs[i])}},dispose:function(){TradIndexWebAPI.Views.ViewBase.callBaseMethod(this,'dispose')}};TradIndexWebAPI.Views.ViewBase.registerClass('TradIndexWebAPI.Views.ViewBase',Sys.Component);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file CommonControler.js
Type.registerNamespace("TradIndexWebAPI.Controlers");TradIndexWebAPI.Controlers.CommonControler=function(data){TradIndexWebAPI.Controlers.CommonControler.initializeBase(this);this._UAVw={};this._FormKeyUpDel=null;this._LoginClickDel=null;this._LogoutClickDel=null;this._SwitchDel=null;this._SwitchToInvestorDel=null;this._UpgradeDel=null};TradIndexWebAPI.Controlers.CommonControler.prototype={get_UAVw:function(){return this._UAVw},set_UAVw:function(value){this._UAVw=value},initialize:function(){this.SetupUserEventHandlers()},dispose:function(){this.onAccountInfoUnload();TradIndexWebAPI.Controlers.CommonControler.callBaseMethod(this,'dispose')},SetupUserEventHandlers:function(){if(this._FormKeyUpDel==null){this._FormKeyUpDel=Function.createDelegate(this,this.onFormKeyUp)}$addHandler(this._UAVw.PasswordInp,"keyup",this._FormKeyUpDel);$addHandler(this._UAVw.LoginNameInp,"keyup",this._FormKeyUpDel);if(this._LoginClickDel==null){this._LoginClickDel=Function.createDelegate(this,this.onLoginClick)}$addHandler(this._UAVw.LoginBtn,"click",this._LoginClickDel);if(this._LogoutClickDel===null){this._LogoutClickDel=Function.createDelegate(this,this.onLogoutClick)}$addHandler(this._UAVw.LogoutBtn,"click",this._LogoutClickDel);if(this._SwitchDel===null){this._SwitchDel=Function.createDelegate(this,this.onSwitch)}$addHandler(this._UAVw.AccountSelectLIn,"change",this._SwitchDel);if(this._SwitchToInvestorDel==null){this._SwitchToInvestorDel=Function.createDelegate(this,this.SwitchToInvestor)}if(this._UAVw.SwitchText!=null)$addHandler(this._UAVw.SwitchText,"click",this._SwitchToInvestorDel)},onAccountInfoUnload:function(){$clearHandlers(this._UAVw.PasswordInp);$clearHandlers(this._UAVw.LoginNameInp);$clearHandlers(this._UAVw.LoginBtn);$clearHandlers(this._UAVw.LogoutBtn);$clearHandlers(this._UAVw.AccountSelectLIn);TradIndexWebAPI.Controlers.CommonControler.callBaseMethod(this,'dispose')},onLoginClick:function(e){var params=this._getUserParams(false);this._Model.LoadUser(params);return false},onLogoutClick:function(e){window.location.href=SiteRoot+"Login.aspx?Destination=LogOut"},onSwitch:function(e){var params=this._getUserParams(true);this._Model.LoadUser(params)},SwitchToInvestor:function(e){var params=this._getUserParams(true);params.LoginType=1;this._Model.LoadUser(params)},_getUserParams:function(UserLoggedIn){var params={};params.UserName=(UserLoggedIn)?null:this._UAVw.LoginNameInp.value;params.Password=(UserLoggedIn)?null:generatePasswordHash(this._UAVw.PasswordInp.value.toLowerCase());params.LoginType=(UserLoggedIn)?this._UAVw.AccountSelectLIn.selectedIndex:this._UAVw.AccountSelectLOut.value;return params},onFormKeyUp:function(e){if(e.keyCode==Sys.UI.Key.enter){this.onLoginClick()}return false}};TradIndexWebAPI.Controlers.CommonControler.registerClass('TradIndexWebAPI.Controlers.CommonControler',TradIndexWebAPI.Controlers.ControlerBase);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file Feeds.js
Type.registerNamespace("TradIndexWebAPI.Feeds");TradIndexWebAPI.Feeds.Feed=function(data){TradIndexWebAPI.Feeds.Feed.initializeBase(this);this._ActiveFeeds=new Array();this._feedTick=null;this._mainFeedTick=null;this._interval=1000;this._isActive=false;this._isMainActive=false;this._Model=null;this._FeedParams=null};TradIndexWebAPI.Feeds.Feed.prototype={initialize:function(){TradIndexWebAPI.Feeds.Feed.callBaseMethod(this,'initialize');var Model=this.get_Model();this._LoadedFeedsDel=Function.createDelegate(this,this.OnFeedsChange);Model.add_ModelEventHandler(this._LoadedFeedsDel,Model.LOADED_FEEDS);this._LoadedMainFeedsDel=Function.createDelegate(this,this.OnMainFeedsChange);Model.add_ModelEventHandler(this._LoadedMainFeedsDel,Model.LOADED_MAIN_FEEDS)},add_FeedsHandler:function(view){var handler=Function.createDelegate(view,view.updateFeed);this.get_events().addHandler("feeds",handler)},remove_FeedsHandler:function(handler){this.get_events().removeHandler("feeds",handler)},raise_Feeds:function(){var handler=this.get_events().getHandler("feeds");if(handler)handler(this,Sys.EventArgs.Empty)},get_Model:function(){return this._Model},set_Model:function(value){this._Model=value},get_FeedParams:function(){return this._FeedParams},set_FeedParams:function(value){this._FeedParams=value},SubscribeToFeed:function(feedName){if(!Array.contains(this._ActiveFeeds,feedName))Array.add(this._ActiveFeeds,feedName)},UnSubscribeToFeed:function(feedName){if(Array.contains(this._ActiveFeeds,feedName))Array.remove(this._ActiveFeeds,feedName)},StartFeed:function(){if(this._isActive==true)return false;this.StopFeed();this._isActive=true;this.LoadFeed()},StopFeed:function(){if(this._isActive==true){clearTimeout(this._feedTick);this._isActive=false}},LoadFeed:function(){params={};params.ActiveFeeds=this._ActiveFeeds;params.ManualRefresh=false;this._Model.LoadFeeds(params)},LoadMainFeed:function(){var params=this._FeedParams;if(!params)params={};this._Model.LoadMainFeeds(params)},StartMainFeed:function(){if(this._isMainActive==true)return false;this.StopMainFeed();this._isMainActive=true;this.LoadMainFeed()},StopMainFeed:function(){if(this._isMainActive==true){clearTimeout(this._mainFeedTick);this._isMainActive=false}},onModelChanged:function(sender,e){if(e.get_propertyName()=='Feeds'){this.OnFeedsChange()}},SessionTimeout:function(){this.StopFeed();document.location.href="/index.aspx?timeout=true";},dispose:function(){TradIndexWebAPI.Feeds.Feed.callBaseMethod(this,'dispose')},OnMainFeedsChange:function(){this.mainFeeds=this._Model.get_MainFeeds();if(this.mainFeeds==null)return false;if(this._isMainActive==true){this._mainFeedTick=setTimeout(Function.createDelegate(this,this.LoadMainFeed),this._interval)}},OnFeedsChange:function(){this.feeds=this._Model.get_Feeds();if(this.feeds==null){this.DoFeedTick();return false}if(this.feeds.ERROR=="StopFeed"){this.StopFeed();return false}if(this.feeds.ERROR=="SessionTimeOut"){this.SessionTimeout();return false}if(this.feeds.ERROR=="Exception"){}if(this._Model.get_Error()!=null){if(this._Model.get_Error().Type=="feed"){this._Model.set_Error(null)}else{this.raise_Feeds()}}else{this.raise_Feeds()}this.DoFeedTick()},DoFeedTick:function(){if(this._isActive==true){this._feedTick=setTimeout(Function.createDelegate(this,this.LoadFeed),this._interval)}}};TradIndexWebAPI.Feeds.Feed.registerClass('TradIndexWebAPI.Feeds.Feed',Sys.Component);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file Model.js
Type.registerNamespace("TradIndexWebAPI.Data");TradIndexWebAPI.Data.Model=function(data){TradIndexWebAPI.Data.Model.initializeBase(this);this.LOADING_CONTRACT="LOADING_CONTRACT";this.LOADING_ORDER="LOADING_ORDER";this.LOADING_USER="LOADING_USER";this.LOADING_CONTRACTS="LOADING_CONTRACTS";this.VIEWING_CONTRACTS="VIEWING_CONTRACTS";this.LOADING_PORTFOLIO="LOADING_PORTFOLIO";this.VIEWING_PORTFOLIO="VIEWING_PORTFOLIO";this.DEALTICKET_OPEN="DEALTICKET_OPEN";this.MOVESTOP_OPEN="MOVESTOP_OPEN";this.PLACING_ORDER="PLACING_ORDER";this.ERROR_OCCURRED="ERROR_OCCURRED";this.LOADING_ALL="LOADING_ALL";this.LOADED_CONTRACTS="LOADED_CONTRACTS";this.LOADED_PORTFOLIO="LOADED_PORTFOLIO";this.LOADED_MOVESTOP_DETAILS="LOADED_MOVESTOP_DETAILS";this.LOADING_MOVESTOP_DETAILS="LOADING_MOVESTOP_DETAILS";this.CANCELLED_MOVESTOP_DETAILS="CANCELLED_MOVESTOP_DETAILS";this.LOADED_CONTRACT="LOADED_CONTRACT";this.LOADED_ORDER="LOADED_ORDER";this.PLACED_ORDER="PLACED_ORDER";this.UPDATE_SINGLE_CONTRACT_ROW="UPDATE_SINGLE_CONTRACT_ROW";this.LOAD_CLOSE_ORDER="LOAD_CLOSE_ORDER";this.UPDATE_ORDER="UPDATE_ORDER";this.CANCELLED_ORDER="CANCELLED_ORDER";this.ORDER_CHANGED="ORDER_CHANGED";this.LOADED_WATCHLIST="LOADED_WATCHLIST";this.WATCHLIST_CHANGED="WATCHLIST_CHANGED";this.LOADED_USER="LOADED_USER";this.USER_LOGGED_OUT="USER_LOGGED_OUT";this.USER_LOGGING_OUT="USER_LOGGING_OUT";this.LOADED_SMALL_GRAPH="LOADED_SMALL_GRAPH";this.LOADED_LARGE_GRAPH="LOADED_LARGE_GRAPH";this.SERVER_ERROR="SERVER_ERROR";this.LOADING_EXPANDED_DETAILS="LOADING_EXPANDED_DETAILS";this.LOADED_EXPANDED_DETAILS="LOADED_EXPANDED_DETAILS";this.UPDATE_EXPANDED_DETAILS="UPDATE_EXPANDED_DETAILS";this.LOADED_TODAYS_TRADES="LOADED_TODAYS_TRADES";this.LOADED_FEEDS="LOADED_FEEDS";this.LOADED_MAIN_FEEDS="LOADED_MAIN_FEEDS";this._OnErrorDel=null;this._PlaceOrderDel=null;this._Order=null;this._User=null;this._AccountProfile=null;this._Contract=null;this._Feeds=null;this._MainFeeds=null;this._MoveStopDetails=null;this._ExpandedDetails=null;this._OnFeedsErrorDel=null;this._OnErrorDel=null;this._ContractsWebRequest=null;this._PortfolioWebRequest=null;this._OptionsWebRequest=null;this._WatchlistWebRequest=null;this._TodaysTradesWebRequest=null;this._Error=null;this._State=null;this._LastState=null;this._ContractID=null;this._OrderID=null;this._ContractsFilter=null;this._ActiveRow=null;this._ClickedRow=null;this._ExpandedDetailsHTML=null;this._MainHtml="";this._WatchlistHtml="";this._TodaysTradesHtml="";this._MainErrorHTML="";this._RHSMessagesHTML="";this._IsLoading=false;this._Provider=SiteRoot+"/V4/WebServices/MarketplaceManager.asmx";this._Provider2=TradIndexWebAPI.MarketplaceManager;this.CurrencySymbol="";this.LastAction="";this._timeout=20000;this._SmallGraph=new Image();this._LargeGraph=new Image()};TradIndexWebAPI.Data.Model.prototype={get_Provider:function(){return this._Provider},set_Provider:function(value){this._Provider=value},get_State:function(){return this._State},set_State:function(value){if(value===this._State)return false;this._LastState=this._State;this._State=value;this.raisePropertyChanged('State')},get_Order:function(){return this._Order},set_Order:function(value){this._Order=value},get_OrderID:function(){return this._OrderID},set_OrderID:function(value){this._OrderID=value},get_User:function(){return this._User},set_User:function(value){this._User=value;this.raisePropertyChanged('User')},get_Contract:function(){return this._Contract},set_Contract:function(value){this._Contract=value},set_MoveStopDetails:function(value){this._MoveStopDetails=value},get_MoveStopDetails:function(){return this._MoveStopDetails},set_ExpandedDetails:function(value){this._ExpandedDetails=value},get_ExpandedDetails:function(){return this._ExpandedDetails},get_ContractID:function(){return this._ContractID},set_ContractID:function(value){if(value==this._ContractID)return null;this._ContractID=value},get_ContractsFilter:function(){return this._ContractsFilter},set_ContractsFilter:function(value){this._ContractsFilter=value;this.raisePropertyChanged('ContractsFilter')},get_ActiveRow:function(){return this._ActiveRow},set_ActiveRow:function(value){this._ActiveRow=value},get_ClickedRow:function(){return this._ClickedRow},set_ClickedRow:function(value){this._ClickedRow=value},get_ExpandedDetailsHTML:function(){return this._ExpandedDetailsHTML},set_ExpandedDetailsHTML:function(value){this._ExpandedDetailsHTML=value},get_Error:function(){return this._Error},set_Error:function(value){this._Error=value},get_AccountProfile:function(){return this._AccountProfile},set_AccountProfile:function(value){this._AccountProfile=value;},get_Feeds:function(){return this._Feeds},set_Feeds:function(value){this._Feeds=value},get_MainFeeds:function(){return this._MainFeeds},set_MainFeeds:function(value){this._MainFeeds=value},get_MainHtml:function(){return this._MainHtml},set_MainHtml:function(value){this._MainHtml=value},add_ModelEventHandler:function(handler,ModelEvent){var e=Function._validateParams(arguments,[{name:"handler",type:Function},{name:"ModelEvent",type:String}]);if(e)throw e;this.get_events().addHandler(ModelEvent,handler)},remove_ModelEventHandler:function(handler,ModelEvent){this.get_events().removeHandler(ModelEvent,handler)},raise_ModelEvent:function(ModelEvent){var handler=this.get_events().getHandler(ModelEvent);if(handler)handler(this,Sys.EventArgs.Empty)},initialize:function(){if(this._OnErrorDel==null){this._OnErrorDel=Function.createDelegate(this,this.onError)}if(this._OnFeedsErrorDel==null){this._OnFeedsErrorDel=Function.createDelegate(this,this.onFeedsError)}},dispose:function(){TradIndexWebAPI.Data.Model.callBaseMethod(this,'dispose')},RegisterView:function(view){var d=Function.createDelegate(view,view.onModelChanged);this.add_propertyChanged(d)},_DoWebServiceCallback:function(methodName,parameters,succeededCallback,failedCallback,userContext,provider){var ServiceProvider=(typeof(provider)=="undefined"||provider==null)?this._Provider:provider;var webRequest=Sys.Net.WebServiceProxy.invoke(ServiceProvider,methodName,false,parameters,succeededCallback,failedCallback,userContext,this._timeout);return webRequest},CancelWebServiceCallbacks:function(){var webRequests=new Array(this._ContractsWebRequest,this._PortfolioWebRequest,this._OptionsWebRequest,this._WatchlistWebRequest,this._TodaysTradesWebRequest);for(var i=0;i<webRequests.length;i++){this._CancelWebServiceCallback(webRequests[i])}},_CancelWebServiceCallback:function(webRequest){if(!webRequest)return false;lastExecutor=webRequest.get_executor();if(lastExecutor!=null){if(lastExecutor.get_started())lastExecutor.abort()}},onError:function(result){this.set_Error({"Type":"server","Title":"Sorry","Message":result._message});this.raise_ModelEvent("SERVER_ERROR")},Error:function(errorObj){this.set_Error(errorObj);this.raise_ModelEvent("SERVER_ERROR")},onFeedsError:function(result){this.set_Error({"Type":"feed","Title":"Sorry","Message":result._message});this.raise_ModelEvent(this.LOADED_FEEDS)},LoadContractsHtml:function(params){var d=Function.createDelegate(this,this.onContractsHtml);this.set_ContractsFilter(params);this.set_State(this.LOADING_CONTRACTS);this._ContractsWebRequest=this._DoWebServiceCallback("LoadStocksHtml",params,d,this._OnErrorDel,null)},onContractsHtml:function(result){this._ContractsWebRequest=null;var xml=this._ProcessXMLResult(result);this.set_MainHtml(xml);this.raise_ModelEvent(this.LOADED_CONTRACTS)},UpdateSingleContractRow:function(){this.raise_ModelEvent(this.UPDATE_SINGLE_CONTRACT_ROW)},LoadActiveContractsByTypeAndExchange:function(params){var d=Function.createDelegate(this,this.onLoadActiveContractsByTypeAndExchange);this._ActiveContractsByTypeAndExchange=this._DoWebServiceCallback("LoadActiveContractsByTypeAndExchange",params,d,d,null)},onLoadActiveContractsByTypeAndExchange:function(result){},LoadContractsByCountryCode:function(params){var d=Function.createDelegate(this,this.onContractsByCountryCode);this._ContractsByCountryCodeWebRequest=this._DoWebServiceCallback("LoadTopDailyChangeContracts",params,d,d,null)},onContractsByCountryCode:function(result){},LoadOptionsHtml:function(p){var d=Function.createDelegate(this,this.onLoadOptionsHtml);this.set_ContractsFilter(p);this.set_State(this.LOADING_CONTRACTS);this._OptionsWebRequest=this._DoWebServiceCallback("GetOptionsList",p,d,this._OnErrorDel,null)},onLoadOptionsHtml:function(result){this._OptionsWebRequest=null;var xml=this._ProcessXMLResult(result);this.set_MainHtml(xml);this.raise_ModelEvent(this.LOADED_CONTRACTS)},CreateOrder:function(params){this._CreateOrderDel=Function.createDelegate(this,this.onCreateOrder);var Order={};Order.ContractID=params.ContractID;Order.BuySell=params.action;Order.Stake=(typeof(params.Stake)=="undefined")?1:params.Stake;this.set_State(this.LOADING_ORDER);this.set_Order(Order);this.LoadContract(Order,this._CreateOrderDel)},onCreateOrder:function(result){if(!this._TestForError(result)){if(this.get_Order()==null)return false;this.get_Order().Contract=result;this.raise_ModelEvent(this.LOADED_ORDER);this.onLoadContract(result);}},LoadOrder:function(params){if(this._LoadOrderDel==null){this._LoadOrderDel=Function.createDelegate(this,this.onLoadOrder)}this.set_State(this.LOADING_ORDER);this._DoWebServiceCallback("LoadOrder",params,this._LoadOrderDel,this._OnErrorDel,null)},onLoadOrder:function(result){this.set_Order(result);this.raise_ModelEvent(this.LOADED_ORDER)},CloseOrder:function(params){if(this._CloseOrderDel==null){this._CloseOrderDel=Function.createDelegate(this,this.onCloseOrder)}this._DoWebServiceCallback("CloseOrder",params,this._CloseOrderDel,this._OnErrorDel,null)},onCloseOrder:function(result){if(!this._TestForError(result,"deal")){this.LoadPortfolioHtml()}},PlaceOrder:function(params){if(this._PlaceOrderDel==null){this._PlaceOrderDel=Function.createDelegate(this,this.onPlaceOrder)}var tmpContract;if(typeof(params.Contract)!="undefined"){tmpContract=params.Contract;params.Contract=null}if(this.get_State()==this.PLACING_ORDER)return false;this.set_State(this.PLACING_ORDER);this._DoWebServiceCallback("PlaceBet",params,this._PlaceOrderDel,this._OnErrorDel,null);params.Contract=tmpContract},onPlaceOrder:function(result){if(!this._TestForError(result,"deal")){this.set_Order(null);this.raise_ModelEvent(this.PLACED_ORDER)}},CancelOrder:function(params){if(this._CancelOrderDel==null){this._CancelOrderDel=Function.createDelegate(this,this.onCancelOrder)}this._DoWebServiceCallback("CancelOrder",params,this._CancelOrderDel,this._OnErrorDel,null);this.set_State(this.LOADING_ORDER)},onCancelOrder:function(result){if(!this._TestForError(result,"deal")){this.set_Order(null);this.raise_ModelEvent(this.CANCELLED_ORDER)}},UpdateOrder:function(params){var Order=this.get_Order();if(!Order||(Order&&!Order.Contract))return false;Order.Contract.SellPrice=params.SellPrice;Order.Contract.BuyPrice=params.BuyPrice;this.set_Order(Order);this.raise_ModelEvent(this.UPDATE_ORDER)},LoadPortfolioHtml:function(params){var d=Function.createDelegate(this,this.onLoadPortfolioHtml);this.set_ContractsFilter(params);this.set_State(this.LOADING_PORTFOLIO);this._PortfolioWebRequest=this._DoWebServiceCallback("LoadPortfolioHtml",params,d,this._OnErrorDel,null)},onLoadPortfolioHtml:function(result){this._PortfolioWebRequest=null;var xml=this._ProcessXMLResult(result);this.set_MainHtml(xml);this.raise_ModelEvent(this.LOADED_PORTFOLIO)},LoadExpandedContractHtml:function(){},LoadExpandedDetails:function(params){if(this._LoadExpandedDetailsDel==null){this._LoadExpandedDetailsDel=Function.createDelegate(this,this.onLoadExpandedDetails)}if(this._State!=this.LOADING_EXPANDED_DETAILS){this.set_State(this.LOADING_EXPANDED_DETAILS);this._DoWebServiceCallback("LoadExpandedContractHtml",params,this._LoadExpandedDetailsDel,this._OnErrorDel,null)}},onLoadExpandedDetails:function(result){var xml=this._ProcessXMLResult(result);this._ExpandedDetailsHTML=xml;this.set_State(this._LastState);this.raise_ModelEvent(this.LOADED_EXPANDED_DETAILS)},CloseExpandedContract:function(params){this._DoWebServiceCallback("CloseExpandedContract",params,null,null,null)},UpdateExpandedDetails:function(params){this.set_ExpandedDetails(params);this.raise_ModelEvent(this.UPDATE_EXPANDED_DETAILS)},SetMarkToMarket:function(){if(this._SetMarkToMarketDel==null){this._SetMarkToMarketDel=Function.createDelegate(this,this.onSetMarkToMarket)}this._DoWebServiceCallback("SetMarkToMarket",null,this._SetMarkToMarketDel,this._OnErrorDel,null)},onSetMarkToMarket:function(result){if(!this._TestForError(result)){this.LoadPortfolioHtml()}this.set_State(null)},DoMoveStop:function(params){if(this._DoMoveStopDel==null){this._DoMoveStopDel=Function.createDelegate(this,this.onDoMoveStop)}this._DoWebServiceCallback("DoMoveStop",params,this._DoMoveStopDel,this._OnErrorDel,null)},onDoMoveStop:function(result){eval("var data = ("+result+")");if(!this._TestForError(data,"movestop")){this.LoadPortfolioHtml();this.set_State(null)}},CancelMoveStop:function(){this.raise_ModelEvent(this.CANCELLED_MOVESTOP_DETAILS)},LoadTodaysTrades:function(params){if(this._LoadTodaysTradesDel==null){this._LoadTodaysTradesDel=Function.createDelegate(this,this.onLoadTodaysTrades)}this._TodaysTradesWebRequest=this._DoWebServiceCallback("LoadTodaysTrades",params,this._LoadTodaysTradesDel,this._OnErrorDel,null)},onLoadTodaysTrades:function(result){this._TodaysTradesWebRequest=null;var xml=this._ProcessXMLResult(result);this._TodaysTradesHtml=xml;this.raise_ModelEvent(this.LOADED_TODAYS_TRADES)},LoadUser:function(params){var d=Function.createDelegate(this,this.onLoadUser);if(params==null||params.UserName==null){this.set_State(this.LOADING_USER);this._DoWebServiceCallback("SwitchCurrencyType",params,d,this._OnErrorDel,null)}else{this.set_State(this.LOADING_ALL);this._DoWebServiceCallback("LogUserIn",params,d,this._OnErrorDel,null)}},onLoadUser:function(result){if(!this._TestForError(result,"user")&&result.AccountName){this.StoreUser(result);this.raise_ModelEvent(this.LOADED_USER)}if(this.get_State()!=this.LOADING_ALL)this.set_State(null)},LoadAccountProfile:function(){var d=Function.createDelegate(this,this.onLoadAccountProfile);this._DoWebServiceCallback("GetAccountProfile",null,d,this._OnErrorDel,null)},StoreUser:function(UserDTO){if(UserDTO==null)return false;this.set_User(UserDTO);this.set_AccountProfile(UserDTO.AccountBalances);this.CurrencySymbol=UserDTO.CurrencySymbol},onLoadAccountProfile:function(result){this.LastAction="LoadAccountProfile";if(!this._TestForError(result)){this.set_AccountProfile(result);this.raise_ModelEvent(this.LOADED_USER)}},DeleteUser:function(){this.set_User(null);var d=Function.createDelegate(this,this.onDeleteUser);this._DoWebServiceCallback("LogUserOut",null,d,this._OnErrorDel,null);this.set_State(this.USER_LOGGING_OUT)},onDeleteUser:function(){this.raise_ModelEvent(this.USER_LOGGED_OUT)},LoadFeeds:function(p){var d=Function.createDelegate(this,this.onLoadFeeds);this._DoWebServiceCallback("LoadFeeds",p,d,this._OnFeedsErrorDel,null)},onLoadFeeds:function(feeds){this.set_Feeds(feeds);this.StoreUser(feeds.UserFeed);this.raise_ModelEvent(this.LOADED_FEEDS)},LoadMainFeeds:function(p){if(!p.Filter)p.Filter=null;if(!p.Exchange)p.Exchange=null;if(!p.Country)p.Country=null;if(!p.numberToReturn)p.numberToReturn=0;var d=Function.createDelegate(this,this.onLoadMainFeeds);this._DoWebServiceCallback("LoadMainFeeds",p,d,this._OnFeedsErrorDel,null)},onLoadMainFeeds:function(feeds){this.set_MainFeeds(feeds);this.raise_ModelEvent(this.LOADED_MAIN_FEEDS)},LoadContract:function(p,d){if(typeof(d)=="undefined"||d==null)d=Function.createDelegate(this,this.onLoadContract);this._DoWebServiceCallback("LoadContract",p,d,this._OnErrorDel,null)},onLoadContract:function(contract){this.set_Contract(contract);this.raise_ModelEvent(this.LOADED_CONTRACT)},LoadSmallGraph:function(p){this._SmallGraph.onload=Function.createDelegate(this,this.onLoadSmallGraph);this._SmallGraph.src="Graphs/GraphsPage.aspx?contractId="+p.ContractID},onLoadSmallGraph:function(p){this.raise_ModelEvent(this.LOADED_SMALL_GRAPH)},LoadLargeGraph:function(p){this._LargeGraph.onload=Function.createDelegate(this,this.onLoadLargeGraph);this._LargeGraph.src="Graphs/GraphsPage.aspx?contractId="+p.ContractID+"&type=1&g="+Math.round(Math.random()*1000);},onLoadLargeGraph:function(p){this.raise_ModelEvent(this.LOADED_LARGE_GRAPH)},LoadWatchlist:function(){if(this._LoadWatchlistDel==null){this._LoadWatchlistDel=Function.createDelegate(this,this.onLoadWatchlist)}this.set_State(this.LOADING_CONTRACTS);this._WatchlistWebRequest=this._DoWebServiceCallback("LoadWatchlist",null,this._LoadWatchlistDel,this._OnErrorDel,null,"WebServices/Watchlist.asmx")},onLoadWatchlist:function(result){this._WatchlistWebRequest=null;this._WatchlistHtml=result.html;this.raise_ModelEvent(this.LOADED_WATCHLIST)},AddToWatchlist:function(p){if(this._DoWatchlistDel==null){this._DoWatchlistDel=Function.createDelegate(this,this.onDoWatchlist)}this._DoWebServiceCallback("AddToWatchlist",p,this._DoWatchlistDel,this._OnErrorDel,null,"WebServices/Watchlist.asmx")},RemoveFromWatchlist:function(p){if(this._DoWatchlistDel==null){this._DoWatchlistDel=Function.createDelegate(this,this.onDoWatchlist)}this._DoWebServiceCallback("RemoveFromWatchlist",p,this._DoWatchlistDel,this._OnErrorDel,null,"WebServices/Watchlist.asmx")},onDoWatchlist:function(result){if(!this._TestForError(result,"server")){this.raise_ModelEvent(this.WATCHLIST_CHANGED)}},_TestForError:function(data,type){if(typeof(type)=="undefined"||type==null)type="server";if(data.ERROR&&data.ERROR!=""){this.set_State(this._LastState);this.RaiseError({"Type":type,"Title":"Sorry","Message":data.ERROR});return true}return false},_ProcessXMLResult:function(result){if(typeof(result.xml)!="undefined")return result.xml;else{var serializer=new XMLSerializer();return serializer.serializeToString(result)}},RaiseError:function(error){this.set_Error(error);this.raise_ModelEvent(this.SERVER_ERROR)}};TradIndexWebAPI.Data.Model.registerClass('TradIndexWebAPI.Data.Model',Sys.Component);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file sha1.js
var hexcase=0;var b64pad="";var chrsz=8;function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length*chrsz))}function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length*chrsz))}function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length*chrsz))}function hex_hmac_sha1(key,data){return binb2hex(core_hmac_sha1(key,data))}function b64_hmac_sha1(key,data){return binb2b64(core_hmac_sha1(key,data))}function str_hmac_sha1(key,data){return binb2str(core_hmac_sha1(key,data))}function sha1_vm_test(){return hex_sha1("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d"}function core_sha1(x,len){x[len>>5]|=0x80<<(24-len%32);x[((len+64>>9)<<4)+15]=len;var w=Array(80);var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var e=-1009589776;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;var olde=e;for(var j=0;j<80;j++){if(j<16)w[j]=x[i+j];else w[j]=rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);var t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j)));e=d;d=c;c=rol(b,30);b=a;a=t}a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);e=safe_add(e,olde)}return Array(a,b,c,d,e)}function sha1_ft(t,b,c,d){if(t<20)return(b&c)|((~b)&d);if(t<40)return b^c^d;if(t<60)return(b&c)|(b&d)|(c&d);return b^c^d}function sha1_kt(t){return(t<20)?1518500249:(t<40)?1859775393:(t<60)?-1894007588:-899497514}function core_hmac_sha1(key,data){var bkey=str2binb(key);if(bkey.length>16)bkey=core_sha1(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C}var hash=core_sha1(ipad.concat(str2binb(data)),512+data.length*chrsz);return core_sha1(opad.concat(hash),512+160)}function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF)}function rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt))}function str2binb(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(32-chrsz-i%32);return bin}function binb2str(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)str+=String.fromCharCode((bin[i>>5]>>>(32-chrsz-i%32))&mask);return str}function binb2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((3-i%4)*8))&0xF)}return str}function binb2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(3-i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*(3-(i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*(3-(i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F)}}return str}
//From file Errors.js
Type.registerNamespace("TradIndexWebAPI.Views");TradIndexWebAPI.Views.Errors=function(data){TradIndexWebAPI.Views.Errors.initializeBase(this);this.BtnItems=null;this.GraphRow="";this._ShowingError=false;this._errorTimer=null};TradIndexWebAPI.Views.Errors.prototype={onModelChanged:function(sender,e){if(e.get_propertyName()=='State'){this.ClearErrors()}},initialize:function(){TradIndexWebAPI.Views.Errors.callBaseMethod(this,'initialize');var Model=this.get_Model();Model.add_ModelEventHandler(Function.createDelegate(this,this.ShowServerError),Model.SERVER_ERROR);this.ErrorModule=this.GetControl("ErrorModule");this.ErrorTitle=this.GetControl("ErrorTitleTxt");this.ErrorText=this.GetControl("ErrorMessageTxt");this.userErrorText=this.GetControl("userErrorText");this.userError=this.GetControl("userError");this.DealError=this.GetControl("DealError");this.DealErrorTitle=this.GetControl("DealErrorTitle");this.DealErrorText=this.GetControl("DealErrorMessage");this.MoveStopError=this.GetControl("MoveStopError");this.MoveStopErrorTitle=this.GetControl("MoveStopErrorTitle");this.MoveStopErrorText=this.GetControl("MoveStopErrorMessage")},dispose:function(){TradIndexWebAPI.Views.Errors.callBaseMethod(this,'dispose')},ShowServerError:function(){var Model=this.get_Model();var error=Model.get_Error();switch(error.Type){case"server":if(error.Message=="NoSession"){document.location.href="/index.aspx?timeout=true";return false}this.ShowErrorMessage(error.Title,error.Message);break;case"user":this.userErrorText.innerHTML=error.Message;this.userError.style.display="block";if(error.Message=="RegisterSwitch"){document.location.href="/Apply/Index.aspx";return false}break;case"deal":this.DealErrorText.innerHTML=error.Message;this.DealError.style.display="block";break;case"movestop":this.MoveStopErrorText.innerHTML=error.Message;this.GetControl("MoveStopError").style.display="block";break;case"timed":if(this._errorTimer!=null)return false;this.ShowErrorMessage(error.Title,error.Message);this._errorTimer=setTimeout(Function.createDelegate(this,this.ClearErrors),error.Interval);break;case"feeds":document.location.href="/index.aspx?timeout=true"}this._ShowingError=true},ShowErrorMessage:function(title,message){if(this.ErrorTitle!=null){this.ErrorModule.style.display="block";this.ErrorTitle.innerHTML=title;this.ErrorText.innerHTML=message}},ClearErrors:function(){var Model=this.get_Model();var state=Model.get_State();if(this._ShowingError){if(this._errorTimer!=null){clearTimeout(this._errorTimer);this._errorTimer=null}this.userErrorText.innerHTML="";this.userError.style.display="none";if(this.ErrorModule!=null){this.ErrorText.innerHTML="";this.ErrorModule.style.display="none"}if(this.DealError!=null)this.DealError.style.display="none";if(this.MoveStopError!=null)this.MoveStopError.style.display="none";this._ShowingError=false}}};TradIndexWebAPI.Views.Errors.registerClass('TradIndexWebAPI.Views.Errors',TradIndexWebAPI.Views.ViewBase);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
//From file User.js
Type.registerNamespace("TradIndexWebAPI.Views");TradIndexWebAPI.Views.UserAccount=function(data){TradIndexWebAPI.Views.UserAccount.initializeBase(this);this._FormKeyUpDel=null;this._LoginClickDel=null;this._LogoutClickDel=null;this.User=null;this.AccountProfile=null;this.UPDATING_DISPLAY=1;this._State="";this.JsAdd};TradIndexWebAPI.Views.UserAccount.prototype={get_User:function(){this.User=this._Model.get_User();return this.User},get_AccountProfile:function(){this.AccountProfile=this._Model.get_AccountProfile();return this.AccountProfile},onModelChanged:function(sender,e){if(e.get_propertyName()=='AccountProfile'){this.RenderBallances()}if(e.get_propertyName()=='State'){this.ToggleMessages()}},_HasUserChanged:function(){var newUser=this._Model.get_User();if(this.User==null&&newUser!=null)return true;if(this.User!=null&&newUser==null)return true;if(this.User!=null&&newUser!=null)if(this.User.AccountName!=this._Model.get_User().AccountName)return true;return false},onPropChange:function(sender,e){if(e.get_propertyName()=='State'){this.ToggleMessages()}},onUserChange:function(){this.SetControlVariables();var User=this.get_User();if(User==null)return false;if(window.location.href.toLowerCase().indexOf("marketplace")==-1||User.PartnerID!=1)window.location.href=SiteRoot+"Login.aspx?Destination=Trade";if(!User.HasReadTandCs){}if(User.AccountType>0&&!User.IsFullyFunded){}if(!User.isActiveInvestor){this.get_Feeds().StopFeed()}else{this.get_Feeds().SubscribeToFeed("user");this.get_Feeds().StartFeed()}if(User.isUserCMS){window.location.href=SiteRoot+"News/News.aspx"}else{var t="";}this.RenderUserPanel();this.RenderView();this.BuildDropDown();this.set_State(0)},onUserLogout:function(){},RenderUserPanel:function(){var User=this.get_User();if(User==null){this.switchAccountInfoOff();return false}else{this.switchAccountInfoOn()}if(User.PartnerID==11){this.GetControl("AccountType").innerHTML="Silver";this.UAProview.style.display="none";this.UAStandard.style.display="none"}else if(User.IsProUser){this.UAProview.style.display="block";this.UAStandard.style.display="none";this.GetControl("AccountType").innerHTML="Black"}else{this.UAProview.style.display="none";this.UAStandard.style.display="block"}this.AccountSelectLIn.selectedIndex=User.AccountType;if(User.loginType=="player"){if(User.isActiveInvestor){this._RenderButtons("none","block","none");this._RenderUpgradeMessage("block","none","block")}else{this._RenderButtons("none","none","block");this._RenderUpgradeMessage("block","block","none");}}else{this._RenderButtons("block","none","none");this._RenderUpgradeMessage("none","none","none");}return true},_RenderButtons:function(I,IaP,P){this.InvestorBtns.style.display=I;this.InvestorAsPlayerBtns.style.display=IaP;this.PlayerBtns.style.display=P},_RenderUpgradeMessage:function(main,Upgrade,Switch){},initialize:function(){this.SetControlVariables();TradIndexWebAPI.Views.UserAccount.callBaseMethod(this,'initialize');var Model=this.get_Model();this._LoadedUserDel=Function.createDelegate(this,this.onUserChange);Model.add_ModelEventHandler(this._LoadedUserDel,Model.LOADED_USER);this._LoadedUserDel=Function.createDelegate(this,this.onUserLogout);Model.add_ModelEventHandler(this._LoadedUserDel,Model.USER_LOGGED_OUT);this._LoadedFeedsDel=Function.createDelegate(this,this.RenderBallances);Model.add_ModelEventHandler(this._LoadedFeedsDel,Model.LOADED_FEEDS);this.get_Feeds().SubscribeToFeed("user");var d2=Function.createDelegate(this,this.onPropChange);this.add_propertyChanged(d2)},SetControlVariables:function(){var User=this.get_User();var p=(User!=null&&User.IsProUser)?"PV":"UA";var Gc=Function.createDelegate(this,this.GetControl);this.AccountLoggedIn=Gc("AccountLoggedIn");this.UAProview=Gc("UAproview");this.UAStandard=Gc("UAstandard");this.CashBal=Gc(p+"cashBalance");this.Margin=Gc(p+"marginReserved");this.PL=Gc(p+"openPL");this.TFA=Gc(p+"TFA");this.Title=Gc("accountInfoText");this.AccountName=Gc("usernameDisplay");this.AccountSelectLIn=Gc("loginTypeCurrencyOn");this.AccountSelectLOut=Gc("loginType");this.BBSlider=Gc("slider");this.BullCon=Gc("bullCon");this.BearCon=Gc("bearCon");this.InvestorBtns=Gc("investorButtons");this.InvestorAsPlayerBtns=Gc("investorAsPlayerButtons");this.PlayerBtns=Gc("playerButtons");this.PasswordInp=Gc("password");this.LoginNameInp=Gc("loginName");this.LogoutBtn=Gc("logoutLink");this.LoginBtn=Gc("loginLink");this.InvestorUpgrade=Gc('InvestorUpgradeDiv');this.UpgradeText=Gc('UpgradeText');this.SwitchText=Gc('SwitchText')},dispose:function(){TradIndexWebAPI.Views.UserAccount.callBaseMethod(this,'dispose')},UpdateFeed:function(){var User=this._Model.get_Feeds().UserFeed;this.User=User;if(!this.RenderView(User)){this.onUserChange()}},RenderView:function(User){if(User==null||typeof(User)==="undefined")var User=this._Model.get_User();if(User==null)return false;this.AccountName.innerHTML=User.AccountName;this.RenderBallances();UsrAccTp=User.AccountType;if(typeof(unitipInit)=="function")unitipInit();this.raise_RenderedView()},RenderBallances:function(){var AccountProfile=this.get_AccountProfile();if(AccountProfile==null)return false;var User=this._Model.get_User();if(User!=null&&this.AccountLoggedIn.style.display=="none"){this.RenderUserPanel();this.RenderView();this.BuildDropDown()}var Curr=this.get_Model().CurrencySymbol;if(this.CashBal==null)return false;this.CashBal.innerHTML=formatCurrency(AccountProfile.CashBalance,Curr);this.setStyle(this.CashBal,AccountProfile.CashBalance);this.Margin.innerHTML=formatCurrency(AccountProfile.MarginReserved,Curr);this.setStyle(this.Margin,AccountProfile.MarginReserved);this.PL.innerHTML=formatCurrency(AccountProfile.OpenPosPL,Curr);this.setStyle(this.PL,AccountProfile.OpenPosPL);this.TFA.innerHTML=formatCurrency(AccountProfile.Tfa,Curr);this.setStyle(this.TFA,AccountProfile.Tfa);if(User==null)return false;if(User.IsProUser){var accountValue=this.GetControl("PVAccountValue");accountValue.innerHTML=formatCurrency(AccountProfile.AccountValue,Curr);this.setStyle(accountValue,AccountProfile.AccountValue);this.SetUpBullBearSlider(AccountProfile,Curr)}},BuildDropDown:function(){var User=this.get_User();if(User==null)return false;var Options=User.AccountSelectors;var select=this.AccountSelectLIn;if(typeof(Options)=="undefined")return false;if(select!=null&&select.options.length!=Options.length){select.options.length=0;for(var i=0;i<Options.length;i++){select.options[i]=new Option(Options[i],i)}select.options.selectedIndex=User.AccountType}},SetUpBullBearSlider:function(AccountProfile,Curr){if(AccountProfile==null||typeof(AccountProfile)==="undefined")AccountProfile=this.get_AccountProfile();if(Curr==null||typeof(Curr)==="undefined")Curr=this.get_User().CurrencySymbol;var bullCon=AccountProfile.BullConsideration;var bearCon=AccountProfile.BearConsideration;this.BullCon.innerHTML=formatCurrency(bullCon,Curr);this.setStyle(this.BullCon,bullCon);this.BearCon.innerHTML=formatCurrency(bearCon,Curr);this.setStyle(this.BearCon,bearCon);if((bullCon+"").length>10||(bearCon+"").length>10){this.BullCon.style.fontWeight="normal";this.BearCon.style.fontWeight="normal"}var totalCon=parseFloat(bullCon)+parseFloat(bearCon);if(bearCon!=0){percentage=Math.round((bearCon/totalCon)*100)*-1}else{percentage=Math.round((bullCon/totalCon)*100);percentage=(100-percentage)*-1}if(isNaN(percentage))percentage=50;var sliderPos=percentage*2+"px 0";this.BBSlider.style.backgroundPosition=sliderPos},setStyle:function(obj,val){if(val<0){obj.className="negative"}else{obj.className="positive"}},switchAccountInfoOn:function(){this.GetControl("AccountLoggedIn").style.display='block';this.GetControl("AccountLoggedOut").style.display='none'},switchAccountInfoOff:function(){this.GetControl("AccountLoggedIn").style.display='none';this.GetControl("AccountLoggedOut").style.display='block';this._RenderUpgradeMessage("none","none","none")},ToggleMessages:function(){if(this.Title==null)return false;var State=this._Model.get_State();if(State==this._Model.LOADING_USER||State==this._Model.LOADING_ALL||State==this._Model.USER_LOGGING_OUT){this.Title.innerHTML='<span class=\"loading\">Loading...<\/span>';}else if(this.get_State()==this.UPDATING_DISPLAY){this.Title.innerHTML='Updating values...'}else{this.Title.cssClass="";this.Title.innerHTML=(this.get_User()==null)?"Login":"Account Info"}}};TradIndexWebAPI.Views.UserAccount.registerClass('TradIndexWebAPI.Views.UserAccount',TradIndexWebAPI.Views.ViewBase);if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
