');
/*
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: '