// jQuery TopUp v1.7.2, Copyright 2010, Paul Engel - Modified by RAWR-Designs
if (typeof(TopUp) == "undefined") {
TopUp = (function() {
var initialized = false, selector = null, on_ready = [], displaying = false, options = null, group = null, index = null, data = null;
var fast_mode = false;
var default_preset = {
layout: "quicklook",
effect: "transform",
resizable: 1,
shaded: 0
}, presets = {};
var extendjQuery = function() {
jQuery.extend({
keys: function(hash) {
var keys = [];
for (var key in hash) {
if (hash.hasOwnProperty(key)) {
keys.push(key);
}
}
return keys;
},
ie: jQuery.browser.msie,
ie6: jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6,
ie7: jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 7,
ie8: jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 8,
ff2: jQuery.browser.mozilla && parseFloat(jQuery.browser.version) < 1.9
});
jQuery.fn.extend({
id: function() {
if (!this.is("[id]")) {
var id = "";
var counter = 0;
do {id = "element_" + counter++;} while (jQuery("#" + id).length);
jQuery(this).attr("id", id);
}
return jQuery(this).attr("id");
},
markerId: function() {
return "_" + this.id() + "_marker";
},
bubbleDetect: function(selector, separator) {
var detected = null;
var element = this;
jQuery.each(selector.split(separator || ","), function(i, e) {
var selector = jQuery.trim(e);
if (jQuery(selector).index(element) != -1) {
detected = {element: jQuery(element), selector: selector};
}
});
return detected || (element.parent()[0] ? jQuery(element.parent()[0]).bubbleDetect(selector, separator) : null);
},
center: function() {
var css = { top: parseInt((jQuery(window).height() - this.outerHeight()) / 2, 10) + jQuery(window).scrollTop(),
left: parseInt((jQuery(window).width() - this.outerWidth()) / 2, 10) + jQuery(window).scrollLeft(),
position: "absolute"};
this.css(css);
return this;
},
lockDimensions: function() {
this.css({width: this.outerWidth(), height: this.outerHeight()});
return this;
},
unlockDimensions: function() {
this.css({width: "auto", height: "auto"});
return this;
},
centerWrap: function(compare) {
var current = {width: this.outerWidth(), height: this.outerHeight()}, delta = {width: 0, height: 0}, diff = 0;
compare.find(".te_frame").css("display", "block");
diff = compare.outerWidth() - current.width;
if (delta.width < diff) {
delta.width = diff;
}
diff = compare.outerHeight() - current.height;
if (delta.height < diff) {
delta.height = diff;
}
var offset = this.offset();
var css = {
top: offset.top - (delta.height === 0 ? 0 : parseInt(delta.height / 2, 10)),
left: offset.left - (delta.width === 0 ? 0 : parseInt(delta.width / 2, 10)),
width: this.width() + delta.width,
height: this.height() + delta.height
};
if (options.x) {
css.left = options.x - parseInt((css.width - compare.outerWidth()) / 2, 10);
}
if (options.y) {
css.top = options.y - parseInt((css.height - compare.outerHeight()) / 2, 10);
}
jQuery("#tu_center_wrapper").css(css);
jQuery("#tu_centered_content").append(this);
this.css({
top: "auto",
left: "auto",
width: "auto",
height: "auto",
display: "inline-block",
position: "relative"
});
if (jQuery.ff2) {
this.css({display: "table"});
}
if (jQuery.ie) {
this.css({display: "inline"});
}
jQuery("#tu_center_wrapper").show();
return this;
},
removeCenterWrap: function(newTopUpWidth) {
var position = jQuery("#tu_center_wrapper").offset();
var delta = {
width: jQuery("#tu_center_wrapper").outerWidth() - newTopUpWidth,
height: jQuery("#tu_center_wrapper").outerHeight() - this.outerHeight()
};
this.css({
top: position.top + parseInt(delta.height / 2, 10),
left: position.left + parseInt(delta.width / 2, 10),
position: "absolute"
}).appendTo("body");
jQuery("#tu_center_wrapper").hide();
return this;
},
draggableZ: function(opts) {
var element = this;
this.mousedown(function(event) {
if (opts && opts.only && !jQuery(event.target).is(opts.only)) {
return;
}
event.preventDefault();
var offset = element.offset();
var diff = {top: event.pageY - offset.top, left: event.pageX - offset.left};
jQuery("body").addClass("te_dragging");
jQuery("*").bind("mousemove.draggable", function(event) {
element.css({top: event.pageY - diff.top, left: event.pageX - diff.left});
});
});
jQuery("#top_up").mouseup(function(event) {
jQuery("body").removeClass("te_dragging");
jQuery("*").unbind("mousemove.draggable");
});
}
});
};
var injectCode = function() {
var images_url = TopUp.host + TopUp.images_path;
var css = '';
var ie7fix = '';
var ie6fix = '';
var iefix = '';
var html = '
';
if (!jQuery("head").length) {
jQuery(document.body).before("");
}
jQuery(css).prependTo("head");
if (jQuery.ie7 || jQuery.ie8) {
jQuery(ie7fix).insertAfter("head > style:first");
}
if (jQuery.ie6) {
jQuery(ie6fix).insertAfter("head > style:first");
}
if (jQuery.ie) {
jQuery(iefix).insertAfter("head > style:first");
}
jQuery(html).appendTo("body");
};
var bind = function() {
var coptions = [];
if (!fast_mode) {
coptions.push("[class^=tu_][class*=x]");
jQuery.each(["db", "ql", "fl", "image", "html", "dom", "iframe", "ajax", "script"], function(i, coption) {
coptions.push("[class^=tu_][class*=_" + coption + "]");
});
}
selector = jQuery.merge([".top_up", "[toptions]", coptions.join(",")], jQuery.keys(presets)).join();
jQuery(selector).live("click", topUpClick);
jQuery(document).bind("keyup", documentKeyPress);
};
var fadeDuration = function(duration) {
return jQuery.ie8 || jQuery.ie7 || jQuery.ie6 ? 0 : duration;
};
var topUpClick = function(event) {
TopUp.displayTopUp(jQuery(event.target));
return false;
};
var documentKeyPress = function(event) {
if (jQuery("#top_up").is(":hidden") || jQuery(event.target).is(":input")) {
return;
}
switch(event.keyCode) {
case 38:
TopUp.close(); break;
case 40:
TopUp.close(); break;
case 37:
TopUp.previous(); break;
case 39:
TopUp.next(); break;
}
};
var deriveTopUpOptions = function(topUp, opts) {
var toptions = jQuery.extend({}, {topUp: "#" + topUp.element.id(), preset: topUp.selector});
jQuery.each(topUp.element.attr("class").split(/\s/), function(i, c) {
if (c.match(/^tu_/)) {
jQuery.each(c.replace(/^tu_/, "").split("_"), function(j, coption) {
switch(coption) {
case "db": case "ql": case "fl":
toptions["layout"] = {"db": "dashboard", "ql": "quicklook", "fl": "flatlook"}[coption]; break;
case "image": case "html": case "dom": case "iframe": case "ajax": case "script":
toptions["type"] = coption; break;
default:
if (coption.match(/\dx\d/)) {
toptions["width"] = coption.split("x")[0];
toptions["height"] = coption.split("x")[1];
}
}
});
}
});
if (topUp.element.is("[toptions]")) {
jQuery.each(topUp.element.attr("toptions").split(","), function(i, option) {
var key_value = option.split("=");
toptions[jQuery.trim(key_value[0])] = jQuery.trim(key_value[1]);
});
}
if (toptions.noGroup && parseInt(toptions.noGroup, 10) == 1) {
toptions.group = null;
}
if (opts) {
toptions = jQuery.extend(toptions, opts);
}
return toptions;
};
var deriveOptions = function(reference, opts, store) {
var result = jQuery.extend({}, default_preset);
if (opts) {
if (presets[opts.preset]) {
result = jQuery.extend(result, presets[opts.preset]);
}
result = jQuery.extend(result, opts);
}
if (result.ondisplay && !jQuery.isFunction(result.ondisplay)) {
var fdisplay = result.ondisplay;
result.ondisplay = function() {eval(fdisplay);};
}
if (result.onclose && !jQuery.isFunction(result.onclose)) {
var fclose = result.onclose;
result.onclose = function() {eval(fclose);};
}
if (store) {
result.reference = result.reference ? jQuery(result.reference) : reference;
if (!result.type) {
result.type = deriveType(reference);
}
if (movieContentDisplayed(result)) {
result.resizable = 0;
}
options = jQuery.extend({}, result);
}
return result;
};
var deriveType = function(reference) {
if (reference.toLowerCase().match(/\.(gif|jpg|jpeg|png)(\?[0123456789]+)?$/)) {
return "image";
}
if (reference.toLowerCase().match(/\.(swf)(\?[0123456789]+)?$/)) {
return "flash";
}
if (reference.toLowerCase().match(/\.(flv|mp3|mp4)(\?[0123456789]+)?$/)) {
return "flashvideo";
}
if (reference.toLowerCase().match(/\.(aif|aiff|aac|au|bmp|gsm|mov|mid|midi|mpg|mpeg|m4a|m4v|psd|qt|qtif|qif|qti|snd|tif|tiff|wav|3g2|3gp|wbmp)(\?[0123456789]+)?$/)) {
return "quicktime";
}
if (reference.toLowerCase().match(/\.(ra|ram|rm|rpm|rv|smi|smil)(\?[0123456789]+)?$/)) {
return "realplayer";
}
if (reference.toLowerCase().match(/\.(asf|wma|wmv)(\?[0123456789]+)?$/)) {
return "windowsmedia";
}
if (reference.toLowerCase().match(/\.(avi|divx|mkv)(\?[0123456789]+)?$/)) {
return "divxmedia";
}
return "ajax";
};
var movieContentDisplayed = function(opts) {
return jQuery.inArray((opts || options).type, ["flash", "flashvideo", "quicktime", "realplayer", "windowsmedia", "divxmedia"]) != -1;
};
var deriveGroup = function() {
if (options.group) {
if (!(group && group.name == options.group)) {
group = {name: options.group, items: jQuery([])};
jQuery.each(jQuery(selector), function(i, e) {
if (!jQuery(e).is("[tu_group]")) {
jQuery(e).attr("tu_group", deriveOptions(null, deriveTopUpOptions(jQuery(e).bubbleDetect(selector))).group);
}
if (jQuery(e).attr("tu_group") == group.name) {
group.items = group.items.add(e);
}
});
}
var ids = jQuery.map(group.items, function(e, i) {
return "#" + jQuery(e).id();
});
index = options.topUp ? jQuery.inArray(options.topUp, ids) : -1;
} else {
group = null;
}
};
var navigateInGroup = function(step) {
if (group === null) {
return;
}
index = index + step;
if (index < 0) {
index = group.items.length - 1;
}
if (index > group.items.length - 1) {
index = 0;
}
TopUp.displayTopUp(group.items[index]);
};
var prepare = function() {
if (jQuery("#top_up .te_frame").resizable) {
jQuery("#top_up .te_frame").resizable("destroy");
}
jQuery("#top_up .te_title").fadeOut(fadeDuration(200));
if (!(group && group.items.length > 1)) {
jQuery("#top_up .te_controls").fadeOut(fadeDuration(200));
}
jQuery(".te_wrapper").attr("class", "te_wrapper te_" + options.layout);
jQuery(".te_frame,.te_content").unlockDimensions();
if (parseInt(options.shaded, 10) == 1) {
jQuery("#tu_overlay").addClass("te_shaded");
} else {
jQuery("#tu_overlay").removeClass("te_shaded");
}
if ((parseInt(options.modal, 10) == 1) || (parseInt(options.shaded, 10) == 1) || (parseInt(options.overlayClose, 10) == 1)) {
if (jQuery.ie8) {
var fixOverlay = function() {
jQuery('#tu_overlay').css('top', document.body.parentElement.scrollTop+'px');
};
fixOverlay.apply();
window.onresize = fixOverlay;
jQuery(window).bind('scroll', fixOverlay);
}
jQuery("#tu_overlay").show();
} else {
jQuery("#tu_overlay").hide();
}
var altText = "";
if (options.topUp && (options.topUp != "") && ((parseInt(options.readAltText, 10) == 1) || (options.title && options.title.match("{alt}")))) {
var topUp = jQuery(options.topUp);
if (topUp.length) {
var image = topUp.find("img");
if (image.length) {
altText = image.attr("alt") || "";
}
if (altText != "" && !(options.title && options.title.match("{alt}"))) {
options.title = "{alt}";
}
}
}
options.title = (options.title || "").replace("{alt}", altText).replace("{current}", group === null ? "" : (index + 1)).replace("{total}", group === null ? "" : group.items.length);
};
var loadContent = function() {
switch(options.type) {
case "image":
options.content = new Image();
jQuery(options.content).load(function() {
options.content = jQuery(this);
onContentReady();
})
.attr("src", options.reference);
break;
case "flash": case "flashvideo": case "quicktime": case "realplayer": case "windowsmedia": case "divxmedia":
let video = document.createElement("video");
let source = document.createElement("source");
video.appendChild(source);
source.src = options.reference;
video.width = options.width;
video.height = options.height;
video.controls = true;
video.autoplay = true;
options.content = $(video);
onContentReady();
break;
case "iframe":
options.content = jQuery(''); break;
case "html": case "dom":
var reference = jQuery(options.reference);
if (reference.context) {
var marker = jQuery("").attr({
id : reference.markerId(),
"class": (reference.is(":hidden") ? "hidden" : ""),
style : "display: none"
});
options.content = jQuery("").append(reference.before(marker).addClass("marked"));
reference.show();
} else {
options.content = jQuery("").append(reference);
}
break;
case "ajax": case "script":
options.content = null;
jQuery.ajax({url: options.reference,
type: (parseInt(options.post, 10) == 1) ? "POST" : "GET",
cache: false,
async: false,
data: options.parameters,
dataType: (options.type == "ajax") ? "html" : "script",
success: onContentReady});
}
if (jQuery.inArray(options.type, ["html", "dom", "iframe"]) != -1) {
onContentReady();
}
};
var onContentReady = function(html) {
hideLoader();
if (html) {
options.content = jQuery(html);
}
switch(options.type) {
case "image": case "html": case "dom": case "iframe":
options.resize = options.content;
jQuery(".te_content").removeClass("te_scrollable");
break;
default:
options.resize = jQuery("#temp_up .te_content");
jQuery(".te_content").addClass("te_scrollable");
}
if (jQuery("#top_up").is(":hidden")) {
show();
} else {
replace();
}
};
var showLoader = function() {
var origin = jQuery("#top_up");
if (jQuery("#top_up").is(":hidden")) {
origin = jQuery(options.topUp);
if (!origin.length) {
origin = jQuery(document);
} else if (origin.children().length > 0) {
origin = jQuery(origin.children()[0]);
}
}
try {
var dimensions = {top: origin.offset().top,
left: origin.offset().left,
width: origin.outerWidth(),
height: origin.outerHeight()};
} catch(e) {
var dimensions = {top: jQuery(window).scrollTop(),
left: jQuery(window).scrollLeft(),
width: parseInt(jQuery(window).width() / 2, 10),
height: parseInt(jQuery(window).height() / 2, 10)};
}
jQuery("#tu_loader").html(" ").css(dimensions).show();
};
var hideLoader = function() {
jQuery("#tu_loader").hide();
};
var show = function() {
setContent();
setDimensions();
moveContent("top_up");
jQuery("#top_up").center();
if (options.x) {
jQuery("#top_up").css({left: parseInt(options.x, 10)});
}
if (options.y) {
jQuery("#top_up").css({top : parseInt(options.y, 10)});
}
switch(options.effect) {
case "appear": case "fade":
jQuery("#top_up").fadeIn(fadeDuration(300), afterDisplay); break;
case "switch": case "clip":
jQuery("#top_up").show("clip", {direction: "vertical"}, 500, afterDisplay); break;
case "transform":
var origin = jQuery(options.topUp);
if (origin.children().length > 0) {
origin = jQuery(origin.children()[0]);
}
var tuContent = jQuery("#top_up").find(".te_content");
var dimensions = options.topUp ?
jQuery.extend({width: origin.outerWidth(), height: origin.outerHeight()}, origin.offset()) :
{top: parseInt(jQuery(window).height() / 2, 10) - parseInt(tuContent.height() / 2, 10) + jQuery(window).scrollTop(),
left: parseInt(jQuery(window).width() / 2, 10) - parseInt(tuContent.width() / 2, 10) + jQuery(window).scrollLeft(),
width: 10,
height: 10};
transform("from", dimensions, afterDisplay);
break;
default:
jQuery("#top_up").show();
afterDisplay();
}
};
var replace = function(callback) {
var isScrollable = jQuery("#top_up .te_content").hasClass("te_scrollable");
if (isScrollable) {
jQuery("#top_up .te_content").removeClass("te_scrollable");
}
var focusedElement = jQuery("#top_up .te_content :focus");
var wrapper = jQuery("#top_up .te_content").lockDimensions().wrapInner("").children();
wrapper.fadeOut(fadeDuration(250), function() {
if (parseInt(options.storeCurrent, 10) == 1) {
wrapper.addClass("te_stored_content").hide().find(".te_stored_content").before(wrapper);
} else {
wrapper.children().appendTo("#temp_up .te_content").end().end().remove();
}
if (callback) {
var arg = jQuery("#temp_up .te_content");
if (jQuery.inArray(options.type, ["html", "dom"]) != -1) {
arg = arg.children().eq(0);
}
callback.apply(arg);
} else {
clearContent();
setContent();
}
if (isScrollable) {
jQuery("#top_up .te_content").addClass("te_scrollable");
}
setDimensions();
jQuery("#top_up").centerWrap(jQuery("#temp_up"));
var animation = {width: jQuery("#temp_up .te_content").outerWidth(),
height: jQuery("#temp_up .te_content").outerHeight()};
var newTopUpWidth = jQuery("#temp_up").outerWidth();
jQuery("#top_up .te_content").animate(animation, 400, function() {
moveContent("top_up");
jQuery("#top_up").removeCenterWrap(newTopUpWidth);
focusedElement.focus();
afterDisplay();
});
});
};
var setContent = function() {
options.content.appendTo("#temp_up .te_content");
};
var moveContent = function(to) {
var from = to == "top_up" ? "temp_up" : "top_up";
jQuery("#" + from + " .te_content").children().appendTo("#" + to + " .te_content");
if (to == "top_up") {
jQuery("#top_up .te_content").css({width: jQuery("#temp_up .te_content").css("width"),
height: jQuery("#temp_up .te_content").css("height")});
}
};
var clearContent = function() {
jQuery(".te_content .marked").each(function() {
var marker = jQuery("#" + jQuery(this).markerId());
if (marker.hasClass("hidden")) {
jQuery(this).hide();
}
marker.after(jQuery(this).removeClass("marked")).remove();
});
jQuery(".te_content").children(":not(.te_stored_content)").remove();
};
var transform = function(direction, dimensions, callback) {
var topUp = jQuery("#top_up");
var tuContent = topUp.find(".te_content");
if (direction == "from") {
topUp.addClass("te_transparent")
.show();
}
var topUpOffset = topUp.offset();
var tuContentOffset = tuContent.offset();
var tuContentDiff = {width: topUp.width() - tuContent.width(),
height: topUp.height() - tuContent.height()};
dimensions.top -= tuContentOffset.top - topUpOffset.top;
dimensions.left -= tuContentOffset.left - topUpOffset.left;
var origin = {top: topUp.css("top"), left: topUp.css("left"), width: topUp.outerWidth(), height: topUp.outerHeight()};
var opts = {to: direction == "from" ? origin : dimensions, duration: 500};
if (direction == "from") {
opts.to.width -= tuContentDiff.width;
opts.to.height -= tuContentDiff.height;
}
var animation = function() {
var cb = function() {
callback.apply();
options.content.removeClass("te_overflow");
};
var onReady = direction == "to" ?
function() {
topUp.fadeOut(fadeDuration(100), cb);
} : cb;
topUp .animate({top: opts.to.top, left: opts.to.left}, opts.duration);
options.content.animate({width: opts.to.width,
height: opts.to.height}, opts.duration, onReady);
};
options.content.addClass("te_overflow");
if (direction == "from") {
topUp .css({top: dimensions.top, left: dimensions.left});
options.content.css({width: dimensions.width, height: dimensions.height});
jQuery(".te_top_up,.te_content").unlockDimensions();
topUp.hide()
.removeClass("te_transparent")
.fadeIn(fadeDuration(150), animation);
} else {
animation.apply();
}
};
var afterDisplay = function() {
var duration = fadeDuration(500);
if (jQuery("#top_up .te_frame").resizable && parseInt(options.resizable, 10) == 1) {
var opts = {stop: function(){ jQuery("#top_up .te_frame").css({width: "auto", height: "auto"}); },
handles: "se",
minWidth: 200, minHeight: 75,
alsoResize: "#" + options.resize.id(),
aspectRatio: options.type == "image"};
jQuery("#top_up .te_frame").resizable(opts);
}
if (jQuery.ie6 || jQuery.ie7) {
jQuery("#top_up .te_title").css("width", jQuery("#top_up").width());
}
jQuery("#top_up .te_title").html(options.title || "")
.fadeIn(duration);
if (group && group.items.length > 1 && jQuery("#top_up .te_controls").is(":hidden")) {
if (jQuery.ie6) {
jQuery("#top_up .te_controls").show();
} else {
jQuery("#top_up .te_controls").fadeIn(duration);
}
}
if (jQuery("#top_up .te_close_link").is(":hidden")) {
if (jQuery.ie6) {
jQuery("#top_up .te_close_link").show();
} else {
jQuery("#top_up .te_close_link").fadeIn(duration);
}
}
checkPosition();
jQuery(".te_top_up,.te_content").unlockDimensions();
if (movieContentDisplayed()) {
options.content.find("object").show();
}
if (options.ondisplay) {
options.ondisplay.apply(this, [jQuery("#top_up .te_content"), data]);
}
displaying = false;
};
var setDimensions = function(dimensions) {
var func = dimensions ? null : checkHeight;
if (!dimensions) {
options.resize.unlockDimensions();
if (jQuery.inArray(options.type, ["image", "html", "dom", "iframe"]) != -1) {
jQuery("#temp_up .te_content").unlockDimensions();
}
dimensions = {};
if (options.width) {
dimensions.width = parseInt(options.width, 10);
}
if (options.height) {
dimensions.height = parseInt(options.height, 10);
}
if (jQuery.ie6) {
jQuery("#top_up .te_title").css("width", jQuery("#temp_up").outerWidth());
}
}
if (jQuery.ie8) {
jQuery("#top_up .te_close_link").hide();
}
options.resize.css(dimensions);
if (jQuery.ie8) {
jQuery("#top_up .te_close").show();
}
if (func) {
func.apply();
}
};
var checkHeight = function() {
if (jQuery("#temp_up").outerHeight() <= jQuery(window).height() - 4) {
return;
}
var extraHeight = jQuery("#temp_up").outerHeight() - jQuery("#temp_up .te_content").height(),
dimensions = {height: jQuery(window).height() - 4 - extraHeight};
if (options.type == "image") {
dimensions.width = parseInt(options.content.width() * (dimensions.height / options.content.height()), 10);
}
setDimensions(dimensions);
};
var checkPosition = function() {
var offset = jQuery("#top_up").offset();
var dimensions = {width: jQuery("#top_up").outerWidth(), height: jQuery("#top_up").outerHeight()};
var position = {};
if (offset.top - jQuery(window).scrollTop() < 2) {
position.top = jQuery(window).scrollTop() + 2;
} else if (offset.top + dimensions.height - jQuery(window).scrollTop() > jQuery(window).height() - 2) {
position.top = jQuery(window).scrollTop() + jQuery(window).height() - dimensions.height - 2;
}
if (offset.left - jQuery(window).scrollLeft() < 2) {
position.left = jQuery(window).scrollLeft() + 2;
} else if (offset.left + dimensions.width - jQuery(window).scrollLeft() > jQuery(window).width() - 2) {
position.left = jQuery(window).scrollLeft() + jQuery(window).width() - dimensions.width - 24;
}
if (jQuery.keys(position).length > 0) {
if (jQuery.ie6 || jQuery.ie7) {
jQuery("#top_up").css(position);
window.setTimeout(function() {
jQuery("#top_up .te_content").show();
}, 1);
} else {
jQuery("#top_up").animate(position, 300);
}
}
};
var hide = function(callback) {
jQuery(".te_content .te_stored_content").removeClass("te_stored_content");
var duration = fadeDuration(250);
var onReady = function() {
animateHide(callback);
};
jQuery("#top_up .te_title") .fadeOut(duration);
jQuery("#top_up .te_controls").fadeOut(duration);
if (movieContentDisplayed()) {
options.content.find("object").hide();
}
if (jQuery.ie) {
jQuery("#top_up .te_close_link").hide();
onReady.apply();
} else {
jQuery("#top_up .te_close_link").fadeOut(duration, onReady);
}
};
var animateHide = function(callback) {
var afterHide = function() {
if (callback) {
callback.apply(this, [jQuery("#top_up .te_content"), data]);
}
if (options.onclose) {
options.onclose.apply(this, [jQuery("#top_up .te_content"), data]);
}
clearContent();
moveContent("temp_up");
};
switch(options.effect) {
case "appear": case "fade":
jQuery("#top_up").fadeOut(fadeDuration(300), afterHide); break;
case "switch": case "clip":
jQuery("#top_up").hide("clip", {direction: "vertical"}, 400, afterHide); break;
case "transform":
if (jQuery.ie6) {
jQuery("#top_up").hide();
afterHide.apply();
break;
}
var origin = jQuery(options.topUp);
if (origin.children().length > 0) {
origin = jQuery(origin.children()[0]);
}
var tuContent = jQuery("#top_up").find(".te_content");
var dimensions = options.topUp ?
jQuery.extend({width: origin.outerWidth(), height: origin.outerHeight()}, origin.offset()) :
{top: parseInt(jQuery(window).height() / 2, 10) + jQuery(window).scrollTop(),
left: parseInt(jQuery(window).width() / 2, 10) + jQuery(window).scrollLeft(),
width: 10,
height: 10};
transform("to", dimensions, afterHide);
break;
default:
jQuery("#top_up").hide();
afterHide();
}
jQuery("#tu_overlay").hide();
};
return {
version: "1.7.2",
jquery: null,
host: "/",
fast_mode: true,
images_path: "template/global/topup/images/",
players_path: "template/global/",
data: data,
init: function() {
if (initialized) {
return false;
}
try {
jQuery(document).ready(function() {
TopUp.jquery = jQuery().jquery;
default_preset.resizable = jQuery.ui && jQuery.ui.resizable ? 1 : 0;
extendjQuery();
injectCode();
bind();
jQuery("#top_up").draggableZ({only: ".te_title,.te_top *,.te_bottom *"});
jQuery.each(on_ready, function(i, func) {
func.apply();
});
});
jQuery(window).unload(function() {
jQuery("*").unbind();
if (jQuery("#top_up .te_frame").resizable) {
jQuery("#top_up .te_frame").resizable("destroy");
}
});
initialized = true;
} catch(e) {}
},
defaultPreset: function(set) {
default_preset = jQuery.extend(default_preset, set);
},
addPresets: function(sets) {
presets = jQuery.extend(presets, sets);
},
ready: function(func) {
on_ready.push(func);
},
enableFastMode: function() {
var args = arguments;
if (!jQuery.isReady) {
TopUp.ready(function() {
TopUp.enableFastMode.apply(null, args);
});
return false;
}
if (arguments.length) {
var arg = arguments[0];
var func = jQuery.isFunction(arg) ? arg : function() { return arg; };
fast_mode = func.apply();
} else {
fast_mode = true;
}
fast_mode = fast_mode == true || parseInt(fast_mode, 10) == 1;
TopUp.rebind();
},
rebind: function() {
if (selector) {
jQuery(selector).die("click", topUpClick);
}
bind();
},
displayTopUp: function(element, opts) {
if (!jQuery.isReady) {
TopUp.ready(function() {
TopUp.displayTopUp(element, opts);
});
return false;
}
var topUp = jQuery(element).bubbleDetect(selector);
var toptions = deriveTopUpOptions(topUp, jQuery.extend(opts || {}, {trigger: "#" + jQuery(element).id()}));
TopUp.display(topUp.element.attr("href"), toptions);
},
display: function(reference, opts) {
if (!jQuery.isReady) {
TopUp.ready(function() {
TopUp.display(reference, opts);
});
return false;
}
if (displaying) {
return false;
}
try {
displaying = true;
data = {};
deriveOptions(reference, opts, true);
showLoader();
var continueDisplaying = function() {
try {
deriveGroup();
prepare();
loadContent();
} catch(e) {
displaying = false;
hideLoader();
alert("Sorry, but the following error occured:\n\n" + e);
}
};
if (jQuery.ie6) {
window.setTimeout(continueDisplaying, 1);
} else {
continueDisplaying();
}
} catch(e) {
displaying = false;
hideLoader();
alert("Sorry, but the following error occured:\n\n" + e);
}
},
update: function(func) {
if (jQuery("#top_up").is(":hidden")) {
return;
}
replace(func || function() {});
},
restore: function(storeCurrent, callback) {
options.storeCurrent = storeCurrent ? 1 : 0;
options.ondisplay = callback;
TopUp.update(function() {
clearContent();
var stored_content = this.children(":not(.te_stored_content):first-child").prev();
if (!stored_content.length) {
stored_content = this.children(".te_stored_content:last-child");
}
stored_content.children().insertBefore(stored_content).end().end().remove();
});
},
previous: function() {
navigateInGroup(-1);
},
next: function() {
navigateInGroup(1);
},
overlayClose: function() {
if (parseInt(options.overlayClose, 10) == 1) {
TopUp.close();
}
},
close: function(callback) {
if (jQuery("#top_up").is(":visible")) {
hide(callback);
}
}
};
}());
(function () {
TopUp.init();
l = new Image();
l.src = '/template/global/topup/images/loader.gif';
}());
}