(function (c) {
function ga(z, s) {
function m() {
u = j.length;
p = v * 2 / u;
for (var b = 0; b < u; b++) ha(b);
o(g);
c.browser.msie || n(0);
c(document).bind("mousemove", function (d) {
k = d.pagex;
q = d.pagey
});
z.onselectstart = function () {
return false
};
a.settings.autoscroll && a();
a.settings.mousescroll && o();
a.settings.mousedrag && x();
a.settings.mousewheel && y();
a.settings.scrollbar && ia();
a.settings.tooltip && c('
').css("opacity", 0).appendto(i)
}
function ha(b) {
var d = c('').appendto(i);
d[0].id='image' + (b + 1);
d[0].src='images/' + 'image' + (b + 1) + '.jpg';
z.push(d);
d.css({
width: a.settings.itemwidth,
h: a.settings.itemheight
}).data({
w: a.settings.itemwidth,
h: a.settings.itemheight,
index: b
}).addclass("out").bind({
mouseover: function () {
c(this).hasclass("out") && c(this).removeclass("out").addclass("over");
a.settings.tooltip && ja(b);
if (a.settings.mousescroll) b = a.settings.mousescrollspeedhover;
var e = {
type: "itemmouseover",
index: b,
data: j[b]
};
c.isfunction(a.settings.itemmouseover) && a.settings.itemmouseover.call(this, e)
},
mouseout: function () {
c(this).hasclass("over") &&
c(this).removeclass("over").addclass("out");
a.settings.tooltip && ka();
if (a.settings.mousescroll) b = a.settings.mousescrollspeed;
var e = {
type: "itemmouseout",
index: b,
data: j[b]
};
c.isfunction(a.settings.itemmouseout) && a.settings.itemmouseout.call(this, e)
},
click: function () {
i.find(".click").removeclass("click").addclass("out");
c(this).removeclass("over").addclass("click");
a.settings.scrollonclick && c(b);
if (j[b].link) window.open(j[b].link, j[b].linktarget || a.settings.linktarget);
var e = {
type: "itemclick",
index: b,
data: j[b]
};
c.isfunction(a.settings.itemclick) && a.settings.itemclick.call(this, e)
}
});
j[b].link && d.css("cursor", "pointer");
c.browser.msie && n(b)
}
function n(b) {
var d = j[b].path,
e = z[b];
c("").load(function () {
var h = parseint(c(this).attr("width") || c(this).prop("width")),
f = parseint(c(this).attr("height") || c(this).prop("height"));
if (a.settings.crop) e.css("background-image", "url(" + d + ")");
else {
e.attr("src", d);
e.css("background-image", "none")
}
if (a.settings.resize)
if (a.settings.maintainaspectratio) {
scalex =
a.settings.itemwidth / h;
scaley = a.settings.itemheight / f;
if (scalex < scaley) {
h *= scalex;
f *= scalex
} else {
h *= scaley;
f *= scaley
}
} else {
h = a.settings.itemwidth;
f = a.settings.itemheigh
} e.css({
width: h,
height: f
});
e.data({
w: h,
h: f
});
o(g);
c.browser.msie || b < u - 1 && n(++b)
}).attr("src", d)
}
function o(b) {
i.find(".carousel-item").each(function (d) {
var e = c(this),
h = e.data("w"),
f = e.data("h"),
d = math.sin(-(p * d) + v * 0.5 + b * w) * a.settings.verticalradius + p - f * 0.5,
r = (d - ($ - f * 0.5)) / (aa - $) * (1 - a.settings.scaleratio) + a.settings.scaleratio;
e.css({
width: h *
r,
height: f * r,
left: math.cos(-(p * d) + v * 0.5 + b * w) * a.settings.horizontalradius + q - h * 0.5 + h * (1 - r) / 2,
top: d + f * (1 - r) / 2,
"z-index": math.floor(r * 10 * u)
})
});
a.settings.scrollbar && !x && la(r())
}
function c(b) {
l = b;
var d = p * (180 / v) * b % 360;
g %= 360;
if (math.abs(d - g) > 180) d += d > g ? -360 : 360;
if (d - g > 180 && d > g) d -= 360;
e();
s = setinterval(function () {
if (math.abs(d - g) > 0.5) {
g += (d - g) * (a.settings.scrollspeed / 100);
o(g)
} else f()
}, 30);
b = {
type: "itemselect",
index: l,
data: j[l]
};
c.isfunction(a.settings.itemselect) && a.settings.itemselect.call(this, b)
}
function ba() {
c(l == j.length - 1 ? 0 : l + 1)
}
function ca() {
c(l == 0 ? j.length - 1 : l - 1)
}
function a() {
if (!(g && a.settings.pauseautoscrolliftooltip)) {
a.settings.autoscroll = true;
t = settimeout(function () {
if (a.settings.autoscrolldirection == "next") ba();
else a.settings.autoscrolldirection == "previous" && ca()
}, a.settings.autoscrolldelay)
}
}
function o() {
a.settings.mousescroll = true;
b = a.settings.mousescrollspeed;
var b = 0,
d = a.settings.mousescrollreverse ? -1 : 1;
h = setinterval(function () {
if (k > i.offset().left && k < i.offset().left + a.settings.width &&
q > i.offset().top && q < i.offset().top + a.settings.height) {
b = d * (k - (i.offset().left + q)) * (b / 1e3);
g += b;
o(g)
} else if (math.abs(b) > 0.1) {
b *= a.settings.mousescrollease / 100;
g += b;
o(g)
} else b = 0
}, 30)
}
function x() {
function b(f) {
t = f.pagex;
if (!i) {
e();
d()
}
}
function d() {
i = true;
j = setinterval(function () {
var f = (360 * (h * (t - da) / (100 * a.settings.mousedragspeed)) + e - g) * (a.settings.mousedragease / 100);
if ((f >= 0 ? f : -f) > 0.1) {
g += f;
l = math.round(g * w / p);
o(g)
} else f()
}, 30)
}
a.settings.mousedrag = true;
var e = 0,
h = a.settings.mousedragreverse ? 1 :
-1;
c(document).bind("mousedown", function (f) {
if (k > i.offset().left && k < i.offset().left + a.settings.width && q > i.offset().top && q < i.offset().top + a.settings.height) {
t = da = f.pagex;
e = g;
c(document).bind("mousemove", b)
}
});
c(document).bind("mouseup", function () {
c(document).unbind("mousemove", b)
})
}
function y() {
a.settings.mousewheel = true;
var b = 0,
d = a.settings.mousewheelreverse ? -1 : 1;
i.bind("mousewheel", function (e, h) {
e.preventdefault();
if (!k) {
e();
k = true;
b = g;
l = setinterval(function () {
if (math.abs(b - g) > 0.5) {
g += (b - g) * (a.settings.mousewheelspeed /
100);
l = math.round(g * w / p);
o(g)
} else f()
}, 30)
}
b += d * h * 10
})
}
function ia() {
function b() {
n = k - h.offset().left - ea;
d()
}
function d() {
if (n < 0) n = 0;
else if (n > parseint(h.css("width")) - parseint(f.css("width"))) n = parseint(h.css("width")) - parseint(f.css("width"));
x && f.css("left", n);
u = n / (parseint(h.css("width")) - parseint(f.css("width")));
if (!m) {
e();
m = true;
g %= 360;
v = setinterval(function () {
if (math.abs(r() - u) > 0.0010) {
var w = (u - r()) * (a.settings.scrollbarease / 100);
g += w * 360;
l = math.round(g * w / p);
o(g)
} else m && f()
}, 30)
}
}
var e =
c('').appendto(i),
h = c('').appendto(e),
f = c('').appendto(h),
d = c('').appendto(e),
r = c('').appendto(e),
n = 0,
ea;
e.css({
top: aa,
left: q - parseint(e.css("width")) / 2
});
f.bind("mousedown", function (w) {
w.preventdefault();
ea = k - f.offset().left;
x = true;
c(document).bind("mousemove", b)
});
c(document).bind("mouseup", function () {
if (x) {
x = false;
c(document).unbind("mousemove", b)
}
});
d.bind("click", function () {
n =
parseint(f.css("left")) - a.settings.arrowscrollamount;
d()
});
r.bind("click", function () {
n = parseint(f.css("left")) + a.settings.arrowscrollamount;
d()
})
}
function la(b) {
var d = i.find(".scrollbar").find(".track"),
e = d.find(".thumb");
e.css("left", b * (parseint(d.css("width")) - parseint(e.css("width"))))
}
function r() {
var b = g % 360 / 360;
if (b < 0) b += 1;
return b
}
function e() {
fa();
if (!y) {
y = true;
c.isfunction(a.settings.scrollstart) && a.settings.scrollstart.call(this)
}
}
function f() {
fa();
if (y) {
y = false;
c.isfunction(a.settings.scrollcomplete) &&
a.settings.scrollcomplete.call(this)
}
a.settings.mousescroll && o();
a.settings.autoscroll && a()
}
function fa() {
h && clearinterval(h);
if (j) {
i = false;
clearinterval(j)
}
if (l) {
k = false;
clearinterval(l)
}
if (v) {
m = false;
clearinterval(v)
}
s && clearinterval(s);
t && cleartimeout(t)
}
function ja(b) {
if (b = j[b].tooltip) {
g = true;
var d = i.find(".tooltip");
d.find("p").html(b);
d.stop().animate({
opacity: 1
}, 300);
var e = -d.outerwidth() / 2,
h = 0 - d.outerheight() - parseint(d.css("marginbottom"));
d.css({
left: k - i.offset().left + e,
top: q - i.offset().top +
h
});
c(document).bind("mousemove.tooltip", function () {
d.css({
left: k - i.offset().left + e,
top: q - i.offset().top + h
})
});
t && a.settings.pauseautoscrolliftooltip && cleartimeout(t)
}
}
function ka() {
if (g) {
g = false;
var b = i.find(".tooltip");
b.stop().animate({
opacity: 0
}, 200, function () {
c(document).unbind("mousemove.tooltip");
b.css("left", -9999)
});
a.settings.autoscroll && a.settings.pauseautoscrolliftooltip && a()
}
}
this.settings = c.extend({}, c.fn.carousel.defaults, s);
var i = c(z),
a = this,
l = 0,
j = [],
z = [],
v = math.pi,
w = v / 180,
s, t, h, j,
l, v, b = a.settings.mousescrollspeed,
k, q, t = 0,
da = 0,
i = false,
k = false,
x = false,
m = false,
u = 0,
g = 0,
q = a.settings.width / 2,
p = a.settings.height / 2,
$ = p - a.settings.verticalradius,
aa = p + a.settings.verticalradius,
p, u, y = false,
g = false;
(function () {
i.addclass("carousel").css({
width: a.settings.width,
height: a.settings.height
});
if (a.settings.xmlsource) {
i.empty();
c.ajax({
type: "get",
url: a.settings.xmlsource,
datatype: c.browser.msie ? "text" : "xml",
success: function (b) {
var d;
if (c.browser.msie) {
d = new activexobject("microsoft.xmldom");
d.async = false;
d.loadxml(b)
} else d = b;
c(d).find("item").each(function () {
for (var e = {}, h = 0; h < c(this).children().length; h++) {
var f = c(this).children()[h];
e[f.nodename] = c(this).find(f.nodename).text()
}
j.push(e)
});
m()
}
})
} else {
i.children().each(function () {
for (var b = {}, d = 0; d < c(this).children().length; d++) {
var e = c(this).children()[d];
if (c(e).is("a")) {
b.path = c(e).find("img").attr("src");
b.link = c(e).attr("href");
if (c(e).attr("target")) b.linktarget = c(e).attr("target")
} else if (c(e).is("img")) b.path = c(e).attr("src");
else b[c(e).attr("class")] = c(e).html()
}
j.push(b)
});
i.empty();
m()
}
})();
this.startautoscroll = a;
this.stopautoscroll = function () {
a.settings.autoscroll = false;
cleartimeout(t)
};
this.startmousescroll = o;
this.stopmousescroll = function () {
a.settings.mousescroll = false;
clearinterval(h)
};
this.startmousedrag = x;
this.stopmousedrag = function () {
i = a.settings.mousedrag = false;
clearinterval(j)
};
this.startmousewheel = y;
this.stopmousewheel = function () {
k = a.settings.mousewheel = false;
clearinterval(l)
};
this.scrolltoitem = c;
this.scrolltonext =
ba;
this.scrolltoprevious = ca;
this.isscrolling = function () {
return y
}
}
c.fn.carousel = function (z) {
for (var s = [], m = 0; m < this.length; m++)
if (!this[m].carousel) {
this[m].carousel = new ga(this[m], z);
s.push(this[m].carousel)
} return s.length > 1 ? s : s[0]
};
c.fn.carousel.defaults = {
xmlsource: null,
width: 500,
height: 300,
itemwidth: 100,
itemheight: 100,
horizontalradius: 250,
verticalradius: 100,
resize: true,
maintainaspectratio: true,
crop: false,
scaleratio: 0.5,
mousescroll: false,
scrollonclick: true,
mousedrag: false,
scrollbar: false,
arrowscrollamount: 50,
tooltip: true,
mousescrollease: 90,
mousedragease: 10,
scrollbarease: 10,
scrollspeed: 10,
mousedragspeed: 20,
mousescrollspeed: 10,
mousescrollspeedhover: 3,
mousewheel: false,
mousewheelspeed: 10,
mousescrollreverse: false,
mousedragreverse: false,
mousewheelreverse: false,
autoscroll: false,
autoscrolldirection: "next",
autoscrolldelay: 3e3,
pauseautoscrolliftooltip: true,
linktarget: "_blank",
itemselect: null,
itemclick: null,
itemmouseover: null,
itemmouseout: null,
scrollstart: null,
scrollcomplete: null
}
})(jquery);