
function insertMedia()
{
for( var k = 0, l = arguments.length; k < l; k++ )
{
document.write( arguments[k] );
}
}
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;
}
});
﻿/**
* 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);
});
});
var window_loaded = false;
(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 theme_path;			// STRING - relative path to theme directory
var paused = false;		// BOOLEAN - flag to indicate whether automated transitions are active
var gallery_width;
var gallery_height;
var pointer_height;
var pointer_width;
var strip_width;
var strip_height;
var wrapper_width;
var f_frame_width;
var f_frame_height;
var frame_caption_size = 20;
var gallery_padding;
var filmstrip_margin;
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;
function showItem(i) {
$('.nav-next-overlay',j_gallery).unbind('click');
$('.nav-prev-overlay',j_gallery).unbind('click');
$('.nav-next',j_gallery).unbind('click');
$('.nav-prev',j_gallery).unbind('click');
j_frames.unbind('click');
if(opts.show_filmstrip) {
j_frames.removeClass('current').find('img').stop().animate({
'opacity':opts.frame_opacity
},opts.transition_speed);
j_frames.eq(i).addClass('current').find('img').stop().animate({
'opacity':1.0
},opts.transition_speed);
}
if(opts.show_panels && opts.fade_panels) {
j_panels.fadeOut(opts.transition_speed).eq(i%item_count).fadeIn(opts.transition_speed,function(){
if(!opts.show_filmstrip) {
$('.nav-prev-overlay',j_gallery).click(showPrevItem);
$('.nav-next-overlay',j_gallery).click(showNextItem);
$('.nav-prev',j_gallery).click(showPrevItem);
$('.nav-next',j_gallery).click(showNextItem);
}
});
}
if(opts.show_filmstrip) {
if(slide_method=='strip') {
j_filmstrip.stop();
var distance;
var diststr;
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
},opts.transition_speed,opts.easing,function(){
var old_i = i;
if(i>item_count) {
i = i%item_count;
iterator = i;
j_filmstrip.css('left','-'+((f_frame_width+opts.frame_gap)*i)+'px');
} else if (i<=(item_count-strip_size)) {
i = (i%item_count)+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.0
});
}
if(!opts.fade_panels) {
j_panels.hide().eq(i%item_count).show();
}
$('.nav-prev-overlay',j_gallery).click(showPrevItem);
$('.nav-next-overlay',j_gallery).click(showNextItem);
$('.nav-prev',j_gallery).click(showPrevItem);
$('.nav-next',j_gallery).click(showNextItem);
enableFrameClicking();
});
} else { // filmstrip_orientation == 'vertical'
distance = getPos(j_frames[i]).top - (getPos(j_pointer[0]).top+(pointer_height)-(f_frame_height/2));
diststr = (distance>=0?'-=':'+=')+Math.abs(distance)+'px';
j_filmstrip.animate({
'top':diststr
},opts.transition_speed,opts.easing,function(){
var old_i = i;
if(i>item_count) {
i = i%item_count;
iterator = i;
j_filmstrip.css('top','-'+((f_frame_height+opts.frame_gap)*i)+'px');
} else if (i<=(item_count-strip_size)) {
i = (i%item_count)+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.0
});
}
if(!opts.fade_panels) {
j_panels.hide().eq(i%item_count).show();
}
$('.nav-prev-overlay',j_gallery).click(showPrevItem);
$('.nav-next-overlay',j_gallery).click(showNextItem);
$('.nav-prev',j_gallery).click(showPrevItem);
$('.nav-next',j_gallery).click(showNextItem);
enableFrameClicking();
});
}
} 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')
},opts.transition_speed,opts.easing,function(){
if(!opts.fade_panels) {
j_panels.hide().eq(i%item_count).show();
}
$('.nav-prev-overlay',j_gallery).click(showPrevItem);
$('.nav-next-overlay',j_gallery).click(showNextItem);
$('.nav-prev',j_gallery).click(showPrevItem);
$('.nav-next',j_gallery).click(showNextItem);
enableFrameClicking();
});
} else {
j_pointer.animate({
'top':(pos.top+(f_frame_height/2)-(pointer_height)+'px')
},opts.transition_speed,opts.easing,function(){
if(!opts.fade_panels) {
j_panels.hide().eq(i%item_count).show();
}
$('.nav-prev-overlay',j_gallery).click(showPrevItem);
$('.nav-next-overlay',j_gallery).click(showNextItem);
$('.nav-prev',j_gallery).click(showPrevItem);
$('.nav-next',j_gallery).click(showNextItem);
enableFrameClicking();
});
}
}
}
};
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);
if(!paused) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
}
};
function showPrevItem() {
$(document).stopTime("transition");
if(--iterator<0) {iterator = item_count-1;}
showItem(iterator);
if(!paused) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
}
};
function getPos(el) {
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);
iterator = i;
if(!paused) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
}
}
});
}
});
};
function buildPanels() {
j_panels.each(function(i){
if($('.panel-overlay',this).length>0) {
$(this).append('<div class="overlay-background"></div>');
}
});
if(!opts.show_filmstrip && opts.show_nav) {
$('<img />').addClass('nav-next').attr('src',theme_path+opts.nav_theme+'/next.gif').appendTo(j_gallery).css({
'position':'absolute',
'zIndex':'1100',
'cursor':'pointer',
'top':((opts.panel_height-22)/2)+gallery_padding+'px',
'right':'10px',
'display':'none'
}).click(showNextItem);
$('<img />').addClass('nav-prev').attr('src',theme_path+opts.nav_theme+'/prev.gif').appendTo(j_gallery).css({
'position':'absolute',
'zIndex':'1100',
'cursor':'pointer',
'top':((opts.panel_height-22)/2)+gallery_padding+'px',
'left':'10px',
'display':'none'
}).click(showPrevItem);
$('<img />').addClass('nav-next-overlay').attr('src',theme_path+opts.nav_theme+'/panel-nav-next.gif').appendTo(j_gallery).css({
'position':'absolute',
'zIndex':'1099',
'top':((opts.panel_height-22)/2)+gallery_padding-10+'px',
'right':'0',
'display':'none',
'cursor':'pointer',
'opacity':0.75
}).click(showNextItem);
$('<img />').addClass('nav-prev-overlay').attr('src',theme_path+opts.nav_theme+'/panel-nav-prev.gif').appendTo(j_gallery).css({
'position':'absolute',
'zIndex':'1099',
'top':((opts.panel_height-22)/2)+gallery_padding-10+'px',
'left':'0',
'display':'none',
'cursor':'pointer',
'opacity':0.75
}).click(showPrevItem);
}
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',
'overflow':'hidden',
'display':'none'
});
switch(opts.filmstrip_position) {
case 'top': $(this).css({
'top':strip_height+Math.max(gallery_padding,filmstrip_margin)+'px',
'left':gallery_padding+'px'
}); break;
case 'left': $(this).css({
'top':gallery_padding+'px',
'left':strip_width+Math.max(gallery_padding,filmstrip_margin)+'px'
}); break;
default: $(this).css({'top':gallery_padding+'px','left':gallery_padding+'px'}); break;
}
});
$('.panel-overlay',j_panels).css({
'position':'absolute',
'zIndex':'999',
'width':(opts.panel_width-extraWidth($('.panel-overlay',j_panels)))+'px',
'left':'0'
});
$('.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') {
$('.panel-overlay',j_panels).css('top',0);
$('.overlay-background',j_panels).css('top',0);
} else {
$('.panel-overlay',j_panels).css('bottom',0);
$('.overlay-background',j_panels).css('bottom',0);
}
$('.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="strip_wrapper"></div>');
if(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="caption"></div>').each(function(i){
$(this).find('.caption').html($(this).find('img').attr('title'));
});
}
j_filmstrip.css({
'listStyle':'none',
'margin':'0',
'padding':'0',
'width':strip_width+'px',
'position':'absolute',
'zIndex':'900',
'top':(filmstrip_orientation=='vertical' && slide_method=='strip'?-((f_frame_height+opts.frame_gap)*iterator):0)+'px',
'left':(filmstrip_orientation=='horizontal' && slide_method=='strip'?-((f_frame_width+opts.frame_gap)*iterator):0)+'px',
'height':strip_height+'px'
});
j_frames.css({
'float':'left',
'position':'relative',
'height':f_frame_height+(opts.show_captions?frame_caption_size:0)+'px',
'width':f_frame_width+'px',
'zIndex':'901',
'padding':'0',
'cursor':'pointer'
});
switch(opts.filmstrip_position) {
case 'top': j_frames.css({
'marginBottom':filmstrip_margin+'px',
'marginRight':opts.frame_gap+'px'
}); break;
case 'bottom': j_frames.css({
'marginTop':filmstrip_margin+'px',
'marginRight':opts.frame_gap+'px'
}); break;
case 'left': j_frames.css({
'marginRight':filmstrip_margin+'px',
'marginBottom':opts.frame_gap+'px'
}); break;
case 'right': j_frames.css({
'marginLeft':filmstrip_margin+'px',
'marginBottom':opts.frame_gap+'px'
}); break;
}
$('.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'?frame_caption_size:0)+Math.max(0,(opts.frame_height-(frame_img_scale[i%item_count]*img_h[i%item_count]))/2)+'px',
'left':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':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.0},300);
}).mouseout(function(){
if(!$(this).parent().parent().hasClass('current')) { $(this).stop().animate({'opacity':opts.frame_opacity},300); }
});
});
$('.strip_wrapper',j_gallery).css({
'position':'absolute',
'overflow':'hidden'
});
if(filmstrip_orientation=='horizontal') {
$('.strip_wrapper',j_gallery).css({
'top':(opts.filmstrip_position=='top'?Math.max(gallery_padding,filmstrip_margin)+'px':opts.panel_height+gallery_padding+'px'),
'left':((gallery_width-wrapper_width)/2)+gallery_padding+'px',
'width':wrapper_width+'px',
'height':strip_height+'px'
});
} else {
$('.strip_wrapper',j_gallery).css({
'left':(opts.filmstrip_position=='left'?Math.max(gallery_padding,filmstrip_margin)+'px':opts.panel_width+gallery_padding+'px'),
'top':Math.max(gallery_padding,opts.frame_gap)+'px',
'width':strip_width+'px',
'height':wrapper_height+'px'
});
}
$('.caption',j_gallery).css({
'position':'absolute',
'top':(opts.filmstrip_position=='bottom'?f_frame_height:0)+'px',
'left':'0',
'margin':'0',
'width':f_frame_width+'px',
'padding':'0',
'height':frame_caption_size+'px',
'overflow':'hidden',
'lineHeight':frame_caption_size+'px'
});
var pointer = $('<div></div>');
pointer.addClass('pointer').appendTo(j_gallery).css({
'position':'absolute',
'zIndex':'1000',
'width':'0px',
'fontSize':'0px',
'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({
'bottom':(opts.panel_height-(pointer_height*2)+gallery_padding+filmstrip_margin)+'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))+gallery_padding+'px',
'borderBottomColor':transColor,
'borderRightColor':transColor,
'borderLeftColor':transColor
}); break;
case 'bottom': pointer.css({
'top':(opts.panel_height-(pointer_height*2)+gallery_padding+filmstrip_margin)+'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))+gallery_padding+'px',
'borderTopColor':transColor,
'borderRightColor':transColor,
'borderLeftColor':transColor
}); break;
case 'left': pointer.css({
'right':(opts.panel_width-pointer_width+gallery_padding+filmstrip_margin)+'px',
'top':(f_frame_height/2)-(pointer_height)+(slide_method=='strip'?0:((f_frame_height+opts.frame_gap)*iterator))+gallery_padding+'px',
'borderBottomColor':transColor,
'borderRightColor':transColor,
'borderTopColor':transColor
}); break;
case 'right': pointer.css({
'left':(opts.panel_width-pointer_width+gallery_padding+filmstrip_margin)+'px',
'top':(f_frame_height/2)-(pointer_height)+(slide_method=='strip'?0:((f_frame_height+opts.frame_gap)*iterator))+gallery_padding+'px',
'borderBottomColor':transColor,
'borderLeftColor':transColor,
'borderTopColor':transColor
}); break;
}
j_pointer = $('.pointer',j_gallery);
if (opts.show_nav) {
var navNext = $('<img />');
navNext.addClass('nav-next').attr('src',theme_path+opts.nav_theme+'/next.gif').appendTo(j_gallery).css({
'position':'absolute',
'cursor':'pointer'
}).click(showNextItem);
var navPrev = $('<img />');
navPrev.addClass('nav-prev').attr('src',theme_path+opts.nav_theme+'/prev.gif').appendTo(j_gallery).css({
'position':'absolute',
'cursor':'pointer'
}).click(showPrevItem);
if(filmstrip_orientation=='horizontal') {
navNext.css({
'top':(opts.filmstrip_position=='top'?Math.max(gallery_padding,filmstrip_margin):opts.panel_height+filmstrip_margin+gallery_padding)+((f_frame_height-22)/2)+'px',
'right':((gallery_width+(gallery_padding*2))/2)-(wrapper_width/2)-opts.frame_gap-22+'px'
});
navPrev.css({
'top':(opts.filmstrip_position=='top'?Math.max(gallery_padding,filmstrip_margin):opts.panel_height+filmstrip_margin+gallery_padding)+((f_frame_height-22)/2)+'px',
'left':((gallery_width+(gallery_padding*2))/2)-(wrapper_width/2)-opts.frame_gap-22+'px'
});
} else {
navNext.css({
'left':(opts.filmstrip_position=='left'?Math.max(gallery_padding,filmstrip_margin):opts.panel_width+filmstrip_margin+gallery_padding)+((f_frame_width-22)/2)+13+'px',
'top':wrapper_height+(Math.max(gallery_padding,opts.frame_gap)*2)+'px'
});
navPrev.css({
'left':(opts.filmstrip_position=='left'?Math.max(gallery_padding,filmstrip_margin):opts.panel_width+filmstrip_margin+gallery_padding)+((f_frame_width-22)/2)-13+'px',
'top':wrapper_height+(Math.max(gallery_padding,opts.frame_gap)*2)+'px'
});
}
}
};
function mouseIsOverGallery(x,y) {
var pos = getPos(j_gallery[0]);
var top = pos.top;
var left = pos.left;
return x > left && x < left+gallery_width+(filmstrip_orientation=='horizontal'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin)) && y > top && y < top+gallery_height+(filmstrip_orientation=='vertical'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin));
};
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+(filmstrip_orientation=='horizontal'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin))+'px',
'height':gallery_height+(filmstrip_orientation=='vertical'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin))+'px'
});
if(opts.show_filmstrip) {
buildFilmstrip();
enableFrameClicking();
}
if(opts.show_panels) {
buildPanels();
}
if(opts.pause_on_hover || (opts.show_panels && !opts.show_filmstrip)) {
$(document).mousemove(function(e){
if(mouseIsOverGallery(e.pageX,e.pageY)) {
if(opts.pause_on_hover) {
if(!paused) {
$(document).oneTime(500,"animation_pause",function(){
$(document).stopTime("transition");
paused=true;
});
}
}
if(opts.show_panels && !opts.show_filmstrip && !panel_nav_displayed) {
$('.nav-next-overlay').fadeIn('fast');
$('.nav-prev-overlay').fadeIn('fast');
$('.nav-next',j_gallery).fadeIn('fast');
$('.nav-prev',j_gallery).fadeIn('fast');
panel_nav_displayed = true;
}
} else {
if(opts.pause_on_hover) {
$(document).stopTime("animation_pause");
if(paused) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
paused = false;
}
}
if(opts.show_panels && !opts.show_filmstrip && panel_nav_displayed) {
$('.nav-next-overlay').fadeOut('fast');
$('.nav-prev-overlay').fadeOut('fast');
$('.nav-next',j_gallery).fadeOut('fast');
$('.nav-prev',j_gallery).fadeOut('fast');
panel_nav_displayed = false;
}
}
});
}
j_filmstrip.css('visibility','visible');
j_gallery.css('visibility','visible');
$('.loader',j_gallery).fadeOut('1000',function(){
showItem(iterator);
if(item_count > 1) {
$(document).everyTime(opts.transition_interval,"transition",function(){
showNextItem();
});
}
});
};
return this.each(function() {
$(this).css('visibility','hidden');
$(this).wrap("<div></div>");
j_gallery = $(this).parent();
j_gallery.css('visibility','hidden').attr('id',$(this).attr('id')).addClass('gallery');
$(this).removeAttr('id').addClass('filmstrip');
$(document).stopTime("transition");
$(document).stopTime("animation_pause");
id = j_gallery.attr('id');
scale_panel_images = $('.panel-content',j_gallery).length==0;
pointer_height = opts.pointer_size;
pointer_width = opts.pointer_size*2;
filmstrip_orientation = (opts.filmstrip_position=='top'||opts.filmstrip_position=='bottom'?'horizontal':'vertical');
if(filmstrip_orientation=='vertical') { opts.show_captions = false; }
$('script').each(function(i){
var s = $(this);
if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
loader_path = s.attr('src').split('jquery.galleryview')[0];
theme_path = s.attr('src')+'themes/';
}
});
j_filmstrip = $('.filmstrip',j_gallery);
j_frames = $('li',j_filmstrip);
j_frames.addClass('frame');
if(opts.show_panels) {
for(i=j_frames.length-1;i>=0;i--) {
if(j_frames.eq(i).find('.panel-content').length>0) {
j_frames.eq(i).find('.panel-content').remove().prependTo(j_gallery).addClass('panel');
} else {
p = $('<div>');
p.addClass('panel');
im = $('<img />');
im.attr('src',j_frames.eq(i).find('img').eq(0).attr('src')).appendTo(p);
p.prependTo(j_gallery);
j_frames.eq(i).find('.panel-overlay').remove().appendTo(p);
}
}
} else {
$('.panel-overlay',j_frames).remove();
$('.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="img_wrap"></div>');
} else {
$(this).find('img').wrap('<div class="img_wrap"></div>');
}
});
j_frame_img_wrappers = $('.img_wrap',j_frames);
}
j_panels = $('.panel',j_gallery);
if(!opts.show_panels) {
opts.panel_height = 0;
opts.panel_width = 0;
}
f_frame_width = opts.frame_width+extraWidth(j_frame_img_wrappers);
f_frame_height = opts.frame_height+extraHeight(j_frame_img_wrappers);
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+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+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';}
iterator = (strip_size<item_count?item_count:0)+opts.start_frame-1;
filmstrip_margin = (opts.show_panels?getInt(j_filmstrip.css('marginTop')):0);
j_filmstrip.css('margin','0px');
if(filmstrip_orientation=='horizontal') {
gallery_width = opts.show_panels?opts.panel_width:(strip_size*(f_frame_width+opts.frame_gap))+44+opts.frame_gap;
gallery_height = (opts.show_panels?opts.panel_height:0)+(opts.show_filmstrip?f_frame_height+filmstrip_margin+(opts.show_captions?frame_caption_size:0):0);
} else {
gallery_height = opts.show_panels?opts.panel_height:(strip_size*(f_frame_height+opts.frame_gap))+22;
gallery_width = (opts.show_panels?opts.panel_width:0)+(opts.show_filmstrip?f_frame_width+filmstrip_margin:0);
}
if(filmstrip_orientation=='horizontal') {
if(slide_method == 'pointer') {strip_width = (f_frame_width*item_count)+(opts.frame_gap*(item_count));}
else {strip_width = (f_frame_width*item_count*3)+(opts.frame_gap*(item_count*3));}
} else {
strip_width = (f_frame_width+filmstrip_margin);
}
if(filmstrip_orientation=='horizontal') {
strip_height = (f_frame_height+filmstrip_margin+(opts.show_captions?frame_caption_size:0));
} else {
if(slide_method == 'pointer') {strip_height = (f_frame_height*item_count+opts.frame_gap*(item_count));}
else {strip_height = (f_frame_height*item_count*3)+(opts.frame_gap*(item_count*3));}
}
wrapper_width = ((strip_size*f_frame_width)+((strip_size-1)*opts.frame_gap));
wrapper_height = ((strip_size*f_frame_height)+((strip_size-1)*opts.frame_gap));
gallery_padding = getInt(j_gallery.css('paddingTop'));
j_gallery.css('padding','0px');
galleryPos = getPos(j_gallery[0]);
$('<div>').addClass('loader').css({
'position':'absolute',
'zIndex':'32666',
'opacity':1,
'top':'0px',
'left':'0px',
'width':gallery_width+(filmstrip_orientation=='horizontal'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin))+'px',
'height':gallery_height+(filmstrip_orientation=='vertical'?(gallery_padding*2):gallery_padding+Math.max(gallery_padding,filmstrip_margin))+'px'
}).appendTo(j_gallery);
if(!window_loaded) {
$(window).load(function(){
window_loaded = true;
buildGallery();
});
} else {
buildGallery();
}
});
};
$.fn.galleryView.defaults = {
show_panels: true,					//BOOLEAN - flag to show or hide panel portion of gallery
show_filmstrip: true,				//BOOLEAN - flag to show or hide filmstrip portion of gallery
show_nav: true,				//BOOLEAN - flag to show or hide filmstrip navigation (prev.gif and next.gif)
panel_width: 600,					//INT - width of gallery panel (in pixels)
panel_height: 400,					//INT - height of gallery panel (in pixels)
frame_width: 60,					//INT - width of filmstrip frames (in pixels)
frame_height: 80,					//INT - width of filmstrip frames (in pixels)
start_frame: 1,						//INT - index of panel/frame to show first when gallery loads
filmstrip_size: 3,
transition_speed: 800,				//INT - duration of panel/frame transition (in milliseconds)
transition_interval: 4000,			//INT - delay between panel/frame transitions (in milliseconds)
overlay_opacity: 0.7,				//FLOAT - transparency for panel overlay (1.0 = opaque, 0.0 = transparent)
frame_opacity: 0.3,					//FLOAT - transparency of non-active frames (1.0 = opaque, 0.0 = transparent)
pointer_size: 8,					//INT - Height of frame pointer (in pixels)
nav_theme: 'dark',					//STRING - name of navigation theme to use (folder must exist within 'themes' directory)
easing: 'swing',					//STRING - easing method to use for animations (jQuery provides 'swing' or 'linear', more available with jQuery UI or Easing plugin)
filmstrip_position: 'bottom',		//STRING - position of filmstrip within gallery (bottom, top, left, right)
overlay_position: 'bottom',			//STRING - position of panel overlay (bottom, top, left, right)
panel_scale: 'nocrop',				//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)
frame_scale: 'crop',				//STRING - cropping option for filmstrip images (same as above)
frame_gap: 5,						//INT - spacing between frames within filmstrip (in pixels)
show_captions: false,				//BOOLEAN - flag to show or hide frame captions
fade_panels: true,					//BOOLEAN - flag to fade panels during transitions or swap instantly
pause_on_hover: false				//BOOLEAN - flag to pause slideshow when user hovers over the gallery
};
})(jQuery);

