$(document).ready(function() { //Tabs $("#tabs1").tabs({ select:function(event,ui) { $('#loading').html(''); addChangeEvent(); }, show: function(event, ui) { $('#loading').html(''); addChangeEvent(); } }); //$('.charts').tabs(); //Tooltip for "Multi" $('a.tooltip').each(function(){ $(this).qtip({ content: { url: "/ajax/tooltip.html", data: { p_id: $(this).attr('id') }, method: 'get' }, position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } }, style: { name: 'light', border: { width: 1, radius: 3 }, width: { min: 100, max: 600 }, tip: { corner: 'topMiddle', size: { x: 20, y : 8 } } } }); }); if ($('a.tooltip').length) { $('a.tooltip').toggle( function(){ $(this).qtip('disable') }, function(){ $(this).qtip('enable') } ); } //Tooltip for "Multi" for underlyings $('a.tooltip_und').each(function(){ $(this).qtip({ content: { url: "/ajax/tooltip_und.html", data: { und_id: $(this).attr('id'), p_id: $(this).attr('pid'), lang: $('#lang').attr('value') }, method: 'get' }, position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } }, style: { name: 'light', border: { width: 1, radius: 3 }, width: { min: 100, max: 600 }, tip: { corner: 'topMiddle', size: { x: 20, y : 8 } } } }); }); if ($('a.tooltip_und').length) { $('a.tooltip_und').toggle( function(){ $(this).qtip('disable') }, function(){ $(this).qtip('enable') } ); } }); function stripslashes (str) { return (str+'').replace(/\\(.?)/g, function (s, n1) { switch (n1) { case '\\': return '\\'; case '0': return '\0'; case '': return ''; default: return n1; } }); } function updatePrices(valor) { $.getJSON("/ajax/getPrices.html", {a: 'getSinglePrice', valor: valor, NO_CACHE: Math.random()}, function(data) { $('#ask-price span').html(data.ask); $('#bid-price span').html(data.bid); $('#ask-bid-datetime span').html(data.datetime); }); } //Chart loading indicator replacment $(window).on('load', function(){ $('#charts div.prod-chart').each(function(){ $(this).find('img.chart').css('display','block'); $(this).find('img.indicator').css('display','none'); }); domhandler = new MDG.MdgJsDomHandler(); }); function addChangeEvent() { for (i = 0; i < $.fn.qtip.interfaces.length; i++) { var api = $.fn.qtip.interfaces[i]; if(api && api.status && api.status.rendered ) { //hide all tip api.hide(); } } resetToggle('a.tooltip'); $('a.tooltip').qtip('enable'); resetToggle('img.tooltipCA'); $('img.tooltipCA').qtip('enable'); resetToggle('img.tooltipCoupon'); $('img.tooltipCoupon').qtip('enable'); resetToggle('a.svsp_risk_class'); $('a.svsp_risk_class').qtip('enable'); } function resetToggle(selector) { $(selector).each(function(){ this.lastToggle = undefined; }); } function showUndClip(id, isin) { $('.und-clip').hide(); $('#'+id).show(); loadCharts(isin, 'underlying_small', 'NULL', 'NULL', 'NULL'); return false; } function loadCharts(isin, chartType, chartTitle, line1, line2) { //Activate the indicator if (chartType == 'underlying_small') { $("#undcharts_"+isin).html('

'); } else { $("#charts").html('
'); } //Load AJAX data $.get("/ajax/charts.html?LANG="+lang, {isin: isin, chartType: chartType, line1: line1, line2: line2, NO_CACHE: Math.random()}, function(data) { //Switch chart title if (chartType != 'underlying_small') { $('#overview-chart-title').html(chartTitle); } //Check if checkbox with given ISIN is checked, save it for later var checked = false; if ($('#showHideBarriers_'+isin).attr('checked')) { checked = true; } //Disable all checkboxes if(chartType != 'underlying_small') { $('.showHideBarriers').each(function(){ $(this).attr('disabled', 'disabled'); $(this).attr('checked', ''); }); } if (chartType != 'product' && chartType != 'underlying_small') { //Enable the one for the given ISIN $('#showHideBarriers_'+isin).removeAttr("disabled"); //If it was checked before, check it if (checked) { $('#showHideBarriers_'+isin).attr('checked', 'checked'); } } //Insert received data if (chartType == 'underlying_small') { $("#undcharts_"+isin).html(data); } else { $("#charts").html(data); //alert(data); } //Reset tabs if (chartType == 'underlying_small') { $('.undchart').tabs(); $('.undchart').tabs('destroy'); $('.undchart').tabs(); } else { $('.charts').tabs(); $('.charts').tabs('destroy'); $('.charts').tabs(); $('.charts li').removeClass('ui-state-disabled'); } /* $(window).load(function() { $('#charts div.prod-chart').each(function(){ $(this).find('img.chart').css('display','block'); $(this).find('img.indicator').css('display','none'); }); domhandler = new MDG.MdgJsDomHandler(); }); */ }); } function showHideBarriers2(obj, isin, chartType, chartTitle, line1, line2, barrierTouched) { if (obj.checked) { loadCharts(isin, chartType, chartTitle, line1, line2, barrierTouched); } else { loadCharts(isin, chartType, chartTitle, 'NULL', 'NULL', barrierTouched); } }