(function(f) {
f.fn.qtip = function(B, u) {
var y, t, A, s, x, w, v, z;
if( typeof B == "string") {
if( typeof f(this).data("qtip") !== "object") {
f.fn.qtip.log.error.call(self, 1, f.fn.qtip.constants.NO_TOOLTIP_PRESENT, false)
}
if(B == "api") {
return f(this).data("qtip").interfaces[f(this).data("qtip").current]
} else {
if(B == "interfaces") {
return f(this).data("qtip").interfaces
}
}
} else {
if(!B) {
B = {}
}
if( typeof B.content !== "object" || (B.content.jquery && B.content.length > 0)) {
B.content = {
text : B.content
}
}
if( typeof B.content.title !== "object") {
B.content.title = {
text : B.content.title
}
}
if( typeof B.position !== "object") {
B.position = {
corner : B.position
}
}
if( typeof B.position.corner !== "object") {
B.position.corner = {
target : B.position.corner,
tooltip : B.position.corner
}
}
if( typeof B.show !== "object") {
B.show = {
when : B.show
}
}
if( typeof B.show.when !== "object") {
B.show.when = {
event : B.show.when
}
}
if( typeof B.show.effect !== "object") {
B.show.effect = {
type : B.show.effect
}
}
if( typeof B.hide !== "object") {
B.hide = {
when : B.hide
}
}
if( typeof B.hide.when !== "object") {
B.hide.when = {
event : B.hide.when
}
}
if( typeof B.hide.effect !== "object") {
B.hide.effect = {
type : B.hide.effect
}
}
if( typeof B.style !== "object") {
B.style = {
name : B.style
}
}
B.style = c(B.style);
s = f.extend(true, {}, f.fn.qtip.defaults, B);
s.style = a.call({
options : s
}, s.style);
s.user = f.extend(true, {}, B)
}
return f(this).each(function() {
if( typeof B == "string") {
w = B.toLowerCase();
A = f(this).qtip("interfaces");
if( typeof A == "object") {
if(u === true && w == "destroy") {
while(A.length > 0) {
A[A.length - 1].destroy()
}
} else {
if(u !== true) {
A = [f(this).qtip("api")]
}
for( y = 0; y < A.length; y++) {
if(w == "destroy") {
A[y].destroy()
} else {
if(A[y].status.rendered === true) {
if(w == "show") {
A[y].show()
} else {
if(w == "hide") {
A[y].hide()
} else {
if(w == "focus") {
A[y].focus()
} else {
if(w == "disable") {
A[y].disable(true)
} else {
if(w == "enable") {
A[y].disable(false)
}
}
}
}
}
}
}
}
}
}
} else {
v = f.extend(true, {}, s);
v.hide.effect.length = s.hide.effect.length;
v.show.effect.length = s.show.effect.length;
if(v.position.container === false) {
v.position.container = f(document.body)
}
if(v.position.target === false) {
v.position.target = f(this)
}
if(v.show.when.target === false) {
v.show.when.target = f(this)
}
if(v.hide.when.target === false) {
v.hide.when.target = f(this)
}
t = f.fn.qtip.interfaces.length;
for( y = 0; y < t; y++) {
if( typeof f.fn.qtip.interfaces[y] == "undefined") {
t = y;
break
}
}
x = new d(f(this), v, t);
f.fn.qtip.interfaces[t] = x;
if( typeof f(this).data("qtip") == "object") {
if( typeof f(this).attr("qtip") === "undefined") {
f(this).data("qtip").current = f(this).data("qtip").interfaces.length
}
f(this).data("qtip").interfaces.push(x)
} else {
f(this).data("qtip", {
current : 0,
interfaces : [x]
})
}
if(v.content.prerender === false && v.show.when.event !== false && v.show.ready !== true) {
v.show.when.target.bind(v.show.when.event + ".qtip-" + t + "-create", {
qtip : t
}, function(C) {
z = f.fn.qtip.interfaces[C.data.qtip];
z.options.show.when.target.unbind(z.options.show.when.event + ".qtip-" + C.data.qtip + "-create");
z.cache.mouse = {
x : C.pageX,
y : C.pageY
};
p.call(z);
z.options.show.when.target.trigger(z.options.show.when.event)
})
} else {
x.cache.mouse = {
x : v.show.when.target.offset().left,
y : v.show.when.target.offset().top
};
p.call(x)
}
}
})
};
function d(u, t, v) {
var s = this;
s.id = v;
s.options = t;
s.status = {
animated : false,
rendered : false,
disabled : false,
focused : false
};
s.elements = {
target : u.addClass(s.options.style.classes.target),
tooltip : null,
wrapper : null,
content : null,
contentWrapper : null,
title : null,
button : null,
tip : null,
bgiframe : null
};
s.cache = {
mouse : {},
position : {},
toggle : 0
};
s.timers = {};
f.extend(s, s.options.api, {
show : function(y) {
var x, z;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "show")
}
if(s.elements.tooltip.css("display") !== "none") {
return s
}
s.elements.tooltip.stop(true, false);
x = s.beforeShow.call(s, y);
if(x === false) {
return s
}
function w() {
if(s.options.position.type !== "static") {
s.focus()
}
s.onShow.call(s, y);
if(f.browser.msie) {
s.elements.tooltip.get(0).style.removeAttribute("filter")
}
}
s.cache.toggle = 1;
if(s.options.position.type !== "static") {
s.updatePosition(y, (s.options.show.effect.length > 0))
}
if( typeof s.options.show.solo == "object") {
z = f(s.options.show.solo)
} else {
if(s.options.show.solo === true) {
z = f("div.qtip").not(s.elements.tooltip)
}
}
if(z) {
z.each(function() {
if(f(this).qtip("api").status.rendered === true) {
f(this).qtip("api").hide()
}
})
}
if( typeof s.options.show.effect.type == "function") {
s.options.show.effect.type.call(s.elements.tooltip, s.options.show.effect.length);
s.elements.tooltip.queue(function() {w();
f(this).dequeue()
})
} else {
switch(s.options.show.effect.type.toLowerCase()) {
case"fade":
s.elements.tooltip.fadeIn(s.options.show.effect.length, w);
break;
case"slide":
s.elements.tooltip.slideDown(s.options.show.effect.length, function() {w();
if(s.options.position.type !== "static") {
s.updatePosition(y, true)
}
});
break;
case"grow":
s.elements.tooltip.show(s.options.show.effect.length, w);
break;
default:
s.elements.tooltip.show(null, w);
break
}
s.elements.tooltip.addClass(s.options.style.classes.active)
}
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_SHOWN, "show")
},
hide : function(y) {
var x;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "hide")
} else {
if(s.elements.tooltip.css("display") === "none") {
return s
}
}clearTimeout(s.timers.show);
s.elements.tooltip.stop(true, false);
x = s.beforeHide.call(s, y);
if(x === false) {
return s
}
function w() {
s.onHide.call(s, y)
}
s.cache.toggle = 0;
if( typeof s.options.hide.effect.type == "function") {
s.options.hide.effect.type.call(s.elements.tooltip, s.options.hide.effect.length);
s.elements.tooltip.queue(function() {w();
f(this).dequeue()
})
} else {
switch(s.options.hide.effect.type.toLowerCase()) {
case"fade":
s.elements.tooltip.fadeOut(s.options.hide.effect.length, w);
break;
case"slide":
s.elements.tooltip.slideUp(s.options.hide.effect.length, w);
break;
case"grow":
s.elements.tooltip.hide(s.options.hide.effect.length, w);
break;
default:
s.elements.tooltip.hide(null, w);
break
}
s.elements.tooltip.removeClass(s.options.style.classes.active)
}
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_HIDDEN, "hide")
},
updatePosition : function(w, x) {
var C, G, L, J, H, E, y, I, B, D, K, A, F, z;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "updatePosition")
} else {
if(s.options.position.type == "static") {
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.CANNOT_POSITION_STATIC, "updatePosition")
}
}
G = {
position : {
left : 0,
top : 0
},
dimensions : {
height : 0,
width : 0
},
corner : s.options.position.corner.target
};
L = {
position : s.getPosition(),
dimensions : s.getDimensions(),
corner : s.options.position.corner.tooltip
};
if(s.options.position.target !== "mouse") {
if(s.options.position.target.get(0).nodeName.toLowerCase() == "area") {
J = s.options.position.target.attr("coords").split(",");
for( C = 0; C < J.length; C++) {
J[C] = parseInt(J[C])
}
H = s.options.position.target.parent("map").attr("name");
E = f('img[usemap="#' + H + '"]:first').offset();
G.position = {
left : Math.floor(E.left + J[0]),
top : Math.floor(E.top + J[1])
};
switch(s.options.position.target.attr("shape").toLowerCase()) {
case"rect":
G.dimensions = {
width : Math.ceil(Math.abs(J[2] - J[0])),
height : Math.ceil(Math.abs(J[3] - J[1]))
};
break;
case"circle":
G.dimensions = {
width : J[2] + 1,
height : J[2] + 1
};
break;
case"poly":
G.dimensions = {
width : J[0],
height : J[1]
};
for( C = 0; C < J.length; C++) {
if(C % 2 == 0) {
if(J[C] > G.dimensions.width) {
G.dimensions.width = J[C]
}
if(J[C] < J[0]) {
G.position.left = Math.floor(E.left + J[C])
}
} else {
if(J[C] > G.dimensions.height) {
G.dimensions.height = J[C]
}
if(J[C] < J[1]) {
G.position.top = Math.floor(E.top + J[C])
}
}
}
G.dimensions.width = G.dimensions.width - (G.position.left - E.left);
G.dimensions.height = G.dimensions.height - (G.position.top - E.top);
break;
default:
return f.fn.qtip.log.error.call(s, 4, f.fn.qtip.constants.INVALID_AREA_SHAPE, "updatePosition");
break
}
G.dimensions.width -= 2;
G.dimensions.height -= 2
} else {
if(s.options.position.target.add(document.body).length === 1) {
G.position = {
left : f(document).scrollLeft(),
top : f(document).scrollTop()
};
G.dimensions = {
height : f(window).height(),
width : f(window).width()
}
} else {
if( typeof s.options.position.target.attr("qtip") !== "undefined") {
G.position = s.options.position.target.qtip("api").cache.position
} else {
G.position = s.options.position.target.offset()
}
G.dimensions = {
height : s.options.position.target.outerHeight(),
width : s.options.position.target.outerWidth()
}
}
}
y = f.extend({}, G.position);
if(G.corner.search(/right/i) !== -1) {
y.left += G.dimensions.width
}
if(G.corner.search(/bottom/i) !== -1) {
y.top += G.dimensions.height
}
if(G.corner.search(/((top|bottom)Middle)|center/) !== -1) {
y.left += (G.dimensions.width / 2)
}
if(G.corner.search(/((left|right)Middle)|center/) !== -1) {
y.top += (G.dimensions.height / 2)
}
} else {
G.position = y = {
left : s.cache.mouse.x,
top : s.cache.mouse.y
};
G.dimensions = {
height : 1,
width : 1
}
}
if(L.corner.search(/right/i) !== -1) {
y.left -= L.dimensions.width
}
if(L.corner.search(/bottom/i) !== -1) {
y.top -= L.dimensions.height
}
if(L.corner.search(/((top|bottom)Middle)|center/) !== -1) {
y.left -= (L.dimensions.width / 2)
}
if(L.corner.search(/((left|right)Middle)|center/) !== -1) {
y.top -= (L.dimensions.height / 2)
}
I = (f.browser.msie) ? 1 : 0;
B = (f.browser.msie && parseInt(f.browser.version.charAt(0)) === 6) ? 1 : 0;
if(s.options.style.border.radius > 0) {
if(L.corner.search(/Left/) !== -1) {
y.left -= s.options.style.border.radius
} else {
if(L.corner.search(/Right/) !== -1) {
y.left += s.options.style.border.radius
}
}
if(L.corner.search(/Top/) !== -1) {
y.top -= s.options.style.border.radius
} else {
if(L.corner.search(/Bottom/) !== -1) {
y.top += s.options.style.border.radius
}
}
}
if(I) {
if(L.corner.search(/top/) !== -1) {
y.top -= I
} else {
if(L.corner.search(/bottom/) !== -1) {
y.top += I
}
}
if(L.corner.search(/left/) !== -1) {
y.left -= I
} else {
if(L.corner.search(/right/) !== -1) {
y.left += I
}
}
if(L.corner.search(/leftMiddle|rightMiddle/) !== -1) {
y.top -= 1
}
}
if(s.options.position.adjust.screen === true) {
y = o.call(s, y, G, L)
}
if(s.options.position.target === "mouse" && s.options.position.adjust.mouse === true) {
if(s.options.position.adjust.screen === true && s.elements.tip) {
K = s.elements.tip.attr("rel")
} else {
K = s.options.position.corner.tooltip
}
y.left += (K.search(/right/i) !== -1) ? -6 : 6;
y.top += (K.search(/bottom/i) !== -1) ? -6 : 6
}
if(!s.elements.bgiframe && f.browser.msie && parseInt(f.browser.version.charAt(0)) == 6) {
f("select, object").each(function() {
A = f(this).offset();
A.bottom = A.top + f(this).height();
A.right = A.left + f(this).width();
if(y.top + L.dimensions.height >= A.top && y.left + L.dimensions.width >= A.left) {
k.call(s)
}
})
}
y.left += s.options.position.adjust.x;
y.top += s.options.position.adjust.y;
F = s.getPosition();
if(y.left != F.left || y.top != F.top) {
z = s.beforePositionUpdate.call(s, w);
if(z === false) {
return s
}
s.cache.position = y;
if(x === true) {
s.status.animated = true;
s.elements.tooltip.animate(y, 200, "swing", function() {
s.status.animated = false
})
} else {
s.elements.tooltip.css(y)
}
s.onPositionUpdate.call(s, w);
if( typeof w !== "undefined" && w.type && w.type !== "mousemove") {
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_POSITION_UPDATED, "updatePosition")
}
}
return s
},
updateWidth : function(w) {
var x;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "updateWidth")
} else {
if(w && typeof w !== "number") {
return f.fn.qtip.log.error.call(s, 2, "newWidth must be of type number", "updateWidth")
}
}
x = s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);
if(!w) {
if( typeof s.options.style.width.value == "number") {
w = s.options.style.width.value
} else {
s.elements.tooltip.css({
width : "auto"
});
x.hide();
if(f.browser.msie) {
s.elements.wrapper.add(s.elements.contentWrapper.children()).css({
zoom : "normal"
})
}
w = s.getDimensions().width + 1;
if(!s.options.style.width.value) {
if(w > s.options.style.width.max) {
w = s.options.style.width.max
}
if(w < s.options.style.width.min) {
w = s.options.style.width.min
}
}
}
}
if(w % 2 !== 0) {
w -= 1
}
s.elements.tooltip.width(w);
x.show();
if(s.options.style.border.radius) {
s.elements.tooltip.find(".qtip-betweenCorners").each(function(y) {
f(this).width(w - (s.options.style.border.radius * 2))
})
}
if(f.browser.msie) {
s.elements.wrapper.add(s.elements.contentWrapper.children()).css({
zoom : "1"
});
s.elements.wrapper.width(w);
if(s.elements.bgiframe) {
s.elements.bgiframe.width(w).height(s.getDimensions.height)
}
}
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_WIDTH_UPDATED, "updateWidth")
},
updateStyle : function(w) {
var z, A, x, y, B;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "updateStyle")
} else {
if( typeof w !== "string" || !f.fn.qtip.styles[w]) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.STYLE_NOT_DEFINED, "updateStyle")
}
}
s.options.style = a.call(s, f.fn.qtip.styles[w], s.options.user.style);
s.elements.content.css(q(s.options.style));
if(s.options.content.title.text !== false) {
s.elements.title.css(q(s.options.style.title, true))
}
s.elements.contentWrapper.css({
borderColor : s.options.style.border.color
});
if(s.options.style.tip.corner !== false) {
if(f("<canvas>").get(0).getContext) {
z = s.elements.tooltip.find(".qtip-tip canvas:first");
x = z.get(0).getContext("2d");
x.clearRect(0, 0, 300, 300);
y = z.parent("div[rel]:first").attr("rel");
B = b(y, s.options.style.tip.size.width, s.options.style.tip.size.height);
h.call(s, z, B, s.options.style.tip.color || s.options.style.border.color)
} else {
if(f.browser.msie) {
z = s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');
z.attr("fillcolor", s.options.style.tip.color || s.options.style.border.color)
}
}
}
if(s.options.style.border.radius > 0) {
s.elements.tooltip.find(".qtip-betweenCorners").css({
backgroundColor : s.options.style.border.color
});
if(f("<canvas>").get(0).getContext) {
A = g(s.options.style.border.radius);
s.elements.tooltip.find(".qtip-wrapper canvas").each(function() {
x = f(this).get(0).getContext("2d");
x.clearRect(0, 0, 300, 300);
y = f(this).parent("div[rel]:first").attr("rel");
r.call(s, f(this), A[y], s.options.style.border.radius, s.options.style.border.color)
})
} else {
if(f.browser.msie) {
s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function() {
f(this).attr("fillcolor", s.options.style.border.color)
})
}
}
}
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_STYLE_UPDATED, "updateStyle")
},
updateContent : function(A, y) {
var z, x, w;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "updateContent")
} else {
if(!A) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.NO_CONTENT_PROVIDED, "updateContent")
}
}
z = s.beforeContentUpdate.call(s, A);
if( typeof z == "string") {
A = z
} else {
if(z === false) {
return
}
}
if(f.browser.msie) {
s.elements.contentWrapper.children().css({
zoom : "normal"
})
}
if(A.jquery && A.length > 0) {
A.clone(true).appendTo(s.elements.content).show()
} else {
s.elements.content.html(A)
}
x = s.elements.content.find("img[complete=false]");
if(x.length > 0) {
w = 0;
x.each(function(C) {
f('<img src="' + f(this).attr("src") + '" />').load(function() {
if(++w == x.length) {B()
}
})
})
} else {B()
}
function B() {
s.updateWidth();
if(y !== false) {
if(s.options.position.type !== "static") {
s.updatePosition(s.elements.tooltip.is(":visible"), true)
}
if(s.options.style.tip.corner !== false) {
n.call(s)
}
}
}
s.onContentUpdate.call(s);
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_CONTENT_UPDATED, "loadContent")
},
loadContent : function(w, z, A) {
var y;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "loadContent")
}
y = s.beforeContentLoad.call(s);
if(y === false) {
return s
}
if(A == "post") {
f.post(w, z, x)
} else {
f.get(w, z, x)
}
function x(B) {
s.onContentLoad.call(s);
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_CONTENT_LOADED, "loadContent");
s.updateContent(B)
}
return s
},
updateTitle : function(w) {
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "updateTitle")
} else {
if(!w) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.NO_CONTENT_PROVIDED, "updateTitle")
}
}
returned = s.beforeTitleUpdate.call(s);
if(returned === false) {
return s
}
if(s.elements.button) {
s.elements.button = s.elements.button.clone(true)
}
s.elements.title.html(w);
if(s.elements.button) {
s.elements.title.prepend(s.elements.button)
}
s.onTitleUpdate.call(s);
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_TITLE_UPDATED, "updateTitle")
},
focus : function(A) {
var y, x, w, z;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "focus")
} else {
if(s.options.position.type == "static") {
return f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.CANNOT_FOCUS_STATIC, "focus")
}
}
y = parseInt(s.elements.tooltip.css("z-index"));
x = 6000 + f("div.qtip[qtip]").length - 1;
if(!s.status.focused && y !== x) {
z = s.beforeFocus.call(s, A);
if(z === false) {
return s
}
f("div.qtip[qtip]").not(s.elements.tooltip).each(function() {
if(f(this).qtip("api").status.rendered === true) {
w = parseInt(f(this).css("z-index"));
if( typeof w == "number" && w > -1) {
f(this).css({
zIndex : parseInt(f(this).css("z-index")) - 1
})
}
f(this).qtip("api").status.focused = false
}
});
s.elements.tooltip.css({
zIndex : x
});
s.status.focused = true;
s.onFocus.call(s, A);
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_FOCUSED, "focus")
}
return s
},
disable : function(w) {
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "disable")
}
if(w) {
if(!s.status.disabled) {
s.status.disabled = true;
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_DISABLED, "disable")
} else {
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED, "disable")
}
} else {
if(s.status.disabled) {
s.status.disabled = false;
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_ENABLED, "disable")
} else {
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED, "disable")
}
}
return s
},
destroy : function() {
var w, x, y;
x = s.beforeDestroy.call(s);
if(x === false) {
return s
}
if(s.status.rendered) {
s.options.show.when.target.unbind("mousemove.qtip", s.updatePosition);
s.options.show.when.target.unbind("mouseout.qtip", s.hide);
s.options.show.when.target.unbind(s.options.show.when.event + ".qtip");
s.options.hide.when.target.unbind(s.options.hide.when.event + ".qtip");
s.elements.tooltip.unbind(s.options.hide.when.event + ".qtip");
s.elements.tooltip.unbind("mouseover.qtip", s.focus);
s.elements.tooltip.remove()
} else {
s.options.show.when.target.unbind(s.options.show.when.event + ".qtip-create")
}
if( typeof s.elements.target.data("qtip") == "object") {
y = s.elements.target.data("qtip").interfaces;
if( typeof y == "object" && y.length > 0) {
for( w = 0; w < y.length - 1; w++) {
if(y[w].id == s.id) {
y.splice(w, 1)
}
}
}
}
delete f.fn.qtip.interfaces[s.id];
if( typeof y == "object" && y.length > 0) {
s.elements.target.data("qtip").current = y.length - 1
} else {
s.elements.target.removeData("qtip")
}
s.onDestroy.call(s);
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_DESTROYED, "destroy");
return s.elements.target
},
getPosition : function() {
var w, x;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "getPosition")
}
w = (s.elements.tooltip.css("display") !== "none") ? false : true;
if(w) {
s.elements.tooltip.css({
visiblity : "hidden"
}).show()
}
x = s.elements.tooltip.offset();
if(w) {
s.elements.tooltip.css({
visiblity : "visible"
}).hide()
}
return x
},
getDimensions : function() {
var w, x;
if(!s.status.rendered) {
return f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.TOOLTIP_NOT_RENDERED, "getDimensions")
}
w = (!s.elements.tooltip.is(":visible")) ? true : false;
if(w) {
s.elements.tooltip.css({
visiblity : "hidden"
}).show()
}
x = {
height : s.elements.tooltip.outerHeight(),
width : s.elements.tooltip.outerWidth()
};
if(w) {
s.elements.tooltip.css({
visiblity : "visible"
}).hide()
}
return x
}
})
}
function p() {
var s, w, u, t, v, y, x;
s = this;
s.beforeRender.call(s);
s.status.rendered = true;
s.elements.tooltip = '<div qtip="' + s.id + '" class="qtip ' + (s.options.style.classes.tooltip || s.options.style) + '"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:' + s.options.position.type + ';">  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">    <div class="qtip-contentWrapper" style="overflow:hidden;">       <div class="qtip-content ' + s.options.style.classes.content + '"></div></div></div></div>';
s.elements.tooltip = f(s.elements.tooltip);
s.elements.tooltip.appendTo(s.options.position.container);
s.elements.tooltip.data("qtip", {
current : 0,
interfaces : [s]
});
s.elements.wrapper = s.elements.tooltip.children("div:first");
s.elements.contentWrapper = s.elements.wrapper.children("div:first").css({
background : s.options.style.background
});
s.elements.content = s.elements.contentWrapper.children("div:first").css(q(s.options.style));
if(f.browser.msie) {
s.elements.wrapper.add(s.elements.content).css({
zoom : 1
})
}
if(s.options.hide.when.event == "unfocus") {
s.elements.tooltip.attr("unfocus", true)
}
if( typeof s.options.style.width.value == "number") {
s.updateWidth()
}
if(f("<canvas>").get(0).getContext || f.browser.msie) {
if(s.options.style.border.radius > 0) {
m.call(s)
} else {
s.elements.contentWrapper.css({
border : s.options.style.border.width + "px solid " + s.options.style.border.color
})
}
if(s.options.style.tip.corner !== false) {
e.call(s)
}
} else {
s.elements.contentWrapper.css({
border : s.options.style.border.width + "px solid " + s.options.style.border.color
});
s.options.style.border.radius = 0;
s.options.style.tip.corner = false;
f.fn.qtip.log.error.call(s, 2, f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED, "render")
}
if(( typeof s.options.content.text == "string" && s.options.content.text.length > 0) || (s.options.content.text.jquery && s.options.content.text.length > 0)) {
u = s.options.content.text
} else {
if( typeof s.elements.target.attr("title") == "string" && s.elements.target.attr("title").length > 0) {
u = s.elements.target.attr("title").replace("\\n", "<br />");
s.elements.target.attr("title", "")
} else {
if( typeof s.elements.target.attr("alt") == "string" && s.elements.target.attr("alt").length > 0) {
u = s.elements.target.attr("alt").replace("\\n", "<br />");
s.elements.target.attr("alt", "")
} else {
u = " ";
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.NO_VALID_CONTENT, "render")
}
}
}
if(s.options.content.title.text !== false) {
j.call(s)
}
s.updateContent(u);
l.call(s);
if(s.options.show.ready === true) {
s.show()
}
if(s.options.content.url !== false) {
t = s.options.content.url;
v = s.options.content.data;
y = s.options.content.method || "get";
s.loadContent(t, v, y)
}
s.onRender.call(s);
f.fn.qtip.log.error.call(s, 1, f.fn.qtip.constants.EVENT_RENDERED, "render")
}
function m() {
var F, z, t, B, x, E, u, G, D, y, w, C, A, s, v;
F = this;
F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();
t = F.options.style.border.width;
B = F.options.style.border.radius;
x = F.options.style.border.color || F.options.style.tip.color;
E = g(B);
u = {};
for(z in E) {
u[z] = '<div rel="' + z + '" style="' + ((z.search(/Left/) !== -1) ? "left" : "right") + ":0; position:absolute; height:" + B + "px; width:" + B + 'px; overflow:hidden; line-height:0.1px; font-size:1px">';
if(f("<canvas>").get(0).getContext) {
u[z] += '<canvas height="' + B + '" width="' + B + '" style="vertical-align: top"></canvas>'
} else {
if(f.browser.msie) {
G = B * 2 + 3;
u[z] += '<v:arc stroked="false" fillcolor="' + x + '" startangle="' + E[z][0] + '" endangle="' + E[z][1] + '" style="width:' + G + "px; height:" + G + "px; margin-top:" + ((z.search(/bottom/) !== -1) ? -2 : -1) + "px; margin-left:" + ((z.search(/Right/) !== -1) ? E[z][2] - 3.5 : -1) + 'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'
}
}
u[z] += "</div>"
}
D = F.getDimensions().width - (Math.max(t, B) * 2);
y = '<div class="qtip-betweenCorners" style="height:' + B + "px; width:" + D + "px; overflow:hidden; background-color:" + x + '; line-height:0.1px; font-size:1px;">';
w = '<div class="qtip-borderTop" dir="ltr" style="height:' + B + "px; margin-left:" + B + 'px; line-height:0.1px; font-size:1px; padding:0;">' + u.topLeft + u.topRight + y;
F.elements.wrapper.prepend(w);
C = '<div class="qtip-borderBottom" dir="ltr" style="height:' + B + "px; margin-left:" + B + 'px; line-height:0.1px; font-size:1px; padding:0;">' + u.bottomLeft + u.bottomRight + y;
F.elements.wrapper.append(C);
if(f("<canvas>").get(0).getContext) {
F.elements.wrapper.find("canvas").each(function() {
A = E[f(this).parent("[rel]:first").attr("rel")];
r.call(F, f(this), A, B, x)
})
} else {
if(f.browser.msie) {
F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')
}
}
s = Math.max(B, (B + (t - B)));
v = Math.max(t - B, 0);
F.elements.contentWrapper.css({
border : "0px solid " + x,
borderWidth : v + "px " + s + "px"
})
}
function r(u, w, s, t) {
var v = u.get(0).getContext("2d");
v.fillStyle = t;
v.beginPath();
v.arc(w[0], w[1], s, 0, Math.PI * 2, false);
v.fill()
}
function e(v) {
var t, s, x, u, w;
t = this;
if(t.elements.tip !== null) {
t.elements.tip.remove()
}
s = t.options.style.tip.color || t.options.style.border.color;
if(t.options.style.tip.corner === false) {
return
} else {
if(!v) {
v = t.options.style.tip.corner
}
}
x = b(v, t.options.style.tip.size.width, t.options.style.tip.size.height);
t.elements.tip = '<div class="' + t.options.style.classes.tip + '" dir="ltr" rel="' + v + '" style="position:absolute; height:' + t.options.style.tip.size.height + "px; width:" + t.options.style.tip.size.width + 'px; margin:0 auto; line-height:0.1px; font-size:1px;">';
if(f("<canvas>").get(0).getContext) {
t.elements.tip += '<canvas height="' + t.options.style.tip.size.height + '" width="' + t.options.style.tip.size.width + '"></canvas>'
} else {
if(f.browser.msie) {
u = t.options.style.tip.size.width + "," + t.options.style.tip.size.height;
w = "m" + x[0][0] + "," + x[0][1];
w += " l" + x[1][0] + "," + x[1][1];
w += " " + x[2][0] + "," + x[2][1];
w += " xe";
t.elements.tip += '<v:shape fillcolor="' + s + '" stroked="false" filled="true" path="' + w + '" coordsize="' + u + '" style="width:' + t.options.style.tip.size.width + "px; height:" + t.options.style.tip.size.height + "px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:" + ((v.search(/top/) !== -1) ? "bottom" : "top") + '"></v:shape>';
t.elements.tip += '<v:image style="behavior:url(#default#VML);"></v:image>';
t.elements.contentWrapper.css("position", "relative")
}
}
t.elements.tooltip.prepend(t.elements.tip + "</div>");
t.elements.tip = t.elements.tooltip.find("." + t.options.style.classes.tip).eq(0);
if(f("<canvas>").get(0).getContext) {
h.call(t, t.elements.tip.find("canvas:first"), x, s)
}
if(v.search(/top/) !== -1 && f.browser.msie && parseInt(f.browser.version.charAt(0)) === 6) {
t.elements.tip.css({
marginTop : -4
})
}
n.call(t, v)
}
function h(t, v, s) {
var u = t.get(0).getContext("2d");
u.fillStyle = s;
u.beginPath();
u.moveTo(v[0][0], v[0][1]);
u.lineTo(v[1][0], v[1][1]);
u.lineTo(v[2][0], v[2][1]);
u.fill()
}
function n(u) {
var t, w, s, x, v;
t = this;
if(t.options.style.tip.corner === false || !t.elements.tip) {
return
}
if(!u) {
u = t.elements.tip.attr("rel")
}
w = positionAdjust = (f.browser.msie) ? 1 : 0;
t.elements.tip.css(u.match(/left|right|top|bottom/)[0], 0);
if(u.search(/top|bottom/) !== -1) {
if(f.browser.msie) {
if(parseInt(f.browser.version.charAt(0)) === 6) {
positionAdjust = (u.search(/top/) !== -1) ? -3 : 1
} else {
positionAdjust = (u.search(/top/) !== -1) ? 1 : 2
}
}
if(u.search(/Middle/) !== -1) {
t.elements.tip.css({
left : "50%",
marginLeft : -(t.options.style.tip.size.width / 2)
})
} else {
if(u.search(/Left/) !== -1) {
t.elements.tip.css({
left : t.options.style.border.radius - w
})
} else {
if(u.search(/Right/) !== -1) {
t.elements.tip.css({
right : t.options.style.border.radius + w
})
}
}
}
if(u.search(/top/) !== -1) {
t.elements.tip.css({
top : -positionAdjust
})
} else {
t.elements.tip.css({
bottom : positionAdjust
})
}
} else {
if(u.search(/left|right/) !== -1) {
if(f.browser.msie) {
positionAdjust = (parseInt(f.browser.version.charAt(0)) === 6) ? 1 : ((u.search(/left/) !== -1) ? 1 : 2)
}
if(u.search(/Middle/) !== -1) {
t.elements.tip.css({
top : "50%",
marginTop : -(t.options.style.tip.size.height / 2)
})
} else {
if(u.search(/Top/) !== -1) {
t.elements.tip.css({
top : t.options.style.border.radius - w
})
} else {
if(u.search(/Bottom/) !== -1) {
t.elements.tip.css({
bottom : t.options.style.border.radius + w
})
}
}
}
if(u.search(/left/) !== -1) {
t.elements.tip.css({
left : -positionAdjust
})
} else {
t.elements.tip.css({
right : positionAdjust
})
}
}
}
s = "padding-" + u.match(/left|right|top|bottom/)[0];
x = t.options.style.tip.size[(s.search(/left|right/) !== -1) ? "width" : "height"];
t.elements.tooltip.css("padding", 0);
t.elements.tooltip.css(s, x);
if(f.browser.msie && parseInt(f.browser.version.charAt(0)) == 6) {
v = parseInt(t.elements.tip.css("margin-top")) || 0;
v += parseInt(t.elements.content.css("margin-top")) || 0;
t.elements.tip.css({
marginTop : v
})
}
}
function j() {
var s = this;
if(s.elements.title !== null) {
s.elements.title.remove()
}
s.elements.title = f('<div class="' + s.options.style.classes.title + '">').css(q(s.options.style.title, true)).css({
zoom : (f.browser.msie) ? 1 : 0
}).prependTo(s.elements.contentWrapper);
if(s.options.content.title.text) {
s.updateTitle.call(s, s.options.content.title.text)
}
if(s.options.content.title.button !== false && typeof s.options.content.title.button == "string") {
s.elements.button = f('<a class="' + s.options.style.classes.button + '" style="float:right; position: relative"></a>').css(q(s.options.style.button, true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t) {
if(!s.status.disabled) {
s.hide(t)
}
})
}
}
function l() {
var t, v, u, s;
t = this;
v = t.options.show.when.target;
u = t.options.hide.when.target;
if(t.options.hide.fixed) {
u = u.add(t.elements.tooltip)
}
if(t.options.hide.when.event == "inactive") {
s = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout", "mouseenter", "mouseleave", "mouseover"];
function y(z) {
if(t.status.disabled === true) {
return
}clearTimeout(t.timers.inactive);
t.timers.inactive = setTimeout(function() {
f(s).each(function() {
u.unbind(this + ".qtip-inactive");
t.elements.content.unbind(this + ".qtip-inactive")
});
t.hide(z)
}, t.options.hide.delay)
}
} else {
if(t.options.hide.fixed === true) {
t.elements.tooltip.bind("mouseover.qtip", function() {
if(t.status.disabled === true) {
return
}clearTimeout(t.timers.hide)
})
}
}
function x(z) {
if(t.status.disabled === true) {
return
}
if(t.options.hide.when.event == "inactive") {
f(s).each(function() {
u.bind(this + ".qtip-inactive", y);
t.elements.content.bind(this + ".qtip-inactive", y)
});
y()
}clearTimeout(t.timers.show);
clearTimeout(t.timers.hide);
t.timers.show = setTimeout(function() {
t.show(z)
}, t.options.show.delay)
}
function w(z) {
if(t.status.disabled === true) {
return
}
if(t.options.hide.fixed === true && t.options.hide.when.event.search(/mouse(out|leave)/i) !== -1 && f(z.relatedTarget).parents("div.qtip[qtip]").length > 0) {
z.stopPropagation();
z.preventDefault();
clearTimeout(t.timers.hide);
return false
}clearTimeout(t.timers.show);
clearTimeout(t.timers.hide);
t.elements.tooltip.stop(true, true);
t.timers.hide = setTimeout(function() {
t.hide(z)
}, t.options.hide.delay)
}
if((t.options.show.when.target.add(t.options.hide.when.target).length === 1 && t.options.show.when.event == t.options.hide.when.event && t.options.hide.when.event !== "inactive") || t.options.hide.when.event == "unfocus") {
t.cache.toggle = 0;
v.bind(t.options.show.when.event + ".qtip", function(z) {
if(t.cache.toggle == 0) {x(z)
} else {w(z)
}
})
} else {
v.bind(t.options.show.when.event + ".qtip", x);
if(t.options.hide.when.event !== "inactive") {
u.bind(t.options.hide.when.event + ".qtip", w)
}
}
if(t.options.position.type.search(/(fixed|absolute)/) !== -1) {
t.elements.tooltip.bind("mouseover.qtip", t.focus)
}
if(t.options.position.target === "mouse" && t.options.position.type !== "static") {
v.bind("mousemove.qtip", function(z) {
t.cache.mouse = {
x : z.pageX,
y : z.pageY
};
if(t.status.disabled === false && t.options.position.adjust.mouse === true && t.options.position.type !== "static" && t.elements.tooltip.css("display") !== "none") {
t.updatePosition(z)
}
})
}
}
function o(u, v, A) {
var z, s, x, y, t, w;
z = this;
if(A.corner == "center") {
return v.position
}
s = f.extend({}, u);
y = {
x : false,
y : false
};
t = {
left : (s.left < f.fn.qtip.cache.screen.scroll.left),
right : (s.left + A.dimensions.width + 2 >= f.fn.qtip.cache.screen.width + f.fn.qtip.cache.screen.scroll.left),
top : (s.top < f.fn.qtip.cache.screen.scroll.top),
bottom : (s.top + A.dimensions.height + 2 >= f.fn.qtip.cache.screen.height + f.fn.qtip.cache.screen.scroll.top)
};
x = {
left : (t.left && (A.corner.search(/right/i) != -1 || (A.corner.search(/right/i) == -1 && !t.right))),
right : (t.right && (A.corner.search(/left/i) != -1 || (A.corner.search(/left/i) == -1 && !t.left))),
top : (t.top && A.corner.search(/top/i) == -1),
bottom : (t.bottom && A.corner.search(/bottom/i) == -1)
};
if(x.left) {
if(z.options.position.target !== "mouse") {
s.left = v.position.left + v.dimensions.width
} else {
s.left = z.cache.mouse.x
}
y.x = "Left"
} else {
if(x.right) {
if(z.options.position.target !== "mouse") {
s.left = v.position.left - A.dimensions.width
} else {
s.left = z.cache.mouse.x - A.dimensions.width
}
y.x = "Right"
}
}
if(x.top) {
if(z.options.position.target !== "mouse") {
s.top = v.position.top + v.dimensions.height
} else {
s.top = z.cache.mouse.y
}
y.y = "top"
} else {
if(x.bottom) {
if(z.options.position.target !== "mouse") {
s.top = v.position.top - A.dimensions.height
} else {
s.top = z.cache.mouse.y - A.dimensions.height
}
y.y = "bottom"
}
}
if(s.left < 0) {
s.left = u.left;
y.x = false
}
if(s.top < 0) {
s.top = u.top;
y.y = false
}
if(z.options.style.tip.corner !== false) {
s.corner = new String(A.corner);
if(y.x !== false) {
s.corner = s.corner.replace(/Left|Right|Middle/, y.x)
}
if(y.y !== false) {
s.corner = s.corner.replace(/top|bottom/, y.y)
}
if(s.corner !== z.elements.tip.attr("rel")) {
e.call(z, s.corner)
}
}
return s
}
function q(u, t) {
var v, s;
v = f.extend(true, {}, u);
for(s in v) {
if(t === true && s.search(/(tip|classes)/i) !== -1) {
delete v[s]
} else {
if(!t && s.search(/(width|border|tip|title|classes|user)/i) !== -1) {
delete v[s]
}
}
}
return v
}
function c(s) {
if( typeof s.tip !== "object") {
s.tip = {
corner : s.tip
}
}
if( typeof s.tip.size !== "object") {
s.tip.size = {
width : s.tip.size,
height : s.tip.size
}
}
if( typeof s.border !== "object") {
s.border = {
width : s.border
}
}
if( typeof s.width !== "object") {
s.width = {
value : s.width
}
}
if( typeof s.width.max == "string") {
s.width.max = parseInt(s.width.max.replace(/([0-9]+)/i, "$1"))
}
if( typeof s.width.min == "string") {
s.width.min = parseInt(s.width.min.replace(/([0-9]+)/i, "$1"))
}
if( typeof s.tip.size.x == "number") {
s.tip.size.width = s.tip.size.x;
delete s.tip.size.x
}
if( typeof s.tip.size.y == "number") {
s.tip.size.height = s.tip.size.y;
delete s.tip.size.y
}
return s
}
function a() {
var s, t, u, x, v, w;
s = this;
u = [true, {}];
for( t = 0; t < arguments.length; t++) {
u.push(arguments[t])
}
x = [f.extend.apply(f, u)];
while( typeof x[0].name == "string") {
x.unshift(c(f.fn.qtip.styles[x[0].name]))
}
x.unshift(true, {
classes : {
tooltip : "qtip-" + (arguments[0].name || "defaults")
}
}, f.fn.qtip.styles.defaults);
v = f.extend.apply(f, x);
w = (f.browser.msie) ? 1 : 0;
v.tip.size.width += w;
v.tip.size.height += w;
if(v.tip.size.width % 2 > 0) {
v.tip.size.width += 1
}
if(v.tip.size.height % 2 > 0) {
v.tip.size.height += 1
}
if(v.tip.corner === true) {
v.tip.corner = (s.options.position.corner.tooltip === "center") ? false : s.options.position.corner.tooltip
}
return v
}
function b(v, u, t) {
var s = {
bottomRight : [[0, 0], [u, t], [u, 0]],
bottomLeft : [[0, 0], [u, 0], [0, t]],
topRight : [[0, t], [u, 0], [u, t]],
topLeft : [[0, 0], [0, t], [u, t]],
topMiddle : [[0, t], [u / 2, 0], [u, t]],
bottomMiddle : [[0, 0], [u, 0], [u / 2, t]],
rightMiddle : [[0, 0], [u, t / 2], [0, t]],
leftMiddle : [[u, 0], [u, t], [0, t / 2]]
};
s.leftTop = s.bottomRight;
s.rightTop = s.bottomLeft;
s.leftBottom = s.topRight;
s.rightBottom = s.topLeft;
return s[v]
}
function g(s) {
var t;
if(f("<canvas>").get(0).getContext) {
t = {
topLeft : [s, s],
topRight : [0, s],
bottomLeft : [s, 0],
bottomRight : [0, 0]
}
} else {
if(f.browser.msie) {
t = {
topLeft : [-90, 90, 0],
topRight : [-90, 90, -s],
bottomLeft : [90, 270, 0],
bottomRight : [90, 270, -s]
}
}
}
return t
}
function k() {
var s, t, u;
s = this;
u = s.getDimensions();
t = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:' + u.height + "px; width:" + u.width + 'px" />';
s.elements.bgiframe = s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")
}
f(document).ready(function() {
f.fn.qtip.cache = {
screen : {
scroll : {
left : f(window).scrollLeft(),
top : f(window).scrollTop()
},
width : f(window).width(),
height : f(window).height()
}
};
var s;
f(window).bind("resize scroll", function(t) {clearTimeout(s);
s = setTimeout(function() {
if(t.type === "scroll") {
f.fn.qtip.cache.screen.scroll = {
left : f(window).scrollLeft(),
top : f(window).scrollTop()
}
} else {
f.fn.qtip.cache.screen.width = f(window).width();
f.fn.qtip.cache.screen.height = f(window).height()
}
for( i = 0; i < f.fn.qtip.interfaces.length; i++) {
var u = f.fn.qtip.interfaces[i];
if(u.status.rendered === true && (u.options.position.type !== "static" || u.options.position.adjust.scroll && t.type === "scroll" || u.options.position.adjust.resize && t.type === "resize")) {
u.updatePosition(t, true)
}
}
}, 100)
});
f(document).bind("mousedown.qtip", function(t) {
if(f(t.target).parents("div.qtip").length === 0) {
f(".qtip[unfocus]").each(function() {
var u = f(this).qtip("api");
if(f(this).is(":visible") && !u.status.disabled && f(t.target).add(u.elements.target).length > 1) {
u.hide(t)
}
})
}
})
});
f.fn.qtip.interfaces = [];
f.fn.qtip.log = {
error : function() {
return this
}
};
f.fn.qtip.constants = {};
f.fn.qtip.defaults = {
content : {
prerender : false,
text : false,
url : false,
data : null,
title : {
text : false,
button : false
}
},
position : {
target : false,
corner : {
target : "bottomRight",
tooltip : "topLeft"
},
adjust : {
x : 0,
y : 0,
mouse : true,
screen : false,
scroll : true,
resize : true
},
type : "absolute",
container : false
},
show : {
when : {
target : false,
event : "mouseover"
},
effect : {
type : "fade",
length : 100
},
delay : 140,
solo : false,
ready : false
},
hide : {
when : {
target : false,
event : "mouseout"
},
effect : {
type : "fade",
length : 100
},
delay : 0,
fixed : false
},
api : {
beforeRender : function() {
},
onRender : function() {
},
beforePositionUpdate : function() {
},
onPositionUpdate : function() {
},
beforeShow : function() {
},
onShow : function() {
},
beforeHide : function() {
},
onHide : function() {
},
beforeContentUpdate : function() {
},
onContentUpdate : function() {
},
beforeContentLoad : function() {
},
onContentLoad : function() {
},
beforeTitleUpdate : function() {
},
onTitleUpdate : function() {
},
beforeDestroy : function() {
},
onDestroy : function() {
},
beforeFocus : function() {
},
onFocus : function() {
}
}
};
f.fn.qtip.styles = {
defaults : {
background : "white",
color : "#111",
overflow : "hidden",
textAlign : "left",
width : {
min : 0,
max : 250
},
padding : "5px 9px",
border : {
width : 1,
radius : 0,
color : "#d3d3d3"
},
tip : {
corner : false,
color : false,
size : {
width : 13,
height : 13
},
opacity : 1
},
title : {
background : "#e1e1e1",
fontWeight : "bold",
padding : "7px 12px"
},
button : {
cursor : "pointer"
},
classes : {
target : "",
tip : "qtip-tip",
title : "qtip-title",
button : "qtip-button",
content : "qtip-content",
active : "qtip-active"
}
},
cream : {
border : {
width : 3,
radius : 0,
color : "#F9E98E"
},
title : {
background : "#F0DE7D",
color : "#A27D35"
},
background : "#FBF7AA",
color : "#A27D35",
classes : {
tooltip : "qtip-cream"
}
},
light : {
border : {
width : 3,
radius : 0,
color : "#E2E2E2"
},
title : {
background : "#f1f1f1",
color : "#454545"
},
background : "white",
color : "#454545",
classes : {
tooltip : "qtip-light"
}
},
dark : {
border : {
width : 3,
radius : 0,
color : "#303030"
},
title : {
background : "#404040",
color : "#f3f3f3"
},
background : "#505050",
color : "#f3f3f3",
classes : {
tooltip : "qtip-dark"
}
},
red : {
border : {
width : 3,
radius : 0,
color : "#CE6F6F"
},
title : {
background : "#f28279",
color : "#9C2F2F"
},
background : "#F79992",
color : "#9C2F2F",
classes : {
tooltip : "qtip-red"
}
},
green : {
border : {
width : 3,
radius : 0,
color : "#A9DB66"
},
title : {
background : "#b9db8c",
color : "#58792E"
},
background : "#CDE6AC",
color : "#58792E",
classes : {
tooltip : "qtip-green"
}
},
blue : {
border : {
width : 3,
radius : 0,
color : "#ADD9ED"
},
title : {
background : "#D0E9F5",
color : "#5E99BD"
},
background : "#E5F6FE",
color : "#4D9FBF",
classes : {
tooltip : "qtip-blue"
}
}
}
})(jQuery);
;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
(function($) {
var NivoSlider = function(element, options){
var settings = $.extend({}, $.fn.nivoSlider.defaults, options);
var vars = {
currentSlide: 0,
currentImage: '',
totalSlides: 0,
randAnim: '',
running: false,
paused: false,
stop: false
};
var slider = $(element);
slider.data('nivo:vars', vars);
slider.css({'position': 'relative', '-webkit-border-radius': settings.borderRadius + 'px', '-moz-border-radius': settings.borderRadius + 'px', 'border-radius': settings.borderRadius + 'px'});
slider.addClass('nivoSlider');
var kids = slider.children();
kids.each(function() {
var child = $(this);
var link = '';
if(!child.is('img')){
if(child.is('a')){
child.addClass('nivo-imageLink');
link = child;
}
child = child.find('img:first');
}
var childWidth = child.width();
if(childWidth == 0) childWidth = child.attr('width');
var childHeight = child.height();
if(childHeight == 0) childHeight = child.attr('height');
if(childWidth > slider.width()){
slider.width(childWidth);
}
if(childHeight > slider.height()){
slider.height(childHeight);
}
if(link != ''){
link.css('display','none');
}
child.css('display','none');
vars.totalSlides++;
});
if(settings.startSlide > 0){
if(settings.startSlide >= vars.totalSlides) settings.startSlide = vars.totalSlides - 1;
vars.currentSlide = settings.startSlide;
}
if($(kids[vars.currentSlide]).is('img')){
vars.currentImage = $(kids[vars.currentSlide]);
} else {
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
}
if($(kids[vars.currentSlide]).is('a')){
$(kids[vars.currentSlide]).css('display','block');
}
slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat');
slider.append(
$('<div class="nivo-caption"><p></p></div>').css({ display:'none', opacity:settings.captionOpacity, '-webkit-border-bottom-right-radius': settings.borderRadius + 'px', '-webkit-border-bottom-left-radius': settings.borderRadius + 'px', '-moz-border-radius-bottomright': settings.borderRadius + 'px', '-moz-border-radius-bottomleft': settings.borderRadius + 'px', 'border-bottom-right-radius': settings.borderRadius + 'px', 'border-bottom-left-radius': settings.borderRadius + 'px' })
);
var processCaption = function(settings){
var nivoCaption = $('.nivo-caption', slider);
if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
var title = vars.currentImage.attr('title');
if(title.substr(0,1) == '#') title = $(title).html();
if(nivoCaption.css('display') == 'block'){
nivoCaption.find('p').fadeOut(settings.animSpeed, function(){
$(this).html(title);
$(this).fadeIn(settings.animSpeed);
});
} else {
nivoCaption.find('p').html(title);
}
nivoCaption.fadeIn(settings.animSpeed);
} else {
nivoCaption.fadeOut(settings.animSpeed);
}
}
processCaption(settings);
var timer = 0;
if(!settings.manualAdvance && kids.length > 1){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
if(settings.directionNav){
slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a></div>');
if(settings.directionNavHide){
$('.nivo-directionNav', slider).hide();
slider.hover(function(){
$('.nivo-directionNav', slider).show();
}, function(){
$('.nivo-directionNav', slider).hide();
});
}
$('a.nivo-prevNav', slider).live('click', function(){
if(vars.running) return false;
clearInterval(timer);
timer = '';
vars.currentSlide -= 2;
nivoRun(slider, kids, settings, 'prev');
});
$('a.nivo-nextNav', slider).live('click', function(){
if(vars.running) return false;
clearInterval(timer);
timer = '';
nivoRun(slider, kids, settings, 'next');
});
}
if(settings.controlNav){
var nivoControl = $('<div class="nivo-controlNav"></div>');
slider.append(nivoControl);
for(var i = 0; i < kids.length; i++){
if(settings.controlNavThumbs){
var child = kids.eq(i);
if(!child.is('img')){
child = child.find('img:first');
}
if (settings.controlNavThumbsFromRel) {
nivoControl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('rel') + '" alt="" /></a>');
} else {
nivoControl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('src').replace(settings.controlNavThumbsSearch, settings.controlNavThumbsReplace) +'" alt="" /></a>');
}
} else {
nivoControl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
}
}
$('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active');
$('.nivo-controlNav a', slider).live('click', function(){
if(vars.running) return false;
if($(this).hasClass('active')) return false;
clearInterval(timer);
timer = '';
slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat');
vars.currentSlide = $(this).attr('rel') - 1;
nivoRun(slider, kids, settings, 'control');
});
}
if(settings.keyboardNav){
$(window).keypress(function(event){
if(event.keyCode == '37'){
if(vars.running) return false;
clearInterval(timer);
timer = '';
vars.currentSlide-=2;
nivoRun(slider, kids, settings, 'prev');
}
if(event.keyCode == '39'){
if(vars.running) return false;
clearInterval(timer);
timer = '';
nivoRun(slider, kids, settings, 'next');
}
});
}
if(settings.pauseOnHover){
slider.hover(function(){
vars.paused = true;
clearInterval(timer);
timer = '';
}, function(){
vars.paused = false;
if(timer == '' && !settings.manualAdvance){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
});
}
slider.bind('nivo:animFinished', function(){
vars.running = false;
$(kids).each(function(){
if($(this).is('a')){
$(this).css('display','none');
}
});
if($(kids[vars.currentSlide]).is('a')){
$(kids[vars.currentSlide]).css('display','block');
}
if(timer == '' && !vars.paused && !settings.manualAdvance){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
settings.afterChange.call(this);
});
var createSlices = function(slider, settings, vars){
for(var i = 0; i < settings.slices; i++){
var sliceWidth = Math.round(slider.width()/settings.slices);
if(i == settings.slices-1){
slider.append(
$('<div class="nivo-slice"></div>').css({
left:(sliceWidth*i)+'px', width:(slider.width()-(sliceWidth*i))+'px',
height:'0px',
opacity:'0',
background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%'
})
);
} else {
slider.append(
$('<div class="nivo-slice"></div>').css({
left:(sliceWidth*i)+'px', width:sliceWidth+'px',
height:'0px',
opacity:'0',
background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%'
})
);
}
}
var firstSlice = $('.nivo-slice:eq(0)', slider);
var lastSlice = $('.nivo-slice:eq(' + (settings.slices-1) + ')', slider);
firstSlice.css({
'-webkit-border-top-left-radius': settings.borderRadius + 'px',
'-webkit-border-bottom-left-radius': settings.borderRadius + 'px',
'-moz-border-radius-topleft': settings.borderRadius + 'px',
'-moz-border-radius-bottomleft': settings.borderRadius + 'px',
'border-top-left-radius': settings.borderRadius + 'px',
'border-bottom-left-radius': settings.borderRadius + 'px'
});
lastSlice.css({
'-webkit-border-top-right-radius': settings.borderRadius + 'px',
'-webkit-border-bottom-right-radius': settings.borderRadius + 'px',
'-moz-border-radius-topright': settings.borderRadius + 'px',
'-moz-border-radius-bottomright': settings.borderRadius + 'px',
'border-top-right-radius': settings.borderRadius + 'px',
'border-bottom-right-radius': settings.borderRadius + 'px'
});
}
var createBoxes = function(slider, settings, vars){
var boxWidth = Math.round(slider.width()/settings.boxCols);
var boxHeight = Math.round(slider.height()/settings.boxRows);
for(var rows = 0; rows < settings.boxRows; rows++){
for(var cols = 0; cols < settings.boxCols; cols++){
if(cols == settings.boxCols-1){
slider.append(
$('<div class="nivo-box"></div>').css({
opacity:0,
left:(boxWidth*cols)+'px',
top:(boxHeight*rows)+'px',
width:(slider.width()-(boxWidth*cols))+'px',
height:boxHeight+'px',
background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px'
})
);
} else {
slider.append(
$('<div class="nivo-box"></div>').css({
opacity:0,
left:(boxWidth*cols)+'px',
top:(boxHeight*rows)+'px',
width:boxWidth+'px',
height:boxHeight+'px',
background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px'
})
);
}
}
}
}
var nivoRun = function(slider, kids, settings, nudge){
var vars = slider.data('nivo:vars');
if(vars && (vars.currentSlide == vars.totalSlides - 1)){
settings.lastSlide.call(this);
}
if((!vars || vars.stop) && !nudge) return false;
settings.beforeChange.call(this);
if(!nudge){
slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat');
} else {
if(nudge == 'prev'){
slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat');
}
if(nudge == 'next'){
slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat');
}
}
vars.currentSlide++;
if(vars.currentSlide == vars.totalSlides){
vars.currentSlide = 0;
settings.slideshowEnd.call(this);
}
if(vars.currentSlide < 0) vars.currentSlide = (vars.totalSlides - 1);
if($(kids[vars.currentSlide]).is('img')){
vars.currentImage = $(kids[vars.currentSlide]);
} else {
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
}
if(settings.controlNav){
$('.nivo-controlNav a', slider).removeClass('active');
$('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active');
}
processCaption(settings);
$('.nivo-slice', slider).remove();
$('.nivo-box', slider).remove();
if(settings.effect == 'random'){
var anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade',
'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');
vars.randAnim = anims[Math.floor(Math.random()*(anims.length + 1))];
if(vars.randAnim == undefined) vars.randAnim = 'fade';
}
if(settings.effect.indexOf(',') != -1){
var anims = settings.effect.split(',');
vars.randAnim = anims[Math.floor(Math.random()*(anims.length))];
if(vars.randAnim == undefined) vars.randAnim = 'fade';
}
vars.running = true;
if(settings.effect == 'sliceDown' || settings.effect == 'sliceDownRight' || vars.randAnim == 'sliceDownRight' ||
settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft'){
createSlices(slider, settings, vars);
var timeBuff = 0;
var i = 0;
var slices = $('.nivo-slice', slider);
if(settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft') slices = $('.nivo-slice', slider)._reverse();
slices.each(function(){
var slice = $(this);
slice.css({ 'top': '0px' });
if(i == settings.slices-1){
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
}
else if(settings.effect == 'sliceUp' || settings.effect == 'sliceUpRight' || vars.randAnim == 'sliceUpRight' ||
settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft'){
createSlices(slider, settings, vars);
var timeBuff = 0;
var i = 0;
var slices = $('.nivo-slice', slider);
if(settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft') slices = $('.nivo-slice', slider)._reverse();
slices.each(function(){
var slice = $(this);
slice.css({ 'bottom': '0px' });
if(i == settings.slices-1){
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
}
else if(settings.effect == 'sliceUpDown' || settings.effect == 'sliceUpDownRight' || vars.randAnim == 'sliceUpDown' ||
settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft'){
createSlices(slider, settings, vars);
var timeBuff = 0;
var i = 0;
var v = 0;
var slices = $('.nivo-slice', slider);
if(settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft') slices = $('.nivo-slice', slider)._reverse();
slices.each(function(){
var slice = $(this);
if(i == 0){
slice.css('top','0px');
i++;
} else {
slice.css('bottom','0px');
i = 0;
}
if(v == settings.slices-1){
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
v++;
});
}
else if(settings.effect == 'fold' || vars.randAnim == 'fold'){
createSlices(slider, settings, vars);
var timeBuff = 0;
var i = 0;
$('.nivo-slice', slider).each(function(){
var slice = $(this);
var origWidth = slice.width();
slice.css({ top:'0px', height:'100%', width:'0px' });
if(i == settings.slices-1){
setTimeout(function(){
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
}
else if(settings.effect == 'fade' || vars.randAnim == 'fade'){
createSlices(slider, settings, vars);
var firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'height': '100%',
'width': slider.width() + 'px',
'-webkit-border-radius': settings.borderRadius + 'px',
'-moz-border-radius': settings.borderRadius + 'px',
'border-radius': settings.borderRadius + 'px'
});
firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
}
else if(settings.effect == 'slideInRight' || vars.randAnim == 'slideInRight'){
createSlices(slider, settings, vars);
var firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'height': '100%',
'width': '0px',
'opacity': '1',
'-webkit-border-radius': settings.borderRadius + 'px',
'-moz-border-radius': settings.borderRadius + 'px',
'border-radius': settings.borderRadius + 'px'
});
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
}
else if(settings.effect == 'slideInLeft' || vars.randAnim == 'slideInLeft'){
createSlices(slider, settings, vars);
var firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'height': '100%',
'width': '0px',
'opacity': '1',
'left': '',
'right': '0px',
'-webkit-border-radius': settings.borderRadius + 'px',
'-moz-border-radius': settings.borderRadius + 'px',
'border-radius': settings.borderRadius + 'px'
});
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){
firstSlice.css({
'left': '0px',
'right': ''
});
slider.trigger('nivo:animFinished');
});
}
else if(settings.effect == 'boxRandom' || vars.randAnim == 'boxRandom'){
createBoxes(slider, settings, vars);
var totalBoxes = settings.boxCols * settings.boxRows;
var i = 0;
var timeBuff = 0;
var boxes = shuffle($('.nivo-box', slider));
var topleftBox = $('.nivo-box:eq(0)', slider);
topleftBox.css({
'-webkit-border-top-left-radius': settings.borderRadius + 'px',
'-moz-border-radius-topleft': settings.borderRadius + 'px',
'border-top-left-radius': settings.borderRadius + 'px'
});
var toprightBox = $('.nivo-box:eq(' + (settings.boxCols-1) + ')', slider);
toprightBox.css({
'-webkit-border-top-right-radius': settings.borderRadius + 'px',
'-moz-border-radius-topright': settings.borderRadius + 'px',
'border-top-right-radius': settings.borderRadius + 'px'
});
var bottomleftBox = $('.nivo-box:eq(' + (settings.boxCols * (settings.boxRows -1)) + ')', slider);
bottomleftBox.css({
'-webkit-border-bottom-left-radius': settings.borderRadius + 'px',
'-moz-border-radius-bottomleft': settings.borderRadius + 'px',
'border-bottom-left-radius': settings.borderRadius + 'px'
});
var bottomrightBox = $('.nivo-box:eq(' + ((settings.boxCols * settings.boxRows)-1) + ')', slider);
bottomrightBox.css({
'-webkit-border-bottom-right-radius': settings.borderRadius + 'px',
'-moz-border-radius-bottomright': settings.borderRadius + 'px',
'border-bottom-right-radius': settings.borderRadius + 'px'
});
boxes.each(function(){
var box = $(this);
if(i == totalBoxes-1){
setTimeout(function(){
box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
box.animate({ opacity:'1' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 20;
i++;
});
}
else if(settings.effect == 'boxRain' || vars.randAnim == 'boxRain' || settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' ||
settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
createBoxes(slider, settings, vars);
var totalBoxes = settings.boxCols * settings.boxRows;
var i = 0;
var timeBuff = 0;
var rowIndex = 0;
var colIndex = 0;
var box2Darr = new Array();
box2Darr[rowIndex] = new Array();
var boxes = $('.nivo-box', slider);
var reverseBoxes = false;
if(settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' ||
settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
boxes = $('.nivo-box', slider)._reverse();
reverseBoxes = true;
}
boxes.each(function(){
box2Darr[rowIndex][colIndex] = $(this);
colIndex++;
if(colIndex == settings.boxCols){
rowIndex++;
colIndex = 0;
box2Darr[rowIndex] = new Array();
}
});
$('.nivo-box', slider).css({'-webkit-border-radius': '0px', '-moz-border-radius': '0px', 'border-radius': '0px'});
var topleftBox = box2Darr[0][0];
if(reverseBoxes) topleftBox = box2Darr[settings.boxRows-1][settings.boxCols-1];
topleftBox.css({
'-webkit-border-top-left-radius': settings.borderRadius + 'px',
'-moz-border-radius-topleft': settings.borderRadius + 'px',
'border-top-left-radius': settings.borderRadius + 'px'
});
var toprightBox = box2Darr[0][settings.boxCols-1];
if(reverseBoxes) toprightBox = box2Darr[settings.boxRows-1][0];
toprightBox.css({
'-webkit-border-top-right-radius': settings.borderRadius + 'px',
'-moz-border-radius-topright': settings.borderRadius + 'px',
'border-top-right-radius': settings.borderRadius + 'px'
});
var bottomleftBox = box2Darr[settings.boxRows-1][0];
if(reverseBoxes) bottomleftBox = box2Darr[0][settings.boxCols-1];
bottomleftBox.css({
'-webkit-border-bottom-left-radius': settings.borderRadius + 'px',
'-moz-border-radius-bottomleft': settings.borderRadius + 'px',
'border-bottom-left-radius': settings.borderRadius + 'px'
});
var bottomrightBox = box2Darr[settings.boxRows-1][settings.boxCols-1];
if(reverseBoxes) bottomrightBox = box2Darr[0][0];
bottomrightBox.css({
'-webkit-border-bottom-right-radius': settings.borderRadius + 'px',
'-moz-border-radius-bottomright': settings.borderRadius + 'px',
'border-bottom-right-radius': settings.borderRadius + 'px'
});
for(var cols = 0; cols < (settings.boxCols * 2); cols++){
var prevCol = cols;
for(var rows = 0; rows < settings.boxRows; rows++){
if(prevCol >= 0 && prevCol < settings.boxCols){
(function(row, col, time, i, totalBoxes) {
var box = $(box2Darr[row][col]);
var w = box.width();
var h = box.height();
if(settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' ||
settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
box.width(0).height(0);
}
if(i == totalBoxes-1){
setTimeout(function(){
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + time));
} else {
setTimeout(function(){
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3);
}, (100 + time));
}
})(rows, prevCol, timeBuff, i, totalBoxes);
i++;
}
prevCol--;
}
timeBuff += 100;
}
}
}
var shuffle = function(arr){
for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);
return arr;
}
var trace = function(msg){
if (this.console && typeof console.log != "undefined")
console.log(msg);
}
this.stop = function(){
if(!$(element).data('nivo:vars').stop){
$(element).data('nivo:vars').stop = true;
trace('Stop Slider');
}
}
this.start = function(){
if($(element).data('nivo:vars').stop){
$(element).data('nivo:vars').stop = false;
trace('Start Slider');
}
}
settings.afterLoad.call(this);
return this;
};
$.fn.nivoSlider = function(options) {
return this.each(function(key, value){
var element = $(this);
if (element.data('nivoslider')) return element.data('nivoslider');
var nivoslider = new NivoSlider(this, options);
element.data('nivoslider', nivoslider);
});
};
$.fn.nivoSlider.defaults = {
effect: 'random',
slices: 15,
boxCols: 8,
boxRows: 4,
animSpeed: 500,
pauseTime: 3000,
startSlide: 0,
borderRadius: 10,
directionNav: true,
directionNavHide: true,
controlNav: true,
controlNavThumbs: false,
controlNavThumbsFromRel: false,
controlNavThumbsSearch: '.jpg',
controlNavThumbsReplace: '_thumb.jpg',
keyboardNav: true,
pauseOnHover: true,
manualAdvance: false,
captionOpacity: 0.8,
prevText: 'Prev',
nextText: 'Next',
beforeChange: function(){},
afterChange: function(){},
slideshowEnd: function(){},
lastSlide: function(){},
afterLoad: function(){}
};
$.fn._reverse = [].reverse;
})(jQuery);
(function($) {
if ($.fn.carouFredSel) return;
$.fn.carouFredSel = function(options, configs) {
if (this.length == 0) {
debug(true, 'No element found for "'+this.selector+'".');
return this;
}
if (this.length > 1) {
return this.each(function() {
$(this).carouFredSel(options, configs);
});
}
var $cfs = this,
$tt0 = this[0];
if ($cfs.data('cfs_isCarousel')) {
var starting_position = $cfs.triggerHandler('_cfs_currentPosition');
$cfs.trigger('_cfs_destroy', true);
} else {
var starting_position = false;
}
$cfs._cfs_init = function(o, setOrig, start) {
o = go_getObject($tt0, o);
if (o.debug) {
conf.debug = o.debug;
debug(conf, 'The "debug" option should be moved to the second configuration-object.');
}
var obs = ['items', 'scroll', 'auto', 'prev', 'next', 'pagination'];
for (var a = 0, l = obs.length; a < l; a++) {
o[obs[a]] = go_getObject($tt0, o[obs[a]]);
}
if (typeof o.scroll == 'number') {
if (o.scroll <= 50)					o.scroll	= { 'items'		: o.scroll 	};
else								o.scroll	= { 'duration'	: o.scroll 	};
} else {
if (typeof o.scroll == 'string')	o.scroll	= { 'easing'	: o.scroll 	};
}
if (typeof o.items == 'number')	o.items		= { 'visible'	: o.items 	};
else if (		o.items == 'variable')	o.items		= { 'visible'	: o.items,
'width'		: o.items,
'height'	: o.items	};
if (typeof o.items != 'object') o.items = {};
if (setOrig) opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
if (typeof opts.items.visibleConf != 'object') opts.items.visibleConf = {};
if (opts.items.start == 0 && typeof start == 'number') {
opts.items.start = start;
}
crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
var dims = [
['width'	, 'innerWidth'	, 'outerWidth'	, 'height'	, 'innerHeight'	, 'outerHeight'	, 'left', 'top'	, 'marginRight'	, 0, 1, 2, 3],
['height'	, 'innerHeight'	, 'outerHeight'	, 'width'	, 'innerWidth'	, 'outerWidth'	, 'top'	, 'left', 'marginBottom', 3, 2, 1, 0]
];
var dn = dims[0].length,
dx = (opts.direction == 'right' || opts.direction == 'left') ? 0 : 1;
opts.d = {};
for (var d = 0; d < dn; d++) {
opts.d[dims[0][d]] = dims[dx][d];
}
var	all_itm = $cfs.children();
if (typeof opts.items.filter == 'undefined') {
opts.items.filter = (all_itm.filter(':hidden').length > 0) ? ':visible' : '*';
}
if (opts[opts.d['width']] == 'auto') {
var lrgst = ms_getTrueLargestSize(all_itm, opts, 'outerWidth');
opts[opts.d['width']] = lrgst;
}
if (opts[opts.d['height']] == 'auto') {
var lrgst = ms_getTrueLargestSize(all_itm, opts, 'outerHeight');
opts[opts.d['height']] = lrgst;
}
if (!opts.items[opts.d['width']]) {
opts.items[opts.d['width']] = (ms_hasVariableSizes(all_itm, opts, 'outerWidth'))
? 'variable'
: all_itm[opts.d['outerWidth']](true);
}
if (!opts.items[opts.d['height']]) {
opts.items[opts.d['height']] = (ms_hasVariableSizes(all_itm, opts, 'outerHeight'))
? 'variable'
: all_itm[opts.d['outerHeight']](true);
}
if (!opts[opts.d['height']]) {
opts[opts.d['height']] = opts.items[opts.d['height']];
}
if (typeof opts.items.visible == 'object') {
opts.items.visibleConf.min = opts.items.visible.min;
opts.items.visibleConf.max = opts.items.visible.max;
opts.items.visible = false;
}
if (typeof opts.items.visible == 'string' || typeof opts.items.visible == 'function') {
opts.items.visibleConf.adjust = opts.items.visible;
opts.items.visible = false;
}
if (!opts.items.visible) {
if (opts.items[opts.d['width']] == 'variable') {
opts.items.visibleConf.variable = true;
}
if (!opts.items.visibleConf.variable) {
if (typeof opts[opts.d['width']] == 'number') {
opts.items.visible = Math.floor(opts[opts.d['width']] / opts.items[opts.d['width']]);
} else {
var maxS = ms_getTrueInnerSize($wrp.parent(), opts, 'innerWidth');
opts.items.visible = Math.floor(maxS / opts.items[opts.d['width']]);
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
if (!opts.items.visibleConf.adjust) opts.align = false;
}
if (opts.items.visible == 'Infinity' || opts.items.visible < 1) {
debug(true, 'Not a valid number of visible items: Set to "variable".');
opts.items.visibleConf.variable = true;
}
}
}
if (!opts[opts.d['width']]) {
if (opts.items.filter != '*') {
opts[opts.d['width']] = 'variable';
} else if (!opts.items.visibleConf.variable && opts.items[opts.d['width']] != 'variable') {
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
opts.align = false;
} else {
opts[opts.d['width']] = 'variable';
}
}
if (opts.items.visibleConf.variable) {
opts.maxDimention = (opts[opts.d['width']] == 'variable')
? ms_getTrueInnerSize($wrp.parent(), opts, 'innerWidth')
: opts[opts.d['width']];
if (opts.align === false) {
opts[opts.d['width']] = 'variable';
}
opts.items.visible = gn_getVisibleItemsNext(all_itm, opts, 0);
} else if (opts.items.filter != '*') {
opts.items.visibleConf.org = opts.items.visible;
opts.items.visible = gn_getVisibleItemsNextFilter(all_itm, opts, 0);
}
if (typeof opts.padding == 'undefined') {
opts.padding = 0;
}
if (typeof opts.align == 'undefined') {
opts.align = (opts[opts.d['width']] == 'variable')
? false
: 'center';
}
opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
opts.items.visibleConf.old = opts.items.visible;
opts.usePadding = false;
opts.padding = cf_getPadding(opts.padding);
if (opts.align == 'top') 		opts.align = 'left';
if (opts.align == 'bottom') 	opts.align = 'right';
switch (opts.align) {
case 'center':
case 'left':
case 'right':
if (opts[opts.d['width']] != 'variable') {
var p = cf_getAlignPadding(gi_getCurrentItems(all_itm, opts), opts);
opts.usePadding = true;
opts.padding[opts.d[1]] = p[1];
opts.padding[opts.d[3]] = p[0];
}
break;
default:
opts.align = false;
opts.usePadding = (
opts.padding[0] == 0 &&
opts.padding[1] == 0 &&
opts.padding[2] == 0 &&
opts.padding[3] == 0
) ? false : true;
break;
}
if (typeof opts.cookie == 'boolean' && opts.cookie)			opts.cookie 					= 'caroufredsel_cookie_'+$cfs.attr('id');
if (typeof opts.items.minimum				!= 'number')	opts.items.minimum				= opts.items.visible;
if (typeof opts.scroll.duration				!= 'number')	opts.scroll.duration			= 500;
if (typeof opts.scroll.items				== 'undefined') opts.scroll.items 				= (opts.items.visibleConf.variable || opts.items.filter != '*') ? 'visible' : opts.items.visible;
opts.auto		= go_getNaviObject($tt0, opts.auto, 'auto');
opts.prev		= go_getNaviObject($tt0, opts.prev);
opts.next		= go_getNaviObject($tt0, opts.next);
opts.pagination	= go_getNaviObject($tt0, opts.pagination, 'pagination');
opts.auto		= $.extend(true, {}, opts.scroll, opts.auto);
opts.prev		= $.extend(true, {}, opts.scroll, opts.prev);
opts.next		= $.extend(true, {}, opts.scroll, opts.next);
opts.pagination	= $.extend(true, {}, opts.scroll, opts.pagination);
if (typeof opts.pagination.keys				!= 'boolean')	opts.pagination.keys 			= false;
if (typeof opts.pagination.anchorBuilder	!= 'function'
&& opts.pagination.anchorBuilder	!== false)		opts.pagination.anchorBuilder	= $.fn.carouFredSel.pageAnchorBuilder;
if (typeof opts.auto.play					!= 'boolean')	opts.auto.play					= true;
if (typeof opts.auto.delay					!= 'number')	opts.auto.delay					= 0;
if (typeof opts.auto.pauseDuration			!= 'number')	opts.auto.pauseDuration			= (opts.auto.duration < 10) ? 2500 : opts.auto.duration * 5;
if (opts.synchronise) {
opts.synchronise = cf_getSynchArr(opts.synchronise);
}
if (conf.debug) {
debug(conf, 'Carousel width: '+opts.width);
debug(conf, 'Carousel height: '+opts.height);
if (opts.maxDimention)	debug(conf, 'Available '+opts.d['width']+': '+opts.maxDimention);
debug(conf, 'Item widths: '+opts.items.width);
debug(conf, 'Item heights: '+opts.items.height);
debug(conf, 'Number of items visible: '+opts.items.visible);
if (opts.auto.play)		debug(conf, 'Number of items scrolled automatically: '+opts.auto.items);
if (opts.prev.button)	debug(conf, 'Number of items scrolled backward: '+opts.prev.items);
if (opts.next.button)	debug(conf, 'Number of items scrolled forward: '+opts.next.items);
}
};	//	/init
$cfs._cfs_build = function() {
$cfs.data('cfs_isCarousel', true);
var orgCSS = {
'textAlign'		: $cfs.css('textAlign'),
'float'			: $cfs.css('float'),
'position'		: $cfs.css('position'),
'top'			: $cfs.css('top'),
'right'			: $cfs.css('right'),
'bottom'		: $cfs.css('bottom'),
'left'			: $cfs.css('left'),
'width'			: $cfs.css('width'),
'height'		: $cfs.css('height'),
'marginTop'		: $cfs.css('marginTop'),
'marginRight'	: $cfs.css('marginRight'),
'marginBottom'	: $cfs.css('marginBottom'),
'marginLeft'	: $cfs.css('marginLeft')
};
switch (orgCSS.position) {
case 'absolute':
var newPosition = 'absolute';
break;
case 'fixed':
var newPosition = 'fixed';
break;
default:
var newPosition = 'relative';
}
$wrp.css(orgCSS).css({
'overflow'		: 'hidden',
'position'		: newPosition
});
$cfs.data('cfs_origCss', orgCSS).css({
'textAlign'		: 'left',
'float'			: 'none',
'position'		: 'absolute',
'top'			: 0,
'left'			: 0,
'marginTop'		: 0,
'marginRight'	: 0,
'marginBottom'	: 0,
'marginLeft'	: 0
});
if (opts.usePadding) {
$cfs.children().each(function() {
var m = parseInt($(this).css(opts.d['marginRight']));
if (isNaN(m)) m = 0;
$(this).data('cfs_origCssMargin', m);
});
}
};	//	/build
$cfs._cfs_bind_events = function() {
$cfs._cfs_unbind_events();
$cfs.bind(cf_e('stop', conf), function(e, imm) {
e.stopPropagation();
if (!crsl.isStopped) {
if (opts.auto.button) {
opts.auto.button.addClass(cf_c('stopped', conf));
}
}
crsl.isStopped = true;
if (opts.auto.play) {
opts.auto.play = false;
$cfs.trigger(cf_e('pause', conf), imm);
}
return true;
});
$cfs.bind(cf_e('finish', conf), function(e) {
e.stopPropagation();
if (crsl.isScrolling) {
sc_stopScroll(scrl);
}
return true;
});
$cfs.bind(cf_e('pause', conf), function(e, imm, res) {
e.stopPropagation();
tmrs = sc_clearTimers(tmrs);
if (imm && crsl.isScrolling) {
scrl.isStopped = true;
var nst = getTime() - scrl.startTime;
scrl.duration -= nst;
if (scrl.pre) scrl.pre.duration -= nst;
if (scrl.post) scrl.post.duration -= nst;
sc_stopScroll(scrl, false);
}
if (!crsl.isPaused && !crsl.isScrolling) {
if (res) tmrs.timePassed += getTime() - tmrs.startTime;
}
if (!crsl.isPaused) {
if (opts.auto.button) {
opts.auto.button.addClass(cf_c('paused', conf));
}
}
crsl.isPaused = true;
if (opts.auto.onPausePause) {
var dur1 = opts.auto.pauseDuration - tmrs.timePassed,
perc = 100 - Math.ceil( dur1 * 100 / opts.auto.pauseDuration );
opts.auto.onPausePause.call($tt0, perc, dur1);
}
return true;
});
$cfs.bind(cf_e('play', conf), function(e, dir, del, res) {
e.stopPropagation();
tmrs = sc_clearTimers(tmrs);
var v = [dir, del, res],
t = ['string', 'number', 'boolean'],
a = cf_sortParams(v, t);
var dir = a[0],
del = a[1],
res = a[2];
if (dir != 'prev' && dir != 'next') dir = crsl.direction;
if (typeof del != 'number') 		del = 0;
if (typeof res != 'boolean') 		res = false;
if (res) {
crsl.isStopped = false;
opts.auto.play = true;
}
if (!opts.auto.play) {
e.stopImmediatePropagation();
return debug(conf, 'Carousel stopped: Not scrolling.');
}
if (crsl.isPaused) {
if (opts.auto.button) {
opts.auto.button.removeClass(cf_c('stopped', conf));
opts.auto.button.removeClass(cf_c('paused', conf));
}
}
crsl.isPaused = false;
tmrs.startTime = getTime();
var dur1 = opts.auto.pauseDuration + del;
dur2 = dur1 - tmrs.timePassed;
perc = 100 - Math.ceil(dur2 * 100 / dur1);
tmrs.auto = setTimeout(function() {
if (opts.auto.onPauseEnd) {
opts.auto.onPauseEnd.call($tt0, perc, dur2);
}
if (crsl.isScrolling) {
$cfs.trigger(cf_e('play', conf), dir);
} else {
$cfs.trigger(cf_e(dir, conf), opts.auto);
}
}, dur2);
if (opts.auto.onPauseStart) {
opts.auto.onPauseStart.call($tt0, perc, dur2);
}
return true;
});
$cfs.bind(cf_e('resume', conf), function(e) {
e.stopPropagation();
if (scrl.isStopped) {
scrl.isStopped = false;
crsl.isPaused = false;
crsl.isScrolling = true;
scrl.startTime = getTime();
sc_startScroll(scrl);
} else {
$cfs.trigger(cf_e('play', conf));
}
return true;
});
$cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb) {
e.stopPropagation();
if (crsl.isStopped || $cfs.is(':hidden')) {
e.stopImmediatePropagation();
return debug(conf, 'Carousel stopped or hidden: Not scrolling.');
}
if (opts.items.minimum >= itms.total) {
e.stopImmediatePropagation();
return debug(conf, 'Not enough items ('+itms.total+', '+opts.items.minimum+' needed): Not scrolling.');
}
var v = [obj, num, clb],
t = ['object', 'number/string', 'function'],
a = cf_sortParams(v, t);
var obj = a[0],
num = a[1],
clb = a[2];
var eType = e.type.substr(conf.events.prefix.length);
if (typeof obj != 'object' || obj == null)	obj = opts[eType];
if (typeof clb == 'function')				obj.onAfter = clb;
if (typeof num != 'number') {
if (opts.items.filter != '*') {
num = 'visible';
} else {
var arr = [num, obj.items, opts[eType].items];
for (var a = 0, l = arr.length; a < l; a++) {
if (typeof arr[a] == 'number' || arr[a] == 'page' || arr[a] == 'visible') {
num = arr[a];
break;
}
}
}
switch(num) {
case 'page':
e.stopImmediatePropagation();
return $cfs.triggerHandler(eType+'Page', [obj, clb]);
break;
case 'visible':
if (!opts.items.visibleConf.variable && opts.items.filter == '*') {
num = opts.items.visible;
}
break;
}
}
if (scrl.isStopped) {
$cfs.trigger(cf_e('resume', conf));
$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
e.stopImmediatePropagation();
return debug(conf, 'Carousel resumed scrolling.');
}
if (obj.duration > 0) {
if (crsl.isScrolling) {
if (obj.queue) $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
e.stopImmediatePropagation();
return debug(conf, 'Carousel currently scrolling.');
}
}
if (obj.conditions && !obj.conditions.call($tt0)) {
e.stopImmediatePropagation();
return debug(conf, 'Callback "conditions" returned false.');
}
tmrs.timePassed = 0;
$cfs.trigger('_cfs_slide_'+eType, [obj, num]);
if (opts.synchronise) {
var s = opts.synchronise,
c = [obj, num];
for (var j = 0, l = s.length; j < l; j++) {
var d = eType;
if (!s[j][1]) c[0] = s[j][0].triggerHandler('_cfs_configuration', eType);
if (!s[j][2]) d = (d == 'prev') ? 'next' : 'prev';
c[1] = num + s[j][3];
s[j][0].trigger('_cfs_slide_'+d, c);
}
}
return true;
});
$cfs.bind(cf_e('_cfs_slide_prev', conf, false), function(e, sO, nI) {
e.stopPropagation();
var a_itm = $cfs.children();
if (!opts.circular) {
if (itms.first == 0) {
if (opts.infinite) {
$cfs.trigger(cf_e('next', conf), itms.total-1);
}
return e.stopImmediatePropagation();
}
}
if (opts.usePadding) sz_resetMargin(a_itm, opts);
if (typeof nI != 'number') {
if (opts.items.visibleConf.variable) {
nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1);
} else if (opts.items.filter != '*') {
var xI = (typeof sO.items == 'number') ? sO.items : gn_getVisibleOrg($cfs, opts);
nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI);
} else {
nI = opts.items.visible;
}
nI = cf_getAdjust(nI, opts, sO.items, $tt0);
}
if (!opts.circular) {
if (itms.total - nI < itms.first) {
nI = itms.total - itms.first;
}
}
if (opts.items.visibleConf.variable) {
var vI = gn_getVisibleItemsNext(a_itm, opts, itms.total-nI);
if (opts.items.visible+nI <= vI && nI < itms.total) {
nI++;
vI = gn_getVisibleItemsNext(a_itm, opts, itms.total-nI);
}
opts.items.visibleConf.old = opts.items.visible;
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
} else if (opts.items.filter != '*') {
var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI);
opts.items.visibleConf.old = opts.items.visible;
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
}
if (opts.usePadding) sz_resetMargin(a_itm, opts, true);
if (nI == 0) {
e.stopImmediatePropagation();
return debug(conf, '0 items to scroll: Not scrolling.');
}
debug(conf, 'Scrolling '+nI+' items backward.');
itms.first += nI;
while (itms.first >= itms.total) {
itms.first -= itms.total;
}
if (!opts.circular) {
if (itms.first == 0 && sO.onEnd) sO.onEnd.call($tt0);
if (!opts.infinite) nv_enableNavi(opts, itms.first, conf);
}
$cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs);
if (itms.total < opts.items.visible + nI) {
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
}
var a_itm = $cfs.children(),
c_old = gi_getOldItemsPrev(a_itm, opts, nI),
c_new = gi_getNewItemsPrev(a_itm, opts),
l_cur = a_itm.eq(nI-1),
l_old = c_old.last(),
l_new = c_new.last();
if (opts.usePadding) sz_resetMargin(a_itm, opts);
if (opts.align) {
var p = cf_getAlignPadding(c_new, opts),
pL = p[0],
pR = p[1];
} else {
var pL = 0,
pR = 0;
}
var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0;
if (sO.fx == 'directscroll' && opts.items.visible < nI) {
var hiddenitems = a_itm.slice(opts.items.visibleConf.old, nI),
orgW = opts.items[opts.d['width']];
hiddenitems.each(function() {
var hi = $(this);
hi.data('isHidden', hi.is(':hidden')).hide();
});
opts.items[opts.d['width']] = 'variable';
} else {
var hiddenitems = false;
}
var i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
w_siz = cf_mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);
if (hiddenitems) opts.items[opts.d['width']] = orgW;
if (opts.usePadding) {
sz_resetMargin(a_itm, opts, true);
if (pR >= 0) {
sz_resetMargin(l_old, opts, opts.padding[opts.d[1]]);
}
sz_resetMargin(l_cur, opts, opts.padding[opts.d[3]]);
}
if (opts.align) {
opts.padding[opts.d[1]] = pR;
opts.padding[opts.d[3]] = pL;
}
var a_cfs = {},
a_dur = sO.duration;
if (sO.fx == 'none')	a_dur = 0;
else if (a_dur == 'auto')	a_dur = opts.scroll.duration / opts.scroll.items * nI;
else if (a_dur <= 0)		a_dur = 0;
else if (a_dur < 10)		a_dur = i_siz / a_dur;
scrl = sc_setScroll(a_dur, sO.easing);
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
scrl.anims.push([$wrp, w_siz]);
}
if (opts.usePadding) {
var new_m = opts.padding[opts.d[3]];
if (l_new.not(l_cur).length) {
var a_cur = {};
a_cur[opts.d['marginRight']] = l_cur.data('cfs_origCssMargin');
if (pL < 0) l_cur.css(a_cur);
else 		scrl.anims.push([l_cur, a_cur]);
}
if (l_new.not(l_old).length) {
var a_old = {};
a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');
scrl.anims.push([l_old, a_old]);
}
if (pR >= 0) {
var a_new = {};
a_new[opts.d['marginRight']] = l_new.data('cfs_origCssMargin') + opts.padding[opts.d[1]];
scrl.anims.push([l_new, a_new]);
}
} else {
var new_m = 0;
}
a_cfs[opts.d['left']] = new_m;
var args = [c_old, c_new, w_siz, a_dur];
if (sO.onBefore) sO.onBefore.apply($tt0, args);
clbk.onBefore = sc_callCallbacks(clbk.onBefore, $tt0, args);
switch(sO.fx) {
case 'fade':
case 'crossfade':
case 'cover':
case 'uncover':
scrl.pre = sc_setScroll(scrl.duration, scrl.easing);
scrl.post = sc_setScroll(scrl.duration, scrl.easing);
scrl.duration = 0;
break;
}
switch(sO.fx) {
case 'crossfade':
case 'cover':
case 'uncover':
var $cf2 = $cfs.clone().appendTo($wrp);
break;
}
switch(sO.fx) {
case 'uncover':
$cf2.children().slice(0, nI).remove();
case 'crossfade':
case 'cover':
$cf2.children().slice(opts.items.visible).remove();
break;
}
switch(sO.fx) {
case 'fade':
scrl.pre.anims.push([$cfs, { 'opacity': 0 }]);
break;
case 'crossfade':
$cf2.css({ 'opacity': 0 });
scrl.pre.anims.push([$cfs, { 'width': '+=0' }, function() { $cf2.remove(); }]);
scrl.post.anims.push([$cf2, { 'opacity': 1 }]);
break;
case 'cover':
scrl = fx_cover(scrl, $cfs, $cf2, opts, true);
break;
case 'uncover':
scrl = fx_uncover(scrl, $cfs, $cf2, opts, true, nI);
break;
}
var a_complete = function() {
var overFill = opts.items.visible+nI-itms.total;
if (overFill > 0) {
$cfs.children().slice(itms.total).remove();
c_old = $cfs.children().slice(itms.total-(nI-overFill)).get().concat( $cfs.children().slice(0, overFill).get() );
}
if (hiddenitems) {
hiddenitems.each(function() {
var hi = $(this);
if (!hi.data('isHidden')) hi.show();
});
}
if (opts.usePadding) {
var l_itm = $cfs.children().eq(opts.items.visible+nI-1);
l_itm.css(opts.d['marginRight'], l_itm.data('cfs_origCssMargin'));
}
scrl.anims = [];
if (scrl.pre) scrl.pre = sc_setScroll(scrl.orgDuration, scrl.easing);
var fn = function() {
switch(sO.fx) {
case 'fade':
case 'crossfade':
$cfs.css('filter', '');
break;
}
scrl.post = sc_setScroll(0, null);
crsl.isScrolling = false;
var args = [c_old, c_new, w_siz];
if (sO.onAfter) sO.onAfter.apply($tt0, args);
clbk.onAfter = sc_callCallbacks(clbk.onAfter, $tt0, args);
if (queu.length) {
$cfs.trigger(cf_e(queu[0][0], conf), queu[0][1]);
queu.shift();
}
if (!crsl.isPaused) $cfs.trigger(cf_e('play', conf));
};
switch(sO.fx) {
case 'fade':
scrl.pre.anims.push([$cfs, { 'opacity': 1 }, fn]);
sc_startScroll(scrl.pre);
break;
case 'uncover':
scrl.pre.anims.push([$cfs, { 'width': '+=0' }, fn]);
sc_startScroll(scrl.pre);
break;
default:
fn();
break;
}
};
scrl.anims.push([$cfs, a_cfs, a_complete]);
crsl.isScrolling = true;
$cfs.css(opts.d['left'], -(i_siz-oL));
tmrs = sc_clearTimers(tmrs);
sc_startScroll(scrl);
cf_setCookie(opts.cookie, $cfs.triggerHandler(cf_e('currentPosition', conf)));
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
return true;
});
$cfs.bind(cf_e('_cfs_slide_next', conf, false), function(e, sO, nI) {
e.stopPropagation();
var a_itm = $cfs.children();
if (!opts.circular) {
if (itms.first == opts.items.visible) {
if (opts.infinite) {
$cfs.trigger(cf_e('prev', conf), itms.total-1);
}
return e.stopImmediatePropagation();
}
}
if (opts.usePadding) sz_resetMargin(a_itm, opts);
if (typeof nI != 'number') {
if (opts.items.filter != '*') {
var xI = (typeof sO.items == 'number') ? sO.items : gn_getVisibleOrg($cfs, opts);
nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI);
} else {
nI = opts.items.visible;
}
nI = cf_getAdjust(nI, opts, sO.items, $tt0);
}
var lastItemNr = (itms.first == 0) ? itms.total : itms.first;
if (!opts.circular) {
if (opts.items.visibleConf.variable) {
var vI = gn_getVisibleItemsNext(a_itm, opts, nI),
xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
} else {
var vI = opts.items.visible,
xI = opts.items.visible;
}
if (nI + vI > lastItemNr) {
nI = lastItemNr - xI;
}
}
if (opts.items.visibleConf.variable) {
var vI = gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr);
while (opts.items.visible-nI >= vI && nI < itms.total) {
nI++;
vI = gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr);
}
opts.items.visibleConf.old = opts.items.visible;
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
} else if (opts.items.filter != '*') {
var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI);
opts.items.visibleConf.old = opts.items.visible;
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
}
if (opts.usePadding) sz_resetMargin(a_itm, opts, true);
if (nI == 0) {
e.stopImmediatePropagation();
return debug(conf, '0 items to scroll: Not scrolling.');
}
debug(conf, 'Scrolling '+nI+' items forward.');
itms.first -= nI;
while (itms.first < 0) {
itms.first += itms.total;
}
if (!opts.circular) {
if (itms.first == opts.items.visible && sO.onEnd) sO.onEnd.call($tt0);
if (!opts.infinite) nv_enableNavi(opts, itms.first, conf);
}
if (itms.total < opts.items.visible+nI) {
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
}
var a_itm = $cfs.children(),
c_old = gi_getOldItemsNext(a_itm, opts),
c_new = gi_getNewItemsNext(a_itm, opts, nI),
l_cur = a_itm.eq(nI-1),
l_old = c_old.last(),
l_new = c_new.last();
if (opts.usePadding) sz_resetMargin(a_itm, opts);
if (opts.align)	{
var p = cf_getAlignPadding(c_new, opts),
pL = p[0],
pR = p[1];
} else {
var pL = 0,
pR = 0;
}
if (sO.fx == 'directscroll' && opts.items.visibleConf.old < nI) {
var hiddenitems = a_itm.slice(opts.items.visibleConf.old, nI),
orgW = opts.items[opts.d['width']];
hiddenitems.each(function() {
var hi = $(this);
hi.data('isHidden', hi.is(':hidden')).hide();
});
opts.items[opts.d['width']] = 'variable';
} else {
var hiddenitems = false;
}
var i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
w_siz = cf_mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);
if (hiddenitems) opts.items[opts.d['width']] = orgW;
if (opts.align) {
if (opts.padding[opts.d[1]] < 0) {
opts.padding[opts.d[1]] = 0;
}
}
if (opts.usePadding) {
sz_resetMargin(a_itm, opts, true);
sz_resetMargin(l_old, opts, opts.padding[opts.d[1]]);
}
if (opts.align) {
opts.padding[opts.d[1]] = pR;
opts.padding[opts.d[3]] = pL;
}
var a_cfs = {},
a_dur = sO.duration;
if (sO.fx == 'none')	a_dur = 0;
else if (a_dur == 'auto')	a_dur = opts.scroll.duration / opts.scroll.items * nI;
else if (a_dur <= 0)		a_dur = 0;
else if (a_dur < 10)		a_dur = i_siz / a_dur;
scrl = sc_setScroll(a_dur, sO.easing);
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
scrl.anims.push([$wrp, w_siz]);
}
if (opts.usePadding) {
var l_new_m = l_new.data('cfs_origCssMargin');
if (pR >= 0) {
l_new_m += opts.padding[opts.d[1]];
}
l_new.css(opts.d['marginRight'], l_new_m);
if (l_cur.not(l_old).length) {
var a_old = {};
a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');
scrl.anims.push([l_old, a_old]);
}
var c_new_m = l_cur.data('cfs_origCssMargin');
if (pL >= 0) {
c_new_m += opts.padding[opts.d[3]];
}
var a_cur = {};
a_cur[opts.d['marginRight']] = c_new_m;
scrl.anims.push([l_cur, a_cur]);
}
a_cfs[opts.d['left']] = -i_siz;
if (pL < 0) {
a_cfs[opts.d['left']] += pL;
}
var args = [c_old, c_new, w_siz, a_dur];
if (sO.onBefore) sO.onBefore.apply($tt0, args);
clbk.onBefore = sc_callCallbacks(clbk.onBefore, $tt0, args);
switch(sO.fx) {
case 'fade':
case 'crossfade':
case 'cover':
case 'uncover':
scrl.pre = sc_setScroll(scrl.duration, scrl.easing);
scrl.post = sc_setScroll(scrl.duration, scrl.easing);
scrl.duration = 0;
break;
}
switch(sO.fx) {
case 'crossfade':
case 'cover':
case 'uncover':
var $cf2 = $cfs.clone().appendTo($wrp);
break;
}
switch(sO.fx) {
case 'uncover':
$cf2.children().slice(opts.items.visibleConf.old).remove();
break;
case 'crossfade':
case 'cover':
$cf2.children().slice(0, nI).remove();
$cf2.children().slice(opts.items.visible).remove();
break;
}
switch(sO.fx) {
case 'fade':
scrl.pre.anims.push([$cfs, { 'opacity': 0 }]);
break;
case 'crossfade':
$cf2.css({ 'opacity': 0 });
scrl.pre.anims.push([$cfs, { 'width': '+=0' }, function() { $cf2.remove(); }]);
scrl.post.anims.push([$cf2, { 'opacity': 1 }]);
break;
case 'cover':
scrl = fx_cover(scrl, $cfs, $cf2, opts, false);
break;
case 'uncover':
scrl = fx_uncover(scrl, $cfs, $cf2, opts, false, nI);
break;
}
var a_complete = function() {
var overFill = opts.items.visible+nI-itms.total,
new_m = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
$cfs.css(opts.d['left'], new_m);
if (overFill > 0) {
$cfs.children().slice(itms.total).remove();
}
var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last();
if (overFill > 0) {
c_new = gi_getCurrentItems(a_itm, opts);
}
if (hiddenitems) {
hiddenitems.each(function() {
var hi = $(this);
if (!hi.data('isHidden')) hi.show();
});
}
if (opts.usePadding) {
if (itms.total < opts.items.visible+nI) {
var l_cur = $cfs.children().eq(opts.items.visible-1);
l_cur.css(opts.d['marginRight'], l_cur.data('cfs_origCssMargin') + opts.padding[opts.d[3]]);
}
l_itm.css(opts.d['marginRight'], l_itm.data('cfs_origCssMargin'));
}
scrl.anims = [];
if (scrl.pre) scrl.pre = sc_setScroll(scrl.orgDuration, scrl.easing);
var fn = function() {
switch(sO.fx) {
case 'fade':
case 'crossfade':
$cfs.css('filter', '');
break;
}
scrl.post = sc_setScroll(0, null);
crsl.isScrolling = false;
var args = [c_old, c_new, w_siz];
if (sO.onAfter) sO.onAfter.apply($tt0, args);
clbk.onAfter = sc_callCallbacks(clbk.onAfter, $tt0, args);
if (queu.length) {
$cfs.trigger(cf_e(queu[0][0], conf), queu[0][1]);
queu.shift();
}
if (!crsl.isPaused) $cfs.trigger(cf_e('play', conf));
};
switch(sO.fx) {
case 'fade':
scrl.pre.anims.push([$cfs, { 'opacity': 1 }, fn]);
sc_startScroll(scrl.pre);
break;
case 'uncover':
scrl.pre.anims.push([$cfs, { 'width': '+=0' }, fn]);
sc_startScroll(scrl.pre);
break;
default:
fn();
break;
}
};
scrl.anims.push([$cfs, a_cfs, a_complete]);
crsl.isScrolling = true;
tmrs = sc_clearTimers(tmrs);
sc_startScroll(scrl);
cf_setCookie(opts.cookie, $cfs.triggerHandler(cf_e('currentPosition', conf)));
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
return true;
});
$cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) {
e.stopPropagation();
var v = [num, dev, org, obj, dir, clb],
t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'],
a = cf_sortParams(v, t);
var obj = a[3],
dir = a[4],
clb = a[5];
num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs);
if (num == 0) return;
if (typeof obj != 'object') obj = false;
if (crsl.isScrolling) {
if (typeof obj != 'object' || obj.duration > 0) return false;
}
if (dir != 'prev' && dir != 'next') {
if (opts.circular) {
if (num <= itms.total / 2) 	dir = 'next';
else 						dir = 'prev';
} else {
if (itms.first == 0 ||
itms.first > num)		dir = 'next';
else						dir = 'prev';
}
}
if (dir == 'prev') num = itms.total-num;
$cfs.trigger(cf_e(dir, conf), [obj, num, clb]);
return true;
});
$cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) {
e.stopPropagation();
var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]);
});
$cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) {
e.stopPropagation();
var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]);
});
$cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) {
e.stopPropagation();
if (typeof pag != 'number') pag = $cfs.triggerHandler(cf_e('currentPage', conf));
var ipp = opts.pagination.items || opts.items.visible,
max = Math.floor(itms.total / ipp);
if (pag < 0)	pag = max;
if (pag > max)	pag = 0;
return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]);
});
$cfs.bind(cf_e('jumpToStart', conf), function(e, s) {
e.stopPropagation();
if (s)	s = gn_getItemIndex(s, 0, true, itms, $cfs);
else 	s = 0;
s += itms.first;
if (s != 0) {
while (s > itms.total) s -= itms.total;
$cfs.prepend($cfs.children().slice(s, itms.total));
}
return true;
});
$cfs.bind(cf_e('synchronise', conf), function(e, s) {
e.stopPropagation();
if (s) 				s = cf_getSynchArr(s);
else if (opts.synchronise)	s = opts.synchronise;
else return debug(conf, 'No carousel to synchronise.');
var n = $cfs.triggerHandler(cf_e('currentPosition', conf)),
x = true;
for (var j = 0, l = s.length; j < l; j++) {
if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true])) {
x = false;
}
}
return x;
});
$cfs.bind(cf_e('queue', conf), function(e, dir, opt) {
e.stopPropagation();
if (typeof dir == 'function') {
dir.call($tt0, queu);
} else if (is_array(dir)) {
queu = dir;
} else if (typeof dir != 'undefined') {
queu.push([dir, opt]);
}
return queu;
});
$cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) {
e.stopPropagation();
var v = [itm, num, org, dev],
t = ['string/object', 'string/number/object', 'boolean', 'number'],
a = cf_sortParams(v, t);
var itm = a[0],
num = a[1],
org = a[2],
dev = a[3];
if (typeof itm == 'object' &&
typeof itm.jquery == 'undefined')	itm = $(itm);
if (typeof itm == 'string') 			itm = $(itm);
if (typeof itm != 'object' ||
typeof itm.jquery == 'undefined' ||
itm.length == 0) return debug(conf, 'Not a valid object.');
if (typeof num == 'undefined') num = 'end';
if (opts.usePadding) {
itm.each(function() {
var m = parseInt($(this).css(opts.d['marginRight']));
if (isNaN(m)) m = 0;
$(this).data('cfs_origCssMargin', m);
});
}
var orgNum = num,
before = 'before';
if (num == 'end') {
if (org) {
if (itms.first == 0) {
num = itms.total-1;
before = 'after';
} else {
num = itms.first;
itms.first += itm.length
}
if (num < 0) num = 0;
} else {
num = itms.total-1;
before = 'after';
}
} else {
num = gn_getItemIndex(num, dev, org, itms, $cfs);
}
if (orgNum != 'end' && !org) {
if (num < itms.first) itms.first += itm.length;
}
if (itms.first >= itms.total) itms.first -= itms.total;
var $cit = $cfs.children().eq(num);
if ($cit.length) {
$cit[before](itm);
} else {
$cfs.append(itm);
}
itms.total = $cfs.children().length;
var sz = $cfs.triggerHandler('updateSizes');
nv_showNavi(opts, itms.total, conf);
nv_enableNavi(opts, itms.first, conf);
$cfs.trigger(cf_e('linkAnchors', conf));
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
return true;
});
$cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) {
e.stopPropagation();
var v = [num, org, dev],
t = ['string/number/object', 'boolean', 'number'],
a = cf_sortParams(v, t);
var num = a[0],
org = a[1],
dev = a[2];
if (typeof num == 'undefined' || num == 'end') {
$cfs.children().last().remove();
} else {
num = gn_getItemIndex(num, dev, org, itms, $cfs);
var $cit = $cfs.children().eq(num);
if ($cit.length){
if (num < itms.first) itms.first -= $cit.length;
$cit.remove();
}
}
itms.total = $cfs.children().length;
var sz = $cfs.triggerHandler('updateSizes');
nv_showNavi(opts, itms.total, conf);
nv_enableNavi(opts, itms.first, conf);
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
return true;
});
$cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) {
e.stopPropagation();
var eType = e.type.substr(conf.events.prefix.length);
if (is_array(fn))				clbk[eType] = fn;
if (typeof fn == 'function')	clbk[eType].push(fn);
return clbk[eType];
});
$cfs.bind(cf_e('_cfs_currentPosition', conf, false), function(e, fn) {
e.stopPropagation();
return $cfs.triggerHandler(cf_e('currentPosition', conf), fn);
});
$cfs.bind(cf_e('currentPosition', conf), function(e, fn) {
e.stopPropagation();
if (itms.first == 0) var val = 0;
else var val = itms.total - itms.first;
if (typeof fn == 'function') fn.call($tt0, val);
return val;
});
$cfs.bind(cf_e('currentPage', conf), function(e, fn) {
e.stopPropagation();
var ipp = opts.pagination.items || opts.items.visible;
var max = Math.ceil(itms.total/ipp-1);
if (itms.first == 0) 							var nr = 0;
else if (itms.first < itms.total % ipp) 		var nr = 0;
else if (itms.first == ipp && !opts.circular) 	var nr = max;
else 											var nr = Math.round((itms.total-itms.first)/ipp);
if (nr < 0) nr = 0;
if (nr > max) nr = max;
if (typeof fn == 'function') fn.call($tt0, nr);
return nr;
});
$cfs.bind(cf_e('currentVisible', conf), function(e, fn) {
e.stopPropagation();
$i = gi_getCurrentItems($cfs.children(), opts);
if (typeof fn == 'function') fn.call($tt0, $i);
return $i;
});
$cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) {
e.stopPropagation();
var eType = e.type.substr(conf.events.prefix.length);
if (typeof fn == 'function') fn.call($tt0, crsl[eType]);
return crsl[eType];
});
$cfs.bind(cf_e('_cfs_configuration', conf, false), function(e, a, b, c) {
e.stopPropagation();
return $cfs.triggerHandler(cf_e('configuration', conf), [a, b, c]);
});
$cfs.bind(cf_e('configuration', conf), function(e, a, b, c) {
e.stopPropagation();
var reInit = false;
if (typeof a == 'function') {
a.call($tt0, opts);
} else if (typeof a == 'object') {
opts_orig = $.extend(true, {}, opts_orig, a);
if (b !== false) reInit = true;
else opts = $.extend(true, {}, opts, a);
} else if (typeof a != 'undefined') {
if (typeof b == 'function') {
var val = eval('opts.'+a);
if (typeof val == 'undefined') val = '';
b.call($tt0, val);
} else if (typeof b != 'undefined') {
if (typeof c !== 'boolean') c = true;
eval('opts_orig.'+a+' = b');
if (c !== false) reInit = true;
else eval('opts.'+a+' = b');
} else {
return eval('opts.'+a);
}
}
if (reInit) {
sz_resetMargin($cfs.children(), opts);
$cfs._cfs_init(opts_orig);
$cfs._cfs_bind_buttons();
var siz = sz_setSizes($cfs, opts);
$cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]);
}
return opts;
});
$cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) {
e.stopPropagation();
if (typeof $con == 'undefined' || $con.length == 0) $con = $('body');
else if (typeof $con == 'string') $con = $($con);
if (typeof $con != 'object') return debug(conf, 'Not a valid object.');
if (typeof sel != 'string' || sel.length == 0) sel = 'a.caroufredsel';
$con.find(sel).each(function() {
var h = this.hash || '';
if (h.length > 0 && $cfs.children().index($(h)) != -1) {
$(this).unbind('click').click(function(e) {
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), h);
});
}
});
return true;
});
$cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) {
e.stopPropagation();
if (!opts.pagination.container) return;
if (build) {
var ipp = opts.pagination.items || opts.items.visible,
l = Math.ceil(itms.total/ipp);
if (opts.pagination.anchorBuilder) {
opts.pagination.container.children().remove();
opts.pagination.container.each(function() {
for (var a = 0; a < l; a++) {
var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) );
$(this).append(opts.pagination.anchorBuilder(a+1, i));
}
});
}
opts.pagination.container.each(function() {
$(this).children().unbind(opts.pagination.event).each(function(a) {
$(this).bind(opts.pagination.event, function(e) {
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), [a*ipp, 0, true, opts.pagination]);
});
});
});
}
opts.pagination.container.each(function() {
$(this).children().removeClass(cf_c('selected', conf)).eq($cfs.triggerHandler(cf_e('currentPage', conf))).addClass(cf_c('selected', conf));
});
return true;
});
$cfs.bind(cf_e('updateSizes', conf), function(e) {
var a_itm = $cfs.children(),
vI = opts.items.visible;
if (opts.items.visibleConf.variable)	vI = gn_getVisibleItemsNext(a_itm, opts, 0);
else if (opts.items.filter != '*') 			vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
if (!opts.circular && itms.first != 0 && vI > itms.first) {
if (opts.items.visibleConf.variable) {
var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first;
} else if (opts.items.filter != '*') {
var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first;
} else {
nI = opts.items.visible - itms.first;
}
debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.');
$cfs.trigger('prev', nI);
}
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
return sz_setSizes($cfs, opts);
});
$cfs.bind(cf_e('_cfs_destroy', conf, false), function(e, orgOrder) {
e.stopPropagation();
$cfs.trigger(cf_e('destroy', conf), orgOrder);
return true;
});
$cfs.bind(cf_e('destroy', conf), function(e, orgOrder) {
e.stopPropagation();
tmrs = sc_clearTimers(tmrs);
$cfs.data('cfs_isCarousel', false);
$cfs.trigger(cf_e('finish', conf));
if (orgOrder) {
$cfs.trigger(cf_e('jumpToStart', conf));
}
if (opts.usePadding) {
sz_resetMargin($cfs.children(), opts);
}
$cfs.css($cfs.data('cfs_origCss'));
$cfs._cfs_unbind_events();
$cfs._cfs_unbind_buttons();
$wrp.replaceWith($cfs);
return true;
});
};	//	/bind_events
$cfs._cfs_unbind_events = function() {
$cfs.unbind(cf_e('', conf, false));
};	//	/unbind_events
$cfs._cfs_bind_buttons = function() {
$cfs._cfs_unbind_buttons();
nv_showNavi(opts, itms.total, conf);
nv_enableNavi(opts, itms.first, conf);
if (opts.auto.pauseOnHover) {
var pC = bt_pauseOnHoverConfig(opts.auto.pauseOnHover);
$wrp.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), [pC[0], pC[1]]);	})
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));					});
}
if (opts.auto.button) {
opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) {
e.preventDefault();
var ev = (crsl.isPaused) ? 'play' : 'pause';
$cfs.trigger(cf_e(ev, conf));
});
}
if (opts.prev.button) {
opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) {
e.preventDefault();
$cfs.trigger(cf_e('prev', conf));
});
if (opts.prev.pauseOnHover) {
var pC = bt_pauseOnHoverConfig(opts.prev.pauseOnHover);
opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), [pC[0], pC[1]]);	})
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));					});
}
}
if (opts.next.button) {
opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) {
e.preventDefault();
$cfs.trigger(cf_e('next', conf));
});
if (opts.next.pauseOnHover) {
var pC = bt_pauseOnHoverConfig(opts.next.pauseOnHover);
opts.next.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), [pC[0], pC[1]]); 	})
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));					});
}
}
if ($.fn.mousewheel) {
if (opts.prev.mousewheel) {
if (!crsl.mousewheelPrev) {
crsl.mousewheelPrev = true;
$wrp.mousewheel(function(e, delta) {
if (delta > 0) {
e.preventDefault();
var num = bt_mousesheelNumber(opts.prev.mousewheel);
$cfs.trigger(cf_e('prev', conf), num);
}
});
}
}
if (opts.next.mousewheel) {
if (!crsl.mousewheelNext) {
crsl.mousewheelNext = true;
$wrp.mousewheel(function(e, delta) {
if (delta < 0) {
e.preventDefault();
var num = bt_mousesheelNumber(opts.next.mousewheel);
$cfs.trigger(cf_e('next', conf), num);
}
});
}
}
}
if ($.fn.touchwipe) {
var wP = (opts.prev.wipe) ? function() { $cfs.trigger(cf_e('prev', conf)) } : null,
wN = (opts.next.wipe) ? function() { $cfs.trigger(cf_e('next', conf)) } : null;
if (wN || wN) {
if (!crsl.touchwipe) {
crsl.touchwipe = true;
var twOps = {
'min_move_x': 30,
'min_move_y': 30,
'preventDefaultEvents': true
};
switch (opts.direction) {
case 'up':
case 'down':
twOps.wipeUp = wN;
twOps.wipeDown = wP;
break;
default:
twOps.wipeLeft = wN;
twOps.wipeRight = wP;
}
$wrp.touchwipe(twOps);
}
}
}
if (opts.pagination.container) {
if (opts.pagination.pauseOnHover) {
var pC = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);
opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), [pC[0], pC[1]]);	})
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));				});
}
}
if (opts.prev.key || opts.next.key) {
$(document).bind(cf_e('keyup', conf, false), function(e) {
var k = e.keyCode;
if (k == opts.next.key)	{
e.preventDefault();
$cfs.trigger(cf_e('next', conf));
}
if (k == opts.prev.key) {
e.preventDefault();
$cfs.trigger(cf_e('prev', conf));
}
});
}
if (opts.pagination.keys) {
$(document).bind(cf_e('keyup', conf, false), function(e) {
var k = e.keyCode;
if (k >= 49 && k < 58) {
k = (k-49) * opts.items.visible;
if (k <= itms.total) {
e.preventDefault();
$cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]);
}
}
});
}
if (opts.auto.play) {
$cfs.trigger(cf_e('play', conf), opts.auto.delay);
}
};	//	/bind_buttons
$cfs._cfs_unbind_buttons = function() {
var ns = cf_e('', conf, false);
$(document).unbind(ns);
$wrp.unbind(ns);
if (opts.auto.button) opts.auto.button.unbind(ns);
if (opts.prev.button) opts.prev.button.unbind(ns);
if (opts.next.button) opts.next.button.unbind(ns);
if (opts.pagination.container) {
opts.pagination.container.unbind(ns);
if (opts.pagination.anchorBuilder) {
opts.pagination.container.children().remove();
}
}
nv_showNavi(opts, 'hide', conf);
nv_enableNavi(opts, 'removeClass', conf);
};	//	/unbind_buttons
var crsl = {
'direction'		: 'next',
'isPaused'		: true,
'isScrolling'	: false,
'isStopped'		: false,
'mousewheelNext': false,
'mousewheelPrev': false,
'touchwipe'		: false
},
itms = {
'total'			: $cfs.children().length,
'first'			: 0
},
tmrs = {
'timer'			: null,
'auto'			: null,
'queue'			: null,
'startTime'		: getTime(),
'timePassed'	: 0
},
scrl = {
'isStopped'		: false,
'duration'		: 0,
'startTime'		: 0,
'easing'		: '',
'anims'			: []
},
clbk = {
'onBefore'		: [],
'onAfter'		: []
},
queu = [],
conf = $.extend(true, {}, $.fn.carouFredSel.configs, configs),
opts = {},
opts_orig = options,
$wrp = $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();
conf.selector = $cfs.selector;
$cfs._cfs_init(opts_orig, true, starting_position);
$cfs._cfs_build();
$cfs._cfs_bind_events();
$cfs._cfs_bind_buttons();
if (is_array(opts.items.start)) {
var start_arr = opts.items.start;
} else {
var start_arr = [];
if (opts.items.start != 0) {
start_arr.push(opts.items.start);
}
}
if (opts.cookie) {
start_arr.unshift(cf_readCookie(opts.cookie));
}
if (start_arr.length > 0) {
for (var a = 0, l = start_arr.length; a < l; a++) {
var s = start_arr[a];
if (s == 0) {
continue;
}
if (s === true) {
s = window.location.hash;
if (s.length < 1) {
continue;
}
} else if (s === 'random') {
s = Math.floor(Math.random()*itms.total);
}
if ($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }])) {
break;
}
}
}
var siz = sz_setSizes($cfs, opts, false),
itm = gi_getCurrentItems($cfs.children(), opts);
if (opts.onCreate) {
opts.onCreate.call($tt0, itm, siz);
}
$cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]);
$cfs.trigger(cf_e('linkAnchors', conf));
return $cfs;
};
$.fn.carouFredSel.defaults = {
'synchronise'	: false,
'infinite'		: true,
'circular'		: true,
'direction'		: 'left',
'items'			: {
'start'			: 0
},
'scroll'		: {
'easing'		: 'swing',
'duration'		: 500,
'pauseOnHover'	: false,
'mousewheel'	: false,
'wipe'			: false,
'event'			: 'click',
'queue'			: false
}
};
$.fn.carouFredSel.configs = {
'debug'			: false,
'events'		: {
'prefix'		: '',
'namespace'		: 'cfs'
},
'wrapper'		: {
'element'		: 'div',
'classname'		: 'caroufredsel_wrapper'
},
'classnames'	: {}
};
$.fn.carouFredSel.pageAnchorBuilder = function(nr, itm) {
return '<a href="#"><span>'+nr+'</span></a>';
};
function sc_setScroll(d, e) {
return {
anims		: [],
duration	: d,
orgDuration	: d,
easing		: e,
startTime	: getTime()
};
}
function sc_startScroll(s) {
if (typeof s.pre == 'object') {
sc_startScroll(s.pre);
}
for (var a = 0, l = s.anims.length; a < l; a++) {
var b = s.anims[a];
if (!b) continue;
if (b[3]) b[0].stop();
b[0].animate(b[1], {
complete: b[2],
duration: s.duration,
easing: s.easing
});
}
if (typeof s.post == 'object') {
sc_startScroll(s.post);
}
}
function sc_stopScroll(s, finish) {
if (typeof finish != 'boolean') finish = true;
if (typeof s.pre == 'object') {
sc_stopScroll(s.pre, finish);
}
for (var a = 0, l = s.anims.length; a < l; a++) {
var b = s.anims[a];
b[0].stop(true);
if (finish) {
b[0].css(b[1]);
if (typeof b[2] == 'function') b[2]();
}
}
if (typeof s.post == 'object') {
sc_stopScroll(s.post, finish);
}
}
function sc_clearTimers(t) {
if (t.auto) clearTimeout(t.auto);
return t;
}
function sc_callCallbacks(cbs, t, args) {
if (cbs.length) {
for (var a = 0, l = cbs.length; a < l; a++) {
cbs[a].apply(t, args);
}
}
return [];
}
function fx_fade(sO, c, x, d, f) {
var o = {
'duration'	: d,
'easing'	: sO.easing
};
if (typeof f == 'function') o.complete = f;
c.animate({
opacity: x
}, o);
}
function fx_cover(sc, c1, c2, o, prev) {
var old_w = ms_getSizes(gi_getOldItemsNext(c1.children(), o), o, true)[0],
new_w = ms_getSizes(c2.children(), o, true)[0],
cur_l = (prev) ? -new_w : old_w,
css_o = {},
ani_o = {};
css_o[o.d['width']] = new_w;
css_o[o.d['left']] = cur_l;
ani_o[o.d['left']] = 0;
sc.pre.anims.push([c1, { 'opacity': 1 }]);
sc.post.anims.push([c2, ani_o, function() { $(this).remove(); }]);
c2.css(css_o);
return sc;
}
function fx_uncover(sc, c1, c2, o, prev, n) {
var new_w = ms_getSizes(gi_getNewItemsNext(c1.children(), o, n), o, true)[0],
old_w = ms_getSizes(c2.children(), o, true)[0],
cur_l = (prev) ? -old_w : new_w,
css_o = {},
ani_o = {};
css_o[o.d['width']] = old_w;
css_o[o.d['left']] = 0;
ani_o[o.d['left']] = cur_l;
sc.post.anims.push([c2, ani_o, function() { $(this).remove(); }]);
c2.css(css_o);
return sc;
}
function nv_showNavi(o, t, c) {
if (t == 'show' || t == 'hide') {
var f = t;
} else if (o.items.minimum >= t) {
debug(c, 'Not enough items: hiding navigation ('+t+' items, '+o.items.minimum+' needed).');
var f = 'hide';
} else {
var f = 'show';
}
var s = (f == 'show') ? 'removeClass' : 'addClass',
h = cf_c('hidden', c);
if (o.auto.button) o.auto.button[f]()[s](h);
if (o.prev.button) o.prev.button[f]()[s](h);
if (o.next.button) o.next.button[f]()[s](h);
if (o.pagination.container) o.pagination.container[f]()[s](h);
}
function nv_enableNavi(o, f, c) {
if (o.circular || o.infinite) return;
var fx = (f == 'removeClass' || f == 'addClass') ? f : false,
di = cf_c('disabled', c);
if (o.auto.button && fx) {
o.auto.button[fx](di);
}
if (o.prev.button) {
var fn = fx || (f == 0) ? 'addClass' : 'removeClass';
o.prev.button[fn](di);
}
if (o.next.button) {
var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass';
o.next.button[fn](di);
}
}
function go_getObject($tt, obj) {
if (typeof obj == 'function')	obj = obj.call($tt);
if (typeof obj == 'undefined')	obj = {};
return obj;
}
function go_getNaviObject($tt, obj, type) {
if (typeof type != 'string') type = '';
obj = go_getObject($tt, obj);
if (typeof obj == 'string') {
var temp = cf_getKeyCode(obj);
if (temp == -1) obj = $(obj);
else 			obj = temp;
}
if (type == 'pagination') {
if (typeof obj 				== 'boolean')	obj = { 'keys': obj };
if (typeof obj.jquery 		!= 'undefined')	obj = { 'container': obj };
if (typeof obj.container	== 'function')	obj.container = obj.container.call($tt);
if (typeof obj.container	== 'string')	obj.container = $(obj.container);
if (typeof obj.items		!= 'number')	obj.items = false;
} else if (type == 'auto') {
if (typeof obj.jquery	!= 'undefined')		obj = { 'button': obj };
if (typeof obj == 'boolean')				obj = { 'play': obj };
if (typeof obj == 'number')					obj = { 'pauseDuration': obj };
if (typeof obj.button		== 'function')	obj.button = obj.button.call($tt);
if (typeof obj.button		== 'string')	obj.button = $(obj.button);
} else {
if (typeof obj.jquery		!= 'undefined')	obj = { 'button': obj };
if (typeof obj 				== 'number')	obj = { 'key': obj };
if (typeof obj.button		== 'function')	obj.button = obj.button.call($tt);
if (typeof obj.button		== 'string')	obj.button = $(obj.button);
if (typeof obj.key			== 'string')	obj.key = cf_getKeyCode(obj.key);
}
return obj;
}
function gn_getItemIndex(num, dev, org, items, $cfs) {
if (typeof num == 'string') {
if (isNaN(num)) num = $(num);
else 			num = parseInt(num);
}
if (typeof num == 'object') {
if (typeof num.jquery == 'undefined') num = $(num);
num = $cfs.children().index(num);
if (num == -1) num = 0;
if (typeof org != 'boolean') org = false;
} else {
if (typeof org != 'boolean') org = true;
}
if (isNaN(num))	num = 0;
else 			num = parseInt(num);
if (isNaN(dev))	dev = 0;
else 			dev = parseInt(dev);
if (org) {
num += items.first;
}
num += dev;
if (items.total > 0) {
while (num >= items.total)	{	num -= items.total; }
while (num < 0)				{	num += items.total; }
}
return num;
}
function gn_getVisibleItemsPrev(i, o, s) {
var t = 0,
x = 0;
for (var a = s; a >= 0; a--) {
var j = i.eq(a);
t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
if (t > o.maxDimention) return x;
if (a == 0) a = i.length;
x++;
}
}
function gn_getVisibleItemsPrevFilter(i, o, s) {
return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s);
}
function gn_getScrollItemsPrevFilter(i, o, s, m) {
return gn_getItemsPrevFilter(i, o.items.filter, m, s);
}
function gn_getItemsPrevFilter(i, f, m, s) {
var t = 0,
x = 0;
for (var a = s, l = i.length-1; a >= 0; a--) {
x++;
if (x == l) return x;
var j = i.eq(a);
if (j.is(f)) {
t++;
if (t == m) return x;
}
if (a == 0) a = i.length;
}
}
function gn_getVisibleOrg($c, o) {
return o.items.visibleConf.org || $c.children().slice(0, o.items.visible).filter(o.items.filter).length;
}
function gn_getVisibleItemsNext(i, o, s) {
var t = 0,
x = 0;
for (var a = s, l = i.length-1; a <= l; a++) {
var j = i.eq(a);
t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
if (t > o.maxDimention) return x;
x++;
if (x == l) return x;
if (a == l) a = -1;
}
}
function gn_getVisibleItemsNextTestCircular(i, o, s, l) {
var v = gn_getVisibleItemsNext(i, o, s);
if (!o.circular) {
if (s + v > l) v = l - s;
}
return v;
}
function gn_getVisibleItemsNextFilter(i, o, s) {
return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s);
}
function gn_getScrollItemsNextFilter(i, o, s, m) {
return gn_getItemsNextFilter(i, o.items.filter, m+1, s) - 1;
}
function gn_getItemsNextFilter(i, f, m, s) {
var t = 0,
x = 0;
for (var a = s, l = i.length-1; a <= l; a++) {
x++;
if (x == l) return x;
var j = i.eq(a);
if (j.is(f)) {
t++;
if (t == m) return x;
}
if (a == l) a = -1;
}
}
function gi_getCurrentItems(i, o) {
return i.slice(0, o.items.visible);
}
function gi_getOldItemsPrev(i, o, n) {
return i.slice(n, o.items.visibleConf.old+n);
}
function gi_getNewItemsPrev(i, o) {
return i.slice(0, o.items.visible);
}
function gi_getOldItemsNext(i, o) {
return i.slice(0, o.items.visibleConf.old);
}
function gi_getNewItemsNext(i, o, n) {
return i.slice(n, o.items.visible+n);
}
function sz_resetMargin(i, o, m) {
var x = (typeof m == 'boolean') ? m : false;
if (typeof m != 'number') m = 0;
i.each(function() {
var j = $(this);
var t = parseInt(j.css(o.d['marginRight']));
if (isNaN(t)) t = 0;
j.data('cfs_tempCssMargin', t);
j.css(o.d['marginRight'], ((x) ? j.data('cfs_tempCssMargin') : m + j.data('cfs_origCssMargin')));
});
}
function sz_setSizes($c, o, p) {
var $w = $c.parent(),
$i = $c.children(),
$v = gi_getCurrentItems($i, o),
sz = cf_mapWrapperSizes(ms_getSizes($v, o, true), o, p);
$w.css(sz);
if (o.usePadding) {
var p = o.padding,
r = p[o.d[1]];
if (o.align) {
if (r < 0) r = 0;
}
var $l = $v.last();
$l.css(o.d['marginRight'], $l.data('cfs_origCssMargin') + r);
$c.css(o.d['top'], p[o.d[0]]);
$c.css(o.d['left'], p[o.d[3]]);
}
$c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2));
$c.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
return sz;
}
function ms_getSizes(i, o, wrapper) {
var s1 = ms_getTotalSize(i, o, 'width', wrapper),
s2 = ms_getLargestSize(i, o, 'height', wrapper);
return [s1, s2];
}
function ms_getLargestSize(i, o, dim, wrapper) {
if (typeof wrapper != 'boolean') wrapper = false;
if (typeof o[o.d[dim]] == 'number' && wrapper) return o[o.d[dim]];
if (typeof o.items[o.d[dim]] == 'number') return o.items[o.d[dim]];
var di2 = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight';
return ms_getTrueLargestSize(i, o, di2);
}
function ms_getTrueLargestSize(i, o, dim) {
var s = 0;
for (var a = 0, l = i.length; a < l; a++) {
var j = i.eq(a);
var m = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
if (s < m) s = m;
}
return s;
}
function ms_getTrueInnerSize($el, o, dim) {
if (!$el.is(':visible')) return 0;
var siz = $el[o.d[dim]](),
arr = (o.d[dim].toLowerCase().indexOf('width') > -1) ? ['paddingLeft', 'paddingRight'] : ['paddingTop', 'paddingBottom'];
for (var a = 0, l = arr.length; a < l; a++) {
var m = parseInt($el.css(arr[a]));
siz -= (isNaN(m)) ? 0 : m;
}
return siz;
}
function ms_getTotalSize(i, o, dim, wrapper) {
if (typeof wrapper != 'boolean') wrapper = false;
if (typeof o[o.d[dim]] == 'number' && wrapper) return o[o.d[dim]];
if (typeof o.items[o.d[dim]] == 'number') return o.items[o.d[dim]] * i.length;
var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight',
s = 0;
for (var a = 0, l = i.length; a < l; a++) {
var j = i.eq(a);
s += (j.is(':visible')) ? j[o.d[d]](true) : 0;
}
return s;
}
function ms_hasVariableSizes(i, o, dim) {
var s = false,
v = false;
for (var a = 0, l = i.length; a < l; a++) {
var j = i.eq(a);
var c = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
if (s === false) s = c;
else if (s != c) v = true;
if (s == 0)		 v = true;
}
return v;
}
function cf_e(n, c, pf, ns) {
if (typeof pf != 'boolean') pf = true;
if (typeof ns != 'boolean') ns = true;
if (pf) n = c.events.prefix + n;
if (ns) n = n +'.'+ c.events.namespace;
return n;
}
function cf_c(n, c) {
return (typeof c.classnames[n] == 'string') ? c.classnames[n] : n;
}
function cf_mapWrapperSizes(ws, o, p) {
if (typeof p != 'boolean') p = true;
var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0];
var wra = {};
wra[o.d['width']] = ws[0] + pad[1] + pad[3];
wra[o.d['height']] = ws[1] + pad[0] + pad[2];
return wra;
}
function cf_sortParams(vals, typs) {
var arr = [];
for (var a = 0, l1 = vals.length; a < l1; a++) {
for (var b = 0, l2 = typs.length; b < l2; b++) {
if (typs[b].indexOf(typeof vals[a]) > -1 && typeof arr[b] == 'undefined') {
arr[b] = vals[a];
break;
}
}
}
return arr;
}
function cf_getPadding(p) {
if (typeof p == 'undefined') return [0, 0, 0, 0];
if (typeof p == 'number') return [p, p, p, p];
else if (typeof p == 'string') p = p.split('px').join('').split('em').join('').split(' ');
if (!is_array(p)) {
return [0, 0, 0, 0];
}
for (var i = 0; i < 4; i++) {
p[i] = parseInt(p[i]);
}
switch (p.length) {
case 0:	return [0, 0, 0, 0];
case 1: return [p[0], p[0], p[0], p[0]];
case 2: return [p[0], p[1], p[0], p[1]];
case 3: return [p[0], p[1], p[2], p[1]];
default: return [p[0], p[1], p[2], p[3]];
}
}
function cf_getAlignPadding(itm, o) {
var x = (typeof o[o.d['width']] == 'number') ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0;
switch (o.align) {
case 'left': return [0, x];
case 'right': return [x, 0];
case 'center':
default:
return [Math.ceil(x/2), Math.floor(x/2)];
}
}
function cf_getAdjust(x, o, a, $t) {
var v = x;
if (typeof a == 'function') {
v = a.call($t, v);
} else if (typeof a == 'string') {
var p = a.split('+'),
m = a.split('-');
if (m.length > p.length) {
var neg = true,
sta = m[0],
adj = m[1];
} else {
var neg = false,
sta = p[0],
adj = p[1];
}
switch(sta) {
case 'even':
v = (x % 2 == 1) ? x-1 : x;
break;
case 'odd':
v = (x % 2 == 0) ? x-1 : x;
break;
default:
v = x;
break;
}
adj = parseInt(adj);
if (!isNaN(adj)) {
if (neg) adj = -adj;
v += adj;
}
}
if (typeof v != 'number') v = 1;
if (v < 1) v = 1;
return v;
}
function cf_getItemsAdjust(x, o, a, $t) {
var v = cf_getAdjust(x, o, a, $t),
i = o.items.visibleConf;
if (typeof i.min == 'number' && v < i.min) v = i.min;
if (typeof i.max == 'number' && v > i.max) v = i.max;
if (v < 1) v = 1;
return v;
}
function cf_getSynchArr(s) {
if (!is_array(s)) 		s = [[s]];
if (!is_array(s[0]))	s = [s];
for (var j = 0, l = s.length; j < l; j++) {
if (typeof s[j][0] == 'string')		s[j][0] = $(s[j][0]);
if (typeof s[j][1] != 'boolean')	s[j][1] = true;
if (typeof s[j][2] != 'boolean')	s[j][2] = true;
if (typeof s[j][3] != 'number')		s[j][3] = 0;
}
return s;
}
function cf_getKeyCode(k) {
if (k == 'right')	return 39;
if (k == 'left')	return 37;
if (k == 'up')		return 38;
if (k == 'down')	return 40;
return -1;
}
function cf_setCookie(n, v) {
if (n) document.cookie = n+'='+v+'; path=/';
}
function cf_readCookie(n) {
n += '=';
var ca = document.cookie.split(';');
for (var a = 0, l = ca.length; a < l; a++) {
var c = ca[a];
while (c.charAt(0) == ' ') {
c = c.substring(1, c.length);
}
if (c.indexOf(n) == 0) {
return c.substring(n.length, c.length);
}
}
return 0;
}
function bt_pauseOnHoverConfig(p) {
if (p && typeof p == 'string') {
var i = (p.indexOf('immediate') > -1) ? true : false,
r = (p.indexOf('resume') 	> -1) ? true : false;
} else {
var i = r = false;
}
return [i, r];
}
function bt_mousesheelNumber(mw) {
return (typeof mw == 'number') ? mw : null
}
function is_array(a) {
return typeof(a) == 'object' && (a instanceof Array);
}
function getTime() {
return new Date().getTime();
}
function debug(d, m) {
if (typeof d == 'object') {
var s = ' ('+d.selector+')';
d = d.debug;
} else {
var s = '';
}
if (!d) return false;
if (typeof m == 'string') m = 'carouFredSel'+s+': ' + m;
else m = ['carouFredSel'+s+':', m];
if (window.console && window.console.log) window.console.log(m);
return false;
}
$.fn.caroufredsel = function(o) {
return this.carouFredSel(o);
};
})(jQuery);
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
;
(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
"";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);
;
﻿/*
*
* jQuery listnav plugin
* Copyright (c) 2009 iHwy, Inc.
* Author: Jack Killpatrick
*
* Version 2.1 (08/09/2009)
* Requires jQuery 1.3.2, jquery 1.2.6 or jquery 1.2.x plus the jquery dimensions plugin
*
* Visit http://www.ihwy.com/labs/jquery-listnav-plugin.aspx for more information.
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
*/
(function($) {
$.fn.listnav = function(options) {
var opts = $.extend({}, $.fn.listnav.defaults, options);
var letters = ['_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-'];
var firstClick = false;
opts.prefixes = $.map(opts.prefixes, function(n) { return n.toLowerCase(); });
return this.each(function() {
var $wrapper, list, $list, $letters, $letterCount, id;
id = this.id;
$wrapper = $('#' + id + '-nav'); // user must abide by the convention: <ul id="myList"> for list and <div id="myList-nav"> for nav wrapper
$list = $(this);
var counts = {}, allCount = 0, isAll = true, numCount = 0, prevLetter = '';
function init() {
$wrapper.append(createLettersHtml());
$letters = $('.ln-letters', $wrapper).slice(0, 1); // will always be a single item
if (opts.showCounts) $letterCount = $('.ln-letter-count', $wrapper).slice(0, 1); // will always be a single item
addClasses();
addNoMatchLI();
if (opts.flagDisabled) addDisabledClass();
bindHandlers();
if (!opts.includeAll) $list.show(); // show the list in case the recommendation for includeAll=false was taken
if (!opts.includeAll) $('.all', $letters).remove();
if (!opts.includeNums) $('._', $letters).remove();
if (!opts.includeOther) $('.-', $letters).remove();
$(':last', $letters).addClass('ln-last'); // allows for styling a case where last item needs right border set (because items before that only have top, left and bottom so that border between items isn't doubled)
if ($.cookie && (opts.cookieName != null)) {
var cookieLetter = $.cookie(opts.cookieName);
if (cookieLetter != null) opts.initLetter = cookieLetter;
}
if (opts.initLetter != '') {
firstClick = true;
$('.' + opts.initLetter.toLowerCase(), $letters).slice(0, 1).click(); // click the initLetter if there was one
}
else {
if (opts.includeAll) $('.all', $letters).addClass('ln-selected'); // showing all: we don't need to click this: the whole list is already loaded
else { // ALL link is hidden, click the first letter that will display LI's
for (var i = ((opts.includeNums) ? 0 : 1); i < letters.length; i++) {
if (counts[letters[i]] > 0) {
firstClick = true;
$('.' + letters[i], $letters).slice(0, 1).click();
break;
}
}
}
}
}
function setLetterCountTop() {
$letterCount.css({ top: $('.a', $letters).slice(0, 1).offset({ margin: false, border: true }).top - $letterCount.outerHeight({ margin: true }) }); // note: don't set top based on '.all': it might not be visible
}
function addClasses() {
var str, firstChar, firstWord, spl, $this, hasPrefixes = (opts.prefixes.length > 0);
$($list).children().each(function() {
$this = $(this), firstChar = '', str = $.trim($this.text()).toLowerCase();
if (str != '') {
if (hasPrefixes) {
spl = str.split(' ');
if ((spl.length > 1) && ($.inArray(spl[0], opts.prefixes) > -1)) {
firstChar = spl[1].charAt(0);
addLetterClass(firstChar, $this, true);
}
}
firstChar = str.charAt(0);
addLetterClass(firstChar, $this);
}
});
}
function addLetterClass(firstChar, $el, isPrefix) {
if (/\W/.test(firstChar)) firstChar = '-'; // not A-Z, a-z or 0-9, so considered "other"
if (!isNaN(firstChar)) firstChar = '_'; // use '_' if the first char is a number
$el.addClass('ln-' + firstChar);
if (counts[firstChar] == undefined) counts[firstChar] = 0;
counts[firstChar]++;
if (!isPrefix) allCount++;
}
function addDisabledClass() {
for (var i = 0; i < letters.length; i++) {
if (counts[letters[i]] == undefined) $('.' + letters[i], $letters).addClass('ln-disabled');
}
}
function addNoMatchLI() {
$list.append('<li class="ln-no-match" style="display:none">' + opts.noMatchText + '</li>');
}
function getLetterCount(el) {
if ($(el).hasClass('all')) return allCount;
else {
var count = counts[$(el).attr('class').split(' ')[0]];
return (count != undefined) ? count : 0; // some letters may not have a count in the hash
}
}
function bindHandlers() {
if (opts.showCounts) {
$wrapper.mouseover(function() {
setLetterCountTop();
});
}
if (opts.showCounts) {
$('a', $letters).mouseover(function() {
var left = $(this).position().left;
var width = ($(this).outerWidth({ margin: true }) - 1) + 'px'; // the -1 is to tweak the width a bit due to a seeming inaccuracy in jquery ui/dimensions outerWidth (same result in FF2 and IE6/7)
var count = getLetterCount(this);
$letterCount.css({ left: left, width: width }).text(count).show(); // set left position and width of letter count, set count text and show it
});
$('a', $letters).mouseout(function() {
$letterCount.hide();
});
}
$('a', $letters).click(function() {
$('a.ln-selected', $letters).removeClass('ln-selected');
var letter = $(this).attr('class').split(' ')[0];
if (letter == 'all') {
$list.children().show();
$list.children('.ln-no-match').hide();
isAll = true;
} else {
if (isAll) {
$list.children().hide();
isAll = false;
} else if (prevLetter != '') $list.children('.ln-' + prevLetter).hide();
var count = getLetterCount(this);
if (count > 0) {
$list.children('.ln-no-match').hide(); // in case it's showing
$list.children('.ln-' + letter).show();
}
else $list.children('.ln-no-match').show();
prevLetter = letter;
}
if ($.cookie && (opts.cookieName != null)) $.cookie(opts.cookieName, letter);
$(this).addClass('ln-selected');
$(this).blur();
if (!firstClick && (opts.onClick != null)) opts.onClick(letter);
else firstClick = false;
return false;
});
}
function createLettersHtml() {
var html = [];
for (var i = 1; i < letters.length; i++) {
if (html.length == 0) html.push('<a class="all" href="#">Alle</a><a class="_" href="#">0-9</a>');
html.push('<a class="' + letters[i] + '" href="#">' + ((letters[i] == '-') ? '...' : letters[i].toUpperCase()) + '</a>');
}
return '<div class="ln-letters">' + html.join('') + '</div>' + ((opts.showCounts) ? '<div class="ln-letter-count">0</div>' : ''); // the styling for ln-letter-count is to give us a starting point for the element, which will be repositioned when made visible (ie, should not need to be styled by the user)
}
init();
});
};
$.fn.listnav.defaults = {
initLetter: '',
includeAll: true,
incudeOther: false,
includeNums: true,
flagDisabled: true,
noMatchText: 'No matching entries',
showCounts: true,
cookieName: null,
onClick: null,
prefixes: []
};
})(jQuery);
(function($) {
$.extend($.fn, {
validate: function( options ) {
if (!this.length) {
options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
return;
}
var validator = $.data(this[0], 'validator');
if ( validator ) {
return validator;
}
validator = new $.validator( options, this[0] );
$.data(this[0], 'validator', validator);
if ( validator.settings.onsubmit ) {
this.find("input, button").filter(".cancel").click(function() {
validator.cancelSubmit = true;
});
if (validator.settings.submitHandler) {
this.find("input, button").filter(":submit").click(function() {
validator.submitButton = this;
});
}
this.submit( function( event ) {
if ( validator.settings.debug )
event.preventDefault();
function handle() {
if ( validator.settings.submitHandler ) {
if (validator.submitButton) {
var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
}
validator.settings.submitHandler.call( validator, validator.currentForm );
if (validator.submitButton) {
hidden.remove();
}
return false;
}
return true;
}
if ( validator.cancelSubmit ) {
validator.cancelSubmit = false;
return handle();
}
if ( validator.form() ) {
if ( validator.pendingRequest ) {
validator.formSubmitted = true;
return false;
}
return handle();
} else {
validator.focusInvalid();
return false;
}
});
}
return validator;
},
valid: function() {
if ( $(this[0]).is('form')) {
return this.validate().form();
} else {
var valid = true;
var validator = $(this[0].form).validate();
this.each(function() {
valid &= validator.element(this);
});
return valid;
}
},
removeAttrs: function(attributes) {
var result = {},
$element = this;
$.each(attributes.split(/\s/), function(index, value) {
result[value] = $element.attr(value);
$element.removeAttr(value);
});
return result;
},
rules: function(command, argument) {
var element = this[0];
if (command) {
var settings = $.data(element.form, 'validator').settings;
var staticRules = settings.rules;
var existingRules = $.validator.staticRules(element);
switch(command) {
case "add":
$.extend(existingRules, $.validator.normalizeRule(argument));
staticRules[element.name] = existingRules;
if (argument.messages)
settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
break;
case "remove":
if (!argument) {
delete staticRules[element.name];
return existingRules;
}
var filtered = {};
$.each(argument.split(/\s/), function(index, method) {
filtered[method] = existingRules[method];
delete existingRules[method];
});
return filtered;
}
}
var data = $.validator.normalizeRules(
$.extend(
{},
$.validator.metadataRules(element),
$.validator.classRules(element),
$.validator.attributeRules(element),
$.validator.staticRules(element)
), element);
if (data.required) {
var param = data.required;
delete data.required;
data = $.extend({required: param}, data);
}
return data;
}
});
$.extend($.expr[":"], {
blank: function(a) {return !$.trim("" + a.value);},
filled: function(a) {return !!$.trim("" + a.value);},
unchecked: function(a) {return !a.checked;}
});
$.validator = function( options, form ) {
this.settings = $.extend( true, {}, $.validator.defaults, options );
this.currentForm = form;
this.init();
};
$.validator.format = function(source, params) {
if ( arguments.length == 1 )
return function() {
var args = $.makeArray(arguments);
args.unshift(source);
return $.validator.format.apply( this, args );
};
if ( arguments.length > 2 && params.constructor != Array  ) {
params = $.makeArray(arguments).slice(1);
}
if ( params.constructor != Array ) {
params = [ params ];
}
$.each(params, function(i, n) {
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
});
return source;
};
$.extend($.validator, {
defaults: {
messages: {},
groups: {},
rules: {},
errorClass: "error",
validClass: "valid",
errorElement: "label",
focusInvalid: true,
errorContainer: $( [] ),
errorLabelContainer: $( [] ),
onsubmit: true,
ignore: [],
ignoreTitle: false,
onfocusin: function(element) {
this.lastActive = element;
if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
this.addWrapper(this.errorsFor(element)).hide();
}
},
onfocusout: function(element) {
if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
this.element(element);
}
},
onkeyup: function(element) {
if ( element.name in this.submitted || element == this.lastElement ) {
this.element(element);
}
},
onclick: function(element) {
if ( element.name in this.submitted )
this.element(element);
else if (element.parentNode.name in this.submitted)
this.element(element.parentNode);
},
highlight: function(element, errorClass, validClass) {
if (element.type === 'radio') {
this.findByName(element.name).addClass(errorClass).removeClass(validClass);
} else {
$(element).addClass(errorClass).removeClass(validClass);
}
},
unhighlight: function(element, errorClass, validClass) {
if (element.type === 'radio') {
this.findByName(element.name).removeClass(errorClass).addClass(validClass);
} else {
$(element).removeClass(errorClass).addClass(validClass);
}
}
},
setDefaults: function(settings) {
$.extend( $.validator.defaults, settings );
},
messages: {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL.",
date: "Please enter a valid date.",
dateISO: "Please enter a valid date (ISO).",
number: "Please enter a valid number.",
digits: "Please enter only digits.",
creditcard: "Please enter a valid credit card number.",
equalTo: "Please enter the same value again.",
accept: "Please enter a value with a valid extension.",
maxlength: $.validator.format("Please enter no more than {0} characters."),
minlength: $.validator.format("Please enter at least {0} characters."),
rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
range: $.validator.format("Please enter a value between {0} and {1}."),
max: $.validator.format("Please enter a value less than or equal to {0}."),
min: $.validator.format("Please enter a value greater than or equal to {0}.")
},
autoCreateRanges: false,
prototype: {
init: function() {
this.labelContainer = $(this.settings.errorLabelContainer);
this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
this.submitted = {};
this.valueCache = {};
this.pendingRequest = 0;
this.pending = {};
this.invalid = {};
this.reset();
var groups = (this.groups = {});
$.each(this.settings.groups, function(key, value) {
$.each(value.split(/\s/), function(index, name) {
groups[name] = key;
});
});
var rules = this.settings.rules;
$.each(rules, function(key, value) {
rules[key] = $.validator.normalizeRule(value);
});
function delegate(event) {
var validator = $.data(this[0].form, "validator"),
eventType = "on" + event.type.replace(/^validate/, "");
validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] );
}
$(this.currentForm)
.validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate)
.validateDelegate(":radio, :checkbox, select, option", "click", delegate);
if (this.settings.invalidHandler)
$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
},
form: function() {
this.checkForm();
$.extend(this.submitted, this.errorMap);
this.invalid = $.extend({}, this.errorMap);
if (!this.valid())
$(this.currentForm).triggerHandler("invalid-form", [this]);
this.showErrors();
return this.valid();
},
checkForm: function() {
this.prepareForm();
for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
this.check( elements[i] );
}
return this.valid();
},
element: function( element ) {
element = this.clean( element );
this.lastElement = element;
this.prepareElement( element );
this.currentElements = $(element);
var result = this.check( element );
if ( result ) {
delete this.invalid[element.name];
} else {
this.invalid[element.name] = true;
}
if ( !this.numberOfInvalids() ) {
this.toHide = this.toHide.add( this.containers );
}
this.showErrors();
return result;
},
showErrors: function(errors) {
if(errors) {
$.extend( this.errorMap, errors );
this.errorList = [];
for ( var name in errors ) {
this.errorList.push({
message: errors[name],
element: this.findByName(name)[0]
});
}
this.successList = $.grep( this.successList, function(element) {
return !(element.name in errors);
});
}
this.settings.showErrors
? this.settings.showErrors.call( this, this.errorMap, this.errorList )
: this.defaultShowErrors();
},
resetForm: function() {
if ( $.fn.resetForm )
$( this.currentForm ).resetForm();
this.submitted = {};
this.prepareForm();
this.hideErrors();
this.elements().removeClass( this.settings.errorClass );
},
numberOfInvalids: function() {
return this.objectLength(this.invalid);
},
objectLength: function( obj ) {
var count = 0;
for ( var i in obj )
count++;
return count;
},
hideErrors: function() {
this.addWrapper( this.toHide ).hide();
},
valid: function() {
return this.size() == 0;
},
size: function() {
return this.errorList.length;
},
focusInvalid: function() {
if( this.settings.focusInvalid ) {
try {
$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
.filter(":visible")
.focus()
.trigger("focusin");
} catch(e) {
}
}
},
findLastActive: function() {
var lastActive = this.lastActive;
return lastActive && $.grep(this.errorList, function(n) {
return n.element.name == lastActive.name;
}).length == 1 && lastActive;
},
elements: function() {
var validator = this,
rulesCache = {};
return $(this.currentForm)
.find("input, select, textarea")
.not(":submit, :reset, :image, [disabled]")
.not( this.settings.ignore )
.filter(function() {
!this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
return false;
rulesCache[this.name] = true;
return true;
});
},
clean: function( selector ) {
return $( selector )[0];
},
errors: function() {
return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
},
reset: function() {
this.successList = [];
this.errorList = [];
this.errorMap = {};
this.toShow = $([]);
this.toHide = $([]);
this.currentElements = $([]);
},
prepareForm: function() {
this.reset();
this.toHide = this.errors().add( this.containers );
},
prepareElement: function( element ) {
this.reset();
this.toHide = this.errorsFor(element);
},
check: function( element ) {
element = this.clean( element );
if (this.checkable(element)) {
element = this.findByName( element.name ).not(this.settings.ignore)[0];
}
var rules = $(element).rules();
var dependencyMismatch = false;
for (var method in rules ) {
var rule = { method: method, parameters: rules[method] };
try {
var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
if ( result == "dependency-mismatch" ) {
dependencyMismatch = true;
continue;
}
dependencyMismatch = false;
if ( result == "pending" ) {
this.toHide = this.toHide.not( this.errorsFor(element) );
return;
}
if( !result ) {
this.formatAndAdd( element, rule );
return false;
}
} catch(e) {
this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
+ ", check the '" + rule.method + "' method", e);
throw e;
}
}
if (dependencyMismatch)
return;
if ( this.objectLength(rules) )
this.successList.push(element);
return true;
},
customMetaMessage: function(element, method) {
if (!$.metadata)
return;
var meta = this.settings.meta
? $(element).metadata()[this.settings.meta]
: $(element).metadata();
return meta && meta.messages && meta.messages[method];
},
customMessage: function( name, method ) {
var m = this.settings.messages[name];
return m && (m.constructor == String
? m
: m[method]);
},
findDefined: function() {
for(var i = 0; i < arguments.length; i++) {
if (arguments[i] !== undefined)
return arguments[i];
}
return undefined;
},
defaultMessage: function( element, method) {
return this.findDefined(
this.customMessage( element.name, method ),
this.customMetaMessage( element, method ),
!this.settings.ignoreTitle && element.title || undefined,
$.validator.messages[method],
"<strong>Warning: No message defined for " + element.name + "</strong>"
);
},
formatAndAdd: function( element, rule ) {
var message = this.defaultMessage( element, rule.method ),
theregex = /\$?\{(\d+)\}/g;
if ( typeof message == "function" ) {
message = message.call(this, rule.parameters, element);
} else if (theregex.test(message)) {
message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);
}
this.errorList.push({
message: message,
element: element
});
this.errorMap[element.name] = message;
this.submitted[element.name] = message;
},
addWrapper: function(toToggle) {
if ( this.settings.wrapper )
toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
return toToggle;
},
defaultShowErrors: function() {
for ( var i = 0; this.errorList[i]; i++ ) {
var error = this.errorList[i];
this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
this.showLabel( error.element, error.message );
}
if( this.errorList.length ) {
this.toShow = this.toShow.add( this.containers );
}
if (this.settings.success) {
for ( var i = 0; this.successList[i]; i++ ) {
this.showLabel( this.successList[i] );
}
}
if (this.settings.unhighlight) {
for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
}
}
this.toHide = this.toHide.not( this.toShow );
this.hideErrors();
this.addWrapper( this.toShow ).show();
},
validElements: function() {
return this.currentElements.not(this.invalidElements());
},
invalidElements: function() {
return $(this.errorList).map(function() {
return this.element;
});
},
showLabel: function(element, message) {
var label = this.errorsFor( element );
if ( label.length ) {
label.removeClass().addClass( this.settings.errorClass );
label.attr("generated") && label.html(message);
} else {
label = $("<" + this.settings.errorElement + "/>")
.attr({"for":  this.idOrName(element), generated: true})
.addClass(this.settings.errorClass)
.html(message || "");
if ( this.settings.wrapper ) {
label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
}
if ( !this.labelContainer.append(label).length )
this.settings.errorPlacement
? this.settings.errorPlacement(label, $(element) )
: label.insertAfter(element);
}
if ( !message && this.settings.success ) {
label.text("");
typeof this.settings.success == "string"
? label.addClass( this.settings.success )
: this.settings.success( label );
}
this.toShow = this.toShow.add(label);
},
errorsFor: function(element) {
var name = this.idOrName(element);
return this.errors().filter(function() {
return $(this).attr('for') == name;
});
},
idOrName: function(element) {
return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
},
checkable: function( element ) {
return /radio|checkbox/i.test(element.type);
},
findByName: function( name ) {
var form = this.currentForm;
return $(document.getElementsByName(name)).map(function(index, element) {
return element.form == form && element.name == name && element  || null;
});
},
getLength: function(value, element) {
switch( element.nodeName.toLowerCase() ) {
case 'select':
return $("option:selected", element).length;
case 'input':
if( this.checkable( element) )
return this.findByName(element.name).filter(':checked').length;
}
return value.length;
},
depend: function(param, element) {
return this.dependTypes[typeof param]
? this.dependTypes[typeof param](param, element)
: true;
},
dependTypes: {
"boolean": function(param, element) {
return param;
},
"string": function(param, element) {
return !!$(param, element.form).length;
},
"function": function(param, element) {
return param(element);
}
},
optional: function(element) {
return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
},
startRequest: function(element) {
if (!this.pending[element.name]) {
this.pendingRequest++;
this.pending[element.name] = true;
}
},
stopRequest: function(element, valid) {
this.pendingRequest--;
if (this.pendingRequest < 0)
this.pendingRequest = 0;
delete this.pending[element.name];
if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
$(this.currentForm).submit();
this.formSubmitted = false;
} else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
$(this.currentForm).triggerHandler("invalid-form", [this]);
this.formSubmitted = false;
}
},
previousValue: function(element) {
return $.data(element, "previousValue") || $.data(element, "previousValue", {
old: null,
valid: true,
message: this.defaultMessage( element, "remote" )
});
}
},
classRuleSettings: {
required: {required: true},
email: {email: true},
url: {url: true},
date: {date: true},
dateISO: {dateISO: true},
dateDE: {dateDE: true},
number: {number: true},
numberDE: {numberDE: true},
digits: {digits: true},
creditcard: {creditcard: true}
},
addClassRules: function(className, rules) {
className.constructor == String ?
this.classRuleSettings[className] = rules :
$.extend(this.classRuleSettings, className);
},
classRules: function(element) {
var rules = {};
var classes = $(element).attr('class');
classes && $.each(classes.split(' '), function() {
if (this in $.validator.classRuleSettings) {
$.extend(rules, $.validator.classRuleSettings[this]);
}
});
return rules;
},
attributeRules: function(element) {
var rules = {};
var $element = $(element);
for (var method in $.validator.methods) {
var value = $element.attr(method);
if (value) {
rules[method] = value;
}
}
if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
delete rules.maxlength;
}
return rules;
},
metadataRules: function(element) {
if (!$.metadata) return {};
var meta = $.data(element.form, 'validator').settings.meta;
return meta ?
$(element).metadata()[meta] :
$(element).metadata();
},
staticRules: function(element) {
var rules = {};
var validator = $.data(element.form, 'validator');
if (validator.settings.rules) {
rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
}
return rules;
},
normalizeRules: function(rules, element) {
$.each(rules, function(prop, val) {
if (val === false) {
delete rules[prop];
return;
}
if (val.param || val.depends) {
var keepRule = true;
switch (typeof val.depends) {
case "string":
keepRule = !!$(val.depends, element.form).length;
break;
case "function":
keepRule = val.depends.call(element, element);
break;
}
if (keepRule) {
rules[prop] = val.param !== undefined ? val.param : true;
} else {
delete rules[prop];
}
}
});
$.each(rules, function(rule, parameter) {
rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
});
$.each(['minlength', 'maxlength', 'min', 'max'], function() {
if (rules[this]) {
rules[this] = Number(rules[this]);
}
});
$.each(['rangelength', 'range'], function() {
if (rules[this]) {
rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
}
});
if ($.validator.autoCreateRanges) {
if (rules.min && rules.max) {
rules.range = [rules.min, rules.max];
delete rules.min;
delete rules.max;
}
if (rules.minlength && rules.maxlength) {
rules.rangelength = [rules.minlength, rules.maxlength];
delete rules.minlength;
delete rules.maxlength;
}
}
if (rules.messages) {
delete rules.messages;
}
return rules;
},
normalizeRule: function(data) {
if( typeof data == "string" ) {
var transformed = {};
$.each(data.split(/\s/), function() {
transformed[this] = true;
});
data = transformed;
}
return data;
},
addMethod: function(name, method, message) {
$.validator.methods[name] = method;
$.validator.messages[name] = message != undefined ? message : $.validator.messages[name];
if (method.length < 3) {
$.validator.addClassRules(name, $.validator.normalizeRule(name));
}
},
methods: {
required: function(value, element, param) {
if ( !this.depend(param, element) )
return "dependency-mismatch";
switch( element.nodeName.toLowerCase() ) {
case 'select':
var val = $(element).val();
return val && val.length > 0;
case 'input':
if ( this.checkable(element) )
return this.getLength(value, element) > 0;
default:
return $.trim(value).length > 0;
}
},
remote: function(value, element, param) {
if ( this.optional(element) )
return "dependency-mismatch";
var previous = this.previousValue(element);
if (!this.settings.messages[element.name] )
this.settings.messages[element.name] = {};
previous.originalMessage = this.settings.messages[element.name].remote;
this.settings.messages[element.name].remote = previous.message;
param = typeof param == "string" && {url:param} || param;
if ( this.pending[element.name] ) {
return "pending";
}
if ( previous.old === value ) {
return previous.valid;
}
previous.old = value;
var validator = this;
this.startRequest(element);
var data = {};
data[element.name] = value;
$.ajax($.extend(true, {
url: param,
mode: "abort",
port: "validate" + element.name,
dataType: "json",
data: data,
success: function(response) {
validator.settings.messages[element.name].remote = previous.originalMessage;
var valid = response === true;
if ( valid ) {
var submitted = validator.formSubmitted;
validator.prepareElement(element);
validator.formSubmitted = submitted;
validator.successList.push(element);
validator.showErrors();
} else {
var errors = {};
var message = response || validator.defaultMessage( element, "remote" );
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
validator.showErrors(errors);
}
previous.valid = valid;
validator.stopRequest(element, valid);
}
}, param));
return "pending";
},
minlength: function(value, element, param) {
return this.optional(element) || this.getLength($.trim(value), element) >= param;
},
maxlength: function(value, element, param) {
return this.optional(element) || this.getLength($.trim(value), element) <= param;
},
rangelength: function(value, element, param) {
var length = this.getLength($.trim(value), element);
return this.optional(element) || ( length >= param[0] && length <= param[1] );
},
min: function( value, element, param ) {
return this.optional(element) || value >= param;
},
max: function( value, element, param ) {
return this.optional(element) || value <= param;
},
range: function( value, element, param ) {
return this.optional(element) || ( value >= param[0] && value <= param[1] );
},
email: function(value, element) {
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
},
url: function(value, element) {
return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
},
date: function(value, element) {
return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
},
dateISO: function(value, element) {
return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
},
number: function(value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
},
digits: function(value, element) {
return this.optional(element) || /^\d+$/.test(value);
},
creditcard: function(value, element) {
if ( this.optional(element) )
return "dependency-mismatch";
if (/[^0-9-]+/.test(value))
return false;
var nCheck = 0,
nDigit = 0,
bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
var cDigit = value.charAt(n);
var nDigit = parseInt(cDigit, 10);
if (bEven) {
if ((nDigit *= 2) > 9)
nDigit -= 9;
}
nCheck += nDigit;
bEven = !bEven;
}
return (nCheck % 10) == 0;
},
accept: function(value, element, param) {
param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
},
equalTo: function(value, element, param) {
var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
$(element).valid();
});
return value == target.val();
}
}
});
$.format = $.validator.format;
})(jQuery);
;(function($) {
var pendingRequests = {};
if ( $.ajaxPrefilter ) {
$.ajaxPrefilter(function(settings, _, xhr) {
var port = settings.port;
if (settings.mode == "abort") {
if ( pendingRequests[port] ) {
pendingRequests[port].abort();
}
pendingRequests[port] = xhr;
}
});
} else {
var ajax = $.ajax;
$.ajax = function(settings) {
var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
port = ( "port" in settings ? settings : $.ajaxSettings ).port;
if (mode == "abort") {
if ( pendingRequests[port] ) {
pendingRequests[port].abort();
}
return (pendingRequests[port] = ajax.apply(this, arguments));
}
return ajax.apply(this, arguments);
};
}
})(jQuery);
;(function($) {
if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
$.each({
focus: 'focusin',
blur: 'focusout'
}, function( original, fix ){
$.event.special[fix] = {
setup:function() {
this.addEventListener( original, handler, true );
},
teardown:function() {
this.removeEventListener( original, handler, true );
},
handler: function(e) {
arguments[0] = $.event.fix(e);
arguments[0].type = fix;
return $.event.handle.apply(this, arguments);
}
};
function handler(e) {
e = $.event.fix(e);
e.type = fix;
return $.event.handle.call(this, e);
}
});
};
$.extend($.fn, {
validateDelegate: function(delegate, type, handler) {
return this.bind(type, function(event) {
var target = $(event.target);
if (target.is(delegate)) {
return handler.apply(target, arguments);
}
});
}
});
})(jQuery);
jQuery.extend( jQuery.easing,
{
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
(function($){
$.fn.UItoTop = function(options) {
var defaults = {
text: 'To Top',
min: 200,
inDelay:600,
outDelay:400,
containerID: 'toTop',
containerHoverID: 'toTopHover',
scrollSpeed: 1200,
easingType: 'linear'
};
var settings = $.extend(defaults, options);
var containerIDhash = '#' + settings.containerID;
var containerHoverIDHash = '#'+settings.containerHoverID;
$('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');
$(containerIDhash).hide().click(function(){
$('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
return false;
})
.prepend('<span id="'+settings.containerHoverID+'"></span>')
.hover(function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 1
}, 600, 'linear');
}, function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 0
}, 700, 'linear');
});
$(window).scroll(function() {
var sd = $(window).scrollTop();
if(typeof document.body.style.maxHeight === "undefined") {
$(containerIDhash).css({
'position': 'absolute',
'top': $(window).scrollTop() + $(window).height() - 50
});
}
if ( sd > settings.min )
$(containerIDhash).fadeIn(settings.inDelay);
else
$(containerIDhash).fadeOut(settings.Outdelay);
});
};
})(jQuery);
(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);
(function(a){a.tools=a.tools||{version:"v1.2.6"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).bind("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);
(function(a){var b=a.tools.scrollable;b.autoscroll={conf:{autoplay:!0,interval:3e3,autopause:!0}},a.fn.autoscroll=function(c){typeof c=="number"&&(c={interval:c});var d=a.extend({},b.autoscroll.conf,c),e;this.each(function(){var b=a(this).data("scrollable"),c=b.getRoot(),f,g=!1;function h(){f=setTimeout(function(){b.next()},d.interval)}b&&(e=b),b.play=function(){f||(g=!1,c.bind("onSeek",h),h())},b.pause=function(){f=clearTimeout(f),c.unbind("onSeek",h)},b.resume=function(){g||b.play()},b.stop=function(){g=!0,b.pause()},d.autopause&&c.add(b.getNaviButtons()).hover(b.pause,b.resume),d.autoplay&&b.play()});return d.api?e:this}})(jQuery);
(function(a){var b=a.tools.scrollable;b.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}};function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}a.fn.navigator=function(d){typeof d=="string"&&(d={navi:d}),d=a.extend({},b.navigator.conf,d);var e;this.each(function(){var b=a(this).data("scrollable"),f=d.navi.jquery?d.navi:c(b.getRoot(),d.navi),g=b.getNaviButtons(),h=d.activeClass,i=d.history&&history.pushState,j=b.getConf().size;b&&(e=b),b.getNaviButtons=function(){return g.add(f)},i&&(history.pushState({i:0}),a(window).bind("popstate",function(a){var c=a.originalEvent.state;c&&b.seekTo(c.i)}));function k(a,c,d){b.seekTo(c),d.preventDefault(),i&&history.pushState({i:c})}function l(){return f.find(d.naviItem||"> *")}function m(b){var c=a("<"+(d.naviItem||"a")+"/>").click(function(c){k(a(this),b,c)});b===0&&c.addClass(h),d.indexed&&c.text(b+1),d.idPrefix&&c.attr("id",d.idPrefix+b);return c.appendTo(f)}l().length?l().each(function(b){a(this).click(function(c){k(a(this),b,c)})}):a.each(b.getItems(),function(a){a%j==0&&m(a)}),b.onBeforeSeek(function(a,b){setTimeout(function(){if(!a.isDefaultPrevented()){var c=b/j,d=l().eq(c);d.length&&l().removeClass(h).eq(c).addClass(h)}},1)}),b.onAddItem(function(a,c){var d=b.getItems().index(c);d%j==0&&m(d)})});return d.api?e:this}})(jQuery);
(function( $ ){
var transitionEnd
$(document).ready(function () {
$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support
})()
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
transitionEnd = "oTransitionEnd"
}
}
})
var Alert = function ( content, selector ) {
this.$element = $(content)
.delegate(selector || '.close', 'click', this.close)
}
Alert.prototype = {
close: function (e) {
var $element = $(this).parent('.alert-message')
e && e.preventDefault()
$element.removeClass('in')
function removeElement () {
$element.remove()
}
$.support.transition && $element.hasClass('fade') ?
$element.bind(transitionEnd, removeElement) :
removeElement()
}
}
$.fn.alert = function ( options ) {
if ( options === true ) {
return this.data('alert')
}
return this.each(function () {
var $this = $(this)
if ( typeof options == 'string' ) {
return $this.data('alert')[options]()
}
$(this).data('alert', new Alert( this ))
})
}
$(document).ready(function () {
new Alert($('body'), '.alert-message[data-alert] .close')
})
})( window.jQuery || window.ender )
!function( $ ) {
var transitionEnd
$(document).ready(function () {
$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support
})()
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
transitionEnd = "oTransitionEnd"
}
}
})
var Twipsy = function ( element, options ) {
this.$element = $(element)
this.options = options
this.enabled = true
this.fixTitle()
}
Twipsy.prototype = {
show: function() {
var pos
, actualWidth
, actualHeight
, placement
, $tip
, tp
if (this.getTitle() && this.enabled) {
$tip = this.tip()
this.setContent()
if (this.options.animate) {
$tip.addClass('fade')
}
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.prependTo(document.body)
pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth
, height: this.$element[0].offsetHeight
})
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
placement = _.maybeCall(this.options.placement, this.$element[0])
switch (placement) {
case 'below':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'above':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
break
case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
break
}
$tip
.css(tp)
.addClass(placement)
.addClass('in')
}
}
, setContent: function () {
var $tip = this.tip()
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
$tip[0].className = 'twipsy'
}
, hide: function() {
var that = this
, $tip = this.tip()
$tip.removeClass('in')
function removeElement () {
$tip.remove()
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip.bind(transitionEnd, removeElement) :
removeElement()
}
, fixTitle: function() {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
}
}
, getTitle: function() {
var title
, $e = this.$element
, o = this.options
this.fixTitle()
if (typeof o.title == 'string') {
title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
} else if (typeof o.title == 'function') {
title = o.title.call($e[0])
}
title = ('' + title).replace(/(^\s*|\s*$)/, "")
return title || o.fallback
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
}
return this.$tip
}
, validate: function() {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
, enable: function() {
this.enabled = true
}
, disable: function() {
this.enabled = false
}
, toggleEnabled: function() {
this.enabled = !this.enabled
}
}
var _ = {
maybeCall: function ( thing, ctx ) {
return (typeof thing == 'function') ? (thing.call(ctx)) : thing
}
}
$.fn.twipsy = function (options) {
$.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
return this
}
$.fn.twipsy.initWith = function (options, Constructor, name) {
var twipsy
, binder
, eventIn
, eventOut
if (options === true) {
return this.data(name)
} else if (typeof options == 'string') {
twipsy = this.data(name)
if (twipsy) {
twipsy[options]()
}
return this
}
options = $.extend({}, $.fn[name].defaults, options)
function get(ele) {
var twipsy = $.data(ele, name)
if (!twipsy) {
twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
$.data(ele, name, twipsy)
}
return twipsy
}
function enter() {
var twipsy = get(this)
twipsy.hoverState = 'in'
if (options.delayIn == 0) {
twipsy.show()
} else {
twipsy.fixTitle()
setTimeout(function() {
if (twipsy.hoverState == 'in') {
twipsy.show()
}
}, options.delayIn)
}
}
function leave() {
var twipsy = get(this)
twipsy.hoverState = 'out'
if (options.delayOut == 0) {
twipsy.hide()
} else {
setTimeout(function() {
if (twipsy.hoverState == 'out') {
twipsy.hide()
}
}, options.delayOut)
}
}
if (!options.live) {
this.each(function() {
get(this)
})
}
if (options.trigger != 'manual') {
binder   = options.live ? 'live' : 'bind'
eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
this[binder](eventIn, enter)[binder](eventOut, leave)
}
return this
}
$.fn.twipsy.Twipsy = Twipsy
$.fn.twipsy.defaults = {
animate: true
, delayIn: 0
, delayOut: 0
, fallback: ''
, placement: 'above'
, html: false
, live: false
, offset: 0
, title: 'title'
, trigger: 'hover'
}
$.fn.twipsy.elementOptions = function(ele, options) {
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
}
}( window.jQuery || window.ender );
!function( $ ) {
var Popover = function ( element, options ) {
this.$element = $(element)
this.options = options
this.enabled = true
this.fixTitle()
}
Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
setContent: function () {
var $tip = this.tip()
$tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
$tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
$tip[0].className = 'popover'
}
, getContent: function () {
var content
, $e = this.$element
, o = this.options
if (typeof this.options.content == 'string') {
content = $e.attr(o.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
return content
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="popover" />')
.html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
}
return this.$tip
}
})
$.fn.popover = function (options) {
if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
$.fn.twipsy.initWith.call(this, options, Popover, 'popover')
return this
}
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
}( window.jQuery || window.ender );
!function( $ ){
"use strict"
function activate ( element, container ) {
container
.find('> .active')
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
}
function tab( e ) {
var $this = $(this)
, $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('href')
, previous
, $href
if ( /^#\w+/.test(href) ) {
e.preventDefault()
if ( $this.parent('li').hasClass('active') ) {
return
}
previous = $ul.find('.active a').last()[0]
$href = $(href)
activate($this.parent('li'), $ul)
activate($href, $href.parent())
$this.trigger({
type: 'change'
, relatedTarget: previous
})
}
}
$.fn.tabs = $.fn.pills = function ( selector ) {
return this.each(function () {
$(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
})
}
$(document).ready(function () {
$('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
})
}( window.jQuery || window.ender );
$(document).ready(function(){
$("a[rel=twipsy]").twipsy({
live: true,
placement: 'right',
animate: true,
offset: 10
});
$("a[rel=popover]").popover({ offset: 0, html: true, delayOut: 500, trigger: 'hover' }).click(function(e) {
e.preventDefault()
});
$('.tabs').tabs();
$().UItoTop({ easingType: 'easeOutQuart' });
$('#navi li a:first').addClass('first');
$('#navi li a:last').addClass('last');
$('#navi_tophotel li a:first').addClass('first');
$('#navi_tophotel li a:last').addClass('last');
$(".navi_tooltip").each(function() {
var content_rel = $(this).attr("rel");
if ($('#'+content_rel).length > 0) {
$(this).qtip({
content:$('#'+content_rel).html(),
style: {
padding: 0,
border: 'none',
width: 'auto'
},
show: {
when: 'mouseover',
effect: {
type: 'fade',
length: 200
}
},
hide: {
when: 'mouseout',
fixed: true,
effect: {
type: 'fade',
length: 500
}
},
position: {
corner: {
target: 'bottomLeft'
},
adjust: {
x: 0,
y: 3
}
}
});
}
});
$(".pageselector").each(function() {
var content_rel = $(this).attr("rel");
if ($('#'+content_rel).length > 0) {
$(this).qtip({
content:$('#'+content_rel).html(),
style: {
padding: 0,
border: 'none'
},
show: {
when: 'mouseover',
effect: {
type: 'fade',
length: 200
}
},
hide: {
when: 'mouseout',
fixed: true,
effect: {
type: 'fade',
length: 500
}
},
position: {
corner: {
target: 'bottomLeft'
},
adjust: {
x: 0,
y: 3
}
}
});
}
});
$("#actual_lang").each(function() {
var content_rel = $(this).attr("rel");
if ($('#'+content_rel).length > 0) {
$(this).qtip({
content:$('#'+content_rel).html(),
style: {
padding: 0,
border: 'none',
width: 'auto'
},
show: {
when: 'mouseover',
effect: {
type: 'fade',
length: 200
}
},
hide: {
when: 'mouseout',
fixed: true,
effect: {
type: 'fade',
length: 500
}
},
position: {
corner: {
target: 'bottomLeft'
},
adjust: {
x: 0,
y: 3
}
}
});
}
});
$('.az_sub div.thumb:last').addClass('last');
$("a.fancy").fancybox();
$("a[rel=gallery]").fancybox();
$("#water_meter_form").validate({
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'Sie haben 1 Feld vergessen oder nicht korrekt ausgefüllt. Es wurde rot markiert.'
: 'Sie haben ' + errors + ' Felder nicht oder nicht korrekt ausgefüllt.<br> Die Felder wurden rot markiert.';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
$("#water_meter_form_full").validate({
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'Sie haben 1 Feld vergessen oder nicht korrekt ausgefüllt. Es wurde rot markiert.'
: 'Sie haben ' + errors + ' Felder nicht oder nicht korrekt ausgefüllt.<br> Die Felder wurden rot markiert.';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
},
emailrules: {
required: "#email:filled"
}
});
$(".newsletter").validate({
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'Sie haben 1 Feld vergessen oder nicht korrekt ausgefüllt. Es wurde rot markiert.'
: 'Sie haben ' + errors + ' Felder nicht oder nicht korrekt ausgefüllt.<br> Die Felder wurden rot markiert.';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
$("#contact_personstate").validate({
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'Sie haben 1 Feld vergessen oder nicht korrekt ausgefüllt. Es wurde rot markiert.'
: 'Sie haben ' + errors + ' Felder nicht oder nicht korrekt ausgefüllt.<br> Die Felder wurden rot markiert.';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
$('input:text').each(function(){
$(this).focus(function(){
$(this).val('')
});
});
$("#bgButton").click(function(){
changeBackground();
});
$('.lis_popup').attr('onclick', 'return popup(this.href, 800,600)');
$('#bgslider_wrapper').appendTo('body');
});
function popup(ziel,w,h) {
h = h - 20; var x=0, y=0, parameter="";
if (w < screen.availWidth || h < screen.availHeight) {
x = (screen.availWidth - w - 12) / 2;
y = (screen.availHeight - h - 104) / 2;
if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
if (x<0 || y<0) { x=0; y=0; }
else parameter = "width=" + w + ",height=" + h + ",";
}
parameter += "left=" + x + ",top=" + y;
parameter += ",menubar=0,location=0,toolbar=0,status=0";
parameter += ",resizable=1,scrollbars=1";
var Fenster = window.open(ziel,"",parameter);
if (Fenster) Fenster.focus();
return !Fenster;
}
function jump(actual, next)
{
if(actual.getAttribute("maxlength") == actual.value.length)
{
document.getElementsByName(next)[0].focus();
}
}
function strtotime (str, now) {
var i, match, s, strTmp = '',
parse = '';
strTmp = str;    strTmp = strTmp.replace(/\s{2,}|^\s|\s$/g, ' '); // unecessary spaces
strTmp = strTmp.replace(/[\t\r\n]/g, ''); // unecessary chars
if (strTmp == 'now') {
return (new Date()).getTime() / 1000; // Return seconds, not milli-seconds
} else if (!isNaN(parse = Date.parse(strTmp))) {        return (parse / 1000);
} else if (now) {
now = new Date(now * 1000); // Accept PHP-style seconds
} else {
now = new Date();    }
strTmp = strTmp.toLowerCase();
var __is = {        day: {
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,            'thu': 4,
'fri': 5,
'sat': 6
},
mon: {            'jan': 0,
'feb': 1,
'mar': 2,
'apr': 3,
'may': 4,            'jun': 5,
'jul': 6,
'aug': 7,
'sep': 8,
'oct': 9,            'nov': 10,
'dec': 11
}
};
var process = function (m) {
var ago = (m[2] && m[2] == 'ago');
var num = (num = m[0] == 'last' ? -1 : 1) * (ago ? -1 : 1);
switch (m[0]) {        case 'last':
case 'next':
switch (m[1].substring(0, 3)) {
case 'yea':
now.setFullYear(now.getFullYear() + num);                break;
case 'mon':
now.setMonth(now.getMonth() + num);
break;
case 'wee':                now.setDate(now.getDate() + (num * 7));
break;
case 'day':
now.setDate(now.getDate() + num);
break;            case 'hou':
now.setHours(now.getHours() + num);
break;
case 'min':
now.setMinutes(now.getMinutes() + num);                break;
case 'sec':
now.setSeconds(now.getSeconds() + num);
break;
default:                var day;
if (typeof(day = __is.day[m[1].substring(0, 3)]) != 'undefined') {
var diff = day - now.getDay();
if (diff == 0) {
diff = 7 * num;                    } else if (diff > 0) {
if (m[0] == 'last') {
diff -= 7;
}
} else {                        if (m[0] == 'next') {
diff += 7;
}
}
now.setDate(now.getDate() + diff);                }
}
break;
default:            if (/\d+/.test(m[0])) {
num *= parseInt(m[0], 10);
switch (m[1].substring(0, 3)) {
case 'yea':                    now.setFullYear(now.getFullYear() + num);
break;
case 'mon':
now.setMonth(now.getMonth() + num);
break;                case 'wee':
now.setDate(now.getDate() + (num * 7));
break;
case 'day':
now.setDate(now.getDate() + num);                    break;
case 'hou':
now.setHours(now.getHours() + num);
break;
case 'min':                    now.setMinutes(now.getMinutes() + num);
break;
case 'sec':
now.setSeconds(now.getSeconds() + num);
break;                }
} else {
return false;
}
break;        }
return true;
};
match = strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);    if (match != null) {
if (!match[2]) {
match[2] = '00:00:00';
} else if (!match[3]) {
match[2] += ':00';        }
s = match[1].split(/-/g);
for (i in __is.mon) {            if (__is.mon[i] == s[1] - 1) {
s[1] = i;
}
}
s[0] = parseInt(s[0], 10);
s[0] = (s[0] >= 0 && s[0] <= 69) ? '20' + (s[0] < 10 ? '0' + s[0] : s[0] + '') : (s[0] >= 70 && s[0] <= 99) ? '19' + s[0] : s[0] + '';
return parseInt(this.strtotime(s[2] + ' ' + s[1] + ' ' + s[0] + ' ' + match[2]) + (match[4] ? match[4] / 1000 : ''), 10);
}
var regex = '([+-]?\\d+\\s' + '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?' + '|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday' + '|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)' + '|(last|next)\\s' + '(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?' + '|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday' + '|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))' + '(\\sago)?';
match = strTmp.match(new RegExp(regex, 'gi')); // Brett: seems should be case insensitive per docs, so added 'i'
if (match == null) {
return false;    }
for (i = 0; i < match.length; i++) {
if (!process(match[i].split(' '))) {
return false;        }
}
return (now.getTime() / 1000);
}
jQuery.extend({
random: function(X) {
return Math.floor(X * (Math.random() % 1));
},
randomBetween: function(MinV, MaxV) {
return MinV + jQuery.random(MaxV - MinV + 1);
}
});
function quckfindTportal () {
var protocol = "http";
var host = "tportal.toubiz.de";
var directory = "winterberg";
var action = "ukv?frame=1&externalUrl=1&doSearch=1&ukv_result_order=1";
var searchtext = $('#textinput').val();
var choice_child1 = $('#tportal_child1').val();
var choice_child2 = $('#tportal_child2').val();
var choice_arrival = $('#choice_dateinput_arrival').val();
var choice_departure = $('#choice_dateinput_departure').val();
var choice_arrival_tmp = choice_arrival.split(' ');
var choice_arrival_cut = choice_arrival_tmp[1];
var choice_departure_tmp = choice_departure.split(' ');
var choice_departure_cut = choice_departure_tmp[1];
if ($('#tportal_adults').val() != '-') {
var choice_adults = $('#tportal_adults').val();
} else {
var choice_adults = '2';
}
var url = protocol + "://" + host + "/" + directory + "/" + action;
if ($('#date_unknown').is(':checked') == true) {
url = url + '&date_unknown=1';
} else {
url = url + '&date_from=' + choice_arrival_cut + '&date_to=' + choice_departure_cut;
}
url = url + '&number_adult[]=' + choice_adults;
if (choice_child1 != 0)
url = url + '&age_child1[]=' + choice_child1;
if (choice_child2 != 0)
url = url + '&age_child2[]=' + choice_child2;
url = url + '&waiter=1';
if (searchtext != '')
url = url + '&searchtext=' + searchtext;
window.location = url;
}
function convert_date(jsondate) {
var d = strtotime(jsondate);
var x = new Date(d);
x.setTime (d * 1000);
var day = x.getDate();
day = (day < 10) ? "0"+day : day;
var month = x.getMonth()+1;
month = (month < 10) ? "0"+month : month;
var year = x.getFullYear();
var hours = x.getHours();
hours = (hours < 10) ? "0"+hours : hours;
var seconds = x.getMinutes();
seconds = (seconds < 10) ? "0"+seconds : seconds;
var date_string = day + "." + month + "." + year + " - " + hours + ":" + seconds + " Uhr";
return date_string;
}
Array.prototype.max = function(){
return Math.max.apply( Math, this );
};
Array.prototype.min = function(){
return Math.min.apply( Math, this );
};
(function ($) {
"use strict";
var $googlemaps = google.maps,
$geocoder = new $googlemaps.Geocoder(),
opts = {},
markerGroups = {},
$markersToLoad = 0,
methods = {}; // for JSLint
methods = {
init: function (options) {
var k,
opts = $.extend({}, $.fn.gMap.defaults, options);
for (k in $.fn.gMap.defaults.icon) {
if(!opts.icon[k]) {
opts.icon[k] = $.fn.gMap.defaults.icon[k];
}
}
return this.each(function () {
var $this = $(this),
center = methods._getMapCenter.apply($this, [opts]),
i, $data;
if (opts.zoom == "fit") {
opts.zoom = methods.autoZoom.apply($this, [opts]);
}
var mapOptions = {
zoom: opts.zoom,
center: center,
mapTypeControl: opts.mapTypeControl,
zoomControl: opts.zoomControl,
panControl : opts.panControl,
scaleControl : opts.scaleControl,
streetViewControl: opts.streetViewControl,
mapTypeId: opts.maptype,
mapTypeIds: opts.maptypeids,
mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, position: google.maps.ControlPosition.TOP_LEFT },
scrollwheel: opts.scrollwheel,
maxZoom: opts.maxZoom,
minZoom: opts.minZoom
};
if (opts.alpmap == false) {
var $gmap = new $googlemaps.Map(this, mapOptions);
} else {
var mapTypeIds = ['alpstein_map', 'alpstein_hybrid', 'alpstein_map_winter', $googlemaps.MapTypeId.SATELLITE, $googlemaps.MapTypeId.TERRAIN];
var $gmap = new alp.gmap3.Map(document.getElementById("lisgmap_map"), {
center : new $googlemaps.LatLng(opts.latitude, opts.longitude),
zoom : opts.zoom,
mapTypeId : mapTypeIds[ 0 ],
mapTypeControlOptions : { mapTypeIds: mapTypeIds, style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, position: google.maps.ControlPosition.TOP_LEFT }
});
}
if (opts.log) {console.log('map center is:'); }
if (opts.log) {console.log(center); }
$this.data("$gmap", $gmap);
$this.data('gmap', {
'opts': opts,
'gmap': $gmap,
'markers': [],
'markerKeys' : {},
'infoWindow': null
});
if (opts.controls.length !== 0) {
for (i = 0; i < opts.controls.length; i += 1) {
$gmap.controls[opts.controls[i].pos].push(opts.controls[i].div);
}
}
if (opts.markers.length !== 0) {
methods.addMarkers.apply($this, [opts.markers]);
}
$(document)
.ajaxStart(function() {
$('#lisgmap_container_loader').show();
$('.lisgmap_trigger').addClass('lisgmap_trigger_loading');
})
.ajaxStop(function(){
$('#lisgmap_container_loader').hide();
$('.lisgmap_trigger').removeClass('lisgmap_trigger_loading');
});
$('a.lisgmap_nav_list_link').click(function(e) {
var group = "group_"+$(this).attr('rel');
if (opts.log) {console.log("toggle group: " + group)};
if (typeof markerGroups[group] == "undefined") {
markerGroups[group] = [];
$.ajax({
url: opts.baseuri + '/' + $(this).attr('rel'),
dataType: 'json',
async: true,
success: function(data) {
methods.addMarkers.apply($this, [data]);
for (var i = 0; i < data.length; i+= 1) {
opts.markers.push(data[i]);
if (opts.log) {console.log(data[i])};
}
methods._lisbounds.apply($this, [opts]);
}
});
} else {
methods.lisToggleGroup(group);
}
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
e.preventDefault();
return false;
});
$('.lisgmap_nav_list_link_fullscreen').click( function(e) {
$('.lisgmap_container').toggleClass('lisgmap_fullscreen_container');
if ($('.lisgmap_container').hasClass('lisgmap_fullscreen_container')) {
$('.lisgmap_fullscreen_panel').show();
$('#lisgmap_map').css({"height":jQuery(window).height() + 15, "width":jQuery(window).width() + 15});
$('body').css({"overflow":"hidden", "height":jQuery(window).height() + 15, "width":jQuery(window).width() + 15});
} else {
$('.lisgmap_fullscreen_panel').hide();
$('#lisgmap_map').css({"height":"500px", "width":"100%"});
$('body').css({"overflow":"visible", "height":"auto", "width":"auto"});
}
methods._lisresize.apply($this, [opts]);
methods._lisbounds.apply($this, [opts]);
e.preventDefault();
return false;
});
var first_load = 0;
$("a.lisgmap_nav_list_link").each(function() {
if ($(this).attr('rev') == 1) {
first_load = 1;
$(this).click();
}
});
if (first_load == 0) {
$('a.lisgmap_nav_list_link').first().click();
}
methods._onComplete.apply($this, []);
});
},
_lisresize: function(opts) {
var $data = this.data('gmap');
$googlemaps.event.trigger($data.gmap, 'resize');
$data.gmap.setZoom( $data.gmap.getZoom() );
},
_lisbounds: function(opts) {
var $data = this.data('gmap');
var mylisbounds = new $googlemaps.LatLngBounds();
$.each(opts.markers, function(key, value) {
mylisbounds.extend(new $googlemaps.LatLng(value.latitude, value.longitude));
if (value.geometry_show == 1) {
var pointAllArray = value.geometry.split(" ");
for (var i = 0; i < pointAllArray.length; i++) {
var pointArray = pointAllArray[i].split(",");
mylisbounds.extend(new $googlemaps.LatLng(pointArray[1], pointArray[0]));
}
}
});
$data.gmap.setCenter(mylisbounds.getCenter());
$data.gmap.fitBounds(mylisbounds);
},
lisToggleGroup: function (group) {
for (var i = 0; i < markerGroups[group].length; i++) {
var marker = markerGroups[group][i];
if (marker.getVisible()) {
marker.setVisible(false);
} else {
marker.setVisible(true);
}
}
return false;
},
_onComplete: function () {
var $data = this.data('gmap'),
that = this;
if ($markersToLoad !== 0) {
window.setTimeout(function () {methods._onComplete.apply(that, []); }, 1000);
return;
}
$data.opts.onComplete();
},
processMarker: function (marker, gicon, gshadow, location) {
var $data = this.data('gmap'),
$gmap = $data.gmap,
opts = $data.opts,
gmarker,
markeropts;
if (location === undefined) {
location = new $googlemaps.LatLng(marker.latitude, marker.longitude);
}
if (!gicon) {
var _gicon = {
image: opts.icon.image,
iconSize: new $googlemaps.Size(opts.icon.iconsize[0], opts.icon.iconsize[1]),
iconAnchor: new $googlemaps.Point(opts.icon.iconanchor[0], opts.icon.iconanchor[1]),
infoWindowAnchor: new $googlemaps.Size(opts.icon.infowindowanchor[0], opts.icon.infowindowanchor[1])
};
gicon = new $googlemaps.MarkerImage(_gicon.image, _gicon.iconSize, null, _gicon.iconAnchor);
}
markeropts = {
position: location,
icon: gicon,
title: marker.title,
map: $gmap
};
gmarker = new $googlemaps.Marker(markeropts);
gmarker.setShadow(gshadow);
$data.markers.push(gmarker);
if (marker.group)
markerGroups[marker.group].push(gmarker);
if(marker.key) {$data.markerKeys[marker.key] = gmarker; }
$googlemaps.event.addListener(gmarker, 'click', function() {
var markerContent = document.createElement("div");
markerContent.innerHTML = opts.html_prepend + marker.html + opts.html_append;
var lisWindowOptions = {
content: markerContent,
pixelOffset: new google.maps.Size(-112, -20),
boxClass: "lisgmap_marker_window",
closeBoxMargin: "0px",
closeBoxURL: "/extension/lisgmap/design/"+opts.main_design+"/images/lisgmap_window_close.png",
enableEventPropagation: false,
alignBottom: true
};
var lisWindow = new InfoBox(lisWindowOptions);
if (opts.singleInfoWindow && $data.lisWindow) {$data.lisWindow.close();}
lisWindow.open($gmap, gmarker);
$data.lisWindow = lisWindow;
});
if (marker.kml) {
var georssLayer = new google.maps.KmlLayer(marker.kml, { preserveViewport : true });
$googlemaps.event.addListener(gmarker, 'mouseover', function() {
georssLayer.setMap($gmap);
});
$googlemaps.event.addListener(gmarker, 'mouseout', function() {
georssLayer.setMap(null);
});
}
if (marker.geometry) {
var pointAllArray = marker.geometry.split(" ");
var tourCoordinates = [];
for (var i = 0; i < pointAllArray.length; i++) {
var pointArray = pointAllArray[i].split(",");
var point = new $googlemaps.LatLng(pointArray[1], pointArray[0]);
tourCoordinates.push(point);
}
var tourPath = new $googlemaps.Polyline({
path: tourCoordinates,
strokeColor: "#ac1512",
strokeOpacity: 0.9,
strokeWeight: 4
});
if (marker.geometry_show == 0) {
$googlemaps.event.addListener(gmarker, 'mouseover', function() {
tourPath.setMap($gmap);
$googlemaps.event.addListener(gmarker, 'mouseout', function() {
tourPath.setMap(null);
});
});
} else {
tourPath.setMap($gmap);
}
}
$googlemaps.event.addListener($gmap, 'click', function() {
$data.lisWindow.hide();
});
if (marker.html && marker.popup) {
if (opts.log) {console.log('opening popup ' + marker.html); }
infoWindow.open($gmap, gmarker);
$data.infoWindow = infoWindow;
}
},
addMarkers: function (markers){
var opts = this.data('gmap').opts;
if (markers.length !== 0) {
if (opts.log) {console.log("adding " + markers.length +" markers");}
for (var i = 0; i < markers.length; i+= 1) {
methods.addMarker.apply($(this),[markers[i]]);
}
}
return this;
},
addMarker: function (marker) {
var opts = this.data('gmap').opts;
if (opts.log) {console.log("putting marker at " + marker.latitude + ', ' + marker.longitude + " with address " + marker.address + " and html "  + marker.html); }
var _gicon = {
image: opts.icon.image,
iconSize: new $googlemaps.Size(opts.icon.iconsize[0], opts.icon.iconsize[1]),
iconAnchor: new $googlemaps.Point(opts.icon.iconanchor[0], opts.icon.iconanchor[1]),
infoWindowAnchor: new $googlemaps.Size(opts.icon.infowindowanchor[0], opts.icon.infowindowanchor[1])
}
marker.infoWindowAnchor = _gicon.infoWindowAnchor;
if (marker.icon) {
if (marker.icon.image) { _gicon.image = marker.icon.image; }
if (marker.icon.iconsize) { _gicon.iconSize = new $googlemaps.Size(marker.icon.iconsize[0], marker.icon.iconsize[1]); }
if (marker.icon.iconanchor) { _gicon.iconAnchor = new $googlemaps.Point(marker.icon.iconanchor[0], marker.icon.iconanchor[1]); }
if (marker.icon.infowindowanchor) { _gicon.infoWindowAnchor = new $googlemaps.Size(marker.icon.infowindowanchor[0], marker.icon.infowindowanchor[1]); }
}
var gicon = new $googlemaps.MarkerImage(_gicon.image, _gicon.iconSize, null, _gicon.iconAnchor);
var gshadow;
if (marker.address) {
if (marker.html === '_address') {
marker.html = marker.address;
}
if (marker.title == '_address') {
marker.title = marker.address;
}
if (opts.log) {console.log('geocoding marker: ' + marker.address); }
methods._geocodeMarker.apply(this, [marker, gicon, gshadow]);
} else {
if (marker.html === '_latlng') {
marker.html = marker.latitude + ', ' + marker.longitude;
}
if (marker.title == '_latlng') {
marker.title = marker.latitude + ', ' + marker.longitude;
}
var gpoint = new $googlemaps.LatLng(marker.latitude, marker.longitude);
methods.processMarker.apply(this, [marker, gicon, gshadow, gpoint]);
}
return this;
},
_setMapCenter: function (center) {
var $data = this.data('gmap');
if ($data.opts.log) {console.log('delayed setMapCenter called'); }
if ($data.gmap !== undefined) {
$data.gmap.setCenter(center);
} else {
var that = this;
window.setTimeout(function () {methods._setMapCenter.apply(that, [center]); }, 500);
}
},
_boundaries: null,
_getBoundaries: function (opts) {
if(methods._boundaries) {return methods._boundaries; }
var mostN = opts.markers[0].latitude,
mostE = opts.markers[0].longitude,
mostW = opts.markers[0].longitude,
mostS = opts.markers[0].latitude,
i;
for (i = 1; i < opts.markers.length; i += 1) {
if(mostN > opts.markers[i].latitude) {mostN = opts.markers[i].latitude; }
if(mostE < opts.markers[i].longitude) {mostE = opts.markers[i].longitude; }
if(mostW > opts.markers[i].longitude) {mostW = opts.markers[i].longitude; }
if(mostS < opts.markers[i].latitude) {mostS = opts.markers[i].latitude; }
}
methods._boundaries = {N: mostN, E: mostE, W: mostW, S: mostS};
return methods._boundaries;
},
_getMapCenter: function (opts) {
var center,
that = this, // 'that' scope fix in geocoding
i,
selectedToCenter,
most; //hoisting
if (opts.markers.length && (opts.latitude == "fit" || opts.longitude == "fit")) {
most = methods._getBoundaries(opts);
center = new $googlemaps.LatLng((most.N + most.S)/2, (most.E + most.W)/2);
return center;
}
if (opts.latitude && opts.longitude && opts.markers.length == 0) {
center = new $googlemaps.LatLng(opts.latitude, opts.longitude);
return center;
} else {
center = new $googlemaps.LatLng(0, 0);
}
if (opts.address) {
$geocoder.geocode(
{address: opts.address},
function (result, status) {
if (status === google.maps.GeocoderStatus.OK) {
methods._setMapCenter.apply(that, [result[0].geometry.location]);
} else {
if (opts.log) {console.log("Geocode was not successful for the following reason: " + status); }
}
}
);
return center;
}
if (opts.markers.length > 0) {
selectedToCenter = null;
for (i = 0; i < opts.markers.length; i += 1) {
if(opts.markers[i].setCenter) {
selectedToCenter = opts.markers[i];
break;
}
}
if (selectedToCenter === null) {
for (i = 0; i < opts.markers.length; i += 1) {
if (opts.markers[i].latitude && opts.markers[i].longitude) {
selectedToCenter = opts.markers[i];
break;
}
if (opts.markers[i].address) {
selectedToCenter = opts.markers[i];
}
}
}
if (selectedToCenter === null) {
return center;
}
if (selectedToCenter.latitude && selectedToCenter.longitude) {
return new $googlemaps.LatLng(selectedToCenter.latitude, selectedToCenter.longitude);
}
if (selectedToCenter.address) {
$geocoder.geocode(
{address: selectedToCenter.address},
function (result, status) {
if (status === google.maps.GeocoderStatus.OK) {
methods._setMapCenter.apply(that, [result[0].geometry.location]);
} else {
if (opts.log) {console.log("Geocode was not successful for the following reason: " + status); }
}
}
);
}
}
return center;
},
setZoom: function (zoom) {
var $map = this.data('gmap').gmap;
if (zoom === "fit"){
zoom = methods.autoZoom.apply($(this), []);
}
$map.setZoom(parseInt(zoom));
},
getRoute: function (options) {
var $data = this.data('gmap'),
$gmap = $data.gmap,
$directionsDisplay = new $googlemaps.DirectionsRenderer(),
$directionsService = new $googlemaps.DirectionsService(),
$travelModes = { 'BYCAR': $googlemaps.DirectionsTravelMode.DRIVING, 'BYBICYCLE': $googlemaps.DirectionsTravelMode.BICYCLING, 'BYFOOT': $googlemaps.DirectionsTravelMode.WALKING },
$travelUnits = { 'MILES': $googlemaps.DirectionsUnitSystem.IMPERIAL, 'KM': $googlemaps.DirectionsUnitSystem.METRIC },
displayObj = null,
travelMode = null,
travelUnit = null,
unitSystem = null;
if(options.routeDisplay !== undefined){
displayObj = (options.routeDisplay instanceof jQuery) ? options.routeDisplay[0] : ((typeof options.routeDisplay == "string") ? $(options.routeDisplay)[0] : null);
} else if($data.opts.routeDisplay !== null){
displayObj = ($data.opts.routeDisplay instanceof jQuery) ? $data.opts.routeDisplay[0] : ((typeof $data.opts.routeDisplay == "string") ? $($data.opts.routeDisplay)[0] : null);
}
$directionsDisplay.setMap($gmap);
if(displayObj !== null){
$directionsDisplay.setPanel(displayObj);
}
travelMode = ($travelModes[$data.opts.travelMode] !== undefined) ? $travelModes[$data.opts.travelMode] : $travelModes['BYCAR'];
travelUnit = ($travelUnits[$data.opts.travelUnit] !== undefined) ? $travelUnits[$data.opts.travelUnit] : $travelUnits['KM'];
var request = {
origin: options.from,
destination: options.to,
travelMode: travelMode,
unitSystem: travelUnit
};
$directionsService.route(request, function(result, status) {
if (status == $googlemaps.DirectionsStatus.OK) {
$directionsDisplay.setDirections(result);
} else if(displayObj !== null){
$(displayObj).html($data.opts.routeErrors[status]);
}
});
return this;
},
_geocodeMarker: function (marker, gicon, gshadow) {
$markersToLoad += 1;
var that = this;
$geocoder.geocode({'address': marker.address}, function (results, status) {
$markersToLoad -= 1;
if (status === $googlemaps.GeocoderStatus.OK) {
if (that.data('gmap').opts.log) {console.log("Geocode was successful with point: ", results[0].geometry.location); }
methods.processMarker.apply(that, [marker, gicon, gshadow, results[0].geometry.location]);
} else {
if (that.data('gmap').opts.log) {console.log("Geocode was not successful for the following reason: " + status); }
}
});
},
autoZoom: function (opts){
var data = this.data('gmap'),
i, boundaries, resX, resY, baseScale = 39135.758482;
opts = data?data.opts:opts
if (opts.log) {console.log("autozooming map");}
boundaries = methods._getBoundaries(opts);
resX = (boundaries.E - boundaries.W) * 111000 / this.width();
resY = (boundaries.S - boundaries.N) * 111000 / this.height();
for(i = 2; i < 20; i += 1) {
if (resX > baseScale || resY > baseScale) {
break;
}
baseScale = baseScale / 2;
}
return i - 2;
},
removeAllMarkers: function () {
var markers = this.data('gmap').markers, i;
for (i = 0; i < markers.length; i += 1) {
markers[i].setMap(null);
delete markers[i];
}
markers.length = 0;
},
getMarker: function (key) {
return this.data('gmap').markerKeys[key];
}
};
$.fn.gMap = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' +  method + ' does not exist on jQuery.gmap');
}
};
$.fn.gMap.defaults = {
baseuri:				 '/lisgmap/getmarkers',
alpmap:					 false,
main_design:			 'standard',
log:                     false,
address:                 '',
latitude:                null,
longitude:               null,
zoom:                    3,
maxZoom: 				 null,
minZoom: 				 null,
markers:                 [],
controls:                {},
scrollwheel:             true,
maptype:                 google.maps.MapTypeId.TERRAIN,
maptypeids:              [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.TERRAIN],
mapTypeControl:          true,
zoomControl:             true,
panControl:              false,
scaleControl:            false,
streetViewControl:       true,
singleInfoWindow:        true,
html_prepend:            '<div class="lisgmap_marker">',
html_append:             '<div class="lisgmap_marker_arrow"><img src="/extension/lisgmap/design/standard/images/lisgmap_window_arrow.png" /></div></div>',
icon: {
image:               "http://www.google.com/mapfiles/marker.png",
iconsize:            [20, 34],
iconanchor:          [9, 34],
infowindowanchor:    [9, 2]
},
onComplete:              function () {},
travelMode:              'BYCAR',
travelUnit:              'KM',
routeDisplay:            null,
routeErrors:			 {
'INVALID_REQUEST': 'The provided request is invalid.',
'NOT_FOUND': 'One or more of the given addresses could not be found.',
'OVER_QUERY_LIMIT': 'A temporary error occured. Please try again in a few minutes.',
'REQUEST_DENIED': 'An error occured. Please contact us.',
'UNKNOWN_ERROR': 'An unknown error occured. Please try again.',
'ZERO_RESULTS': 'No route could be found within the given addresses.'
}
};
}(jQuery));
function InfoBox(opt_opts) {
opt_opts = opt_opts || {};
google.maps.OverlayView.apply(this, arguments);
this.content_ = opt_opts.content || "";
this.disableAutoPan_ = opt_opts.disableAutoPan || false;
this.maxWidth_ = opt_opts.maxWidth || 0;
this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
this.zIndex_ = opt_opts.zIndex || null;
this.boxClass_ = opt_opts.boxClass || "infoBox";
this.boxStyle_ = opt_opts.boxStyle || {};
this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
this.closeBoxURL_ = opt_opts.closeBoxURL || "http://www.google.com/intl/en_us/mapfiles/close.gif";
if (opt_opts.closeBoxURL === "") {
this.closeBoxURL_ = "";
}
this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
this.isHidden_ = opt_opts.isHidden || false;
this.alignBottom_ = opt_opts.alignBottom || false;
this.pane_ = opt_opts.pane || "floatPane";
this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
this.div_ = null;
this.closeListener_ = null;
this.eventListener1_ = null;
this.eventListener2_ = null;
this.eventListener3_ = null;
this.moveListener_ = null;
this.contextListener_ = null;
this.fixedWidthSet_ = null;
}
InfoBox.prototype = new google.maps.OverlayView();
InfoBox.prototype.createInfoBoxDiv_ = function () {
var bw;
var me = this;
var cancelHandler = function (e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
var ignoreHandler = function (e) {
e.returnValue = false;
if (e.preventDefault) {
e.preventDefault();
}
if (!me.enableEventPropagation_) {
cancelHandler(e);
}
};
if (!this.div_) {
this.div_ = document.createElement("div");
this.setBoxStyle_();
if (typeof this.content_.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(this.content_);
}
this.getPanes()[this.pane_].appendChild(this.div_);
this.addClickHandler_();
if (this.div_.style.width) {
this.fixedWidthSet_ = true;
} else {
if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
this.div_.style.width = this.maxWidth_;
this.div_.style.overflow = "auto";
this.fixedWidthSet_ = true;
} else { // The following code is needed to overcome problems with MSIE
bw = this.getBoxWidths_();
this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
this.fixedWidthSet_ = false;
}
}
this.panBox_(this.disableAutoPan_);
if (!this.enableEventPropagation_) {
this.eventListener1_ = google.maps.event.addDomListener(this.div_, "mousedown", cancelHandler);
this.eventListener2_ = google.maps.event.addDomListener(this.div_, "click", cancelHandler);
this.eventListener3_ = google.maps.event.addDomListener(this.div_, "dblclick", cancelHandler);
}
this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
google.maps.event.trigger(this, "domready");
}
};
InfoBox.prototype.getCloseBoxImg_ = function () {
var img = "";
if (this.closeBoxURL_ !== "") {
img  = "<img";
img += " src='" + this.closeBoxURL_ + "'";
img += " align=right"; // Do this because Opera chokes on style='float: right;'
img += " style='";
img += " position: relative;"; // Required by MSIE
img += " cursor: pointer;";
img += " z-index:9999999999999;";
img += " margin: " + this.closeBoxMargin_ + ";";
img += "'>";
}
return img;
};
InfoBox.prototype.addClickHandler_ = function () {
var closeBox;
if (this.closeBoxURL_ !== "") {
closeBox = this.div_.firstChild;
this.closeListener_ = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler_());
} else {
this.closeListener_ = null;
}
};
InfoBox.prototype.getCloseClickHandler_ = function () {
var me = this;
return function (e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
me.close();
google.maps.event.trigger(me, "closeclick");
};
};
InfoBox.prototype.panBox_ = function (disablePan) {
var map;
var bounds;
var xOffset = 0, yOffset = 0;
if (!disablePan) {
map = this.getMap();
if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
if (!map.getBounds().contains(this.position_)) {
map.setCenter(this.position_);
}
bounds = map.getBounds();
var mapDiv = map.getDiv();
var mapWidth = mapDiv.offsetWidth;
var mapHeight = mapDiv.offsetHeight;
var iwOffsetX = this.pixelOffset_.width;
var iwOffsetY = this.pixelOffset_.height;
var iwWidth = this.div_.offsetWidth;
var iwHeight = this.div_.offsetHeight;
var padX = this.infoBoxClearance_.width;
var padY = this.infoBoxClearance_.height;
var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
if (pixPosition.x < (-iwOffsetX + padX)) {
xOffset = pixPosition.x + iwOffsetX - padX;
} else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
}
if (this.alignBottom_) {
if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
} else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
}
} else {
if (pixPosition.y < (-iwOffsetY + padY)) {
yOffset = pixPosition.y + iwOffsetY - padY;
} else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
}
}
if (!(xOffset === 0 && yOffset === 0)) {
var c = map.getCenter();
map.panBy(xOffset, yOffset);
}
}
}
};
InfoBox.prototype.setBoxStyle_ = function () {
var i, boxStyle;
if (this.div_) {
this.div_.className = this.boxClass_;
this.div_.style.cssText = "";
boxStyle = this.boxStyle_;
for (i in boxStyle) {
if (boxStyle.hasOwnProperty(i)) {
this.div_.style[i] = boxStyle[i];
}
}
if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
this.div_.style.position = "absolute";
this.div_.style.visibility = 'hidden';
if (this.zIndex_ !== null) {
this.div_.style.zIndex = this.zIndex_;
}
}
};
InfoBox.prototype.getBoxWidths_ = function () {
var computedStyle;
var bw = {top: 0, bottom: 0, left: 0, right: 0};
var box = this.div_;
if (document.defaultView && document.defaultView.getComputedStyle) {
computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
if (computedStyle) {
bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
}
} else if (document.documentElement.currentStyle) { // MSIE
if (box.currentStyle) {
bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
}
}
return bw;
};
InfoBox.prototype.onRemove = function () {
if (this.div_) {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
InfoBox.prototype.draw = function () {
this.createInfoBoxDiv_();
var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
if (this.alignBottom_) {
this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
} else {
this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
}
if (this.isHidden_) {
this.div_.style.visibility = 'hidden';
} else {
this.div_.style.visibility = "visible";
}
};
InfoBox.prototype.setOptions = function (opt_opts) {
if (typeof opt_opts.boxClass !== "undefined") { // Must be first
this.boxClass_ = opt_opts.boxClass;
this.setBoxStyle_();
}
if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
this.boxStyle_ = opt_opts.boxStyle;
this.setBoxStyle_();
}
if (typeof opt_opts.content !== "undefined") {
this.setContent(opt_opts.content);
}
if (typeof opt_opts.disableAutoPan !== "undefined") {
this.disableAutoPan_ = opt_opts.disableAutoPan;
}
if (typeof opt_opts.maxWidth !== "undefined") {
this.maxWidth_ = opt_opts.maxWidth;
}
if (typeof opt_opts.pixelOffset !== "undefined") {
this.pixelOffset_ = opt_opts.pixelOffset;
}
if (typeof opt_opts.position !== "undefined") {
this.setPosition(opt_opts.position);
}
if (typeof opt_opts.zIndex !== "undefined") {
this.setZIndex(opt_opts.zIndex);
}
if (typeof opt_opts.closeBoxMargin !== "undefined") {
this.closeBoxMargin_ = opt_opts.closeBoxMargin;
}
if (typeof opt_opts.closeBoxURL !== "undefined") {
this.closeBoxURL_ = opt_opts.closeBoxURL;
}
if (typeof opt_opts.infoBoxClearance !== "undefined") {
this.infoBoxClearance_ = opt_opts.infoBoxClearance;
}
if (typeof opt_opts.isHidden !== "undefined") {
this.isHidden_ = opt_opts.isHidden;
}
if (typeof opt_opts.enableEventPropagation !== "undefined") {
this.enableEventPropagation_ = opt_opts.enableEventPropagation;
}
if (this.div_) {
this.draw();
}
};
InfoBox.prototype.setContent = function (content) {
this.content_ = content;
if (this.div_) {
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
if (!this.fixedWidthSet_) {
this.div_.style.width = "";
}
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
if (!this.fixedWidthSet_) {
this.div_.style.width = this.div_.offsetWidth + "px";
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
}
}
this.addClickHandler_();
}
google.maps.event.trigger(this, "content_changed");
};
InfoBox.prototype.setPosition = function (latlng) {
this.position_ = latlng;
if (this.div_) {
this.draw();
}
google.maps.event.trigger(this, "position_changed");
};
InfoBox.prototype.setZIndex = function (index) {
this.zIndex_ = index;
if (this.div_) {
this.div_.style.zIndex = index;
}
google.maps.event.trigger(this, "zindex_changed");
};
InfoBox.prototype.getContent = function () {
return this.content_;
};
InfoBox.prototype.getPosition = function () {
return this.position_;
};
InfoBox.prototype.getZIndex = function () {
return this.zIndex_;
};
InfoBox.prototype.show = function () {
this.isHidden_ = false;
if (this.div_) {
this.div_.style.visibility = "visible";
}
};
InfoBox.prototype.hide = function () {
this.isHidden_ = true;
if (this.div_) {
this.div_.style.visibility = "hidden";
}
};
InfoBox.prototype.open = function (map, anchor) {
var me = this;
if (anchor) {
this.position_ = anchor.getPosition();
this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
me.setPosition(this.getPosition());
});
}
this.setMap(map);
if (this.div_) {
this.panBox_();
}
};
InfoBox.prototype.close = function () {
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
if (this.eventListener1_) {
google.maps.event.removeListener(this.eventListener1_);
google.maps.event.removeListener(this.eventListener2_);
google.maps.event.removeListener(this.eventListener3_);
this.eventListener1_ = null;
this.eventListener2_ = null;
this.eventListener3_ = null;
}
if (this.moveListener_) {
google.maps.event.removeListener(this.moveListener_);
this.moveListener_ = null;
}
if (this.contextListener_) {
google.maps.event.removeListener(this.contextListener_);
this.contextListener_ = null;
}
this.setMap(null);
};

