function StreamingClass(){this._dec_sep=",";this._group_sep=" ";this._unique_underlying_id=null;this._products_table={};this._underlyings_table={};this._elementById=new ElementsCacheClass();this.timerRefreshTotalPerf=null;var a=null;this.showError=function(b){var c=new Window({className:"dialog",width:400,height:100,zIndex:100,resizable:false,title:msgStreaming3,draggable:true});c.getContent().innerHTML="<table style='width:100%;height:100%;background:#FFF;font-size:9px;font-weight:bold;'><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<img src='../files/images/commun/exclamation.gif'/></td><td>"+b+"<br><a href='#' onclick='window.location.reload();'>"+msgStreaming4+"</a></td></tr></table>";c.showCenter()};this.errorHandler=function(c,b){if(c!="No data received from server"){StreamingClass.getInstance().showError(msgStreaming1)}};this.sessionTimeoutHandler=function(){StreamingClass.getInstance().showError(msgStreaming2);setTimeout("dwr.engine.setActiveReverseAjax(false);",250);if(a!=null&&typeof a!="function"){a()}else{if(typeof a!="function"){dwr.engine._debug("La methode defineWhatToDoAfterSessionTimeout(function) n'est pas correctement appelee")}}};this.refreshOnePrice=function(d,e,b,h,f,g,i,c,j){if(this._products_table[d]!=undefined){this._products_table[d].updatePrice(e,b,h,f,g,i,c,j);if(this._is_total_perf_displayed()){this.waitBeforeRefreshTotalPerf()}}};this.refreshOnePerf=function(d,b,c){if(this._products_table[d]==undefined){this.addProduct(d,"all",c,false,2,0,0,0)}this._products_table[d].updatePerf(b,c)};this.refreshOneSpot=function(c,b){if(this._underlyings_table[c]!=undefined){this._underlyings_table[c].updateSpot(b)}};this.oneProductGetsKO=function(b){if(this._products_table[b]!=undefined){this._products_table[b].knockOut()}};this.oneProductGetsClosed=function(b){if(this._products_table[b]!=undefined){this._products_table[b].endOfTheDay()}};this.setUniqueUnderlyingId=function(b){this._unique_underlying_id=b};this.setFormatPref=function(b,c){this._dec_sep=b;this._group_sep=c
};this.defineCustomSessionTimeoutHandler=function(b){sessionTimeoutHandler=b};this.defineWhatToDoAfterSessionTimeout=function(b){a=b};this.defineCustomShowError=function(b){this.showError=b}}StreamingClass.instance=null;StreamingClass.getInstance=function(){if(StreamingClass.instance==null){StreamingClass.instance=new StreamingClass()}return StreamingClass.instance};StreamingClass.prototype.addProduct=function(a,b,c,f,h,e,j,d){if(this._products_table[a]!=undefined){var i=this._products_table[a];if(f=="true"){i.setPositionValues(j,d)}i._elementById.refresh();return false}else{var g=new ProductClass(a,b,c,f,h,e,j,d);this._products_table[a]=g;if(this._underlyings_table[b]!=undefined){this._underlyings_table[b].addProduct(a,g)}return true}};StreamingClass.prototype.addProductAndConnect=function(h,f,e,b,c,d,g,a){if(this.addProduct(h,f,e,b,c,d,g,a)){PushFilterRemote.addIdPrice(h)}};StreamingClass.prototype.addUnderlying=function(e,c,a,d){if(this._underlyings_table[e]!=undefined){this._underlyings_table[e]._elementById.refresh();return false}else{var b=new UnderlyingClass(e,c,a,d);for(product in this._products_table){if(product.underId==e){b.addProduct(product.id,product)}}this._underlyings_table[e]=b;return true}};StreamingClass.prototype.addUnderlyingAndConnect=function(d,b,a,c){if(this.addUnderlying(d,b,a,c)){PushFilterRemote.addIdSpot(d)}};StreamingClass.prototype.lookUpForNewProducts=function(hiddenInputId){var text=getElt(hiddenInputId);if(text){eval(text.value)}};StreamingClass.prototype.refreshUserSession=function(){PushFilterRemote.orderPassedEvent()};StreamingClass.prototype.refreshTotalPerfInformations=function(){var f=0,a=0;for(productId in this._products_table){var c=this._products_table[productId];if(c.isAPosition=="true"){f+=parseFloat(c.getValue());a+=parseFloat(c.getInvestedAmount())}}var e=f-a,d=e*100/a;if(a>0){this._elementById.update("totalValuation",StreamingClass.getInstance().formatNumber(f,2)+" &euro;");this._elementById.update("totalInvest",StreamingClass.getInstance().formatNumber(a,2)+" &euro;");
if(e<0){var b="moins"}else{if(e>0){var b="plus"}}this._elementById.updateAndChangeColor("totalPerfEuro",StreamingClass.getInstance().formatNumber(e,2)+" &euro;",b);this._elementById.updateAndChangeColor("totalPerfPrct",StreamingClass.getInstance().formatNumber(d,2)+" %",b);this._elementById.get("totalPerfColor").className=b}else{this._elementById.update("totalValuation","--");this._elementById.update("totalInvest","--");this._elementById.updateAndChangeColor("totalPerfEuro","--","");this._elementById.updateAndChangeColor("totalPerfPrct","--","");this._elementById.get("totalPerfColor").className=""}};StreamingClass.prototype.waitBeforeRefreshTotalPerf=function(){if(this.timerRefreshTotalPerf==null){var a=this;this.timerRefreshTotalPerf=setTimeout(function(){a.refreshTotalPerfInformations();a.timerRefreshTotalPerf=null},1000)}};StreamingClass.prototype.formatNumber=function(b,i){var a=i;if(a==null){a=2}var f="",g="",c="",d,j,e="";b=""+parseFloat(b).toFixed(a);var h=b.indexOf(".",0);if(this._group_sep==""){this._group_sep=" "}if(h!=-1){f=b.substring(0,h);g=b.substring(h+1,b.length)}else{f=b.substring(h+1,b.length);g=b.substring(0,h)}if(g.length>0){g=this._dec_sep+g}e=f.length;mod=e%3;divis=e/3;if(mod>0){c=f.substring(0,mod);if(divis>1){c=c+this._group_sep}}for(d=mod;d+3<e;d+=3){c=c+f.substring(d,d+3)+this._group_sep}f=c.concat(f.substring(d,d+3));j=f+g;return j};StreamingClass.prototype.start=function(a){if(typeof dwr=="undefined"){this.errorHandler("dwr is undefined")}else{dwr.engine.setErrorHandler(this.errorHandler);dwr.engine.setActiveReverseAjax(true);if(a!=null&&typeof a=="function"){a()}else{dwr.engine._debug("Method sendInfo not correctly defined")}}};function ProductClass(h,f,e,b,c,d,g,a){this._bid_price=e;this._bid_status=999;this._ask_price;this._ask_status=999;this._perf;this._perf_5_days;this._elasticite;this._delta;this._is_ko=false;this._barrier=d;this._decimal_nbr=c;this._variation=0;this._invested_amount=a;this._position_qty=g;this._NO_PERF_AVAILABLE="-1234.0";
this._elementById=new ElementsCacheClass();this._variation_img_timeout;this.id=h;this.underId=f;if(b=="true"){this.isAPosition="true"}else{this.isAPosition="false"}}ProductClass.prototype.updatePrice=function(f,b,m,i,l,n,p,o){if(this._is_ko==true){this._is_ko=false}if(this._is_variation_image_displayed()){this._variation=compareValues(this._bid_price,m);this.displayVariationImage()}if(this._is_position_bid_button_displayed()&&this.isAPosition=="true"){if(i!=this._bid_status){this._bid_status=i;if(this._bid_status==1){var a=this._green_sell_button_url()}else{if(this._bid_status==-1){var a=this._ko_button_url()}else{var a=this._red_sell_button_url()}}var h=this._elementById.get("bidImg_position_"+this.id);if(h!=null){h.src=a}}}if(this._is_position_ask_button_displayed()||this._is_ask_button_displayed()){if(b!=this._ask_status){this._ask_status=b;if(this._ask_status==1){var a=this._green_ask_button_url()}else{if(this._ask_status==-1){var a=this._ko_button_url()}else{var a=this._red_ask_button_url()}}if(this._is_position_ask_button_displayed()&&this.isAPosition=="true"){var h=this._elementById.get("askImg_position_"+this.id);if(h!=null){h.src=a}}if(this._is_ask_button_displayed()){var h=this._elementById.get("askImg_"+this.id);if(h!=null){h.src=a}}}}this._bid_price=m;if(this._is_position_bid_price_displayed()||this._is_bid_price_displayed()){var j=StreamingClass.getInstance().formatNumber(this._bid_price,this._decimal_nbr);if(this._is_position_bid_price_displayed()&&this.isAPosition=="true"){this._elementById.update("bidPrice_position_"+this.id,j)}if(this._is_bid_price_displayed()){this._elementById.update("bidPrice_"+this.id,j)}}this._ask_price=f;if(this._is_position_ask_price_displayed()||this._is_ask_price_displayed()){var g=StreamingClass.getInstance().formatNumber(this._ask_price,this._decimal_nbr);if(this._is_position_ask_price_displayed()&&this.isAPosition=="true"){this._elementById.update("askPrice_position_"+this.id,g)}if(this._is_ask_price_displayed()){this._elementById.update("askPrice_"+this.id,g)
}}if(this._is_perf_product_displayed()){this._perf=l;if(this._perf==this._NO_PERF_AVAILABLE){this._elementById.updateAndChangeColor("perf_"+this.id,"--","moins")}else{if(this._bid_price>0){if(this._perf>0){var e="plus"}else{var e="moins"}this._elementById.updateAndChangeColor("perf_"+this.id,StreamingClass.getInstance().formatNumber(l*100,2)+" %",e)}else{this._elementById.updateAndChangeColor("perf_"+this.id,"--","")}}}if((this._is_perf_position_percent_displayed()||this._is_perf_position_euro_displayed())&&this.isAPosition=="true"){if(this._invested_amount!=null&&this._invested_amount!=0&&this._position_qty!=null){var k=(this._bid_price*this._position_qty)-this._invested_amount;var d=k/this._invested_amount;if(this._is_perf_position_euro_displayed()){if(k>0){var e="plus"}else{var e="moins"}this._elementById.updateAndChangeColor("perfEuro_"+this.id,StreamingClass.getInstance().formatNumber(k,2),e);var c=this._elementById.get("perfEuroColor_"+this.id);if(c){c.className=e}}if(this._is_perf_position_percent_displayed()){if(d>0){var e="plus"}else{var e="moins"}this._elementById.updateAndChangeColor("perfPrct_"+this.id,StreamingClass.getInstance().formatNumber(d*100,2),e);var c=this._elementById.get("perfPrctColor_"+this.id);if(c){c.className=e}}}else{if(this._is_perf_position_euro_displayed()){this._elementById.updateAndChangeColor("perfEuro_"+this.id,"")}if(this._is_perf_position_percent_displayed()){this._elementById.updateAndChangeColor("perfPrct_"+this.id,"--","moins");var c=this._elementById.get("perfPrctColor_"+this.id);if(c){c.className="moins"}}}}if(this._is_perf_5_days_displayed()){this._perf_5_days=n;if(this._perf_5_days==this._NO_PERF_AVAILABLE){this._elementById.updateAndChangeColor("perf5Days_"+this.id,"--","moins")}else{this._elementById.update("perf5Days_"+this.id,StreamingClass.getInstance().formatNumber(this._perf_5_days,2))}}if(this._is_elasticity_displayed()){this._elasticite=p;this._elementById.update("elast_"+this.id,StreamingClass.getInstance().formatNumber(this._elasticite,2))
}if(this._is_delta_displayed()){this._delta=o;this._elementById.update("delta_"+this.id,StreamingClass.getInstance().formatNumber(this._delta,2))}};ProductClass.prototype.updatePerf=function(a,b){if(this._is_variation_image_displayed()){this._variation=compareValues(this._bid_price,b);this.displayVariationImage()}this._bid_price=b;this._perf=a;if(this._perf==this._NO_PERF_AVAILABLE){this._elementById.update("perf_"+this.id,"--")}else{if(this._bid_price>0){this._elementById.update("perf_"+this.id,StreamingClass.getInstance().formatNumber(a*100,2)+" %")}else{this._elementById.update("perf_"+this.id,"--")}}};ProductClass.prototype.knockOut=function(){this._is_ko=true;this._bid_status=999;this._ask_status=999;if(this._is_position_bid_button_displayed()&&this.isAPosition=="true"){var a=this._elementById.get("bidImg_position_"+this.id);if(a!=null){a.src=this._ko_button_url()}}if(this._is_position_ask_button_displayed()&&this.isAPosition=="true"){var a=this._elementById.get("askImg_position_"+this.id);if(a!=null){a.src=this._ko_button_url()}}if(this._is_ask_button_displayed()){var a=this._elementById.get("askImg_"+this.id);if(a!=null){a.src=this._ko_button_url()}}this.disableProduct()};ProductClass.prototype.endOfTheDay=function(){if(this._is_position_bid_button_displayed()&&this.isAPosition=="true"){var a=this._elementById.get("bidImg_position_"+this.id);if(a!=null){a.parentNode.innerHTML=this._nego_closed_innerHTML()}}if(this._is_position_ask_button_displayed()&&this.isAPosition=="true"){var a=this._elementById.get("askImg_position_"+this.id);if(a!=null){a.parentNode.innerHTML=this._nego_closed_innerHTML()}}if(this._is_ask_button_displayed()){var a=this._elementById.get("askImg_"+this.id);if(a!=null){a.parentNode.innerHTML=this._nego_closed_innerHTML()}}this.disableProduct()};ProductClass.prototype.disableProduct=function(){if(this._is_position_bid_price_displayed()&&this.isAPosition=="true"){this._elementById.update("bidPrice_position_"+this.id,"--")}if(this._is_bid_price_displayed()){this._elementById.update("bidPrice_"+this.id,"--")
}if(this._is_position_ask_price_displayed()&&this.isAPosition=="true"){this._elementById.update("askPrice_position_"+this.id,"--")}if(this._is_ask_price_displayed()){this._elementById.update("askPrice_"+this.id,"--")}if(this._is_perf_product_displayed()){this._elementById.updateAndChangeColor("perf_"+this.id,"--","moins")}if(this._is_perf_position_euro_displayed()&&this.isAPosition=="true"){this._elementById.update("perfEuro_"+this.id,this._perf_nulle_innerHTML())}if(this._is_perf_position_percent_displayed()&&this.isAPosition=="true"){this._elementById.updateAndChangeColor("perfPrct_"+this.id,this._perf_nulle_innerHTML(),"")}if(this._is_perf_5_days_displayed()){this._elementById.update("perf5days_"+this.id,"--")}if(this._is_elasticity_displayed()){this._elementById.update("elast_"+this.id,"--")}if(this._is_delta_displayed()){this._elementById.update("delta_"+this.id,"--")}if(this._is_distance_secu_displayed()){this._elementById.update("distSecu_"+this.id,"--")}if(this._is_distance_secu_position_displayed()){this._elementById.update("distSecu_position_"+this.id,"--")}};ProductClass.prototype.displayVariationImage=function(){var a=this._elementById.get("divImg_"+this.id);if(a){if(this._variation==1){a.style.backgroundPosition="-18px 0"}else{if(this._variation==-1){a.style.backgroundPosition="-9px 0"}}clearTimeout(this._variation_img_timeout);var b=this;this._variation_img_timeout=setTimeout(function(){b.hideVariationImage()},2000)}};ProductClass.prototype.hideVariationImage=function(){var a=this._elementById.get("divImg_"+this.id);if(a){a.style.backgroundPosition="0 0"}};ProductClass.prototype.updateOneDistanceSecu=function(b,a){if(this._barrier!=null&&this._is_ko==false){var c=StreamingClass.getInstance().formatNumber(Math.abs(b-this._barrier),a);if(ProductClass.prototype._is_distance_secu_displayed){this._elementById.update("distSecu_"+this.id,c)}if(ProductClass.prototype._is_distance_secu_position_displayed){this._elementById.update("distSecu_position_"+this.id,c)}}};
ProductClass.prototype.setPositionValues=function(b,a){this.isAPosition="true";this._position_qty=b;this._invested_amount=a;this._elementById.refresh()};ProductClass.prototype.getInvestedAmount=function(){return this._invested_amount};ProductClass.prototype.getValue=function(){return this._bid_price*this._position_qty};function UnderlyingClass(d,b,a,c){this._spot_price=b;this._spot_perf;this._close_quote=a;this._decimal_nbr=c;this._products_table={};this._elementById=new ElementsCacheClass();this.id=d}UnderlyingClass.prototype.updateSpot=function(d){if(this._is_spot_highlight_displayed()){var c=compareValues(this._spot_price,d);if(c==1){highlight("spotPrice_"+this.id,"green")}else{if(c==-1){highlight("spotPrice_"+this.id,"red")}}}this._spot_price=d;if(this._is_spot_displayed()){if(StreamingClass.getInstance()._unique_underlying_id){this._elementById.update("spot_"+this.id,StreamingClass.getInstance().formatNumber(this._spot_price,this._decimal_nbr))}else{for(productId in this._products_table){this._elementById.update("spot_"+productId,StreamingClass.getInstance().formatNumber(this._spot_price,this._decimal_nbr))}}}if(this._is_spot_perf_displayed()){if(this._close_quote!=null&&this._close_quote!=0){var a=(this._spot_price-this._close_quote)/this._close_quote;if(a>0){var b="plus"}else{b="moins"}if(StreamingClass.getInstance()._unique_underlying_id){this._elementById.updateAndChangeColor("spotPerf_"+this.id,StreamingClass.getInstance().formatNumber(a*100,2)+" %",b)}else{for(productId in this._products_table){this._elementById.updateAndChangeColor("spotPerf_"+productId,StreamingClass.getInstance().formatNumber(a*100,2)+" %",b)}}}}if(this._is_distance_avant_secu_displayed()){this.updateDistanceSecu(d)}};UnderlyingClass.prototype.updateDistanceSecu=function(a){for(product in this._products_table){this._products_table[product].updateOneDistanceSecu(a,this._decimal_nbr)}};UnderlyingClass.prototype.addProduct=function(b,a){if(this._products_table[b]==undefined){this._products_table[b]=a
}};function ElementsCacheClass(){this.table={};this.get=function(b){if(this.table[b]!=undefined){return this.table[b]}else{var a=getElt(b);this.table[b]=a;return a}};this.refresh=function(){this.table={}};this.update=function(a,c){var b=this.get(a);if(b!=null){b.innerHTML=c}};this.updateAndChangeColor=function(b,d,a){var c=this.get(b);if(c!=null){c.innerHTML=d;c.className=a}};this.getValueOf=function(a){var b=this.get(a);if(b!=null){return b.value}else{return null}}}function compareValues(a,b){if(b>a){return 1}else{if(b<a){return -1}else{return 0}}}function ftrue(){return true}function ffalse(){return false}function fnull(){return null};