
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);
var window_loaded = false;
$(window).load(function(){
window_loaded = true;
});
(function($){
$.fn.galleryView = function(options) {
var opts = $.extend($.fn.galleryView.defaults,options);
var id;
var iterator = 0;			// INT - Currently visible panel/frame
var item_count = 0;			// INT - Total number of panels/frames
var slide_method;			// STRING - indicator to slide entire filmstrip or just the pointer ('strip','pointer')
var paused = false;			// BOOLEAN - flag to indicate whether automated transitions are active
var pointer_speed = 0;		// INT - Speed (in milliseconds) of pointer animation
var animate_panels = true;	// BOOLEAN - flag to indicate whether panels will animate during transitions
var current = 1;			// INT - index of current panel/frame
var gallery_images;			// OBJECT - container for images within UL passed to plugin
var image_count = 0;		// INT - number of images within gallery
var loaded_images = 0;		// INT - number of gallery images that have been loaded in the browser
var gallery_width;
var gallery_height;
var pointer_height;
var pointer_width;
var strip_width;
var strip_height;
var wrapper_width;
var wrapper_height;
var f_frame_width;
var f_frame_height;
var filmstrip_orientation;
var frame_img_scale = {};
var panel_img_scale = {};
var img_h = {};
var img_w = {};
var scale_panel_images = true;
var panel_nav_displayed = false;
var j_gallery;
var j_filmstrip;
var j_frames;
var j_frame_img_wrappers;
var j_panels;
var j_pointer;
var j_panel_wrapper;
function showItem(i,speed,callback) {
var mod_i = i%item_count;
var distance;
var diststr;
$('.gv-nav-next, .gv-panel-nav-next, .gv-nav-prev, .gv-panel-nav-prev',j_gallery).unbind('click');
j_frames.unbind('click');
$(document).oneTime(speed,'bindNavButtons',function(){
$('.gv-nav-next, .gv-panel-nav-next',j_gallery).click(showNextItem);
$('.gv-nav-prev, .gv-panel-nav-prev',j_gallery).click(showPrevItem);
enableFrameClicking();
});
if(opts.show_filmstrip) {
j_frames.removeClass('current').find('img').stop().animate({opacity:opts.frame_opacity},speed);
j_frames.eq(i).addClass('current').find('img').stop().animate({opacity:1},speed);
}
if(opts.show_panels) {
if(animate_panels) {
if(opts.panel_animation=='slide') {
j_panels.eq(mod_i).css({
left: getInt($('.gv-panel.current').eq(0).css('left'))+opts.panel_width+'px',
zIndex: 50
}).show().animate({
left: '-='+opts.panel_width+'px'
},speed,opts.easing,function(){
$(this).addClass('current');
});
$('.gv-panel.current').css({zIndex:49}).animate({
left: '-='+opts.panel_width+'px'
},speed,opts.easing,function(){
$(this).removeClass('current').hide();
});
} else if(opts.panel_animation=='zoomOut') {
$(document).oneTime(speed,'setCurrentFrame',function(){
j_panels.eq(mod_i).addClass('current').css('zIndex',50);
});
j_panels.eq(mod_i).show().css('zIndex',49);
$('.gv-panel.current img').animate({
top: '-='+opts.panel_height/2+'px',
left:'-='+opts.panel_width/2+'px'
},speed,'swing',function(){
$(this).animate({
top: '+='+opts.panel_height/2+'px',
left: '+='+opts.panel_width/2+'px'
},0);
});
$('.gv-panel.current').animate({
top:'+='+opts.panel_height/2+'px',
left:'+='+opts.panel_width/2+'px',
height:0,
width:0
},speed,'swing',function(){
$(this).removeClass('current').hide().css({
top:getPos(j_panels[mod_i]).top+'px',
left:getPos(j_panels[mod_i]).left+'px',
height:opts.panel_height+'px',
width:opts.panel_width+'px'
});
});
} else if(opts.panel_animation == 'crossfade') {
j_panels.removeClass('current').fadeOut(speed,function(){$(this).css('filter','');}).eq(mod_i).addClass('current').fadeIn(speed,function(){$(this).css('filter','');});
} else {
j_panels.removeClass('current').stop().fadeOut(speed/2);
$(document).oneTime(speed/2,'fadeInPanel',function(){
j_panels.eq(mod_i).addClass('current').stop().fadeIn(speed/2);
});
}
} else {
$(document).oneTime(speed,'switch_panels',function(){j_panels.hide().eq(mod_i).show();});
}
}
if(opts.show_filmstrip) {
if(opts.filmstrip_style == 'scroll' && slide_method=='strip') {
j_filmstrip.stop();
if(filmstrip_orientation=='horizontal') {
distance = getPos(j_frames[i]).left - (getPos(j_pointer[0]).left+(pointer_width/2)-(f_frame_width/2));
diststr = (distance>=0?'-=':'+=')+Math.abs(distance)+'px';
j_filmstrip.animate({left:diststr},speed,opts.easing,function(){
var old_i = i;
if(i>item_count) {
i = mod_i;
iterator = i;
j_filmstrip.css('left','-'+((f_frame_width+opts.frame_gap)*i)+'px');
} else if (i<=(item_count-strip_size)) {
i = (mod_i)+item_count;
iterator = i;
j_filmstrip.css('left','-'+((f_frame_width+opts.frame_gap)*i)+'px');
}
if(old_i != i) {
j_frames.eq(old_i).removeClass('current').find('img').css({opacity:opts.frame_opacity});
j_frames.eq(i).addClass('current').find('img').css({opacity:1});
}
});
} else {
distance = getPos(j_frames[i]).top-getPos($('.gv-strip_wrapper',j_gallery)[0]).top;
diststr = (distance>=0?'-=':'+=')+Math.abs(distance)+'px';
j_filmstrip.animate({
'top':diststr
},speed,opts.easing,function(){
var old_i = i;
if(i>item_count) {
i = mod_i;
iterator = i;
j_filmstrip.css('top','-'+((f_frame_height+opts.frame_gap)*i)+'px');
} else if (i<=(item_count-strip_size)) {
i = (mod_i)+item_count;
iterator = i;
j_filmstrip.css('top','-'+((f_frame_height+opts.frame_gap)*i)+'px');
}
if(old_i != i) {
j_frames.eq(old_i).removeClass('current').find('img').css({opacity:opts.frame_opacity});
j_frames.eq(i).addClass('current').find('img').css({opacity:1});
}
if(!animate_panels) {
j_panels.hide().eq(mod_i).show();
}
});
}
} else if(slide_method=='pointer') {
j_pointer.stop();
var pos = getPos(j_frames[i]);
if(filmstrip_orientation=='horizontal') {
j_pointer.animate({
left:pos.left+(f_frame_width/2)-(pointer_width/2)+'px'
},pointer_speed,opts.easing,function(){
if(!animate_panels) {j_panels.hide().eq(mod_i).show();}
});
} else {
j_pointer.animate({
top:pos.top+(f_frame_height/2)-(pointer_height)+'px'
},pointer_speed,opts.easing,function(){
if(!animate_panels) {j_panels.hide().eq(mod_i).show();}
});
}
}
}
if(callback) {$(document).oneTime(speed,'showItemCallback',callback);}
current = i;
};
function extraWidth(el) {
if(!el) { return 0; }
if(el.length==0) { return 0; }
el = el.eq(0);
var ew = 0;
ew += getInt(el.css('paddingLeft'));
ew += getInt(el.css('paddingRight'));
ew += getInt(el.css('borderLeftWidth'));
ew += getInt(el.css('borderRightWidth'));
return ew;
};
function extraHeight(el) {
if(!el) { return 0; }
if(el.length==0) { return 0; }
el = el.eq(0);
var eh = 0;
eh += getInt(el.css('paddingTop'));
eh += getInt(el.css('paddingBottom'));
eh += getInt(el.css('borderTopWidth'));
eh += getInt(el.css('borderBottomWidth'));
return eh;
};
function showNextItem() {
$(document).stopTime("transition");
if(++iterator==j_frames.length) {iterator=0;}
showItem(iterator,opts.transition_speed);
if(!paused && opts.transition_interval > 0) {
$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});
}
};
function showPrevItem() {
$(document).stopTime("transition");
if(--iterator<0) {iterator = item_count-1;}
showItem(iterator,opts.transition_speed);
if(!paused && opts.transition_interval > 0) {
$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});
}
};
function getPos(el) {
if(!el) return {top:0,left:0};
var left = 0, top = 0;
var el_id = el.id;
if(el.offsetParent) {
do {
left += el.offsetLeft;
top += el.offsetTop;
} while(el = el.offsetParent);
}
if(el_id == id) {return {'left':left,'top':top};}
else {
var gPos = getPos(j_gallery[0]);
var gLeft = gPos.left;
var gTop = gPos.top;
return {'left':left-gLeft,'top':top-gTop};
}
};
function enableFrameClicking() {
j_frames.each(function(i){
if($('a',this).length==0) {
$(this).click(function(){
if(iterator!=i) {
$(document).stopTime("transition");
showItem(i,opts.transition_speed);
iterator = i;
if(!paused && opts.transition_interval > 0) {
$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});
}
}
});
}
});
};
function buildPanels() {
j_panels.each(function(i){
if($('.gv-panel-overlay',this).length>0) {
$(this).append('<div class="gv-overlay-background"></div>');
}
});
if(opts.show_panel_nav) {
$('<div></div>').addClass('gv-panel-nav-next').appendTo(j_gallery).css({
position:'absolute',
zIndex:'1100',
top:((opts.filmstrip_position=='top'?opts.frame_gap+wrapper_height:0)+(opts.panel_height-22)/2)+'px',
right:((opts.filmstrip_position=='right'?opts.frame_gap+wrapper_width:0)+10)+'px',
display:'none'
}).click(showNextItem);
$('<div></div>').addClass('gv-panel-nav-prev').appendTo(j_gallery).css({
position:'absolute',
zIndex:'1100',
top:((opts.filmstrip_position=='top'?opts.frame_gap+wrapper_height:0)+(opts.panel_height-22)/2)+'px',
left:((opts.filmstrip_position=='left'?opts.frame_gap+wrapper_width:0)+10)+'px',
display:'none'
}).click(showPrevItem);
}
j_panel_wrapper.css({
width:opts.panel_width+'px',
height:opts.panel_height+'px',
position:'absolute',
overflow:'hidden'
});
if(opts.show_filmstrip) {
switch(opts.filmstrip_position) {
case 'top': j_panel_wrapper.css({top:wrapper_height+opts.frame_gap+'px'}); break;
case 'left': j_panel_wrapper.css({left:wrapper_width+opts.frame_gap+'px'}); break;
default: break;
}
}
j_panels.each(function(i){
$(this).css({
width:(opts.panel_width-extraWidth(j_panels))+'px',
height:(opts.panel_height-extraHeight(j_panels))+'px',
position:'absolute',
top:0,
left:0,
display:'none'
});
});
$('.gv-panel-overlay',j_panels).css({
position:'absolute',
zIndex:'999',
width:(opts.panel_width-extraWidth($('.gv-panel-overlay',j_panels)))+'px',
left:0
});
$('.gv-overlay-background',j_panels).css({
position:'absolute',
zIndex:'998',
width:opts.panel_width+'px',
left:0,
opacity:opts.overlay_opacity
});
if(opts.overlay_position=='top') {
$('.gv-panel-overlay',j_panels).css('top',0);
$('.gv-overlay-background',j_panels).css('top',0);
} else {
$('.gv-panel-overlay',j_panels).css('bottom',0);
$('.gv-overlay-background',j_panels).css('bottom',0);
}
$('.gv-panel iframe',j_panels).css({
width:opts.panel_width+'px',
height:opts.panel_height+'px',
border:0
});
if(scale_panel_images) {
$('img',j_panels).each(function(i){
$(this).css({
height:panel_img_scale[i%item_count]*img_h[i%item_count],
width:panel_img_scale[i%item_count]*img_w[i%item_count],
position:'relative',
top:(opts.panel_height-(panel_img_scale[i%item_count]*img_h[i%item_count]))/2+'px',
left:(opts.panel_width-(panel_img_scale[i%item_count]*img_w[i%item_count]))/2+'px'
});
});
}
};
function buildFilmstrip() {
j_filmstrip.wrap('<div class="gv-strip_wrapper"></div>');
if(opts.filmstrip_style == 'scroll' && slide_method=='strip') {
j_frames.clone().appendTo(j_filmstrip);
j_frames.clone().appendTo(j_filmstrip);
j_frames = $('li',j_filmstrip);
}
if(opts.show_captions) {
j_frames.append('<div class="gv-caption"></div>').each(function(i){
if($(this).find('img').parent('a').length > 0){
ima = $('<a></a>');
ima.attr('href',$(this).find('img').parent('a').eq(0).attr('href'));
ima.attr('target',$(this).find('img').parent('a').eq(0).attr('target'));
ima.attr('title',$(this).find('img').attr('alt'));
ima.append($(this).find('img').attr('title'));
} else {
ima = $(this).find('img').attr('title');
}
$(this).find('.gv-caption').html(ima);
$(this).find('img').attr('title', $(this).find('img').attr('alt'));
});
}
j_filmstrip.css({
listStyle:'none',
margin:0,
width:strip_width+'px',
position:'absolute',
zIndex:'900',
top:(filmstrip_orientation=='vertical' && opts.filmstrip_style == 'scroll' && slide_method=='strip'?-((f_frame_height+opts.frame_gap)*iterator):0)+'px',
left:(filmstrip_orientation=='horizontal' && opts.filmstrip_style == 'scroll' && slide_method=='strip'?-((f_frame_width+opts.frame_gap)*iterator):0)+'px',
height:'290px' //strip_height+'px',
});
j_frames.css({
float:'left',
position:'relative',
height:f_frame_height+'px',
width:f_frame_width+'px',
zIndex:'901',
padding:0,
cursor:'pointer',
marginBottom:opts.frame_gap+'px',
marginRight:opts.frame_gap+'px'
});
$('.gv-img_wrap',j_frames).each(function(i){
$(this).css({
height:Math.min(opts.frame_height,img_h[i%item_count]*frame_img_scale[i%item_count])+'px',
width:Math.min(opts.frame_width,img_w[i%item_count]*frame_img_scale[i%item_count])+'px',
position:'relative',
top:(opts.show_captions && opts.filmstrip_position=='top'?f_caption_height:0)+Math.max(0,(opts.frame_height-(frame_img_scale[i%item_count]*img_h[i%item_count]))/2)+'px',
left:0, //Math.max(0,(opts.frame_width-(frame_img_scale[i%item_count]*img_w[i%item_count]))/2)+'px',
overflow:'hidden'
});
});
$('img',j_frames).each(function(i){
$(this).css({
opacity:opts.frame_opacity,
height:opts.frame_height+'px', //img_h[i%item_count]*frame_img_scale[i%item_count]+'px',
width:img_w[i%item_count]*frame_img_scale[i%item_count]+'px',
position:'relative',
top:Math.min(0,(opts.frame_height-(frame_img_scale[i%item_count]*img_h[i%item_count]))/2)+'px',
left:Math.min(0,(opts.frame_width-(frame_img_scale[i%item_count]*img_w[i%item_count]))/2)+'px'
}).mouseover(function(){
$(this).stop().animate({opacity:1},300);
}).mouseout(function(){
if(!$(this).parent().parent().hasClass('current')){$(this).stop().animate({opacity:opts.frame_opacity},300);}
});
});
$('.gv-strip_wrapper',j_gallery).css({
position:'absolute',
overflow:'hidden'
});
if(filmstrip_orientation=='horizontal') {
$('.gv-strip_wrapper',j_gallery).css({
top:opts.show_panels ? opts.filmstrip_position=='top'?0:opts.panel_height+opts.frame_gap+'px' : 0,
left:((gallery_width-wrapper_width)/2)+'px',
width:wrapper_width+'px',
height:wrapper_height+'px'
});
} else {
$('.gv-strip_wrapper',j_gallery).css({
left:opts.show_panels ? opts.filmstrip_position=='left'?0:opts.panel_width+opts.frame_gap+'px' : 0,
top:0,
width:wrapper_width+'px',
height:wrapper_height+'px'
});
}
$('.gv-caption',j_gallery).css({
position:'absolute',
top:(opts.filmstrip_position=='bottom'?f_frame_height:0)+'px',
left: $('.gv-img_wrap').css("width").match(/\d+(,\d+)?/)[0] +'px',
margin:3 + 'px',
width:f_caption_width - $('.gv-img_wrap').css("width").match(/\d+(,\d+)?/)[0] +'px', //f_caption_width+'px',
overflow:'visible'
});
var pointer = $('<div></div>');
pointer.addClass('gv-pointer').appendTo(j_gallery).css({
position:'absolute',
zIndex:'1000',
width:0,
fontSize:0,
lineHeight:0,
borderTopWidth:pointer_height+'px',
borderRightWidth:(pointer_width/2)+'px',
borderBottomWidth:pointer_height+'px',
borderLeftWidth:(pointer_width/2)+'px',
borderStyle:'solid'
});
var transColor = $.browser.msie && $.browser.version.substr(0,1) == '6' ? 'pink' : 'transparent';
if(!opts.show_panels) { pointer.css('borderColor',transColor); }
switch(opts.filmstrip_position) {
case 'top': pointer.css({
top:wrapper_height+'px',
left:((gallery_width-wrapper_width)/2)+(slide_method=='strip'?0:((f_frame_width+opts.frame_gap)*iterator))+((f_frame_width/2)-(pointer_width/2))+'px',
borderBottomColor:transColor,
borderRightColor:transColor,
borderLeftColor:transColor
}); break;
case 'bottom': pointer.css({
bottom:wrapper_height+'px',
left:((gallery_width-wrapper_width)/2)+(slide_method=='strip'?0:((f_frame_width+opts.frame_gap)*iterator))+((f_frame_width/2)-(pointer_width/2))+'px',
borderTopColor:transColor,
borderRightColor:transColor,
borderLeftColor:transColor
}); break;
case 'left': pointer.css({
left:wrapper_width+'px',
top:(f_frame_height/2)-(pointer_height)+(slide_method=='strip'?0:((f_frame_height+opts.frame_gap)*iterator))+'px',
borderBottomColor:transColor,
borderRightColor:transColor,
borderTopColor:transColor
}); break;
case 'right': pointer.css({
right:wrapper_width+'px',
top:(f_frame_height/2)-(pointer_height)+(slide_method=='strip'?0:((f_frame_height+opts.frame_gap)*iterator))+'px',
borderBottomColor:transColor,
borderLeftColor:transColor,
borderTopColor:transColor
}); break;
}
j_pointer = $('.gv-pointer',j_gallery);
if(opts.show_filmstrip_nav) {
var navNext = $('<div></div>');
navNext.addClass('gv-nav-next').appendTo(j_gallery).css({
position:'absolute'
}).click(showNextItem);
var navPrev = $('<div></div>');
navPrev.addClass('gv-nav-prev').appendTo(j_gallery).css({
position:'absolute'
}).click(showPrevItem);
if(filmstrip_orientation=='horizontal') {
navNext.css({
top:(opts.show_panels ? (opts.filmstrip_position=='top'?0:opts.panel_height+opts.frame_gap) : 0)+((strip_height-22)/2)+'px',
right:((gallery_width)/2)-(wrapper_width/2)-opts.frame_gap-22+'px'
});
navPrev.css({
top:(opts.show_panels ? (opts.filmstrip_position=='top'?0:opts.panel_height+opts.frame_gap) : 0)+((strip_height-22)/2)+'px',
left:((gallery_width)/2)-(wrapper_width/2)-opts.frame_gap-22+'px'
});
} else {
navNext.css({
left:(opts.show_panels ? (opts.filmstrip_position=='left'?0:opts.panel_width+opts.frame_gap) : 0)+((strip_width-22)/2)+13+'px',
top:wrapper_height+opts.frame_gap+'px'
});
navPrev.css({
left:(opts.show_panels ? (opts.filmstrip_position=='left'?0:opts.panel_width+opts.frame_gap) : 0)+((strip_width-22)/2)-13+'px',
top:wrapper_height+opts.frame_gap+'px'
});
}
}
};
function mouseIsOverGallery(x,y) {
var pos = getPos(j_gallery[0]);
var top = pos.top;
var left = pos.left;
return x > left && x < left+j_gallery.outerWidth() && y > top && y < top+j_gallery.outerHeight();
};
function mouseIsOverPanel(x,y) {
var pos = getPos($('#'+id+' .gv-panel_wrap')[0]);
var gPos = getPos(j_gallery[0]);
var top = pos.top+gPos.top;
var left = pos.left+gPos.left;
return x > left && x < left+j_panels.outerWidth() && y > top && y < top+j_panels.outerHeight();
};
function getInt(i) {
i = parseInt(i,10);
if(isNaN(i)) { i = 0; }
return i;
};
function buildGallery() {
var gallery_images = opts.show_filmstrip?$('img',j_frames):$('img',j_panels);
gallery_images.each(function(i){
img_h[i] = this.height;
img_w[i] = this.width;
if(opts.frame_scale=='nocrop') {
frame_img_scale[i] = Math.min(opts.frame_height/img_h[i],opts.frame_width/img_w[i]);
} else {
frame_img_scale[i] = Math.max(opts.frame_height/img_h[i],opts.frame_width/img_w[i]);
}
if(opts.panel_scale=='nocrop') {
panel_img_scale[i] = Math.min(opts.panel_height/img_h[i],opts.panel_width/img_w[i]);
} else {
panel_img_scale[i] = Math.max(opts.panel_height/img_h[i],opts.panel_width/img_w[i]);
}
});
j_gallery.css({
position:'relative',
width:gallery_width+'px',
height:gallery_height+'px'
});
if(opts.show_filmstrip) {
buildFilmstrip();
enableFrameClicking();
}
if(!opts.show_overlays) {
$('.gv-panel-overlay',j_gallery).remove();
}
if(opts.show_panels) {
buildPanels();
}
if(opts.pause_on_hover || opts.show_panel_nav) {
$(document).mousemove(function(e){
if(opts.pause_on_hover) {
if(mouseIsOverGallery(e.pageX,e.pageY) && !paused) {
$(document).oneTime(500,"animation_pause",function(){
$(document).stopTime("transition");
paused=true;
});
} else {
$(document).stopTime("animation_pause");
if(paused && opts.transition_interval > 0) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
paused = false;
}
}
}
if(opts.show_panel_nav) {
if(mouseIsOverPanel(e.pageX,e.pageY) && !panel_nav_displayed) {
$('.gv-panel-nav-next, .gv-panel-nav-prev',j_gallery).show();
panel_nav_displayed = true;
} else if(!mouseIsOverPanel(e.pageX,e.pageY) && panel_nav_displayed) {
$('.gv-panel-nav-next, .gv-panel-nav-prev',j_gallery).hide();
panel_nav_displayed = false;
}
}
});
}
j_filmstrip.css('visibility','visible');
j_gallery.css('visibility','visible');
showItem(iterator,10,function(){
$('.gv-loader',j_gallery).fadeOut('1000',function(){
if(item_count > 1 && opts.transition_interval > 0) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
}
});
});
};
return this.each(function() {
var _t = $(this);
_t.css('visibility','hidden');
gallery_images = $('img',_t);
image_count = gallery_images.length;
current = opts.start_frame-1;
_t.wrap("<div></div>");
j_gallery = _t.parent();
j_gallery.css('visibility','hidden').attr('id',_t.attr('id')).addClass('gv-gallery').addClass(_t.attr('class'));
_t.removeAttr('id').addClass('gv-filmstrip');
$(document).stopTime("transition");
$(document).stopTime("animation_pause");
id = j_gallery.attr('id');
scale_panel_images = $('.gv-panel-content',j_gallery).length==0;
animate_panels = (opts.panel_animation != 'none');
filmstrip_orientation = (opts.filmstrip_position=='top'||opts.filmstrip_position=='bottom'?'horizontal':'vertical');
if(filmstrip_orientation=='vertical') { opts.show_captions = true; }
if(filmstrip_orientation == 'horizontal' && opts.pointer_size > opts.frame_width/2) {
opts.pointer_size = opts.frame_width/2;
}
if(filmstrip_orientation == 'vertical' && opts.pointer_size > opts.frame_height/2) {
opts.pointer_size = opts.frame_height/2;
}
j_filmstrip = $('.gv-filmstrip',j_gallery);
j_frames = $('li',j_filmstrip);
j_frames.addClass('gv-frame');
j_panel_wrapper = $('<div>');
j_panel_wrapper.addClass('gv-panel_wrap').prependTo(j_gallery);
if(opts.show_panels) {
for(i=j_frames.length-1;i>=0;i--) {
jf = j_frames.eq(i);
if(jf.find('.gv-panel-content').length>0) {
jf.find('.gv-panel-content').remove().prependTo(j_panel_wrapper).addClass('gv-panel').addClass(jf.attr('class')).removeClass('gv-frame');
} else {
p = $('<div>');
p.addClass('gv-panel');
p.addClass(jf.attr('class')).removeClass('gv-frame');
im = $('<img />');
jfimg = jf.find('img').eq(0)
im.attr('src',jfimg.attr('src'));
if(jfimg.parent('a').length > 0){
ima = $('<a></a>');
ima.attr('href',jfimg.parent('a').eq(0).attr('href'));
ima.attr('target',jfimg.parent('a').eq(0).attr('target'));
ima.append(im);
ima.appendTo(p);
} else {
im.appendTo(p);
}
p.prependTo(j_panel_wrapper);
j_frames.eq(i).find('.gv-panel-overlay').remove().appendTo(p);
}
}
} else {
$('.gv-panel-overlay',j_frames).remove();
$('.gv-panel-content',j_frames).remove();
}
if(!opts.show_filmstrip) { j_filmstrip.remove(); }
else {
j_frames.each(function(i){
if($(this).find('a').length>0) {
$(this).find('a').wrap('<div class="gv-img_wrap"></div>');
} else {
$(this).find('img').wrap('<div class="gv-img_wrap"></div>');
}
});
j_frame_img_wrappers = $('.gv-img_wrap',j_frames);
}
j_panels = $('.gv-panel',j_gallery);
if(!opts.show_panels) {
opts.panel_height = 0;
opts.panel_width = 0;
}
$('<div class="gv-caption"></div>').appendTo(j_frames);
f_frame_width = opts.frame_width+extraWidth(j_frame_img_wrappers);
f_frame_height = opts.frame_height+extraHeight(j_frame_img_wrappers);
frame_caption_size = getInt($('.gv-caption',j_gallery).css('height'));
f_caption_width = f_frame_width - extraWidth($('.gv-caption',j_gallery));
f_caption_height = frame_caption_size + extraHeight($('.gv-caption',j_gallery));
$('.gv-caption',j_gallery).remove();
item_count = opts.show_panels?j_panels.length:j_frames.length;
if(filmstrip_orientation=='horizontal') {
strip_size = opts.show_panels?Math.floor((opts.panel_width+opts.frame_gap-(!opts.show_filmstrip_nav?0:(opts.frame_gap+22)*2))/(f_frame_width+opts.frame_gap)):Math.min(item_count,opts.filmstrip_size);
} else {
strip_size = opts.show_panels?Math.floor((opts.panel_height+opts.frame_gap-(!opts.show_filmstrip_nav?0:opts.frame_gap+22))/(f_frame_height+opts.frame_gap)):Math.min(item_count,opts.filmstrip_size);
}
if(strip_size >= item_count) {
slide_method = 'pointer';
strip_size = item_count;
}
else {
slide_method = 'strip';
}
if(Math.ceil(item_count/strip_size) > 1) { opts.pointer_size = 0; }
pointer_height = opts.pointer_size;
pointer_width = opts.pointer_size*2;
iterator = opts.start_frame-1;
if(opts.filmstrip_style == 'scroll' && strip_size < item_count) {
iterator += item_count;
}
j_filmstrip.css('margin',0);
if(filmstrip_orientation=='horizontal') {
if(opts.filmstrip_style == 'show all' || (opts.filmstrip_style == 'scroll' && slide_method == 'pointer')) {
strip_width = (f_frame_width*strip_size)+(opts.frame_gap*(strip_size));
}
else {
strip_width = (f_frame_width*item_count*3)+(opts.frame_gap*((item_count*3)));
}
} else {
if(opts.filmstrip_style == 'show all') {
strip_width = (f_frame_width*Math.ceil(item_count/strip_size))+(opts.frame_gap*(Math.ceil(item_count/strip_size)));
} else {
strip_width = (f_frame_width);
}
}
if(filmstrip_orientation=='horizontal') {
if(opts.filmstrip_style == 'show all') {
strip_height = ((f_frame_height+(opts.show_captions?f_caption_height:0))*Math.ceil(item_count/strip_size))+(opts.frame_gap*(Math.ceil(item_count/strip_size)-1));
} else {
strip_height = (f_frame_height+(opts.show_captions?f_caption_height:0));
}
} else {
if(opts.filmstrip_style =='show all' || (opts.filmstrip_style == 'scroll' && slide_method == 'pointer')) {
strip_height = ((f_frame_height*strip_size)+opts.frame_gap*(strip_size-1));
}
else {
strip_height = (f_frame_height*item_count*3)+(opts.frame_gap*((item_count*3)-1));
}
}
if(filmstrip_orientation=='horizontal') {
wrapper_width = ((strip_size*f_frame_width)+((strip_size-1)*opts.frame_gap));
if(opts.filmstrip_style == 'show all') {
wrapper_height = ((f_frame_height+(opts.show_captions?f_caption_height:0))*Math.ceil(item_count/strip_size))+(opts.frame_gap*(Math.ceil(item_count/strip_size)-1));
} else {
wrapper_height = (f_frame_height+(opts.show_captions?f_caption_height:0));
}
} else {
wrapper_height = 290; //((strip_size*f_frame_height)+((strip_size-1)*opts.frame_gap));
if(opts.filmstrip_style == 'show all') {
wrapper_width = (f_frame_width*Math.ceil(item_count/strip_size))+(opts.frame_gap*(Math.ceil(item_count/strip_size)-1));
} else {
wrapper_width = f_frame_width;
}
}
j_gallery.css('padding',0);
if(filmstrip_orientation=='horizontal') {
gallery_width = opts.show_panels?opts.panel_width:wrapper_width+44+(opts.frame_gap*2);
gallery_height = (opts.show_panels?opts.panel_height+(opts.show_filmstrip?opts.frame_gap:0):0)+(opts.show_filmstrip?wrapper_height:0);
} else {
gallery_height = opts.show_panels?opts.panel_height:wrapper_height+22;
gallery_width = (opts.show_panels?opts.panel_width+(opts.show_filmstrip?opts.frame_gap:0):0)+(opts.show_filmstrip?wrapper_width:0);
}
galleryPos = getPos(j_gallery[0]);
$('<div>').addClass('gv-loader').css({
position:'absolute',
zIndex:'32666',
opacity:1,
top:0,
left:0,
width:gallery_width+'px',
height:gallery_height+'px'
}).appendTo(j_gallery);
if(opts.transition_speed > opts.transition_interval && opts.transition_interval > 0) {
opts.transition_speed = opts.transition_interval;
}
pointer_speed = opts.animate_pointer ? opts.transition_speed : 0;
if(!window_loaded) {
gallery_images.each(function(i){
if($(this).attr('complete')) {
loaded_images++;
if(loaded_images==image_count) {
buildGallery();
window_loaded;
}
} else {
$(this).load(function(){
loaded_images++;
if(loaded_images==image_count) {
buildGallery();
window_loaded;
}
});
}
});
} else {
buildGallery();
}
});
};
$.fn.galleryView.defaults = {
transition_speed: 800,				//INT - duration of panel/frame transition (in milliseconds)
transition_interval: 4000,			//INT - delay between panel/frame transitions (in milliseconds)
easing: 'swing',					//STRING - easing method to use for animations (jQuery provides 'swing' or 'linear', more available with jQuery UI or Easing plugin)
pause_on_hover: false,				//BOOLEAN - flag to pause slideshow when user hovers over the gallery
show_panels: true,					//BOOLEAN - flag to show or hide panel portion of gallery
panel_width: 600,					//INT - width of gallery panel (in pixels)
panel_height: 400,					//INT - height of gallery panel (in pixels)
panel_animation: 'crossfade',		//STRING - animation method for panel transitions (crossfade,fade,slide,zoomOut,none)
overlay_opacity: 0.7,				//FLOAT - transparency for panel overlay (1.0 = opaque, 0.0 = transparent)
overlay_position: 'bottom',			//STRING - position of panel overlay (bottom, top)
panel_scale: 'crop',				//STRING - cropping option for panel images (crop = scale image and fit to aspect ratio determined by panel_width and panel_height, nocrop = scale image and preserve original aspect ratio)
show_panel_nav: true,				//BOOLEAN - flag to show or hide panel navigation buttons
show_overlays: false,				//BOOLEAN - flag to show or hide panel overlays
show_filmstrip: true,				//BOOLEAN - flag to show or hide filmstrip portion of gallery
frame_width: 60,					//INT - width of filmstrip frames (in pixels)
frame_height: 40,					//INT - width of filmstrip frames (in pixels)
start_frame: 1,						//INT - index of panel/frame to show first when gallery loads
filmstrip_size: 3,					//INT - number of frames to show in filmstrip-only gallery
frame_opacity: 0.7,					//FLOAT - transparency of non-active frames (1.0 = opaque, 0.0 = transparent)
filmstrip_style: 'scroll',			//STRING - type of filmstrip to use (scroll, show all)
filmstrip_position: 'bottom',		//STRING - position of filmstrip within gallery (bottom, top, left, right)
show_filmstrip_nav: true,			//BOOLEAN - flag indicating whether to display navigation buttons
frame_scale: 'crop',				//STRING - cropping option for filmstrip images (same as above)
frame_gap: 1,						//INT - spacing between frames within filmstrip (in pixels)
show_captions: false,				//BOOLEAN - flag to show or hide frame captions
pointer_size: 8,					//INT - Height of frame pointer (in pixels)
animate_pointer: true				//BOOLEAN - flag to animate pointer or move it instantly to target frame
};
})(jQuery);
﻿/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/
jQuery.fn.extend({
everyTime: function(interval, label, fn, times) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, times);
});
},
oneTime: function(interval, label, fn) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, 1);
});
},
stopTime: function(label, fn) {
return this.each(function() {
jQuery.timer.remove(this, label, fn);
});
}
});
jQuery.extend({
timer: {
global: [],
guid: 1,
dataKey: "jQuery.timer",
regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
powers: {
'ms': 1,
'cs': 10,
'ds': 100,
's': 1000,
'das': 10000,
'hs': 100000,
'ks': 1000000
},
timeParse: function(value) {
if (value == undefined || value == null)
return null;
var result = this.regex.exec(jQuery.trim(value.toString()));
if (result[2]) {
var num = parseFloat(result[1]);
var mult = this.powers[result[2]] || 1;
return num * mult;
} else {
return value;
}
},
add: function(element, interval, label, fn, times) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times)
times = fn;
fn = label;
label = interval;
}
interval = jQuery.timer.timeParse(interval);
if (typeof interval != 'number' || isNaN(interval) || interval < 0)
return;
if (typeof times != 'number' || isNaN(times) || times < 0)
times = 0;
times = times || 0;
var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
if (!timers[label])
timers[label] = {};
fn.timerID = fn.timerID || this.guid++;
var handler = function() {
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
jQuery.timer.remove(element, label, fn);
};
handler.timerID = fn.timerID;
if (!timers[label][fn.timerID])
timers[label][fn.timerID] = window.setInterval(handler,interval);
this.global.push( element );
},
remove: function(element, label, fn) {
var timers = jQuery.data(element, this.dataKey), ret;
if ( timers ) {
if (!label) {
for ( label in timers )
this.remove(element, label, fn);
} else if ( timers[label] ) {
if ( fn ) {
if ( fn.timerID ) {
window.clearInterval(timers[label][fn.timerID]);
delete timers[label][fn.timerID];
}
} else {
for ( var fn in timers[label] ) {
window.clearInterval(timers[label][fn]);
delete timers[label][fn];
}
}
for ( ret in timers[label] ) break;
if ( !ret ) {
ret = null;
delete timers[label];
}
}
for ( ret in timers ) break;
if ( !ret )
jQuery.removeData(element, this.dataKey);
}
}
}
});
jQuery(window).bind("unload", function() {
jQuery.each(jQuery.timer.global, function(index, item) {
jQuery.timer.remove(item);
});
});
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
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;
}
});

