');
/*
If this select is disabled, remove the actual disabled attribute and let themeroller's .ui-state-disabled class handle it.
This is a workaround for jQuery bug #6211 where options in webkit inherit the select's disabled property. This
won't achieve the same level of 'disabled' behavior (the checkboxes will still be present in form submission),
but it at least gives you a way to emulate the UI.
*/
if(isDisabled){
$select.removeAttr("disabled");
}
$select.find('option').each(function(i){
var $this = $(this),
title = $this.html(),
value = this.value,
inputID = this.id || "ui-multiselect-"+id+"-option-"+i,
$parent = $this.parent(),
hasOptGroup = $parent.is('optgroup'),
isDisabled = $this.is(':disabled'),
labelClasses = ['ui-corner-all'];
if(hasOptGroup){
var label = $parent.attr('label');
if($.inArray(label,optgroups) === -1){
html.push('
';
jQuery('body').append(html);
jQuery(window).resize(function() {
repositionCompare();
});
repositionCompare();
}
// @author: tiberiu: reload the saved and viewed boxes
if ($event == 'click') {
try{
jQuery('#vs').vsReload();
} catch (e) {}
}
}
function repositionCompare() {
var pageWidth = jQuery(window).width();
if(pageWidth < '1420') {
jQuery('#compare_box').addClass('docked');
} else {
jQuery('#compare_box').removeClass('docked');
}
}
function redirectCompare(obj) {
var compare_items = readCookie('compare_items');
compare_items = JSON.parse(unescape(compare_items));
if(compare_items.length < 2) {
alert(i18n.elg_cars_JSNOTIFY.compareatleasttwo);
return false;
}
obj.href = 'utile/compara/?vehicle[typeid]='+compare_items[0].typeid+'&L='+url.charAt(url.length-1);
return true;
}
function deleteCompareItem(vehicle_id) {
var compare_items = readCookie('compare_items');
compare_items = JSON.parse(unescape(compare_items));
if (compare_items === null) {
return;
}
var aux_arr = new Array();
for(i=0;i img').attr('src');
}
image = image.replace('200x200', '48x37');
image = image.replace('_big', '_sm');
if(!price) {
var price = jQuery('#vehicle_'+vehicle_id).parent().next().find('.list_price').text();
}
if(price[0] % 1 != 0) {
price = price.replace(price.charAt(0), "");
}
if(!make_model) {
var make_model = jQuery('#vehicle_'+vehicle_id).parent().next().find('.list_cont_text > a.list_title').text();
}
if(!href) {
var href = jQuery('#vehicle_'+vehicle_id).parent().next().find('.list_cont_text > a.list_title').attr('href');
}
var json_var = {"uid": vehicle_id, "image": image, "price": price, "name": make_model, "href": href, "typeid": current_typeid};
if(compare_items) {
var parsed = JSON.parse(unescape(compare_items));
for(i=0;i= 3) {
alert(i18n.elg_cars_JSNOTIFY.notmorethanthree+'.');
return false;
}
parsed.push(json_var);
createCookie('compare_items', escape(JSON.stringify(parsed)), 0);
} else {
json_var = [{"uid": vehicle_id, "image": image, "price": price, "name": make_model, "href": href, "typeid": current_typeid}];
createCookie('compare_items', escape(JSON.stringify(json_var)), 0);
}
// when in single view: show "Scoate din compara" and hide "Compara"
jQuery('#compared_link').show();
jQuery('#compare_link').hide();
// when in list.tpl: show "Scoate din compara" and hide "Compara"
jQuery('#c_link_'+vehicle_id).hide();
jQuery('#c_link_not_'+vehicle_id).show();
manageCompareWindow('click');
return true;
}
var typeid = 1;
function doCompare(vehicle, object){
var action = 'set';
if (object.checked == false) {
action = 'unset';
}
var post = "uid="+vehicle.uid+"&typeid="+vehicle.typeid+"&todo=COMPARE&action="+action;
jQuery.post (url, post, function(result){
var jsondata=eval("("+result+")")
if (jsondata.content == 'set') {
typeid = jsondata.typeid;
}
});
}
function doCompareToPage(){
var url = jQuery('a#compara').attr("href");
window.location = url+'?vehicle[typeid]='+typeid;
return false;
}
function limitChars(textid, limit)
{
var text = jQuery('#'+textid).val();
if (text !== undefined){
var textlength = text.length;
if(textlength > limit)
{
jQuery('#'+textid).val(text.substr(0,limit));
return false;
}
else
{
jQuery('#charNumber').html(format_number(limit - textlength));
return true;
}
}
}
// format the number in "Mai aveţi 3.000 (de) caractere la dispoziţie." message
function format_number(str) {
var amount = new String(str);
if (amount.length == 4){
output = amount[0]+"."+amount[1]+amount[2]+amount[3];// 3.000
amount = amount.split(""); // 3,0,0,0
}
else{
output = str;
}
return output;
}
(function($) {
$(document).ready(function () {
$('#description').next().hide();
$("#formQuickSearch select").each(function () {
var $label = $("label[for='"+$(this).attr('id')+"']");
$(this).find("option").filter("[value=]").text($label.text());
$label.hide();
});
var $fuel_type_label = $("#formQuickSearch label[for='tipcombustibil']");
setTimeout(function() {$("#formQuickSearch #tipcombustibil input").val($fuel_type_label.text());}, 100);
$fuel_type_label.hide();
});
})(jQuery);
function checkRequiredMultiselects(form_id) {
var selector = '';
if(form_id) {
selector = '#'+form_id;
} else {
selector = 'form';
}
var multiselects = jQuery(selector).find('.required_multiselect');
var error_cnt = 0;
var multiselects_to_open = new Array();
var status = '';
for(var i=0;i'+jQuery.validator.messages.required+'');
}
}
return false;
}
return true;
}
/**
* checks if a multiselect has at least one checkbox selected
**/
function checkMultiselectStatus(multiselect) {
var element_id = jQuery(multiselect).attr('rel');
var checkboxes = jQuery('a#'+element_id).nextAll('.ui-multiselect-options').find('input[type=checkbox]');
var checkboxes_checked = jQuery('a#'+element_id).nextAll('.ui-multiselect-options').find('input[type=checkbox]:checked');
var status = 'ok';
if(checkboxes.length > 0 && checkboxes_checked.length == 0) {
status = 'must_check';
}
return status;
}
// CAPTCHA JS
/***************************************************************
* Copyright notice
*
* (c) 2007-2008 Stanislas Rolland
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/*
* Javascript functions for TYPO3 plugin freeCap (sr_freecap)
*
* TYPO3 CVS ID: $Id$
*/
/*
* Loads a new freeCap image
*
* @param string id: identifier used to uniiquely identify the image
*
* @return void
*/
function newFreeCap(id, noImageMessage) {
if (document.getElementById) {
// extract image name from image source (i.e. cut off ?randomness)
var theImage = document.getElementById("tx_srfreecap_pi2_captcha_image_"+id);
var parts = theImage.src.split("&");
// add ?(random) to prevent browser/isp caching
// parts[0] should be base url up to eID parameter
// parts[1] should be id=page_id
// parts[2] should be L=sys_language_uid
var LParameterInUse = (typeof(parts[2]) != "undefined") && (parts[2].indexOf("L=") != -1);
theImage.src = parts[0] + "&" + parts[1] + (LParameterInUse ? "&" + parts[2] : "") + "&set=" + Math.round(Math.random()*100000);
} else {
alert(noImageMessage ? noImageMessage : "Sorry, we cannot autoreload a new image. Submit the form and a new image will be loaded.");
}
}
/*
* Plays the audio captcha
*
* @param string id: identifier used to uniquely identify the wav file
* @param string wavURL: url of the wave file generating script
*
* @return void
*
* Note: In order for this to work with IE8, [SYS][cookieDomain] must be set using the TYPO3 Install Tool
*/
function playCaptcha(id, wavURL, noPlayMessage) {
if (document.getElementById) {
var theAudio = document.getElementById("tx_srfreecap_pi2_captcha_playAudio_"+id);
var wavURLForOpera = wavURL + "&nocache=" + Math.random();
while (theAudio.firstChild) {
theAudio.removeChild(theAudio.firstChild);
}
var objectElement = document.createElement("object");
objectElement.setAttribute("id", "tx_srfreecap_pi2_captcha_playAudio_object"+id);
objectElement.setAttribute("type", "audio/x-wav");
objectElement.setAttribute("data", wavURLForOpera);
objectElement.setAttribute("height", 0);
objectElement.setAttribute("width", 0);
try {
objectElement.innerHTML = '' + (noPlayMessage ? noPlayMessage : 'Sorry, we cannot play the word of the image.') + '';
} catch (e) {
// IE8 does not allow any element other than param as child of object
objectElement.setAttribute("altHTML", '' + (noPlayMessage ? noPlayMessage : 'Sorry, we cannot play the word of the image.') + '');
}
theAudio.appendChild(objectElement);
// IE8 needs a delay before the param children are appended...
window.setTimeout("addAudioCaptchaParams('" + id + "');", 50);
} else {
alert(noPlayMessage ? noPlayMessage : "Sorry, we cannot play the word of the image.");
}
}
function addAudioCaptchaParams(id) {
var theAudio = document.getElementById("tx_srfreecap_pi2_captcha_playAudio_"+id);
var objectElement = theAudio.firstChild;
var url = objectElement.getAttribute("data");
var parameters = {
"type" : "audio/x-wav",
"filename" : url,
"src" : url,
"autoplay" : true,
"autoStart" : 1,
"hidden" : true,
"controller" : false
};
for (var parameter in parameters) {
if (parameters.hasOwnProperty(parameter)) {
var paramElement = document.createElement("param");
paramElement.setAttribute("value", parameters[parameter]);
paramElement.setAttribute("name", parameter);
paramElement = objectElement.appendChild(paramElement);
}
}
}
// CAPTCHA JS END
//Contains the markup for popups
var popupTemplate =
'
';
},
initialisePopupSelector: function (options) {
var examples = Object.keys(options.popups);
var itemOpen = '
';
var itemClose = '
';
var instances = [];
options.selector.innerHTML = itemOpen + Object.keys(options.popups).join(itemClose+itemOpen) + itemClose;
options.selector.onclick = function (e) {
var targ = e.target, item;
// if the target is the container, exit
if (targ.isEqualNode(options.selector)) return;
// from this point, only the child elements of opts.selector will get through.
// out of these child elements, we want to find the closest direct decendant
while (targ.tagName != 'LI' && targ.parentNode) {
targ = targ.parentNode;
}
if (!targ.parentNode.isEqualNode(options.selector)) return;
// from this point, 'targ' will be a direct decendant of opts.selector
var idx = Array.prototype.indexOf.call(options.selector.children, targ);
if (idx >= 0 && instances[idx]) {
instances[idx].clearStatus();
// We could remember the popup that's currently open, but it gets complicated when we consider
// the revoke button. Therefore, simply close them all regardless
instances.forEach(function (popup) {
if (popup.isOpen()) {
popup.close()
}
popup.toggleRevokeButton(false);
});
instances[idx].open();
}
};
for (var i = 0, l = examples.length; i < l; ++i) {
options.popups[examples[i]].onPopupOpen = function(options) {
return function(){
var codediv = document.getElementById('options');
if(codediv) {
codediv.innerHTML = JSON.stringify(options, null, 2);
}
};
} (options.popups[examples[i]]);
var myOpts = options.popups[examples[i]];
myOpts.autoOpen = false;
options.cookieconsent.initialise(myOpts, function(idx, popup){
instances[idx] = popup;
}.bind(null, i), function(idx, err, popup) {
instances[idx] = popup;
console.error(err);
}.bind(null, i));
}
return instances;
},
};
function timeStamp() {
var now = new Date();
var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ];
for ( var i = 1; i < 3; i++ ) {
if ( time[i] < 10 ) {
time[i] = "0" + time[i];
}
}
return '['+time.join(":")+'] ';
}
! function(e) {
if (!e.hasInitialised) {
var t = {
escapeRegExp: function(e) {
return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")
},
hasClass: function(e, t) {
var i = " ";
return 1 === e.nodeType && (i + e.className + i).replace(/[\n\t]/g, i).indexOf(i + t + i) >= 0
},
addClass: function(e, t) {
e.className += " " + t
},
removeClass: function(e, t) {
var i = new RegExp("\\b" + this.escapeRegExp(t) + "\\b");
e.className = e.className.replace(i, "")
},
interpolateString: function(e, t) {
var i = /{{([a-z][a-z0-9\-_]*)}}/gi;
return e.replace(i, function(e) {
return t(arguments[1]) || ""
})
},
getCookie: function(e) {
var t = "; " + document.cookie,
i = t.split("; " + e + "=");
return 2 != i.length ? void 0 : i.pop().split(";").shift()
},
setCookie: function(e, t, i, n, o) {
var s = new Date;
s.setDate(s.getDate() + (i || 365));
var r = [e + "=" + t, "expires=" + s.toUTCString(), "path=" + (o || "/")];
n && r.push("domain=" + n), document.cookie = r.join(";")
},
deepExtend: function(e, t) {
for (var i in t) t.hasOwnProperty(i) && (i in e && this.isPlainObject(e[i]) && this.isPlainObject(t[i]) ? this.deepExtend(e[i], t[i]) : e[i] = t[i]);
return e
},
throttle: function(e, t) {
var i = !1;
return function() {
i || (e.apply(this, arguments), i = !0, setTimeout(function() {
i = !1
}, t))
}
},
hash: function(e) {
var t, i, n, o = 0;
if (0 === e.length) return o;
for (t = 0, n = e.length; t < n; ++t) i = e.charCodeAt(t), o = (o << 5) - o + i, o |= 0;
return o
},
normaliseHex: function(e) {
return "#" == e[0] && (e = e.substr(1)), 3 == e.length && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]), e
},
getContrast: function(e) {
e = this.normaliseHex(e);
var t = parseInt(e.substr(0, 2), 16),
i = parseInt(e.substr(2, 2), 16),
n = parseInt(e.substr(4, 2), 16),
o = (299 * t + 587 * i + 114 * n) / 1e3;
return o >= 128 ? "#000" : "#fff"
},
getLuminance: function(e) {
var t = parseInt(this.normaliseHex(e), 16),
i = 38,
n = (t >> 16) + i,
o = (t >> 8 & 255) + i,
s = (255 & t) + i,
r = (16777216 + 65536 * (n < 255 ? n < 1 ? 0 : n : 255) + 256 * (o < 255 ? o < 1 ? 0 : o : 255) + (s < 255 ? s < 1 ? 0 : s : 255)).toString(16).slice(1);
return "#" + r
},
isMobile: function() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
},
isPlainObject: function(e) {
return "object" == typeof e && null !== e && e.constructor == Object
}
};
e.status = {
deny: "deny",
allow: "allow",
dismiss: "dismiss"
}, e.transitionEnd = function() {
var e = document.createElement("div"),
t = {
t: "transitionend",
OT: "oTransitionEnd",
msT: "MSTransitionEnd",
MozT: "transitionend",
WebkitT: "webkitTransitionEnd"
};
for (var i in t)
if (t.hasOwnProperty(i) && "undefined" != typeof e.style[i + "ransition"]) return t[i];
return ""
}(), e.hasTransition = !!e.transitionEnd;
var i = Object.keys(e.status).map(t.escapeRegExp);
e.customStyles = {}, e.Popup = function() {
function n() {
this.initialise.apply(this, arguments)
}
function o(e) {
this.openingTimeout = null, t.removeClass(e, "cc-invisible")
}
function s(t) {
t.style.display = "none", t.removeEventListener(e.transitionEnd, this.afterTransition), this.afterTransition = null
}
function r() {
var t = this.options.onInitialise.bind(this);
if (!window.navigator.cookieEnabled) return t(e.status.deny), !0;
if (window.CookiesOK || window.navigator.CookiesOK) return t(e.status.allow), !0;
var i = Object.keys(e.status),
n = this.getStatus(),
o = i.indexOf(n) >= 0;
return o && t(n), o
}
function a() {
var e = this.options.position.split("-"),
t = [];
return e.forEach(function(e) {
t.push("cc-" + e)
}), t
}
function c() {
var e = this.options,
i = "top" == e.position || "bottom" == e.position ? "banner" : "floating";
t.isMobile() && (i = "floating");
var n = ["cc-" + i, "cc-type-" + e.type, "cc-theme-" + e.theme];
e["static"] && n.push("cc-static"), n.push.apply(n, a.call(this));
p.call(this, this.options.palette);
return this.customStyleSelector && n.push(this.customStyleSelector), n
}
function l() {
var e = {},
i = this.options;
i.showLink || (i.elements.link = "", i.elements.messagelink = i.elements.message), Object.keys(i.elements).forEach(function(n) {
e[n] = t.interpolateString(i.elements[n], function(e) {
var t = i.content[e];
return e && "string" == typeof t && t.length ? t : ""
})
});
var n = i.compliance[i.type];
n || (n = i.compliance.info), e.compliance = t.interpolateString(n, function(t) {
return e[t]
});
var o = i.layouts[i.layout];
return o || (o = i.layouts.basic), t.interpolateString(o, function(t) {
return e[t]
})
}
function u(i) {
var n = this.options,
o = document.createElement("div"),
s = n.container && 1 === n.container.nodeType ? n.container : document.body;
o.innerHTML = i;
var r = o.children[0];
return r.style.display = "none", t.hasClass(r, "cc-window") && e.hasTransition && t.addClass(r, "cc-invisible"), this.onButtonClick = h.bind(this), r.addEventListener("click", this.onButtonClick), n.autoAttach && (s.firstChild ? s.insertBefore(r, s.firstChild) : s.appendChild(r)), r
}
function h(n) {
var o = n.target;
if (t.hasClass(o, "cc-btn")) {
var s = o.className.match(new RegExp("\\bcc-(" + i.join("|") + ")\\b")),
r = s && s[1] || !1;
r && (this.setStatus(r), this.close(!0))
}
t.hasClass(o, "cc-close") && (this.setStatus(e.status.dismiss), this.close(!0)), t.hasClass(o, "cc-revoke") && this.revokeChoice()
}
function p(e) {
var i = t.hash(JSON.stringify(e)),
n = "cc-color-override-" + i,
o = t.isPlainObject(e);
return this.customStyleSelector = o ? n : null, o && d(i, e, "." + n), o
}
function d(i, n, o) {
if (e.customStyles[i]) return void++e.customStyles[i].references;
var s = {},
r = n.popup,
a = n.button,
c = n.highlight;
r && (r.text = r.text ? r.text : t.getContrast(r.background), r.link = r.link ? r.link : r.text, s[o + ".cc-window"] = ["color: " + r.text, "background-color: " + r.background], s[o + ".cc-revoke"] = ["color: " + r.text, "background-color: " + r.background], s[o + " .cc-link," + o + " .cc-link:active," + o + " .cc-link:visited"] = ["color: " + r.link], a && (a.text = a.text ? a.text : t.getContrast(a.background), a.border = a.border ? a.border : "transparent", s[o + " .cc-btn"] = ["color: " + a.text, "border-color: " + a.border, "background-color: " + a.background], "transparent" != a.background && (s[o + " .cc-btn:hover, " + o + " .cc-btn:focus"] = ["background-color: " + v(a.background)]), c ? (c.text = c.text ? c.text : t.getContrast(c.background), c.border = c.border ? c.border : "transparent", s[o + " .cc-highlight .cc-btn:first-child"] = ["color: " + c.text, "border-color: " + c.border, "background-color: " + c.background]) : s[o + " .cc-highlight .cc-btn:first-child"] = ["color: " + r.text]));
var l = document.createElement("style");
document.head.appendChild(l), e.customStyles[i] = {
references: 1,
element: l.sheet
};
var u = -1;
for (var h in s) s.hasOwnProperty(h) && l.sheet.insertRule(h + "{" + s[h].join(";") + "}", ++u)
}
function v(e) {
return e = t.normaliseHex(e), "000000" == e ? "#222" : t.getLuminance(e)
}
function f(i) {
if (t.isPlainObject(i)) {
var n = t.hash(JSON.stringify(i)),
o = e.customStyles[n];
if (o && !--o.references) {
var s = o.element.ownerNode;
s && s.parentNode && s.parentNode.removeChild(s), e.customStyles[n] = null
}
}
}
function m(e, t) {
for (var i = 0, n = e.length; i < n; ++i) {
var o = e[i];
if (o instanceof RegExp && o.test(t) || "string" == typeof o && o.length && o === t) return !0
}
return !1
}
function b() {
var t = this.setStatus.bind(this),
i = this.options.dismissOnTimeout;
"number" == typeof i && i >= 0 && (this.dismissTimeout = window.setTimeout(function() {
t(e.status.dismiss)
}, Math.floor(i)));
var n = this.options.dismissOnScroll;
if ("number" == typeof n && n >= 0) {
var o = function(i) {
window.pageYOffset > Math.floor(n) && (t(e.status.dismiss), window.removeEventListener("scroll", o), this.onWindowScroll = null)
};
this.onWindowScroll = o, window.addEventListener("scroll", o)
}
}
function y() {
if ("info" != this.options.type && (this.options.revokable = !0), t.isMobile() && (this.options.animateRevokable = !1), this.options.revokable) {
var e = a.call(this);
this.options.animateRevokable && e.push("cc-animate"), this.customStyleSelector && e.push(this.customStyleSelector);
var i = this.options.revokeBtn.replace("{{classes}}", e.join(" "));
this.revokeBtn = u.call(this, i);
var n = this.revokeBtn;
if (this.options.animateRevokable) {
var o = t.throttle(function(e) {
var i = !1,
o = 20,
s = window.innerHeight - 20;
t.hasClass(n, "cc-top") && e.clientY < o && (i = !0), t.hasClass(n, "cc-bottom") && e.clientY > s && (i = !0), i ? t.hasClass(n, "cc-active") || t.addClass(n, "cc-active") : t.hasClass(n, "cc-active") && t.removeClass(n, "cc-active")
}, 200);
this.onMouseMove = o, window.addEventListener("mousemove", o)
}
}
}
var g = {
enabled: !0,
container: null,
cookie: {
name: "cookieconsent_status",
path: "/",
domain: "",
expiryDays: 365
},
onPopupOpen: function() {},
onPopupClose: function() {},
onInitialise: function(e) {},
onStatusChange: function(e, t) {},
onRevokeChoice: function() {},
content: {
header: "Cookies used on the website!",
message: "This website uses cookies to ensure you get the best experience on our website.",
dismiss: "Got it!",
allow: "Allow cookies",
deny: "Decline",
link: "Learn more",
href: "http://cookiesandyou.com",
close: "❌"
},
elements: {
header: '{{header}} ',
message: '
");
o.style.display = "", this.element = o.firstChild, this.element.style.display = "none", t.addClass(this.element, "cc-invisible")
} else this.element = u.call(this, i);
b.call(this), y.call(this), this.options.autoOpen && this.autoOpen()
}, n.prototype.destroy = function() {
this.onButtonClick && this.element && (this.element.removeEventListener("click", this.onButtonClick), this.onButtonClick = null), this.dismissTimeout && (clearTimeout(this.dismissTimeout), this.dismissTimeout = null), this.onWindowScroll && (window.removeEventListener("scroll", this.onWindowScroll), this.onWindowScroll = null), this.onMouseMove && (window.removeEventListener("mousemove", this.onMouseMove), this.onMouseMove = null), this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element), this.element = null, this.revokeBtn && this.revokeBtn.parentNode && this.revokeBtn.parentNode.removeChild(this.revokeBtn), this.revokeBtn = null, f(this.options.palette), this.options = null
}, n.prototype.open = function(t) {
if (this.element) return this.isOpen() || (e.hasTransition ? this.fadeIn() : this.element.style.display = "", this.options.revokable && this.toggleRevokeButton(), this.options.onPopupOpen.call(this)), this
}, n.prototype.close = function(t) {
if (this.element) return this.isOpen() && (e.hasTransition ? this.fadeOut() : this.element.style.display = "none", t && this.options.revokable && this.toggleRevokeButton(!0), this.options.onPopupClose.call(this)), this
}, n.prototype.fadeIn = function() {
var i = this.element;
if (e.hasTransition && i && (this.afterTransition && s.call(this, i), t.hasClass(i, "cc-invisible"))) {
if (i.style.display = "", this.options["static"]) {
var n = this.element.clientHeight;
this.element.parentNode.style.maxHeight = n + "px"
}
var r = 20;
this.openingTimeout = setTimeout(o.bind(this, i), r)
}
}, n.prototype.fadeOut = function() {
var i = this.element;
e.hasTransition && i && (this.openingTimeout && (clearTimeout(this.openingTimeout), o.bind(this, i)), t.hasClass(i, "cc-invisible") || (this.options["static"] && (this.element.parentNode.style.maxHeight = ""), this.afterTransition = s.bind(this, i), i.addEventListener(e.transitionEnd, this.afterTransition), t.addClass(i, "cc-invisible")))
}, n.prototype.isOpen = function() {
return this.element && "" == this.element.style.display && (!e.hasTransition || !t.hasClass(this.element, "cc-invisible"))
}, n.prototype.toggleRevokeButton = function(e) {
this.revokeBtn && (this.revokeBtn.style.display = e ? "" : "none")
}, n.prototype.revokeChoice = function(e) {
this.options.enabled = !0, this.clearStatus(), this.options.onRevokeChoice.call(this), e || this.autoOpen()
}, n.prototype.hasAnswered = function(t) {
return Object.keys(e.status).indexOf(this.getStatus()) >= 0
}, n.prototype.hasConsented = function(t) {
var i = this.getStatus();
return i == e.status.allow || i == e.status.dismiss
}, n.prototype.autoOpen = function(e) {
!this.hasAnswered() && this.options.enabled && this.open()
}, n.prototype.setStatus = function(i) {
var n = this.options.cookie,
o = t.getCookie(n.name),
s = Object.keys(e.status).indexOf(o) >= 0;
Object.keys(e.status).indexOf(i) >= 0 ? (t.setCookie(n.name, i, n.expiryDays, n.domain, n.path), this.options.onStatusChange.call(this, i, s)) : this.clearStatus()
}, n.prototype.getStatus = function() {
return t.getCookie(this.options.cookie.name)
}, n.prototype.clearStatus = function() {
var e = this.options.cookie;
t.setCookie(e.name, "", -1, e.domain, e.path)
}, n
}(), e.Location = function() {
function e(e) {
t.deepExtend(this.options = {}, s), t.isPlainObject(e) && t.deepExtend(this.options, e), this.currentServiceIndex = -1
}
function i(e, t, i) {
var n, o = document.createElement("script");
o.type = "text/" + (e.type || "javascript"), o.src = e.src || e, o.async = !1, o.onreadystatechange = o.onload = function() {
var e = o.readyState;
clearTimeout(n), t.done || e && !/loaded|complete/.test(e) || (t.done = !0, t(), o.onreadystatechange = o.onload = null)
}, document.body.appendChild(o), n = setTimeout(function() {
t.done = !0, t(), o.onreadystatechange = o.onload = null
}, i)
}
function n(e, t, i, n, o) {
var s = new(window.XMLHttpRequest || window.ActiveXObject)("MSXML2.XMLHTTP.3.0");
if (s.open(n ? "POST" : "GET", e, 1), s.setRequestHeader("X-Requested-With", "XMLHttpRequest"), s.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), Array.isArray(o))
for (var r = 0, a = o.length; r < a; ++r) {
var c = o[r].split(":", 2);
s.setRequestHeader(c[0].replace(/^\s+|\s+$/g, ""), c[1].replace(/^\s+|\s+$/g, ""))
}
"function" == typeof t && (s.onreadystatechange = function() {
s.readyState > 3 && t(s)
}), s.send(n)
}
function o(e) {
return new Error("Error [" + (e.code || "UNKNOWN") + "]: " + e.error)
}
var s = {
timeout: 5e3,
services: ["freegeoip", "ipinfo", "maxmind"],
serviceDefinitions: {
freegeoip: function() {
return {
url: "//freegeoip.net/json/?callback={callback}",
isScript: !0,
callback: function(e, t) {
try {
var i = JSON.parse(t);
return i.error ? o(i) : {
code: i.country_code
}
} catch (n) {
return o({
error: "Invalid response (" + n + ")"
})
}
}
}
},
ipinfo: function() {
return {
url: "//ipinfo.io",
headers: ["Accept: application/json"],
callback: function(e, t) {
try {
var i = JSON.parse(t);
return i.error ? o(i) : {
code: i.country
}
} catch (n) {
return o({
error: "Invalid response (" + n + ")"
})
}
}
}
},
ipinfodb: function(e) {
return {
url: "//api.ipinfodb.com/v3/ip-country/?key={api_key}&format=json&callback={callback}",
isScript: !0,
callback: function(e, t) {
try {
var i = JSON.parse(t);
return "ERROR" == i.statusCode ? o({
error: i.statusMessage
}) : {
code: i.countryCode
}
} catch (n) {
return o({
error: "Invalid response (" + n + ")"
})
}
}
}
},
maxmind: function() {
return {
url: "//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js",
isScript: !0,
callback: function(e) {
return window.geoip2 ? void geoip2.country(function(t) {
try {
e({
code: t.country.iso_code
})
} catch (i) {
e(o(i))
}
}, function(t) {
e(o(t))
}) : void e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"))
}
}
}
}
};
return e.prototype.getNextService = function() {
var e;
do e = this.getServiceByIdx(++this.currentServiceIndex); while (this.currentServiceIndex < this.options.services.length && !e);
return e
}, e.prototype.getServiceByIdx = function(e) {
var i = this.options.services[e];
if ("function" == typeof i) {
var n = i();
return n.name && t.deepExtend(n, this.options.serviceDefinitions[n.name](n)), n
}
return "string" == typeof i ? this.options.serviceDefinitions[i]() : t.isPlainObject(i) ? this.options.serviceDefinitions[i.name](i) : null
}, e.prototype.locate = function(e, t) {
var i = this.getNextService();
return i ? (this.callbackComplete = e, this.callbackError = t, void this.runService(i, this.runNextServiceOnError.bind(this))) : void t(new Error("No services to run"))
}, e.prototype.setupUrl = function(e) {
var t = this.getCurrentServiceOpts();
return e.url.replace(/\{(.*?)\}/g, function(i, n) {
if ("callback" === n) {
var o = "callback" + Date.now();
return window[o] = function(t) {
e.__JSONP_DATA = JSON.stringify(t)
}, o
}
if (n in t.interpolateUrl) return t.interpolateUrl[n]
})
}, e.prototype.runService = function(e, t) {
var o = this;
if (e && e.url && e.callback) {
var s = e.isScript ? i : n,
r = this.setupUrl(e);
s(r, function(i) {
var n = i ? i.responseText : "";
e.__JSONP_DATA && (n = e.__JSONP_DATA, delete e.__JSONP_DATA), o.runServiceCallback.call(o, t, e, n)
}, this.options.timeout, e.data, e.headers)
}
}, e.prototype.runServiceCallback = function(e, t, i) {
var n = this,
o = function(t) {
s || n.onServiceResult.call(n, e, t)
},
s = t.callback(o, i);
s && this.onServiceResult.call(this, e, s)
}, e.prototype.onServiceResult = function(e, t) {
t instanceof Error || t && t.error ? e.call(this, t, null) : e.call(this, null, t)
}, e.prototype.runNextServiceOnError = function(e, t) {
if (e) {
this.logError(e);
var i = this.getNextService();
i ? this.runService(i, this.runNextServiceOnError.bind(this)) : this.completeService.call(this, this.callbackError, new Error("All services failed"))
} else this.completeService.call(this, this.callbackComplete, t)
}, e.prototype.getCurrentServiceOpts = function() {
var e = this.options.services[this.currentServiceIndex];
return "string" == typeof e ? {
name: e
} : "function" == typeof e ? e() : t.isPlainObject(e) ? e : {}
}, e.prototype.completeService = function(e, t) {
this.currentServiceIndex = -1, e && e(t)
}, e.prototype.logError = function(e) {
var t = this.currentServiceIndex,
i = this.getServiceByIdx(t);
console.error("The service[" + t + "] (" + i.url + ") responded with the following error", e)
}, e
}(), e.Law = function() {
function e(e) {
this.initialise.apply(this, arguments)
}
var i = {
regionalLaw: !0,
hasLaw: ["AT", "BE", "BG", "HR", "CZ", "CY", "DK", "EE", "FI", "FR", "DE", "EL", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "SK", "SI", "ES", "SE", "GB", "UK"],
revokable: ["HR", "CY", "DK", "EE", "FR", "DE", "LV", "LT", "NL", "PT", "ES"],
explicitAction: ["HR", "IT", "ES"]
};
return e.prototype.initialise = function(e) {
t.deepExtend(this.options = {}, i), t.isPlainObject(e) && t.deepExtend(this.options, e)
}, e.prototype.get = function(e) {
var t = this.options;
return {
hasLaw: t.hasLaw.indexOf(e) >= 0,
revokable: t.revokable.indexOf(e) >= 0,
explicitAction: t.explicitAction.indexOf(e) >= 0
}
}, e.prototype.applyLaw = function(e, t) {
var i = this.get(t);
return i.hasLaw || (e.enabled = !1), this.options.regionalLaw && (i.revokable && (e.revokable = !0), i.explicitAction && (e.dismissOnScroll = !1, e.dismissOnTimeout = !1)), e
}, e
}(), e.initialise = function(t, i, n) {
var o = new e.Law(t.law);
i || (i = function() {}), n || (n = function() {}), e.getCountryCode(t, function(n) {
delete t.law, delete t.location, n.code && (t = o.applyLaw(t, n.code)), i(new e.Popup(t))
}, function(i) {
delete t.law, delete t.location, n(i, new e.Popup(t))
})
}, e.getCountryCode = function(t, i, n) {
if (t.law && t.law.countryCode) return void i({
code: t.law.countryCode
});
if (t.location) {
var o = new e.Location(t.location);
return void o.locate(function(e) {
i(e || {})
}, n)
}
i({})
}, e.utils = t, e.hasInitialised = !0, window.cookieconsent = e
}
}(window.cookieconsent || {});/*! jCarousel - v0.3.9 - 2018-07-30
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
!function(t){"use strict";var i=t.jCarousel={};i.version="0.3.9";var s=/^([+\-]=)?(.+)$/;i.parseTarget=function(t){var i=!1,e="object"!=typeof t?s.exec(t):null;return e?(t=parseInt(e[2],10)||0,e[1]&&(i=!0,"-="===e[1]&&(t*=-1))):"object"!=typeof t&&(t=parseInt(t,10)||0),{target:t,relative:i}},i.detectCarousel=function(t){for(var i;t.length>0;){if((i=t.filter("[data-jcarousel]")).length>0)return i;if((i=t.find("[data-jcarousel]")).length>0)return i;t=t.parent()}return null},i.base=function(s){return{version:i.version,_options:{},_element:null,_carousel:null,_init:t.noop,_create:t.noop,_destroy:t.noop,_reload:t.noop,create:function(){return this._element.attr("data-"+s.toLowerCase(),!0).data(s,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(s).removeAttr("data-"+s.toLowerCase()),this)},reload:function(t){return!1===this._trigger("reload")?this:(t&&this.options(t),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(i,s){if(0===arguments.length)return t.extend({},this._options);if("string"==typeof i){if(void 0===s)return void 0===this._options[i]?null:this._options[i];this._options[i]=s}else this._options=t.extend({},this._options,i);return this},carousel:function(){return this._carousel||(this._carousel=i.detectCarousel(this.options("carousel")||this._element),this._carousel||t.error('Could not detect carousel for plugin "'+s+'"')),this._carousel},_trigger:function(i,e,r){var n,o=!1;return r=[this].concat(r||[]),(e||this._element).each(function(){n=t.Event((s+":"+i).toLowerCase()),t(this).trigger(n,r),n.isDefaultPrevented()&&(o=!0)}),!o}}},i.plugin=function(s,e){var r=t[s]=function(i,s){this._element=t(i),this.options(s),this._init(),this.create()};return r.fn=r.prototype=t.extend({},i.base(s),e),t.fn[s]=function(i){var e=Array.prototype.slice.call(arguments,1),n=this;return"string"==typeof i?this.each(function(){var r=t(this).data(s);if(!r)return t.error("Cannot call methods on "+s+' prior to initialization; attempted to call method "'+i+'"');if(!t.isFunction(r[i])||"_"===i.charAt(0))return t.error('No such method "'+i+'" for '+s+" instance");var o=r[i].apply(r,e);return o!==r&&void 0!==o?(n=o,!1):void 0}):this.each(function(){var e=t(this).data(s);e instanceof r?e.reload(i):new r(this,i)}),n},r}}(jQuery),function(t,i){"use strict";var s=t(i),e=function(t){return parseFloat(t)||0};t.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeState:null,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:t(),_first:t(),_last:t(),_visible:t(),_fullyvisible:t(),_init:function(){var t=this;return t.resizeState=s.width()+"x"+s.height(),this.onWindowResize=function(){t.resizeTimer&&clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){var i=s.width()+"x"+s.height();i!==t.resizeState&&(t.resizeState=i,t.reload())},100)},this},_create:function(){this._reload(),s.on("resize.jcarousel",this.onWindowResize)},_destroy:function(){s.off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=e(this.list().height())>e(this.list().width())),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(i){if("rtl"===(""+i.attr("dir")).toLowerCase())return!0;var s=!1;return i.parents("[dir]").each(function(){if(/rtl/i.test(t(this).attr("dir")))return s=!0,!1}),s}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var i=this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var s={left:0,top:0};return i.length>0&&(this._prepare(i),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,s[this.lt]=this._position(i)+"px"),this.move(s),this},list:function(){if(null===this._list){var i=this.options("list");this._list=t.isFunction(i)?i.call(this):this._element.find(i)}return this._list},items:function(){if(null===this._items){var i=this.options("items");this._items=(t.isFunction(i)?i.call(this):this.list().find(i)).not("[data-jcarousel-clone]")}return this._items},index:function(t){return this.items().index(t)},closest:function(){var i,s=this,r=this.list().position()[this.lt],n=t(),o=!1,l=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.items().each(function(){if(n=t(this),o)return!1;var a=s.dimension(n);if((r+=a)>=0){if(i=a-e(n.css("margin-"+l)),!(Math.abs(r)-a+i/2<=0))return!1;o=!0}}),n},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var t=this.options("wrap"),i=this.items().length-1,s=this.options("center")?this._target:this._last;return!!(i>=0&&!this.underflow&&(t&&"first"!==t||this.index(s)0&&!this.underflow&&(t&&"last"!==t||this.index(this._first)>0||this.tail&&this.inTail))},clipping:function(){return e(this._element["inner"+(this.vertical?"Height":"Width")]())},dimension:function(t){return e(t["outer"+(this.vertical?"Height":"Width")](!0))},scroll:function(i,s,e){if(this.animating)return this;if(!1===this._trigger("scroll",null,[i,s]))return this;t.isFunction(s)&&(e=s,s=!0);var r=t.jCarousel.parseTarget(i);if(r.relative){var n,o,l,a,h,u,c,f,d=this.items().length-1,_=Math.abs(r.target),p=this.options("wrap");if(r.target>0){var g=this.index(this._last);if(g>=d&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,s,e):t.isFunction(e)&&e.call(this,!1):this._scrollTail(s,e);else if(n=this.index(this._target),this.underflow&&n===d&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&g===d&&("both"===p||"last"===p))this._scroll(0,s,e);else if(l=n+_,this.circular&&l>d){for(f=d,h=this.items().get(-1);f++=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(h),u||((c={})[this.lt]=this.dimension(h),this.moveBy(c)),this._items=null;this._scroll(h,s,e)}else this._scroll(Math.min(l,d),s,e)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-_+1,0),s,e);else if(o=this.index(this._first),n=this.index(this._target),l=(a=this.underflow?n:o)-_,a<=0&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(d,s,e);else if(this.circular&&l<0){for(f=l,h=this.items().get(0);f++<0;){h=this.items().eq(-1),(u=this._visible.index(h)>=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(h),this._items=null;var m=this.dimension(h);(c={})[this.lt]=-m,this.moveBy(c)}this._scroll(h,s,e)}else this._scroll(Math.max(l,0),s,e)}else this._scroll(r.target,s,e);return this._trigger("scrollend"),this},moveBy:function(t,i){var s=this.list().position(),r=1,n=0;return this.rtl&&!this.vertical&&(r=-1,this.relative&&(n=e(this.list().width())-this.clipping())),t.left&&(t.left=e(s.left)+n+e(t.left)*r+"px"),t.top&&(t.top=e(s.top)+n+e(t.top)*r+"px"),this.move(t,i)},move:function(i,s){s=s||{};var e=this.options("transitions"),r=!!e,n=!!e.transforms,o=!!e.transforms3d,l=s.duration||0,a=this.list();if(!r&&l>0)a.animate(i,s);else{var h=s.complete||t.noop,u={};if(r){var c={transitionDuration:a.css("transitionDuration"),transitionTimingFunction:a.css("transitionTimingFunction"),transitionProperty:a.css("transitionProperty")},f=h;h=function(){t(this).css(c),f.call(this)},u={transitionDuration:(l>0?l/1e3:0)+"s",transitionTimingFunction:e.easing||s.easing,transitionProperty:l>0?n||o?"all":i.left?"left":"top":"none",transform:"none"}}o?u.transform="translate3d("+(i.left||0)+","+(i.top||0)+",0)":n?u.transform="translate("+(i.left||0)+","+(i.top||0)+")":t.extend(u,i),r&&l>0&&a.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",h),a.css(u),l<=0&&a.each(function(){h.call(this)})}},_scroll:function(i,s,r){if(this.animating)return t.isFunction(r)&&r.call(this,!1),this;if("object"!=typeof i?i=this.items().eq(i):void 0===i.jquery&&(i=t(i)),0===i.length)return t.isFunction(r)&&r.call(this,!1),this;this.inTail=!1,this._prepare(i);var n=this._position(i);if(n===e(this.list().position()[this.lt]))return t.isFunction(r)&&r.call(this,!1),this;var o={};return o[this.lt]=n+"px",this._animate(o,s,r),this},_scrollTail:function(i,s){if(this.animating||!this.tail)return t.isFunction(s)&&s.call(this,!1),this;var r=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.rtl&&!this.vertical?r+=this.tail:r-=this.tail,this.inTail=!0;var n={};return n[this.lt]=r+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(n,i,s),this},_animate:function(i,s,e){if(e=e||t.noop,!1===this._trigger("animate"))return e.call(this,!1),this;this.animating=!0;var r=this.options("animation"),n=t.proxy(function(){this.animating=!1;var t=this.list().find("[data-jcarousel-clone]");t.length>0&&(t.remove(),this._reload()),this._trigger("animateend"),e.call(this,!0)},this),o="object"==typeof r?t.extend({},r):{duration:r},l=o.complete||t.noop;return!1===s?o.duration=0:void 0!==t.fx.speeds[o.duration]&&(o.duration=t.fx.speeds[o.duration]),o.complete=function(){n(),l.call(this)},this.move(i,o),this},_prepare:function(i){var s,r,n,o=this.index(i),l=o,a=this.dimension(i),h=this.clipping(),u=this.vertical?"bottom":this.rtl?"left":"right",c=this.options("center"),f={target:i,first:i,last:i,visible:i,fullyvisible:a<=h?i:t()};if(c&&(a/=2,h/=2),a=0)&&s.after(s.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(s),!r){var d={};d[this.lt]=this.dimension(s),this.moveBy(d)}this._items=null}if(0===(n=this.dimension(s)))break;if(a+=n,f.last=s,f.visible=f.visible.add(s),a-e(s.css("margin-"+u))<=h&&(f.fullyvisible=f.fullyvisible.add(s)),a>=h)break}if(!this.circular&&!c&&a=h)););return this._update(f),this.tail=0,c||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(f.last)!==this.items().length-1||(a-=e(f.last.css("margin-"+u)))>h&&(this.tail=a-h),this},_position:function(t){var i=this._first,s=e(i.position()[this.lt]),r=this.options("center"),n=r?this.clipping()/2-this.dimension(i)/2:0;return this.rtl&&!this.vertical?(this.relative?s-=e(this.list().width())-this.dimension(i):s-=this.clipping()-this.dimension(i),s+=n):s-=n,!r&&(this.index(t)>this.index(i)||this.inTail)&&this.tail?(s=this.rtl&&!this.vertical?s-this.tail:s+this.tail,this.inTail=!0):this.inTail=!1,-s},_update:function(i){var s,e=this,r={target:this._target,first:this._first,last:this._last,visible:this._visible,fullyvisible:this._fullyvisible},n=this.index(i.first||r.first)=o&&r<=l)return t.isFunction(e)&&e.call(this,!1),this;for(var a,h=this.items(),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=0;0!==(a=h.eq(r)).length;){if((f+=this.dimension(a))>=u){f-(parseFloat(a.css("margin-"+c))||0)!==u&&r++;break}if(r<=0)break;r--}return this.scroll(r,s,e)}}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(i){i.preventDefault();var s=this.options("method");t.isFunction(s)?s.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var i,s=t.jCarousel.parseTarget(this.options("target")),e=this.carousel();if(s.relative)i=e.jcarousel(s.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof s.target?e.jcarousel("items").eq(s.target):s.target;i=e.jcarousel("target").index(r)>=0}return this._active!==i&&(this._trigger(i?"active":"inactive"),this._active=i),this}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselPagination",{_options:{perPage:null,item:function(t){return''+t+""},event:"click",method:"scroll"},_carouselItems:null,_pages:{},_items:{},_currentPage:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onScroll=t.proxy(this._update,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend",this.onReload).on("jcarousel:scrollend",this.onScroll),this._reload()},_destroy:function(){this._clear(),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend",this.onReload).off("jcarousel:scrollend",this.onScroll),this._carouselItems=null},_reload:function(){var i=this.options("perPage");if(this._pages={},this._items={},t.isFunction(i)&&(i=i.call(this)),null==i)this._pages=this._calculatePages();else for(var s,e=parseInt(i,10)||0,r=this._getCarouselItems(),n=1,o=0;0!==(s=r.eq(o++)).length;)this._pages[n]?this._pages[n]=this._pages[n].add(s):this._pages[n]=s,o%e==0&&n++;this._clear();var l=this,a=this.carousel().data("jcarousel"),h=this._element,u=this.options("item"),c=this._getCarouselItems().length;t.each(this._pages,function(i,s){var e=l._items[i]=t(u.call(l,i,s));e.on(l.options("event")+".jcarouselpagination",t.proxy(function(){var t=s.eq(0);if(a.circular){var e=a.index(a.target()),r=a.index(t);parseFloat(i)>parseFloat(l._currentPage)?re&&(t="-="+(e+(c-r)))}a[this.options("method")](t)},l)),h.append(e)}),this._update()},_update:function(){var i,s=this.carousel().jcarousel("target");t.each(this._pages,function(t,e){if(e.each(function(){if(s.is(this))return i=t,!1}),i)return!1}),this._currentPage!==i&&(this._trigger("inactive",this._items[this._currentPage]),this._trigger("active",this._items[i])),this._currentPage=i},items:function(){return this._items},reloadCarouselItems:function(){return this._carouselItems=null,this},_clear:function(){this._element.empty(),this._currentPage=null},_calculatePages:function(){for(var t,i,s=this.carousel().data("jcarousel"),e=this._getCarouselItems(),r=s.clipping(),n=0,o=0,l=1,a={};0!==(t=e.eq(o++)).length;)n+(i=s.dimension(t))>r&&(l++,n=0),n+=i,a[l]?a[l]=a[l].add(t):a[l]=t;return a},_getCarouselItems:function(){return this._carouselItems||(this._carouselItems=this.carousel().jcarousel("items")),this._carouselItems}})}(jQuery),function(t,i){"use strict";var s,e;t.each({hidden:"visibilitychange",mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",webkitHidden:"webkitvisibilitychange"},function(t,r){if(void 0!==i[t])return s=t,e=r,!1}),t.jCarousel.plugin("jcarouselAutoscroll",{_options:{target:"+=1",interval:3e3,autostart:!0,method:"scroll"},_timer:null,_started:!1,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onAnimateEnd=t.proxy(this._start,this),this.onVisibilityChange=t.proxy(function(){i[s]?this._stop():this._start()},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy),t(i).on(e,this.onVisibilityChange),this.options("autostart")&&this.start()},_destroy:function(){this._stop(),this.carousel().off("jcarousel:destroy",this.onDestroy),t(i).off(e,this.onVisibilityChange)},_start:function(){if(this._stop(),this._started)return this.carousel().one("jcarousel:animateend",this.onAnimateEnd),this._timer=setTimeout(t.proxy(function(){this.carousel().jcarousel(this.options("method"),this.options("target"))},this),this.options("interval")),this},_stop:function(){return this._timer&&(this._timer=clearTimeout(this._timer)),this.carousel().off("jcarousel:animateend",this.onAnimateEnd),this},start:function(){return this._started=!0,this._start(),this},stop:function(){return this._started=!1,this._stop(),this}})}(jQuery,document);!function(t){"use strict";t.jCarousel.plugin("jcarouselSwipe",{_options:{perSwipe:1,draggable:!0,method:"scroll"},_init:function(){var t=this;this.carousel().on("jcarousel:reloadend",function(){t._reload()})},_create:function(){this._instance=this.carousel().data("jcarousel"),this._instance._element.css("touch-action",this._instance.vertical?"pan-x":"pan-y"),this._carouselOffset=this.carousel().offset()[this._instance.lt]+parseInt(this.carousel().css(this._instance.vertical?"border-top-width":"border-left-width"))+parseInt(this.carousel().css(this._instance.vertical?"padding-top":"padding-left")),this._slidesCount=this._instance.items().length,this.carousel().find("img, a").attr("draggable",!1).css("user-select","none").on("dragstart",function(t){t.preventDefault()}),this._destroy(),this._instance.items().length>this._instance.fullyvisible().length&&this._initGestures()},_initGestures:function(){function e(e){var i,o,p;e=e.originalEvent||e||window.event,l=n(e);var f=Math.abs(r[u]-l[u]),d=Math.abs(r[_]-l[_]);h&&e.preventDefault(),d>10&&d>f&&!h?t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe"):(!c._instance.animating&&f>10||h)&&(i=r[u]-l[u],h||(h=!0,c._addClones(),c._currentLT=c._getListPosition(),p=c._instance.options("items"),a=(t.isFunction(p)?p.call(c._instance):c._instance.list().find(p)).last(),s=c._instance.rtl&&!c._instance.vertical?c._instance.dimension(c._instance.list())-a.position()[c._instance.lt]-c._instance.clipping():-1*(a.position()[c._instance.lt]+c._instance.dimension(a)-c._instance.clipping())),o="circular"===c._instance._options.wrap?c._currentLT-i:c._instance.rtl&&!c._instance.vertical?Math.max(0,Math.min(c._currentLT-i,s)):Math.min(0,Math.max(c._currentLT-i,s)),c._setListPosition(o+"px"))}function i(e){e=e.originalEvent||e||window.event,l=n(e);var i=Math.abs(r[u]-l[u]),s=Math.abs(r[_]-l[_]);if(h||!c._options.draggable&&i>10&&i>s){var a=c._getNewTarget(r[u]-l[u]>0);a="circular"===c._instance._options.wrap?a.relative:a.static,o===e.target&&t(e.target).on("click.disable",function(e){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t(e.target).off("click.disable")}),"circular"===c._instance._options.wrap&&(c._removeClones(),c._instance._items=null),h=!1,c._instance[c._options.method](a,function(){"circular"!==c._instance._options.wrap&&(c._removeClones(),c._instance._items=null)})}t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe"),t(document).off("touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe")}function n(t){return void 0!==t.touches&&t.touches.length>0?{x:t.touches[0].pageX,y:t.touches[0].pageY}:void 0!==t.changedTouches&&t.changedTouches.length>0?{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY}:void 0!==t.pageX?{x:t.pageX,y:t.pageY}:{x:t.clientX,y:t.clientY}}var s,a,o,c=this,r={},l={},h=!1,u=this._instance.vertical?"y":"x",_=this._instance.vertical?"x":"y";this._element.on("touchstart.jcarouselSwipe mousedown.jcarouselSwipe",function(s){s=s.originalEvent||s||window.event,r=n(s),o=s.target||s.srcElement,c._options.draggable&&!c._instance.animating&&t(document).on("touchmove.jcarouselSwipe mousemove.jcarouselSwipe",e),t(document).on("touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe",i)})},_getNewTarget:function(t){var e,i=this._instance.target(),n=this._instance.index(i),s=0,a=this._instance.rtl&&!this._instance.vertical?!t:t;if(this._options.draggable)for(;;){if(e=this._instance.rtl&&!this._instance.vertical?i.offset()[this._instance.lt]+this._instance.dimension(i)-(this._carouselOffset+this._instance.clipping()):i.offset()[this._instance.lt]-this._carouselOffset,!i.length||t&&e>=0||!t&&e<=0)break;if(a){if(!(i=i.next()).length)break;n+=1}else{if(!(i=i.prev()).length)break;n-=1}s++}else n=a?n+1:n-1,s=1;return a?n+=Math.abs(s-this._options.perSwipe*Math.ceil(s/this._options.perSwipe)):n-=Math.abs(s-this._options.perSwipe*Math.ceil(s/this._options.perSwipe)),"first"===this._instance._options.wrap?n=Math.min(this._slidesCount-1,n):"last"===this._instance._options.wrap?n=Math.max(0,n):this._instance._options.wrap||(n=Math.max(0,Math.min(this._slidesCount-1,n))),n%=this._slidesCount,s=this._options.perSwipe*Math.ceil(s/this._options.perSwipe),{static:n,relative:(a?"+":"-")+"="+s}},_getListPosition:function(){var t=this._instance.list(),e=t.position();return this._instance.rtl&&(e.left=t.width()+e.left-this._carousel.width()),e[this._instance.lt]},_setListPosition:function(t){var e=this._instance.options("transitions"),i=!!e.transforms,n=!!e.transforms3d,s={},a="left"===this._instance.lt;t=t||0,n?s.transform="translate3d("+(a?t:0)+","+(a?0:t)+",0)":i?s.transform="translate("+(a?t:0)+","+(a?0:t)+")":s[this._instance.lt]=t,this._instance.list().css(s)},_addClones:function(){var e,i,n,s=this,a=this._instance,o=a.items(),c=a.first(),r=a.last(),l=a.dimension(t(window)),h=[],u=[],_=s._getListPosition(),p={};if(!a._options.wrap)return!1;if("last"!==a._options.wrap){for(i=0,n=0,e=c;io.length-1?0:n,i+=a.dimension(o.eq(n)),u.push(o.eq(n).clone().attr("data-jcarousel-clone",!0))):i+=a.dimension(e);a._items.last().after(u)}},_removeClones:function(){var t,e=this._instance.first().position()[this._instance.lt],i={};this._instance.list().find("[data-jcarousel-clone]").remove(),(t=e-this._instance.first().position()[this._instance.lt])&&(i[this._instance.lt]=this._getListPosition()+t+"px",this._instance.move(i))},_destroy:function(){this._element.off("touchstart.jcarouselSwipe mousedown.jcarouselSwipe"),t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe")},_reload:function(){this._create()}})}(jQuery);jQuery(function () {
// notice how you can overwrite the defaults for instances
jQuery.fn.multiSelect.defaults.minWidth = 170;
jQuery.fn.multiSelect.defaults.selectedList = 3;
jQuery.fn.multiSelect.defaults.noneSelectedText = i18n.elg_cars_JSNOTIFY.notifyoricare;
jQuery.fn.multiSelect.defaults.checkAllText = i18n.elg_cars_JSNOTIFY.notifyoricare;
jQuery.fn.multiSelect.defaults.unCheckAllText = i18n.elg_cars_JSNOTIFY.notifyunselect;
jQuery.fn.multiSelect.defaults.selectedText = '# ' + i18n.elg_cars_JSNOTIFY.selectate;
// $('#themeswitcher').themeswitcher({ loadTheme: 'blitzer' });
jQuery("select.multiselect#tipcombustibil, select.multiselect#transmission").multiSelect({
onCheck: doSearch
});
// default options
jQuery("select.multiselect150#culoareext, select#vehicle-exteriorcolor").multiSelect({
onCheck: doSearch,
minWidth: 150,
//colors must be described exactly in order the select's options are
colors: ['white', 'blue', 'silver', 'gold', 'azure', 'beige', 'yellow', 'grey', 'brown', 'black', 'orange', 'red', 'green', 'purple', 'burgundy']
});
jQuery("select.multiselect150#culoareint, select#vehicle-interiorcolor").multiSelect({
onCheck: doSearch,
minWidth: 150,
colors: ['white', 'beige', 'grey', 'brown', 'black', 'burgundy', 'others']
});
jQuery("select.multiselect150#tapiterie").multiSelect({
onCheck: doSearch,
minWidth: 150
});
jQuery("select.multiselect130").multiSelect({
onCheck: doSearch,
minWidth: 130
});
jQuery("select.multiselect200").multiSelect({
onCheck: doSearch,
minWidth: 220
});
jQuery("select.multiselect").multiSelect({
onCheck: doSearch
});
jQuery(".ui-multiselect").addClass('form-control');
});
jQuery(document).ready(function () {
toggleDisabled({
'1': 'marca2',
'2': 'model2',
'3': 'versiune2',
'4': 'caroserie2',
'5': 'categorie2'}, jQuery('#marca option:selected').val(), '');
toggleDisabled({
'1': 'marca3',
'2': 'model3',
'3': 'versiune3',
'4': 'caroserie3',
'5': 'categorie3'}, jQuery('#marca2 option:selected').val(), '');
/**
* attach events to all input/select/checkboxes etc. ... form elements.
* so that they will submit the form when it fires.
*/
if (jQuery('#search-form') != null) {
// attach an event to all specific field inputs
jQuery('#search-form').find('select#marca').bind('change', function () {
sessionStorage.as_1_make = this.selectedIndex;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': this.options[this.selectedIndex].value,
'auto_type': '1',
'element_id': 'model'
});
toggleDisabled({
'1': 'marca2',
'2': 'model2',
'3': 'versiune2',
'4': 'caroserie2'}, this.options[this.selectedIndex].value, '0');
});
jQuery('#search-form').find('select#model').bind('change', function () {
sessionStorage.as_1_model = this.selectedIndex;
});
jQuery('#search-form').find('select#vehicle-makeid-0').bind('change', function () {
sessionStorage.as_1_make = this.selectedIndex;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': this.options[this.selectedIndex].value,
'auto_type': '1',
'element_id': 'vehicle-modelid-0'});
doSearch();
});
jQuery('#search-form').find('select#vehicle-modelid-0').bind('change', function () {
sessionStorage.as_1_model = this.selectedIndex;
});
jQuery('#search-form').find('select#marca2').bind('change', function () {
sessionStorage.as_2_make = this.selectedIndex;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': this.options[this.selectedIndex].value,
'auto_type': '1',
'element_id': 'model2'});
toggleDisabled({
'1': 'marca3',
'2': 'model3',
'3': 'versiune3',
4: 'caroserie3'}, this.options[this.selectedIndex].value, '0');
});
jQuery('#search-form').find('select#model2').bind('change', function () {
sessionStorage.as_2_model = this.selectedIndex;
});
jQuery('#search-form').find('select#marca3').bind('change', function () {
sessionStorage.as_3_make = this.selectedIndex;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': this.options[this.selectedIndex].value,
'auto_type': '1',
'element_id': 'model3'});
});
jQuery('#search-form').find('select#model3').bind('change', function () {
sessionStorage.as_3_model = this.selectedIndex;
});
var select_make_1 = document.getElementById("marca");
var select_model_1 = document.getElementById("model");
var select_make_2 = document.getElementById("marca2");
var select_model_2 = document.getElementById("model2");
var select_make_3 = document.getElementById("marca3");
var select_model_3 = document.getElementById("model3");
var select_make_mobile = document.getElementById("vehicle-makeid-0");
var select_model_mobile = document.getElementById("vehicle-modelid-0");
if (sessionStorage.as_1_make && select_make_1) {
select_make_1.options[sessionStorage.as_1_make].selected = true;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': select_make_1.options[select_make_1.selectedIndex].value,
'auto_type': '1',
'element_id': 'model'
}, function () {
if (sessionStorage.as_1_model) {
select_model_1.options[sessionStorage.as_1_model].selected = true;
}
});
}
if (sessionStorage.as_2_make && select_make_2) {
select_make_2.options[sessionStorage.as_2_make].selected = true;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': select_make_2.options[select_make_2.selectedIndex].value,
'auto_type': '1',
'element_id': 'model2'
}, function () {
if (sessionStorage.as_2_model) {
select_model_2.options[sessionStorage.as_2_model].selected = true;
}
});
}
if (sessionStorage.as_3_make && select_make_3) {
select_make_3.options[sessionStorage.as_3_make].selected = true;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': select_make_3.options[select_make_3.selectedIndex].value,
'auto_type': '1',
'element_id': 'model3'
}, function () {
if (sessionStorage.as_3_model) {
select_model_3.options[sessionStorage.as_3_model].selected = true;
}
});
}
if (sessionStorage.as_1_make && select_make_mobile) {
select_make_mobile.options[sessionStorage.as_1_make].selected = true;
ajaxRequest({
'TODO': 'MODELS',
'ACTION': 'OPTION',
'vehicle:makeid': select_make_mobile.options[select_make_mobile.selectedIndex].value,
'auto_type': '1',
'element_id': 'vehicle-modelid-0'
}, function () {
if (sessionStorage.as_1_model) {
select_model_mobile.options[sessionStorage.as_1_model].selected = true;
}
});
}
jQuery('#search-form').find('input:text').bind('keyup', doSearch);
jQuery('#versiune').bind('change', doSearch);
jQuery('#versiune2').bind('change', doSearch);
jQuery('#versiune3').bind('change', doSearch);
jQuery('#oras').bind('change', doSearch);
//jQuery('#search-form').find('input[type=checkbox]').bind('change', doSearch);
/**
* multi-selects send 2 requests to the server, one for select element and the other for input checkbox
* make this hack by checking if the checkbox id has the string 'ui-multiselect' ... and skip in this case.
*/
jQuery('#search-form').find('input[type=checkbox]').each(function (index) {
var str = jQuery(this).attr("id");
if (str != null && str.substring(0, 14) == 'ui-multiselect') {
} else {
jQuery(this).bind('change', doSearch);
}
});
/**
* multi-selects au Select-all si Unselect-all, dar nu au niciun eveniment si nu se face doSearch.
* Atasez un eveniment pentru ele.
*/
jQuery('.ui-multiselect-none').bind("click", doSearch);
jQuery('.ui-multiselect-all').bind("click", doSearch);
}
if (jQuery('#judet option:selected').val() == '') {
jQuery('#judet').attr('disabled', true);
}
jQuery('#tara_seller').change(function () {
var value = jQuery('#tara_seller').val();
if (value == 'RO') {
jQuery('#judet').attr('disabled', false);
} else {
jQuery('#judet').val('');
jQuery('#judet').attr('disabled', true);
}
});
jQuery('.jTip').each(function () {
target_div = jQuery(this).attr('rel');
if (jQuery('#' + target_div).is(':empty')) {
jQuery(this).hide();
}
});
jQuery("select.multiselect").each(function () {
jQuery(this).parent().append("");
}).change(function () {
jQuery(this).siblings("input[type=text]").val(jQuery(this).val() === "" ? i18n.elg_cars_JSNOTIFY.notifyoricare : jQuery(this).val());
jQuery(this).siblings("input[type=hidden]").val(jQuery(this).val());
});
jQuery("select.with-free-input").each(function () {
var maxlength = "maxlength='4'";
if(jQuery(this).attr('id') == 'kilometrajdela' || jQuery(this).attr('id') == 'kilometrajpanala') {
maxlength = "maxlength='6'";
}
if(jQuery(this).attr('id') == 'pretdela' || jQuery(this).attr('id') == 'pretpanala') {
maxlength = "maxlength='7'";
}
jQuery(this).parent().css('position', 'relative');
if (jQuery(this).attr('id') === "puteredela" || jQuery(this).attr('id') === "puterepanala") {
jQuery(this).parent().append("");
} else {
jQuery(this).parent().append("");
}
jQuery(this).parent().append("");
jQuery(this).attr('name', '_' + jQuery(this).attr('name'));
jQuery(this).siblings("input[type=text]").keypress(function (e) {
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
jQuery(this).siblings("input[type=text]").change (function () {
jQuery(this).siblings("input[type=hidden]").val(jQuery(this).val() === "Oricare" ? "" : jQuery(this).val());
jQuery(this).siblings("select.with-free-input").attr('selectedIndex', 1);
});
jQuery(this).siblings("input[type=text]").focusout (function () {
if(jQuery(this).val() === "") {
jQuery(this).val("Oricare");
} else {
if (jQuery(this).attr('name') === "__vehicle[powerkw][from]" || jQuery(this).attr('name') === "__vehicle[powerkw][to]") {
//get kW number from string and add kW + HP conversion at the end
jQuery(this).val(getEnginePowerString(jQuery(this).val()));
}
}
});
jQuery(this).siblings("input[type=text]").focus (function () {
if(jQuery(this).val() === "Oricare") {
jQuery(this).val("");
} else {
if (jQuery(this).attr('name') === "__vehicle[powerkw][from]" || jQuery(this).attr('name') === "__vehicle[powerkw][to]") {
//strip value to only kW number
jQuery(this).val(getEngineKWPowerNumber(jQuery(this).val()));
}
}
});
jQuery(this).siblings("input[type=text]").bind('focusout', doSearch);
}).change(function () {
if (jQuery(this).attr('id') === "puteredela" || jQuery(this).attr('id') === "puterepanala") {
jQuery(this).siblings("input[type=text]").val(jQuery(this).val() === "" ? i18n.elg_cars_JSNOTIFY.notifyoricare : jQuery(this).find("option:selected").text());
} else {
jQuery(this).siblings("input[type=text]").val(jQuery(this).val() === "" ? i18n.elg_cars_JSNOTIFY.notifyoricare : jQuery(this).val());
}
jQuery(this).siblings("input[type=hidden]").val(jQuery(this).val());
});
if (jQuery('#search-form') != null) {
jQuery('#search-form').find('select').bind('change', function () {
doSearch();
});
}
doSearch();
});
function getEngineKWPowerNumber(val) {
var engine_kw = parseInt(val.substr(0,val.indexOf(' ')));
if (isNaN(engine_kw)) {
return val;
} else {
return engine_kw;
}
}
function getEnginePowerString(val) {
var engine_kw = val;
var engine_hp = parseInt(val) * 1.359;
return engine_kw.toString() + i18n.elg_cars_JSNOTIFY.powerkw + " (" + Math.ceil(engine_hp).toString() + i18n.elg_cars_JSNOTIFY.powercp + ")";
}/*
* jQuery plugin for vizualizate si salvate (VS)
*
*/
var $LoadingImage = '';
(function($){
$.fn.vs = function(){}
/**
*reload boxes
*/
$.fn.vsReload = function() {
var $viewedBodyObject = $("#vs_body");
var $parkedBodyObject = $("#vs_body_parked");
// put the loading image to both boxes.
$viewedBodyObject.html($LoadingImage);
$parkedBodyObject.html($LoadingImage);
// just reload boxes
var $action = 'refresh';
$.post(url, {todo:'VS_VEHICLE_SAVE', action:$action}, function($result){
$('#vs').replaceWith($result.content);
var $offset = $("#compare_box").offset();
if ($offset !== null && $offset.top > 500) {
$.fn.vs.scrollToBaseBox();
}
}, "json");
}
/**
* Previous function.
*/
$.fn.vs.Prev = function($object, $start, $count){
// check the start.
if ($start - $count <= 0) {
return;
}
// create the from param to be sent to the server
var $params = new Array();
$params.push({name:'from', value:$start - $count - 1});
$.fn.vs.getContent($params, $object);
};
/**
* Next function
*/
$.fn.vs.Next = function($object, $end, $records){
// get out if not applicable.
if ($end >= $records) {
return;
}
// create the form param to be sent to the server.
var $params = new Array();
$params.push({name:'from', value:$end});
// get the data through ajax
$.fn.vs.getContent($params, $object);
};
/**
* Get content of the next/previous.
*/
$.fn.vs.getContent = function($params, $object) {
// current a tag clicked
var $jObject = $($object);
var $jParentObject = $jObject.parents(".vc_body");
var $action = 'viewed';
if ($jParentObject.attr("id") == 'vs_body_parked') {
$action = 'parked';
}
$params.push({name:'todo', value:'VS_NAVIGATION'});
$params.push({name:'action', value: $action});
$jParentObject.html($LoadingImage);
$.post(url, $params, function($result){
if ($result.content !== null && $result.content !== undefined) {
$jParentObject.html($result.content);
/*.animate({
height: "toggle",
opacity: "show"
}, "slow" );*/
}
$.fn.vs.scrollToBaseBox();
}, 'json');
};
$.fn.vs.toggle = function($object, $containerid) {
var $jContainer = $("#"+$containerid);
var $jObject = $($object);
// $containerid is the id of the div content with viewed cars.
$jContainer.toggle('slow');
// $object is the current clicked a tag.
if ('vc_opened' == $($object).attr('class') ) {
$jObject.attr('class', 'vc_closed');
if ($containerid == 'vs_body_parked') {
$("#vs_bottom_opened").remove();
$jObject.parent().attr('class', "vc_btn_bgr last");
}
} else {
if ($containerid == 'vs_body_parked') {
$jContainer.after('
');
$jObject.parent().attr('class', "vc_btn_bgr");
}
$jObject.attr('class', 'vc_opened');
}
$.fn.vs.scrollToBaseBox();
};
$.fn.vs.salveaza = function($object, $vehicleUid, $vehicleTitle) {
// jquery object of the current clicked a element
var $jObject = $($object);
// parent that is the body which holds the content.
var $currentBodyObject = $jObject.parents(".vc_body");
var $topParentObject = $jObject.parents(".left_vc_box");
// get the other parent ( if saved vehicle -> viewed, if viewed vehicle -> saved )
if ($currentBodyObject.attr("id") == 'vs_body') {
var $viewedBodyObject = $currentBodyObject;
var $parkedBodyObject = $currentBodyObject.nextAll(".vc_body");
} else {
var $viewedBodyObject = $currentBodyObject.prevAll(".vc_body");
var $parkedBodyObject = $currentBodyObject;
}
// save or delete?
var $action = 'save_icon' == $jObject.attr("class") ? 'save' : 'delete';
// put the loading image to both boxes.
$viewedBodyObject.html($LoadingImage);
$parkedBodyObject.html($LoadingImage);
// fac un post pentru a salva sau ÅŸterge maÅŸina.
$.post(url, {todo:'VS_VEHICLE_SAVE', action:$action, 'vehicle[uid]':$vehicleUid, 'vehicle[title]':$vehicleTitle}, function($result){
// buttons save from top, only if provided vehicleUid is equal with the current loaded car.
if ($vehicleUid == $("#vehicle_uid").val()) {
$.fn.vs.toggleButonSalveaza($jObject.attr("class"), $result.label, $vehicleUid, $vehicleTitle);
}
$topParentObject.replaceWith($result.content);
$.fn.vs.scrollToBaseBox();
}, "json");
};
$.fn.vs.salveazaTop = function ($object, $vehicleUid, $vehicleTitle) {
// get the jQuery object
var $jObject = $($object);
// get the parent of the boxes
var $topParentBoxes = $("#vs");
// save or delete?
var $action = 'save_icon' == $jObject.attr("rel") ? 'save' : 'delete';
// fac un post pentru a salva sau ÅŸterge maÅŸina.
$.post(url, {todo:'VS_VEHICLE_SAVE', action:$action, 'vehicle[uid]':$vehicleUid, 'vehicle[title]':$vehicleTitle}, function($result){
// buttons save from top.
$.fn.vs.toggleButonSalveaza($jObject.attr("rel"), $result.label, $vehicleUid, $vehicleTitle, 'single');
$topParentBoxes.replaceWith($result.content);
//$.fn.vs.scrollToBaseBox();
}, "json");
};
// save into parking when in listing of vehicles
$.fn.vs.salveazaList = function ($object, $vehicleUid, $vehicleTitle) {
// save or delete?
var $action = 'save_icon' == $($object).attr("rel") ? 'save' : 'delete';
// fac un post pentru a salva sau ÅŸterge maÅŸina.
$.post(url, {todo:'VS_VEHICLE_SAVE_LIST', action:$action, 'vehicle[uid]':$vehicleUid, 'vehicle[title]':$vehicleTitle}, function($result){
// buttons save from top.
$.fn.vs.toggleButonSalveaza($($object).attr("rel"), $result.label, $vehicleUid, $vehicleTitle, 'list');
$.fn.vs.scrollToBaseBox();
}, "json");
};
// toggle between saved or removed link at park vehicle.
$.fn.vs.toggleButonSalveaza = function($status, $label, $vehicleUid, $vehicleTitle, todo) {
// status means the save or delete...
var $rel = 'save_icon' == $status ? 'remove_icon' : 'save_icon';
var $className = 'save_icon' == $status ? 'saving_remove' : 'saving';
// the link is differnt if it is created for list or single
var $link = ''+$label+'';
var $park_link = "#park_link";
if (todo == 'list') {
$link = ''+$label+'';
$park_link += "_"+$vehicleUid;
}
$($park_link).replaceWith($link);
};
$.fn.vs.scrollToBaseBox = function() {
$("html,body").animate({
scrollTop: $("#vs").offset().top
});
};
})(jQuery);/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
(function($){
$.fn.customAccordion = function() {
return this.each(function() {
$obj = $(this);
var body = $obj.html();
// add onclick event on all a elements with parent
$("div.wp_head_bgr a", $obj).click(function(event){
event.preventDefault();
// this id the
$parent = $(this).parent();
$id = $parent.attr("id").split("_");
$class = $parent.attr("class").split(" ");
// check if content exists. Otherwise make a ajax call for the content and add it after the parent.
if ($('#c_'+$id[1]).html() === null) {
$.fn.customAccordion.getContentAndSave({"id":$id[1],"position":$class[1]}, $parent);
// it is important to call Adjustments in ajaxComplete method, otherwise it might get un-syncronized.
$("#r_"+$id[1]).ajaxComplete(function(){
// $(this).next().show(300);
$.fn.customAccordion.Adjustments($id, $class, $obj);
// remove loading image if exists.
$("#img_"+$id[1]).remove();
// initialize the dialog
/*$("#c_"+$id[1]+" a.dialog_link").click(function(){
var $long_description = $("#l_"+$id[1]).html();
event.preventDefault();
var title = $(this).attr('name');
var action = new Array();
dialogLinkClick(title,action, undefined, $(this));
return false;
});*/
});
} else {
$.fn.customAccordion.Adjustments($id, $class, $obj);
}
return false;
});
});
};
$.fn.customAccordion.Adjustments = function($id, $class, $obj) {
// close all contents and open the required one
$.fn.customAccordion.toggle($id[1]);
// fix the last item, if that's the one being opened.
$.fn.customAccordion.adjustLastElement($id, $class, $obj);
};
/**
* make an ajax post request to the server and get the content of the block being opened.
*/
$.fn.customAccordion.getContentAndSave = function($params, $parent){
// put an image loader near the title.
var $image = '';
$parent.append($image);
// make the post to the server to grabb the content of the tab.
$.post(url, "todo=AVANTAJE_WEBCAR&uid="+$params.id+"&position="+$params.position, function(result){
if (result.content !== null) {
result.content = result.content.replace('wp_opened_content"', 'wp_opened_content" style="display:none;"');
$parent.after(result.content);
}
}, "json");
return content;
};
/*
* toggle the content by hidding the opened one and showing the clicked one.
*/
$.fn.customAccordion.toggle = function($id){
if ($("#r_"+$id).find("a").attr("class") == 'wp_closed') {
// hide opened content
$("div.wp_opened_content").hide();
$("a.wp_opened").attr("class", "wp_closed");
// show and change the arrow
$("#r_"+$id).find("a.wp_closed").attr("class", "wp_opened");
$("#c_"+$id).slideDown("500", "linear");
}
};
/**
* last element has additional content and rules which have to be fixed.
*/
$.fn.customAccordion.adjustLastElement = function($id, $class, $object){
// remove first the div with class bottom_opened
$("div.left_wp_box > div.bottom_opened").remove();
// add the div with class bottom_opened if the box being opened is the last one
if ($class[1] == 'last' || $class[1] == 'last_opened') {
$('#r_'+$id[1], $object).attr("class", "wp_head_bgr last_opened");
$object.after('