/* DON'T STEAL!!! */ var slideshowSettings={slideshowID:'slideshow',timeout:5000,transition:'fade',transitionSpeed:1200,showTitle:true,showDescription:true},gallerySettings={thumbImageHeight:100,thumbBGColor:'#333',inactiveThumbStyles:{opacity:0.6},activeThumbStyles:{opacity:1},showTitle:true,showDescription:true};var pixelle={init:function(){this.attachStylesheet('style/main.js.css');this.slideshow.init();this.gallery.init()},slideshow:{settings:this.settings,init:function(){this.attachSlideshowControls();this.prepareSlideshow()},attachSlideshowControls:function(){$('#'+slideshowSettings.slideshowID).append('<div style="height:350px;" />').find('> li').hide().find('img').each(function(){var a=$(this).parent().get(0).nodeName.toLowerCase()==='a'?$(this).parent():this;$(a).appendTo('#'+slideshowSettings.slideshowID+' > div')});$('#'+slideshowSettings.slideshowID).append('<a href="#" id="'+slideshowSettings.slideshowID+'-next">NEXT</a><a href="#" id="'+slideshowSettings.slideshowID+'-last">LAST</a>'+(slideshowSettings.showTitle||slideshowSettings.showDescription?('<div id="'+slideshowSettings.slideshowID+'-description"><div>'+(slideshowSettings.showTitle?'<h3/>':'')+(slideshowSettings.showDescription?'<p/>':'')+'</div></div>'):'')).find('> li').hide()},prepareSlideshow:function(){function onAfter(a,b,c){var d=$(b).attr('alt')?$(b).attr('alt'):$('img:eq(0)',b).attr('alt'),description=$('#'+slideshowSettings.slideshowID+' li:eq('+c.currSlide+') p:eq(0)').text();if(d&&d!==''){$('#'+slideshowSettings.slideshowID+'-description h3').html(d)}if(description&&description!==''){$('#'+slideshowSettings.slideshowID+'-description p').html(description)}$('#'+slideshowSettings.slideshowID+'-description').slideDown()}function onBefore(a,b,c){$('#'+slideshowSettings.slideshowID+'-description').slideUp()}$('#'+slideshowSettings.slideshowID+' > div:eq(0)').cycle({fx:slideshowSettings.transition||'fade',timeout:slideshowSettings.timeout||4000,prev:'#'+slideshowSettings.slideshowID+'-last',next:'#'+slideshowSettings.slideshowID+'-next',after:onAfter,before:onBefore,speed:slideshowSettings.transitionSpeed||1000})}},gallery:{init:function(){var a=this;$(window).load(function(){a.prepareGallery()})},prepareGallery:function(){var f=$('#gallery'),contentWidth=$('#content').width(),widerThanContent=true,clickCount=0;if(!f.get(0)){return}if(!$('#'+slideshowSettings.slideshowID).get(0)){$('<div/>').attr({id:slideshowSettings.slideshowID}).append('<a href="#" id="'+slideshowSettings.slideshowID+'-next">NEXT</a><a href="#" id="'+slideshowSettings.slideshowID+'-last">LAST</a>'+(gallerySettings.showTitle||gallerySettings.showDescription?('<div id="'+slideshowSettings.slideshowID+'-description"><div>'+(gallerySettings.showTitle?'<h3/>':'')+(gallerySettings.showDescription?'<p/>':'')+'</div></div>'):'')).insertBefore('#content-wrapper')}var g=$('#'+slideshowSettings.slideshowID);f.css({height:'110px',overflow:'hidden',width:(function(){var a=0;$('li',f).each(function(){$(this).css({width:'auto',backgroundColor:gallerySettings.thumbBGColor,height:gallerySettings.thumbImageHeight||100});$('p',this).hide();a+=($(this).width()+parseInt($(this).css('borderLeftWidth').replace('px',''),10)+parseInt($(this).css('borderRightWidth').replace('px',''),10)+parseInt($(this).css('marginLeft').replace('px',''),10)+parseInt($(this).css('marginLeft').replace('px',''),10))});if(a<contentWidth){widerThanContent=false}return a})()+'px'}).wrap('<div id="gallery-wrap"/>');if(widerThanContent){$('<a href="#" id="carousel-back">BACK</a>').click(function(){$('#gallery-wrap').stop().animate({scrollLeft:'-=400px'},900);return false}).prependTo('#content');$('<a href="#" id="carousel-forward">FORWARD</a>').click(function(){$('#gallery-wrap').stop().animate({scrollLeft:'+=400px'},900);return false}).appendTo('#content');$('#gallery-wrap').css({width:contentWidth-90+'px'})}$('li > a',f).each(function(i){$('<img src="'+$(this).attr('href')+'" />').load(function(){$(this).data('loaded',true)}).appendTo(g);$(this).click((function(i){return function(){$(g).cycle(i);return false}})(i)).find('img').css(gallerySettings.inactiveThumbStyles)});function applyThumbStyle(i){$('li > a img',f).css(gallerySettings.inactiveThumbStyles);$('li > a:eq('+i+') img',f).css(gallerySettings.activeThumbStyles)}function onBefore(a,b,c){var d=$(b).height();$(b).css({width:$(b).width(),left:'50%',marginLeft:'-'+($(b).width()/2)+'px',height:d}).animate({top:'30px'});$(g).animate({height:(d+60)+'px'});applyThumbStyle(clickCount===0?0:c.nextSlide);if(c.currSlide!==c.nextSlide){$('#'+slideshowSettings.slideshowID+'-description').slideUp()}var e=$('li:eq('+(clickCount===0?0:c.nextSlide)+')',f),offsetLeft=$('li:eq(0)',f).offset().left-e.offset().left;offsetLeft=parseInt((offsetLeft).toString().replace('-',''),10)-(422-(e.width()/2));$('#gallery-wrap').stop().animate({scrollLeft:offsetLeft+'px'},900);clickCount++}function onAfter(a,b,c){var d=$('li:eq('+c.currSlide+') img:eq(0)',f).attr('alt'),description=$('li:eq('+c.currSlide+') p:eq(0)',f).html();if(d&&d!==''){$('#'+slideshowSettings.slideshowID+'-description').find('h3').html(d)}if(description&&description!==''){$('#'+slideshowSettings.slideshowID+'-description').find('p').html(description)}$('#'+slideshowSettings.slideshowID+'-description').slideDown()}function showLoader(){$('<div id="gallery-loader"><div><strong>PLEASE WAIT, IMAGES ARE LOADING. (<span>0 of _</span> so far)</strong></div></div>').appendTo(g)}function updateLoader(a,b){$('#gallery-loader span').html(a+' of '+b)}function hideLoader(){$('#gallery-loader').fadeOut(function(){$(this).remove()})}function checkIfImagesAreLoaded(){var a=$('img',g),loadedImages=0;showLoader();function check(){$(a).each(function(i){if($(this).data('loaded')===true){loadedImages++}});if(loadedImages===a.length){hideLoader();beginSlideshow()}else{updateLoader(loadedImages,a.length);loadedImages=0;setTimeout(function(){check()},400)}}check()}function beginSlideshow(){$(g).cycle({slideExpr:'img',fx:'fade',timeout:0,prev:'#'+slideshowSettings.slideshowID+'-last',next:'#'+slideshowSettings.slideshowID+'-next',after:onAfter,before:onBefore,speed:gallerySettings.transitionSpeed})}checkIfImagesAreLoaded()}},attachStylesheet:function(a){return $('<link href="'+a+'" rel="stylesheet" type="text/css" />').insertAfter('title')}};$(function(){pixelle.init()});


