
function insertMedia()
{
for( var k = 0, l = arguments.length; k < l; k++ )
{
document.write( arguments[k] );
}
}
function insertMedia2( node_id, string )
{
var flashNode = document.getElementById( node_id );
flashNode.innerHTML = string;
}
(function($) {
$.fn.lightBox = function(settings) {
settings = jQuery.extend({
overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
imageLoading:			'/extension/ezjquerylightbox/design/standard/images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
imageBtnPrev:			'/extension/ezjquerylightbox/design/standard/images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
imageBtnNext:			'/extension/ezjquerylightbox/design/standard/images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
imageBtnClose:			'/extension/ezjquerylightbox/design/standard/images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
imageBlank:				'/extension/ezjquerylightbox/design/standard/images/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
containerBorderSize:	2,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
txtImage:				'',	// (string) Specify text "Image"
txtOf:					'-',		// (string) Specify text "of"
keyToClose:				'c',		// (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
keyToPrev:				'p',		// (string) (p = previous) Letter to show the previous image
keyToNext:				'n',		// (string) (n = next) Letter to show the next image.
imageArray:				[],
activeImage:			0
},settings);
var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
function _initialize() {
_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
return false; // Avoid the browser following the link
}
function _start(objClicked,jQueryMatchedObj) {
$('embed, object, select').css({ 'visibility' : 'visible' });
_set_interface();
settings.imageArray.length = 0;
settings.activeImage = 0;
if ( jQueryMatchedObj.length == 1 ) {
settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));
} else {
for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));
}
}
while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) {
settings.activeImage++;
}
_set_image_to_view();
}
function _set_interface() {
$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');
var arrPageSizes = ___getPageSize();
$('#jquery-overlay').css({
backgroundColor:	settings.overlayBgColor,
opacity:			settings.overlayOpacity,
width:				arrPageSizes[0],
height:				arrPageSizes[1]
}).fadeIn();
var arrPageScroll = ___getPageScroll();
$('#jquery-lightbox').css({
top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
left:	arrPageScroll[0]
}).show();
$('#jquery-overlay,#jquery-lightbox').click(function() {
_finish();
});
$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
_finish();
return false;
});
$(window).resize(function() {
var arrPageSizes = ___getPageSize();
$('#jquery-overlay').css({
width:		arrPageSizes[0],
height:		arrPageSizes[1]
});
var arrPageScroll = ___getPageScroll();
$('#jquery-lightbox').css({
top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
left:	arrPageScroll[0]
});
});
}
function _set_image_to_view() { // show the loading
$('#lightbox-loading').show();
if ( settings.fixedNavigation ) {
$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
} else {
$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
}
var objImagePreloader = new Image();
objImagePreloader.onload = function() {
$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);
objImagePreloader.onload=function(){};
};
objImagePreloader.src = settings.imageArray[settings.activeImage][0];
};
function _resize_container_image_box(intImageWidth,intImageHeight) {
var intCurrentWidth = $('#lightbox-container-image-box').width();
var intCurrentHeight = $('#lightbox-container-image-box').height();
var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the image�s width and the left and right padding value
var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image�s height and the left and right padding value
var intDiffW = intCurrentWidth - intWidth;
var intDiffH = intCurrentHeight - intHeight;
$('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); });
if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {
if ( $.browser.msie ) {
___pause(250);
} else {
___pause(100);
}
}
$('#lightbox-container-image-data-box').css({ width: intImageWidth });
$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) });
};
function _show_image() {
$('#lightbox-loading').hide();
$('#lightbox-image').fadeIn(function() {
_show_image_data();
_set_navigation();
});
_preload_neighbor_images();
};
function _show_image_data() {
$('#lightbox-container-image-data-box').slideDown('fast');
$('#lightbox-image-details-caption').hide();
if ( settings.imageArray[settings.activeImage][1] ) {
$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
}
if ( settings.imageArray.length > 1 ) {
$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
}
}
function _set_navigation() {
$('#lightbox-nav').show();
$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
if ( settings.activeImage != 0 ) {
if ( settings.fixedNavigation ) {
$('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
.unbind()
.bind('click',function() {
settings.activeImage = settings.activeImage - 1;
_set_image_to_view();
return false;
});
} else {
$('#lightbox-nav-btnPrev').unbind().hover(function() {
$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });
},function() {
$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
}).show().bind('click',function() {
settings.activeImage = settings.activeImage - 1;
_set_image_to_view();
return false;
});
}
}
if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
if ( settings.fixedNavigation ) {
$('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
.unbind()
.bind('click',function() {
settings.activeImage = settings.activeImage + 1;
_set_image_to_view();
return false;
});
} else {
$('#lightbox-nav-btnNext').unbind().hover(function() {
$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });
},function() {
$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
}).show().bind('click',function() {
settings.activeImage = settings.activeImage + 1;
_set_image_to_view();
return false;
});
}
}
_enable_keyboard_navigation();
}
function _enable_keyboard_navigation() {
$(document).keydown(function(objEvent) {
_keyboard_action(objEvent);
});
}
function _disable_keyboard_navigation() {
$(document).unbind();
}
function _keyboard_action(objEvent) {
if ( objEvent == null ) {
keycode = event.keyCode;
escapeKey = 27;
} else {
keycode = objEvent.keyCode;
escapeKey = objEvent.DOM_VK_ESCAPE;
}
key = String.fromCharCode(keycode).toLowerCase();
if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) {
_finish();
}
if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) {
if ( settings.activeImage != 0 ) {
settings.activeImage = settings.activeImage - 1;
_set_image_to_view();
_disable_keyboard_navigation();
}
}
if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) {
if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) {
settings.activeImage = settings.activeImage + 1;
_set_image_to_view();
_disable_keyboard_navigation();
}
}
}
function _preload_neighbor_images() {
if ( (settings.imageArray.length -1) > settings.activeImage ) {
objNext = new Image();
objNext.src = settings.imageArray[settings.activeImage + 1][0];
}
if ( settings.activeImage > 0 ) {
objPrev = new Image();
objPrev.src = settings.imageArray[settings.activeImage -1][0];
}
}
function _finish() {
$('#jquery-lightbox').remove();
$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
$('embed, object, select').css({ 'visibility' : 'visible' });
}
function ___getPageSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {	// all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
return arrayPageSize;
};
function ___getPageScroll() {
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
arrayPageScroll = new Array(xScroll,yScroll);
return arrayPageScroll;
};
function ___pause(ms) {
var date = new Date();
curDate = null;
do { var curDate = new Date(); }
while ( curDate - date < ms);
};
return this.unbind('click').click(_initialize);
};
})(jQuery); // Call and execute the function immediately passing the jQuery object
$(document).ready(function(){
$('a[rel*=lightbox]').lightBox({
overlayBgColor: '#BBB',
overlayOpacity: 0.6
});
});
(function($) {
var tabId = 0,
listId = 0;
$.widget("ui.tabs", {
options: {
add: null,
ajaxOptions: null,
cache: false,
cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
collapsible: false,
disable: null,
disabled: [],
enable: null,
event: 'click',
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
idPrefix: 'ui-tabs-',
load: null,
panelTemplate: '<div></div>',
remove: null,
select: null,
show: null,
spinner: '<em>Loading&#8230;</em>',
tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
},
_create: function() {
this._tabify(true);
},
_setOption: function(key, value) {
if (key == 'selected') {
if (this.options.collapsible && value == this.options.selected) {
return;
}
this.select(value);
}
else {
this.options[key] = value;
this._tabify();
}
},
_tabId: function(a) {
return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
this.options.idPrefix + (++tabId);
},
_sanitizeSelector: function(hash) {
return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
},
_cookie: function() {
var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + (++listId));
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
},
_ui: function(tab, panel) {
return {
tab: tab,
panel: panel,
index: this.anchors.index(tab)
};
},
_cleanup: function() {
this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
.find('span:data(label.tabs)')
.each(function() {
var el = $(this);
el.html(el.data('label.tabs')).removeData('label.tabs');
});
},
_tabify: function(init) {
this.list = this.element.find('ol,ul').eq(0);
this.lis = $('li:has(a[href])', this.list);
this.anchors = this.lis.map(function() { return $('a', this)[0]; });
this.panels = $([]);
var self = this, o = this.options;
var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
this.anchors.each(function(i, a) {
var href = $(a).attr('href');
var hrefBase = href.split('#')[0], baseEl;
if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
(baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
href = a.hash;
a.href = href;
}
if (fragmentId.test(href)) {
self.panels = self.panels.add(self._sanitizeSelector(href));
}
else if (href != '#') { // prevent loading the page itself if href is just "#"
$.data(a, 'href.tabs', href); // required for restore on destroy
$.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
var id = self._tabId(a);
a.href = '#' + id;
var $panel = $('#' + id);
if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
.insertAfter(self.panels[i - 1] || self.list);
$panel.data('destroy.tabs', true);
}
self.panels = self.panels.add($panel);
}
else {
o.disabled.push(i);
}
});
if (init) {
this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
this.lis.addClass('ui-state-default ui-corner-top');
this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');
if (o.selected === undefined) {
if (location.hash) {
this.anchors.each(function(i, a) {
if (a.hash == location.hash) {
o.selected = i;
return false; // break
}
});
}
if (typeof o.selected != 'number' && o.cookie) {
o.selected = parseInt(self._cookie(), 10);
}
if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
}
o.selected = o.selected || (this.lis.length ? 0 : -1);
}
else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
o.selected = -1;
}
o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;
o.disabled = $.unique(o.disabled.concat(
$.map(this.lis.filter('.ui-state-disabled'),
function(n, i) { return self.lis.index(n); } )
)).sort();
if ($.inArray(o.selected, o.disabled) != -1) {
o.disabled.splice($.inArray(o.selected, o.disabled), 1);
}
this.panels.addClass('ui-tabs-hide');
this.lis.removeClass('ui-tabs-selected ui-state-active');
if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
this.panels.eq(o.selected).removeClass('ui-tabs-hide');
this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
self.element.queue("tabs", function() {
self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
});
this.load(o.selected);
}
$(window).bind('unload', function() {
self.lis.add(self.anchors).unbind('.tabs');
self.lis = self.anchors = self.panels = null;
});
}
else {
o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
}
this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
if (o.cookie) {
this._cookie(o.selected, o.cookie);
}
for (var i = 0, li; (li = this.lis[i]); i++) {
$(li)[$.inArray(i, o.disabled) != -1 &&
!$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
}
if (o.cache === false) {
this.anchors.removeData('cache.tabs');
}
this.lis.add(this.anchors).unbind('.tabs');
if (o.event != 'mouseover') {
var addState = function(state, el) {
if (el.is(':not(.ui-state-disabled)')) {
el.addClass('ui-state-' + state);
}
};
var removeState = function(state, el) {
el.removeClass('ui-state-' + state);
};
this.lis.bind('mouseover.tabs', function() {
addState('hover', $(this));
});
this.lis.bind('mouseout.tabs', function() {
removeState('hover', $(this));
});
this.anchors.bind('focus.tabs', function() {
addState('focus', $(this).closest('li'));
});
this.anchors.bind('blur.tabs', function() {
removeState('focus', $(this).closest('li'));
});
}
var hideFx, showFx;
if (o.fx) {
if ($.isArray(o.fx)) {
hideFx = o.fx[0];
showFx = o.fx[1];
}
else {
hideFx = showFx = o.fx;
}
}
function resetStyle($el, fx) {
$el.css({ display: '' });
if (!$.support.opacity && fx.opacity) {
$el[0].style.removeAttribute('filter');
}
}
var showTab = showFx ?
function(clicked, $show) {
$(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
$show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
.animate(showFx, showFx.duration || 'normal', function() {
resetStyle($show, showFx);
self._trigger('show', null, self._ui(clicked, $show[0]));
});
} :
function(clicked, $show) {
$(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
$show.removeClass('ui-tabs-hide');
self._trigger('show', null, self._ui(clicked, $show[0]));
};
var hideTab = hideFx ?
function(clicked, $hide) {
$hide.animate(hideFx, hideFx.duration || 'normal', function() {
self.lis.removeClass('ui-tabs-selected ui-state-active');
$hide.addClass('ui-tabs-hide');
resetStyle($hide, hideFx);
self.element.dequeue("tabs");
});
} :
function(clicked, $hide, $show) {
self.lis.removeClass('ui-tabs-selected ui-state-active');
$hide.addClass('ui-tabs-hide');
self.element.dequeue("tabs");
};
this.anchors.bind(o.event + '.tabs', function() {
var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
$show = $(self._sanitizeSelector(this.hash));
if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
$li.hasClass('ui-state-disabled') ||
$li.hasClass('ui-state-processing') ||
self._trigger('select', null, self._ui(this, $show[0])) === false) {
this.blur();
return false;
}
o.selected = self.anchors.index(this);
self.abort();
if (o.collapsible) {
if ($li.hasClass('ui-tabs-selected')) {
o.selected = -1;
if (o.cookie) {
self._cookie(o.selected, o.cookie);
}
self.element.queue("tabs", function() {
hideTab(el, $hide);
}).dequeue("tabs");
this.blur();
return false;
}
else if (!$hide.length) {
if (o.cookie) {
self._cookie(o.selected, o.cookie);
}
self.element.queue("tabs", function() {
showTab(el, $show);
});
self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
this.blur();
return false;
}
}
if (o.cookie) {
self._cookie(o.selected, o.cookie);
}
if ($show.length) {
if ($hide.length) {
self.element.queue("tabs", function() {
hideTab(el, $hide);
});
}
self.element.queue("tabs", function() {
showTab(el, $show);
});
self.load(self.anchors.index(this));
}
else {
throw 'jQuery UI Tabs: Mismatching fragment identifier.';
}
if ($.browser.msie) {
this.blur();
}
});
this.anchors.bind('click.tabs', function(){return false;});
},
destroy: function() {
var o = this.options;
this.abort();
this.element.unbind('.tabs')
.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
.removeData('tabs');
this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
this.anchors.each(function() {
var href = $.data(this, 'href.tabs');
if (href) {
this.href = href;
}
var $this = $(this).unbind('.tabs');
$.each(['href', 'load', 'cache'], function(i, prefix) {
$this.removeData(prefix + '.tabs');
});
});
this.lis.unbind('.tabs').add(this.panels).each(function() {
if ($.data(this, 'destroy.tabs')) {
$(this).remove();
}
else {
$(this).removeClass([
'ui-state-default',
'ui-corner-top',
'ui-tabs-selected',
'ui-state-active',
'ui-state-hover',
'ui-state-focus',
'ui-state-disabled',
'ui-tabs-panel',
'ui-widget-content',
'ui-corner-bottom',
'ui-tabs-hide'
].join(' '));
}
});
if (o.cookie) {
this._cookie(null, o.cookie);
}
return this;
},
add: function(url, label, index) {
if (index === undefined) {
index = this.anchors.length; // append by default
}
var self = this, o = this.options,
$li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);
$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);
var $panel = $('#' + id);
if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
}
$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');
if (index >= this.lis.length) {
$li.appendTo(this.list);
$panel.appendTo(this.list[0].parentNode);
}
else {
$li.insertBefore(this.lis[index]);
$panel.insertBefore(this.panels[index]);
}
o.disabled = $.map(o.disabled,
function(n, i) { return n >= index ? ++n : n; });
this._tabify();
if (this.anchors.length == 1) { // after tabify
o.selected = 0;
$li.addClass('ui-tabs-selected ui-state-active');
$panel.removeClass('ui-tabs-hide');
this.element.queue("tabs", function() {
self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
});
this.load(0);
}
this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
return this;
},
remove: function(index) {
var o = this.options, $li = this.lis.eq(index).remove(),
$panel = this.panels.eq(index).remove();
if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
}
o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
function(n, i) { return n >= index ? --n : n; });
this._tabify();
this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
return this;
},
enable: function(index) {
var o = this.options;
if ($.inArray(index, o.disabled) == -1) {
return;
}
this.lis.eq(index).removeClass('ui-state-disabled');
o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
return this;
},
disable: function(index) {
var self = this, o = this.options;
if (index != o.selected) { // cannot disable already selected tab
this.lis.eq(index).addClass('ui-state-disabled');
o.disabled.push(index);
o.disabled.sort();
this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
}
return this;
},
select: function(index) {
if (typeof index == 'string') {
index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
}
else if (index === null) { // usage of null is deprecated, TODO remove in next release
index = -1;
}
if (index == -1 && this.options.collapsible) {
index = this.options.selected;
}
this.anchors.eq(index).trigger(this.options.event + '.tabs');
return this;
},
load: function(index) {
var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
this.abort();
if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
this.element.dequeue("tabs");
return;
}
this.lis.eq(index).addClass('ui-state-processing');
if (o.spinner) {
var span = $('span', a);
span.data('label.tabs', span.html()).html(o.spinner);
}
this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
url: url,
success: function(r, s) {
$(self._sanitizeSelector(a.hash)).html(r);
self._cleanup();
if (o.cache) {
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
}
self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
try {
o.ajaxOptions.success(r, s);
}
catch (e) {}
},
error: function(xhr, s, e) {
self._cleanup();
self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
try {
o.ajaxOptions.error(xhr, s, index, a);
}
catch (e) {}
}
}));
self.element.dequeue("tabs");
return this;
},
abort: function() {
this.element.queue([]);
this.panels.stop(false, true);
this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2));
if (this.xhr) {
this.xhr.abort();
delete this.xhr;
}
this._cleanup();
return this;
},
url: function(index, url) {
this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
return this;
},
length: function() {
return this.anchors.length;
}
});
$.extend($.ui.tabs, {
version: '1.8'
});
$.extend($.ui.tabs.prototype, {
rotation: null,
rotate: function(ms, continuing) {
var self = this, o = this.options;
var rotate = self._rotate || (self._rotate = function(e) {
clearTimeout(self.rotation);
self.rotation = setTimeout(function() {
var t = o.selected;
self.select( ++t < self.anchors.length ? t : 0 );
}, ms);
if (e) {
e.stopPropagation();
}
});
var stop = self._unrotate || (self._unrotate = !continuing ?
function(e) {
if (e.clientX) { // in case of a true click
self.rotate(null);
}
} :
function(e) {
t = o.selected;
rotate();
});
if (ms) {
this.element.bind('tabsshow', rotate);
this.anchors.bind(o.event + '.tabs', stop);
rotate();
}
else {
clearTimeout(self.rotation);
this.element.unbind('tabsshow', rotate);
this.anchors.unbind(o.event + '.tabs', stop);
delete this._rotate;
delete this._unrotate;
}
return this;
}
});
})(jQuery);
(function($) {
var defaults = {
vertical: false,
rtl: false,
start: 1,
offset: 1,
size: null,
scroll: 3,
visible: null,
animation: 'normal',
easing: 'swing',
auto: 0,
wrap: null,
initCallback: null,
reloadCallback: null,
itemLoadCallback: null,
itemFirstInCallback: null,
itemFirstOutCallback: null,
itemLastInCallback: null,
itemLastOutCallback: null,
itemVisibleInCallback: null,
itemVisibleOutCallback: null,
buttonNextHTML: '<div></div>',
buttonPrevHTML: '<div></div>',
buttonNextEvent: 'click',
buttonPrevEvent: 'click',
buttonNextCallback: null,
buttonPrevCallback: null,
itemFallbackDimension: null
}, windowLoaded = false;
$(window).bind('load.jcarousel', function() { windowLoaded = true; });
$.jcarousel = function(e, o) {
this.options    = $.extend({}, defaults, o || {});
this.locked          = false;
this.autoStopped     = false;
this.container       = null;
this.clip            = null;
this.list            = null;
this.buttonNext      = null;
this.buttonPrev      = null;
this.buttonNextState = null;
this.buttonPrevState = null;
if (!o || o.rtl === undefined) {
this.options.rtl = ($(e).attr('dir') || $('html').attr('dir') || '').toLowerCase() == 'rtl';
}
this.wh = !this.options.vertical ? 'width' : 'height';
this.lt = !this.options.vertical ? (this.options.rtl ? 'right' : 'left') : 'top';
var skin = '', split = e.className.split(' ');
for (var i = 0; i < split.length; i++) {
if (split[i].indexOf('jcarousel-skin') != -1) {
$(e).removeClass(split[i]);
skin = split[i];
break;
}
}
if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') {
this.list = $(e);
this.container = this.list.parent();
if (this.container.hasClass('jcarousel-clip')) {
if (!this.container.parent().hasClass('jcarousel-container')) {
this.container = this.container.wrap('<div></div>');
}
this.container = this.container.parent();
} else if (!this.container.hasClass('jcarousel-container')) {
this.container = this.list.wrap('<div></div>').parent();
}
} else {
this.container = $(e);
this.list = this.container.find('ul,ol').eq(0);
}
if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) {
this.container.wrap('<div class=" '+ skin + '"></div>');
}
this.clip = this.list.parent();
if (!this.clip.length || !this.clip.hasClass('jcarousel-clip')) {
this.clip = this.list.wrap('<div></div>').parent();
}
this.buttonNext = $('.jcarousel-next', this.container);
if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) {
this.buttonNext = this.clip.after(this.options.buttonNextHTML).next();
}
this.buttonNext.addClass(this.className('jcarousel-next'));
this.buttonPrev = $('.jcarousel-prev', this.container);
if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
this.buttonPrev = this.clip.after(this.options.buttonPrevHTML).next();
}
this.buttonPrev.addClass(this.className('jcarousel-prev'));
this.clip.addClass(this.className('jcarousel-clip')).css({
overflow: 'hidden',
position: 'relative'
});
this.list.addClass(this.className('jcarousel-list')).css({
overflow: 'hidden',
position: 'relative',
top: 0,
margin: 0,
padding: 0
}).css((this.options.rtl ? 'right' : 'left'), 0);
this.container.addClass(this.className('jcarousel-container')).css({
position: 'relative'
});
if (!this.options.vertical && this.options.rtl) {
this.container.addClass('jcarousel-direction-rtl').attr('dir', 'rtl');
}
var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
var li = this.list.children('li');
var self = this;
if (li.size() > 0) {
var wh = 0, j = this.options.offset;
li.each(function() {
self.format(this, j++);
wh += self.dimension(this, di);
});
this.list.css(this.wh, (wh + 100) + 'px');
if (!o || o.size === undefined) {
this.options.size = li.size();
}
}
this.container.css('display', 'block');
this.buttonNext.css('display', 'block');
this.buttonPrev.css('display', 'block');
this.funcNext   = function() { self.next(); };
this.funcPrev   = function() { self.prev(); };
this.funcResize = function() { self.reload(); };
if (this.options.initCallback !== null) {
this.options.initCallback(this, 'init');
}
if (!windowLoaded && $.browser.safari) {
this.buttons(false, false);
$(window).bind('load.jcarousel', function() { self.setup(); });
} else {
this.setup();
}
};
var $jc = $.jcarousel;
$jc.fn = $jc.prototype = {
jcarousel: '0.2.7'
};
$jc.fn.extend = $jc.extend = $.extend;
$jc.fn.extend({
setup: function() {
this.first     = null;
this.last      = null;
this.prevFirst = null;
this.prevLast  = null;
this.animating = false;
this.timer     = null;
this.tail      = null;
this.inTail    = false;
if (this.locked) {
return;
}
this.list.css(this.lt, this.pos(this.options.offset) + 'px');
var p = this.pos(this.options.start, true);
this.prevFirst = this.prevLast = null;
this.animate(p, false);
$(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize);
},
reset: function() {
this.list.empty();
this.list.css(this.lt, '0px');
this.list.css(this.wh, '10px');
if (this.options.initCallback !== null) {
this.options.initCallback(this, 'reset');
}
this.setup();
},
reload: function() {
if (this.tail !== null && this.inTail) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
}
this.tail   = null;
this.inTail = false;
if (this.options.reloadCallback !== null) {
this.options.reloadCallback(this);
}
if (this.options.visible !== null) {
var self = this;
var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
this.list.children('li').each(function(i) {
wh += self.dimension(this, di);
if (i + 1 < self.first) {
lt = wh;
}
});
this.list.css(this.wh, wh + 'px');
this.list.css(this.lt, -lt + 'px');
}
this.scroll(this.first, false);
},
lock: function() {
this.locked = true;
this.buttons();
},
unlock: function() {
this.locked = false;
this.buttons();
},
size: function(s) {
if (s !== undefined) {
this.options.size = s;
if (!this.locked) {
this.buttons();
}
}
return this.options.size;
},
has: function(i, i2) {
if (i2 === undefined || !i2) {
i2 = i;
}
if (this.options.size !== null && i2 > this.options.size) {
i2 = this.options.size;
}
for (var j = i; j <= i2; j++) {
var e = this.get(j);
if (!e.length || e.hasClass('jcarousel-item-placeholder')) {
return false;
}
}
return true;
},
get: function(i) {
return $('.jcarousel-item-' + i, this.list);
},
add: function(i, s) {
var e = this.get(i), old = 0, n = $(s);
if (e.length === 0) {
var c, j = $jc.intval(i);
e = this.create(i);
while (true) {
c = this.get(--j);
if (j <= 0 || c.length) {
if (j <= 0) {
this.list.prepend(e);
} else {
c.after(e);
}
break;
}
}
} else {
old = this.dimension(e);
}
if (n.get(0).nodeName.toUpperCase() == 'LI') {
e.replaceWith(n);
e = n;
} else {
e.empty().append(s);
}
this.format(e.removeClass(this.className('jcarousel-item-placeholder')), i);
var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
var wh = this.dimension(e, di) - old;
if (i > 0 && i < this.first) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');
}
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
return e;
},
remove: function(i) {
var e = this.get(i);
if (!e.length || (i >= this.first && i <= this.last)) {
return;
}
var d = this.dimension(e);
if (i < this.first) {
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
}
e.remove();
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
},
next: function() {
if (this.tail !== null && !this.inTail) {
this.scrollTail(false);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
}
},
prev: function() {
if (this.tail !== null && this.inTail) {
this.scrollTail(true);
} else {
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
}
},
scrollTail: function(b) {
if (this.locked || this.animating || !this.tail) {
return;
}
this.pauseAuto();
var pos  = $jc.intval(this.list.css(this.lt));
pos = !b ? pos - this.tail : pos + this.tail;
this.inTail = !b;
this.prevFirst = this.first;
this.prevLast  = this.last;
this.animate(pos);
},
scroll: function(i, a) {
if (this.locked || this.animating) {
return;
}
this.pauseAuto();
this.animate(this.pos(i), a);
},
pos: function(i, fv) {
var pos  = $jc.intval(this.list.css(this.lt));
if (this.locked || this.animating) {
return pos;
}
if (this.options.wrap != 'circular') {
i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
}
var back = this.first > i;
var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
var c = back ? this.get(f) : this.get(this.last);
var j = back ? f : f - 1;
var e = null, l = 0, p = false, d = 0, g;
while (back ? --j >= i : ++j < i) {
e = this.get(j);
p = !e.length;
if (e.length === 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
c[back ? 'before' : 'after' ](e);
if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
g = this.get(this.index(j));
if (g.length) {
e = this.add(j, g.clone(true));
}
}
}
c = e;
d = this.dimension(e);
if (p) {
l += d;
}
if (this.first !== null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size === null || j <= this.options.size)))) {
pos = back ? pos + d : pos - d;
}
}
var clipping = this.clipping(), cache = [], visible = 0, v = 0;
c = this.get(i - 1);
j = i;
while (++visible) {
e = this.get(j);
p = !e.length;
if (e.length === 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
if (c.length === 0) {
this.list.prepend(e);
} else {
c[back ? 'before' : 'after' ](e);
}
if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
g = this.get(this.index(j));
if (g.length) {
e = this.add(j, g.clone(true));
}
}
}
c = e;
d = this.dimension(e);
if (d === 0) {
throw new Error('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
}
if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size) {
cache.push(e);
} else if (p) {
l += d;
}
v += d;
if (v >= clipping) {
break;
}
j++;
}
for (var x = 0; x < cache.length; x++) {
cache[x].remove();
}
if (l > 0) {
this.list.css(this.wh, this.dimension(this.list) + l + 'px');
if (back) {
pos -= l;
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
}
}
var last = i + visible - 1;
if (this.options.wrap != 'circular' && this.options.size && last > this.options.size) {
last = this.options.size;
}
if (j > last) {
visible = 0;
j = last;
v = 0;
while (++visible) {
e = this.get(j--);
if (!e.length) {
break;
}
v += this.dimension(e);
if (v >= clipping) {
break;
}
}
}
var first = last - visible + 1;
if (this.options.wrap != 'circular' && first < 1) {
first = 1;
}
if (this.inTail && back) {
pos += this.tail;
this.inTail = false;
}
this.tail = null;
if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
if ((v - m) > clipping) {
this.tail = v - clipping - m;
}
}
if (fv && i === this.options.size && this.tail) {
pos -= this.tail;
this.inTail = true;
}
while (i-- > first) {
pos += this.dimension(this.get(i));
}
this.prevFirst = this.first;
this.prevLast  = this.last;
this.first     = first;
this.last      = last;
return pos;
},
animate: function(p, a) {
if (this.locked || this.animating) {
return;
}
this.animating = true;
var self = this;
var scrolled = function() {
self.animating = false;
if (p === 0) {
self.list.css(self.lt,  0);
}
if (!self.autoStopped && (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size === null || self.last < self.options.size || (self.last == self.options.size && self.tail !== null && !self.inTail))) {
self.startAuto();
}
self.buttons();
self.notify('onAfterAnimation');
if (self.options.wrap == 'circular' && self.options.size !== null) {
for (var i = self.prevFirst; i <= self.prevLast; i++) {
if (i !== null && !(i >= self.first && i <= self.last) && (i < 1 || i > self.options.size)) {
self.remove(i);
}
}
}
};
this.notify('onBeforeAnimation');
if (!this.options.animation || a === false) {
this.list.css(this.lt, p + 'px');
scrolled();
} else {
var o = !this.options.vertical ? (this.options.rtl ? {'right': p} : {'left': p}) : {'top': p};
this.list.animate(o, this.options.animation, this.options.easing, scrolled);
}
},
startAuto: function(s) {
if (s !== undefined) {
this.options.auto = s;
}
if (this.options.auto === 0) {
return this.stopAuto();
}
if (this.timer !== null) {
return;
}
this.autoStopped = false;
var self = this;
this.timer = window.setTimeout(function() { self.next(); }, this.options.auto * 1000);
},
stopAuto: function() {
this.pauseAuto();
this.autoStopped = true;
},
pauseAuto: function() {
if (this.timer === null) {
return;
}
window.clearTimeout(this.timer);
this.timer = null;
},
buttons: function(n, p) {
if (n == null) {
n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size === null || this.last < this.options.size);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size !== null && this.last >= this.options.size) {
n = this.tail !== null && !this.inTail;
}
}
if (p == null) {
p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size !== null && this.first == 1) {
p = this.tail !== null && this.inTail;
}
}
var self = this;
if (this.buttonNext.size() > 0) {
this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
if (n) {
this.buttonNext.bind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
}
this.buttonNext[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
if (this.options.buttonNextCallback !== null && this.buttonNext.data('jcarouselstate') != n) {
this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); }).data('jcarouselstate', n);
}
} else {
if (this.options.buttonNextCallback !== null && this.buttonNextState != n) {
this.options.buttonNextCallback(self, null, n);
}
}
if (this.buttonPrev.size() > 0) {
this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
if (p) {
this.buttonPrev.bind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
}
this.buttonPrev[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
if (this.options.buttonPrevCallback !== null && this.buttonPrev.data('jcarouselstate') != p) {
this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); }).data('jcarouselstate', p);
}
} else {
if (this.options.buttonPrevCallback !== null && this.buttonPrevState != p) {
this.options.buttonPrevCallback(self, null, p);
}
}
this.buttonNextState = n;
this.buttonPrevState = p;
},
notify: function(evt) {
var state = this.prevFirst === null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
this.callback('itemLoadCallback', evt, state);
if (this.prevFirst !== this.first) {
this.callback('itemFirstInCallback', evt, state, this.first);
this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
}
if (this.prevLast !== this.last) {
this.callback('itemLastInCallback', evt, state, this.last);
this.callback('itemLastOutCallback', evt, state, this.prevLast);
}
this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
},
callback: function(cb, evt, state, i1, i2, i3, i4) {
if (this.options[cb] == null || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation')) {
return;
}
var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
if (!$.isFunction(callback)) {
return;
}
var self = this;
if (i1 === undefined) {
callback(self, state, evt);
} else if (i2 === undefined) {
this.get(i1).each(function() { callback(self, this, i1, state, evt); });
} else {
var call = function(i) {
self.get(i).each(function() { callback(self, this, i, state, evt); });
};
for (var i = i1; i <= i2; i++) {
if (i !== null && !(i >= i3 && i <= i4)) {
call(i);
}
}
}
},
create: function(i) {
return this.format('<li></li>', i);
},
format: function(e, i) {
e = $(e);
var split = e.get(0).className.split(' ');
for (var j = 0; j < split.length; j++) {
if (split[j].indexOf('jcarousel-') != -1) {
e.removeClass(split[j]);
}
}
e.addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({
'float': (this.options.rtl ? 'right' : 'left'),
'list-style': 'none'
}).attr('jcarouselindex', i);
return e;
},
className: function(c) {
return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
},
dimension: function(e, d) {
var el = e.jquery !== undefined ? e[0] : e;
var old = !this.options.vertical ?
(el.offsetWidth || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
(el.offsetHeight || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');
if (d == null || old == d) {
return old;
}
var w = !this.options.vertical ?
d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');
$(el).css(this.wh, w + 'px');
return this.dimension(el);
},
clipping: function() {
return !this.options.vertical ?
this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
},
index: function(i, s) {
if (s == null) {
s = this.options.size;
}
return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
}
});
$jc.extend({
defaults: function(d) {
return $.extend(defaults, d || {});
},
margin: function(e, p) {
if (!e) {
return 0;
}
var el = e.jquery !== undefined ? e[0] : e;
if (p == 'marginRight' && $.browser.safari) {
var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;
$.swap(el, old, function() { oWidth = el.offsetWidth; });
old.marginRight = 0;
$.swap(el, old, function() { oWidth2 = el.offsetWidth; });
return oWidth2 - oWidth;
}
return $jc.intval($.css(el, p));
},
intval: function(v) {
v = parseInt(v, 10);
return isNaN(v) ? 0 : v;
}
});
$.fn.jcarousel = function(o) {
if (typeof o == 'string') {
var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1);
return instance[o].apply(instance, args);
} else {
return this.each(function() {
$(this).data('jcarousel', new $jc(this, o));
});
}
};
})(jQuery);

