var QueryLoader={overlay:"",loadBar:"",preloader:"",items:new Array(),doneStatus:0,doneNow:0,selectorPreload:"body",ieLoadFixTime:2000,ieTimeout:"",init:function(){if(navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/)=="MSIE 6.0,6.0"){return false;}
if(QueryLoader.selectorPreload=="body"){QueryLoader.spawnLoader();QueryLoader.getImages(QueryLoader.selectorPreload);QueryLoader.createPreloading();}else{$(document).ready(function(){QueryLoader.spawnLoader();QueryLoader.getImages(QueryLoader.selectorPreload);QueryLoader.createPreloading();});}
QueryLoader.ieTimeout=setTimeout("QueryLoader.ieLoadFix()",QueryLoader.ieLoadFixTime);},ieLoadFix:function(){if($.browser.msie){while((100/QueryLoader.doneStatus)*QueryLoader.doneNow<100){QueryLoader.imgCallback();}}},imgCallback:function(){QueryLoader.doneNow++;QueryLoader.animateLoader();},getImages:function(selector){var everything=$(selector).find("*:not(script)").each(function(){var url="";if($(this).css("background-image")!="none"){var url=$(this).css("background-image");}else if(typeof($(this).attr("src"))!="undefined"&&$(this).attr("tagName").toLowerCase()=="img"){var url=$(this).attr("src");}
url=url.replace("url(\"","");url=url.replace("url(","");url=url.replace("\")","");url=url.replace(")","");if(url.length>0){QueryLoader.items.push(url);}});},createPreloading:function(){QueryLoader.preloader=$("<div></div>").appendTo(QueryLoader.selectorPreload);$(QueryLoader.preloader).css({height:"0px",width:"0px",overflow:"hidden"});var length=QueryLoader.items.length;QueryLoader.doneStatus=length;for(var i=0;i<length;i++){var imgLoad=$("<img></img>");$(imgLoad).attr("src",QueryLoader.items[i]);$(imgLoad).unbind("load");$(imgLoad).bind("load",function(){QueryLoader.imgCallback();});$(imgLoad).appendTo($(QueryLoader.preloader));}},spawnLoader:function(){if(QueryLoader.selectorPreload=="body"){var height=$(window).height();var width=$(window).width();var position="fixed";}else{var height=$(QueryLoader.selectorPreload).outerHeight();var width=$(QueryLoader.selectorPreload).outerWidth();var position="absolute";}
var top,left=0;QueryLoader.overlay=$("<div></div>").appendTo($(QueryLoader.selectorPreload));$(QueryLoader.overlay).addClass("QOverlay");$(QueryLoader.overlay).css({position:position,top:top,left:left,width:width+"px",height:height+"px"});QueryLoader.loadBar=$("<div></div>").appendTo($(QueryLoader.overlay));$(QueryLoader.loadBar).addClass("QLoader");$(QueryLoader.loadBar).css({position:"relative",top:"50%",width:"0%"});QueryLoader.loadAmt=$("<div>0%</div>").appendTo($(QueryLoader.overlay));$(QueryLoader.loadAmt).addClass("QAmt");$(QueryLoader.loadAmt).css({position:"relative",top:"50%",left:"50%",width:"100px"});},animateLoader:function(){$(QueryLoader.selectorPreload).css({visibility:"visible"});var perc=(100/QueryLoader.doneStatus)*QueryLoader.doneNow;if(perc>99){$(QueryLoader.loadAmt).html("100%");$(QueryLoader.loadBar).stop().animate({width:perc+"%"},500,"linear",function(){QueryLoader.doneLoad();});}else{$(QueryLoader.loadBar).stop().animate({width:perc+"%"},500,"linear",function(){});$(QueryLoader.loadAmt).html(Math.floor(perc)+"%");}},doneLoad:function(){clearTimeout(QueryLoader.ieTimeout);if(QueryLoader.selectorPreload=="body"){var height=$(window).height();}else{var height=$(QueryLoader.selectorPreload).outerHeight();}
$(QueryLoader.loadAmt).hide();$(QueryLoader.loadBar).animate({height:height+"px",top:"0%"},500,"linear",function(){$(QueryLoader.overlay).fadeOut(800);$(QueryLoader.preloader).remove();});}};$(document).ready(function(){QueryLoader.selectorPreload="#gallery";QueryLoader.init();slideShow();});function slideShow(){$('#gallery a').css({opacity:0.0});$('#gallery a:first').css({opacity:1.0});$('#gallery .caption').css({opacity:0.7});$('#gallery .caption').css({width:$('#gallery a').find('caption').css('width')});$('#gallery .content').html($('#gallery a:first').attr('rel')).animate({opacity:1.0},400);setInterval('gallery()',6000);}
function gallery(){var current=($('#gallery a.show')?$('#gallery a.show'):$('#gallery a:first'));var next=((current.next().length)?((current.next().hasClass('caption'))?$('#gallery a:first'):current.next()):$('#gallery a:first'));var caption=next.attr('rel');next.css({opacity:0.0}).addClass('show').animate({opacity:1.0},1000);current.animate({opacity:0.0},1000).removeClass('show');$('#gallery .caption').animate({opacity:0.0},{queue:false,duration:0}).animate({height:'30px'},{queue:true,duration:300});$('#gallery .caption').animate({opacity:0.7},1500).animate({height:'30px'},500);$('#gallery .content').html(caption);}
