function playFromSlide(slideNumber) {
theIndex = slideNumber -1;
player.sendEvent('ITEM', theIndex);
}
var blipurl = 'http://blip.tv/?1=1&s=posts&skin=rss';
var currentPlaylist = null;
var currentLength = 0;
var currentItem = -1;
var previousItem = -1;
var currentMute = false;
var currentVolume = 80;
var currentPosition = 0;
var currentState = 'NONE';
var currentLoaded = 0;
var currentRemain = 0;
var audioToggle = new Array();
var numSlides = 0;
var player = null;
function playerReady(thePlayer) {
player = window.document[thePlayer.id];
addListeners();
}
function preloadPlayList() {
if(audioToggle.length == 0) {
getPlaylistData();
}
}
function addListeners() {
if (player) {
player.addControllerListener("ITEM", "itemListener");
player.addControllerListener("MUTE", "muteListener");
player.addModelListener("LOADED", "loadedListener");
player.addModelListener("STATE", "stateListener");
player.addModelListener("TIME", "positionListener");
player.addViewListener("VOLUME", "volumeListener");
} else {
setTimeout("addListeners()",100);
}
}
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
currentState = obj.newstate;
previousState = obj.oldstate;
var tmp = document.getElementById("stat");
if (tmp) {
tmp.innerHTML = "current state: " + currentState +
"
previous state: " + previousState;
}
}
function positionListener(obj) {
currentPosition = obj.position;
var tmp = document.getElementById("tim");
if (tmp) { tmp.innerHTML = "position: " + currentPosition; }
}
function loadedListener(obj) {
currentLoaded = obj.loaded;
currentRemain = obj.total - currentLoaded;
var tmp = document.getElementById("ldd");
if (tmp) {
tmp.innerHTML = "bytes loaded: " + currentLoaded +
"
bytes remaining: " + currentRemain;
}
}
function volumeListener(obj) {
currentVolume = obj.percentage;
var tmp = document.getElementById("vol");
if (tmp) { tmp.innerHTML = "volume: " + currentVolume; }
}
function muteListener(obj) {
currentMute = obj.state;
var tmp = document.getElementById("mut");
if (tmp) { tmp.innerHTML = "mute: " + currentMute; }
}
function itemListener(obj) {
if (obj.index != currentItem) {
previousItem = currentItem;
currentItem = obj.index;
if (previousItem == -1) { getPlaylistData(); }
var tmp = document.getElementById("itm");
if (tmp) {
tmp.innerHTML = "current item: " + currentItem +
"
previous item: " + previousItem;
}
var tmp = document.getElementById("item");
if (tmp) { tmp.innerHTML = "item: " + currentItem; }
var tmp = document.getElementById("pid");
if (tmp) {
tmp.innerHTML = "(received from the player with the id: " + obj.id + ")";
}
printItemData(currentItem);
}
}
function printItemData(theIndex) {
var plst = null;
plst = player.getPlaylist();
if (plst) {
var txt = '';
txt += '
item number: ' + theIndex + ':';
txt += 'title: ' + plst[theIndex].title + '';
txt += 'author: ' + plst[theIndex].author + '';
txt += 'file: ' + plst[theIndex].file + '';
txt += 'image: ' + plst[theIndex].image + '';
txt += 'link: ' + plst[theIndex].link + '';
//txt += 'description: ' + plst[theIndex].description + '';
var tmp = document.getElementById("itmsDat");
if (tmp) { tmp.innerHTML = txt; }
}
}
function getPlaylistData() {
var plst = null;
if (player) {
plst = player.getPlaylist();
if (plst) {
currentPlaylist = plst;
//alert(" I just loaded the player list now --- currentPlaylist.length is " + currentPlaylist.length);
var txt = '';
for(var i in currentPlaylist) {
txt += ' ';
txt += currentPlaylist[i].title;
audioToggle[i] = currentPlaylist[i].title;
//alert(i + " " + audioToggle[i]);
txt += '
';
}
var tmp = document.getElementById("plstDat");
if (tmp) { tmp.innerHTML = txt; }
}
}
else {
setTimeout("getPlaylistData()",500);
}
}
function loadCheckedPlaylistData() {
if (currentPlaylist) {
var j = 0;
var lst = new Array();
for(var i in currentPlaylist) {
if(document.getElementById('cb' + i).checked) {
lst[j] = {
author:currentPlaylist[i].author,
description:currentPlaylist[i].description,
duration:currentPlaylist[i].duration,
file:currentPlaylist[i].file,
link:currentPlaylist[i].link,
image:currentPlaylist[i].image,
start:currentPlaylist[i].start,
title:currentPlaylist[i].title,
type:currentPlaylist[i].type
}
j++;
}
}
if(lst.length > 0) { player.sendEvent('LOAD', lst); }
}
}
function getLength() { currentLength = player.getPlaylist().length; return(currentLength); };
function loadFile(theFile) { currentItem = -1; previousItem = -1; player.sendEvent('LOAD', theFile); };
function createPlayer(theFile) {
var flashvars = {
file:theFile,
// SET THIS WITH COLD FUSION TO AUTO PLAY IF
autostart:"false",
shuffle:"false",
playlistsize:"0",
playlist:"bottom"
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always",
wmode:"transparent"
}
var attributes = {
id:"player1",
name:"player1"
}
swfobject.embedSWF("/slmp/v01/player.swf", "audioplayer", "320", "12", "9.0.115", false, flashvars, params, attributes);
};
//function showValAt(i) { theVal = audioToggle[i]; alert(theVal); }
//
// END AUDIO PLAYER SCRIPT
//
//
// MEDIA PLAYER SCRIPT
//
(function($){
$.fn.slideShow = function(options) {
// multiple elements
if (this.length > 1) {
this.each(function() { $(this).slideShow(options)});
return this;
}
// private vars
this.defaults = {
start: 0, // start index, set to 'random' or 'rnd' to random start
interval: 3, // interval, autoplay, set to false for no auto-play, in seconds
repeat: true, // repeat at the end
transition: {
mode: 'fade',
speed: 1
},
slideSize: 'auto', // size for slides (used for mouseover and stuff)
hoverNavigation:false, // enable mouse to change images
slideClick: false, // insert callback method for slide clicks
gotoSlide: false // slide change callback
};
this.options = $.extend({}, this.defaults, options);
// internal vars
this.numSlides = this.find('.slide').length;
if (this.options.start == 'random' || this.options.start == 'rnd') {
this.current = Math.floor(Math.random() * this.numSlides) + 1;
} else {
this.current = this.options.start;
}
if (this.current >= this.numSlides) {
this.current = this.numSlides - 1;
}
this.last = false;
this.elm = $(this);
this.interval = false;
this.mouse = {
x: 0, // store mouse x relative position on element
y: 0, // store mouse y relative position on element
over: false // store mouse over boolena value
};
// init slideshow
this.init = function() {
// set slide container to correct width and height
if (this.find('.slides').length) {
// auto-detect slide size
if (this.options.slideSize == 'auto') {
this.options.slideSize = {
height: '550px',
width: '990px'
};
}
// don't set size of slides and slide container if not needed
if (this.options.slideSize != 'none' && this.options.slideSize != false) {
this.find('.slides, .slide').css({
height: '550px',
width: '990px',
//For some reason IE7 only needs this. Whoever built IE should die.
overflow: 'hidden'
});
}
}
// set slides to be positioned absolute
this.find('.slide').css('position','absolute');
// hide slides if not hidden allready
this.find('.slide:not(:eq(' + this.current + '))').hide();
// navigation shortcuts
this.find('.first, .next, .jump, .prev, .last, .navigation, .slide, .page, .slides, .controls,.jump1,.jump2,.jump3,.jump4,.jump5,.jump6,.jump7,.jump8,.jump9,.jump10,.jump11,.jump12,.jump13,.jump14,.jump15,.jump16,.jump17,.jump18,.jump19,.jump20,.jump21,.jump22,.jump23,.jump24,.jump25,.jump26,.jump27,.jump28,.jump29,.jump30,.jump31,.jump32,.jump33,.jump34,.jump35,.jump36,.jump37,.jump38,.jump39,.jump40,.jump41,.jump42,.jump43,.jump44,.jump45,.jump46,.jump47,.jump48,.jump49,.jump50,.jump51,.jump52,.jump53,.jump54,.jump55').data('slideShow', this);
this.find('.first').click(this.first);
this.find('.next').click(this.next);
this.find('.prev').click(this.previous);
this.find('.last').click(this.last);
this.find('.jump').click(this.jump);
this.find('.jump1').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 0;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump2').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 1;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump3').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 2;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump4').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 3;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump5').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 4;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump6').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 5;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump7').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 6;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump8').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 7;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump9').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 8;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump10').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 9;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump11').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 10;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump12').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 11;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump13').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 12;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump14').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 13;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump15').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 14;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump16').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 15;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump17').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 16;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump18').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 17;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump19').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 18;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump20').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 19;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump21').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 20;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump22').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 21;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump23').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 22;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump24').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 23;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump25').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 24;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump26').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 25;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump27').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 26;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump28').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 27;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump29').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 28;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump30').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 29;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump31').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 30;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump32').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 31;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump33').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 32;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump34').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 33;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump35').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 34;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump36').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 35;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump37').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 36;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump38').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 37;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump39').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 38;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump40').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 39;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump41').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 40;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump42').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 41;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump43').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 42;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump44').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 43;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump45').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 44;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump46').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 45;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump47').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 46;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump48').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 47;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump49').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 48;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump50').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 49;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump51').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 50;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump52').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 51;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump53').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 52;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump54').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 53;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
this.find('.jump55').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
indexNum = 54;
// alert(indexNum);
handleAudio(indexNum);
handleVideo(indexNum,slideShow.numSlides);
slideShow.gotoSlide(indexNum);
});
// init pag��nation buttons if available
this.find('.navigation .page:eq(' + this.current + ')').addClass('selected');
//this.find('.controls').focus(preloadPlayList);
this.find('.page').click(function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
// determine position in navigation
var index = $(this).html();
if (!(index = parseInt($(this).html()-1))) {
var index = $(this).parents('.navigation').find('.page').index($(this));
// need to know where the user jumps so the audio for the bamp can load correctly
//var newNum = index + 1;
//alert('Jumpin to Slide: ' + newNum);
handleAudio(index);
handleVideo(index,slideShow.numSlides);
}
slideShow.gotoSlide(index);
});
// init mouse move handler
this.find('.slide').mousemove(function(event) {
var slideShow = $(this).data('slideShow');
// calculate mouse relative position and store it
slideShow.mouse.x = Math.abs(event.clientX - $(this).position().left);
slideShow.mouse.y = Math.abs(event.clientY - $(this).position().top);
if (slideShow.mouse.x > slideShow.options.slideSize.width) slideShow.mouse.x = slideShow.options.slideSize.width;
if (slideShow.mouse.y > slideShow.options.slideSize.height) slideShow.mouse.y = slideShow.options.slideSize.height;
// use mouse vor navigation, calculate new page from mouse position
if (slideShow.options.hoverNavigation) {
var index = Math.round((slideShow.numSlides - 1) * slideShow.mouse.x / slideShow.options.slideSize.width);
slideShow.gotoSlide(index, true);
}
});
// mouse enter handler
this.find('.slide').mouseenter(function() {
var slideShow = $(this).data('slideShow');
slideShow.mouse.over = true;
slideShow.stopAuto();
});
// mouse leave handler
this.find('.slide').mouseleave(function() {
var slideShow = $(this).data('slideShow');
slideShow.mouse.over = false;
slideShow.auto();
});
// on click handler
if (typeof(this.options.slideClick) == 'function') {
this.find('.slide').click(function() {
var slideShow = $(this).data('slideShow');
slideShow.options.slideClick(slideShow);
});
}
g = this.current;
this.current = -1;
this.gotoSlide(g);
// start interval for auto animation
if (this.options.interval > 0) {
this.auto();
}
return this;
};
// public methods
this.auto = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
if (!slideShow.interval && slideShow.options.interval > 0.001) {
slideShow.interval = window.setInterval(function() {
slideShow.next();
}, slideShow.options.interval * 1000);
}
return this;
}
// check if slideshow is running
this.isPlaying = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
return slideShow.interval;
}
// stop/play slideshow automatic
this.togglePlayback = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
if (slideShow.isPlaying()) {
slideShow.stopAuto();
} else {
slideShow.auto();
}
},
// stop automatic slideshow
this.stopAuto = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
if (slideShow.interval) {
window.clearInterval(slideShow.interval);
slideShow.interval = false;
}
return this;
}
// goto first slide
this.first = function(elm) {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
return slideShow.gotoSlide(0);
};
// goto last slide????
this.next = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
nextSlide = slideShow.current + 1;
if(nextSlide > (slideShow.numSlides-1)) {
nextSlide = 0;
}
handleAudio(nextSlide);
handleVideo(nextSlide,slideShow.numSlides);
return slideShow.gotoSlide(nextSlide);
};
// jump to what slide
this.jump = function() {
// grab the id of the element in which is calling for the jump. the id should be a number of the slide inwhich you want to jump to.
//this might be confusing but is neccesary for multiple applications of this function
var jumpNum =$(".jump").attr('id')
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
slideIndex = jumpNum -1;
handleAudio(slideIndex);
handleVideo(slideIndex,slideShow.numSlides);
return slideShow.gotoSlide(slideIndex)
};
this.previous = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
prevSlide = slideShow.current - 1;
if(prevSlide < 0) {
prevSlide = slideShow.numSlides - 1;
}
handleAudio(prevSlide);
handleVideo(prevSlide,slideShow.numSlides);
return slideShow.gotoSlide(prevSlide);
};
function handleAudio(index){
if(audioToggle.length > 0) {
if(index > (audioToggle.length-1)){
index = 0;
}else if(index < 0){
index = audioToggle.length -1;
}
}
// talk to audio player
if(audioToggle[index] == "noaudio") {
//alert('NO AUDIO');
player.sendEvent('STOP');
$("#audioplayerCover").fadeTo("fast",0.99);
$('#audioplayerCover').animate({width: '500' }, 10, function() { });
} else{
//alert("play Audio Track: " + goingToAndPlaySlide);
$("#audioplayerCover").fadeTo("fast",0.01);
$('#audioplayerCover').animate({width: '1' }, 10, function() { });
var goingToAndPlaySlide = index;
player.sendEvent('ITEM', goingToAndPlaySlide);
player.sendEvent('STOP');
}
}
function handleVideo(indexNum,numSlides){
// this closes the slideout story left if it is open and when someone wants to go to the next slide
if(slideOut == false) {
//alert("NOT OPEN")
} else{
slideoutStoryLeft();
}
// figure out what kind of slide we are on
var adjustedIndex = indexNum+1
var CurrentDivID = $('#slide' + adjustedIndex);
var idFind =$("#slide" + adjustedIndex + "> div").attr('id')
// alert(idFind);
var isVideo = false;
var isHDVideo = false;
var isGoogle = false;
var isYouTube = false;
var isSequence = false;
var isMap = false;
var isSlideOut = false;
if(idFind == "video") {
//alert("#video" + adjustedIndex);
var isVideo = true;
} else if(idFind == "google") {
var isGoogle = true;
//alert("#google" + adjustedIndex);
} else if(idFind == "hdvideo") {
var isHDVideo = true;
} else if(idFind == "youtube") {
//alert("#youtube" + adjustedIndex);
var isYouTube = true;
} else if(idFind == "sequence") {
var isSequence = true;
} else if(idFind == "GoogleMap") {
//alert("#youtube" + adjustedIndex);
var isMap = true;
} else if(idFind == "story") {
//alert("#youtube" + adjustedIndex);
var isSlideOut = true;
}
if(isSlideOut == false) {
if(hasIntroSlide == true) {
closeSlideOut();
}
}
// if a user clicks on any navigation buttons pause the current video through the iframe window to the JW API Player for VIDEO
// this is needed for IE and safari so the video doesnt keep playing in the background
//handle videos - unload all if we are not on video slide
if(isVideo == false){
for(i=1;i div").attr('id');
if(thisID == "video") {
//$("#slide" + i + "> div").html('');
window["clearVideo" + i]();
}
}
} else{
window["loadVideo" + adjustedIndex]();
//clear any others
for(i=1;i div").attr('id');
if(thisID == "video" && i != adjustedIndex) {
window["clearVideo" + i]();
}
}
}
//handle HD videos - unload all if we are not on video slide
if(isHDVideo == false){
for(i=1;i div").attr('id');
if(thisID == "hdvideo") {
//$("#slide" + i + "> div").html('');
window["clearHDVideo" + i]();
}
}
} else{
window["loadHDVideo" + adjustedIndex]();
//clear any others
for(i=1;i div").attr('id');
if(thisID == "hdvideo" && i != adjustedIndex) {
window["clearHDVideo" + i]();
}
}
}
//handle maps - unload all if we are not on video slide
if(isGoogle == false){
for(i=1;i div").attr('id');
if(thisID == "google") {
//$("#slide" + i + "> div").html('');
window["clearGoogle" + i]();
}
}
} else{
window["loadGoogle" + adjustedIndex]();
//clear any others
for(i=1;i div").attr('id');
if(thisID == "google" && i != adjustedIndex) {
window["clearGoogle" + i]();
}
}
}
//handle sequences - unload all if we are not on video slide
if(isSequence == false){
for(i=1;i div").attr('id');
if(thisID == "sequence") {
window["clearSequence" + i]();
}
}
} else{
window["loadSequence" + adjustedIndex]();
//clear any others
for(i=1;i div").attr('id');
if(thisID == "sequence" && i != adjustedIndex) {
window["clearSequence" + i]();
}
}
}
//handle youTube videos - unload all if we are not on YouTube slide
if(isYouTube == false){
for(i=1;i div").attr('id');
if(thisID == "youtube") {
$("#slide" + i + "> div").html('');
}
}
} else{
var theFuncStr = "loadYouTube" + adjustedIndex;
var theIFrame = eval(theFuncStr);
$("#slide" + adjustedIndex + "> div").html(theIFrame);
for(i=1;i div").attr('id');
if(thisID == "youtube" && i != adjustedIndex) {
$("#slide" + i + "> div").html('');
}
}
}
//handle maps - unload all if we are not on map slide
if(isMap == false){
for(i=1;i div").attr('id');
if(thisID == "GoogleMap") {
window["clearMap" + i]();
}
}
} else{
window["loadMap" + adjustedIndex]();
//clear any others
for(i=1;i div").attr('id');
if(thisID == "GoogleMap" && i != adjustedIndex) {
window["clearMap" + i]();
}
}
}
}
this.last = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
return slideShow.gotoSlide(slideShow.numSlides);
};
this.gotoSlide = function(index, noanimation) {
if (index < 0) {
index = this.numSlides - 1;
}
if (index >= this.numSlides) {
index = 0;
}
if (index === this.current) return this;
// get slide elements
var oldSlide = this.find('.slide:eq(' + this.current +')');
var newSlide = this.find('.slide:eq(' + index +')');
// callbacks for animation finished
oldFinished = function () {
$(this).removeClass('selected');
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
slideShow.elm.find('.navigation .page:eq(' + slideShow.current + ')').addClass('selected');
if (!slideShow.mouse.over) {
slideShow.auto();
}
}
newFinished = function() {
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
slideShow.elm.find('.navigation .page:not(:eq(' + slideShow.current + '))').removeClass('selected');
$(this).addClass('selected');
}
// get slideshow
if (!(slideShow = $(this).data('slideShow'))) {
var slideShow = this;
}
slideShow.stopAuto();
// call callback
if (typeof(this.options.gotoSlide) == 'function') {
this.options.gotoSlide(slideShow, index);
}
// start transition
if (noanimation) {
oldSlide.hide(1, oldFinished);
newSlide.show(1, newFinished);
} else {
if (typeof(this.options.transition.mode) == 'function') {
this.call(this.options.transition.mode, newSlide, oldSlide);
} else {
switch(this.options.transition.mode) {
default:
case 'fade':
oldSlide.fadeOut(this.options.transition.speed, oldFinished);
newSlide.fadeIn(this.options.transition.speed, newFinished);
break;
}
}
}
this.last = this.current;
this.current = index;
return this;
};
return this.init();
}
})(jQuery);
jQuery.fn.highlight = function(selector, className, eventStart, eventEnd){
// variables
var className = className || 'highlight';
if(eventStart == undefined && eventEnd == undefined){
var eventStart = 'mouseover';
var eventEnd = 'mouseout';
}
else if(eventStart == eventEnd || eventStart != undefined && eventEnd == undefined){
var toggle = true;
}
// code
this.each
(
function(){
var tagName = this.tagName.toLowerCase();
if(tagName == 'form'){
selector = selector || 'li';
var elements = jQuery("textarea, select, multi-select, :text, :image, :password, :radio, :checkbox, :file", this);
elements.bind
(
'focus',
function(){
var parents = jQuery(this).parents(selector)
var parent = jQuery(parents.get(0))
parent.addClass(className);
}
);
elements.bind
(
'blur',
function(){
var parents = jQuery(this).parents(selector)
var parent = jQuery(parents.get(0))
parent.removeClass(className);
}
);
}
else{
if(tagName.match(/^(table|tbody)$/) != null){
selector = selector || 'tr';
}
else if(tagName.match(/^(ul|ol)$/) != null){
selector = selector || 'li';
}
else{
selector = '*';
}
var elements = jQuery(selector, this);
if(toggle){
elements.bind
(
eventStart,
function(){
if($(this).hasClass(className)){
$(this).removeClass(className);
}
else{
$(this).addClass(className);
}
}
);
}
else{
elements.bind
(
eventStart,
function(){
$(this).addClass(className);
}
);
elements.bind
(
eventEnd,
function(){
$(this).removeClass(className);
}
);
}
}
}
);
}