$(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('
![]() |