/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);


/**
 * jQuery[a] - Animated scrolling of series
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/20/2008
 * @author Ariel Flesler
 * @version 1.2.1
 *
 * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
 */
;(function($){var a='serialScroll',b='.'+a,c='bind',C=$[a]=function(b){$.scrollTo.window()[a](b)};C.defaults={duration:1e3,axis:'x',event:'click',start:0,step:1,lock:1,cycle:1,constant:1};$.fn[a]=function(y){y=$.extend({},C.defaults,y);var z=y.event,A=y.step,B=y.lazy;return this.each(function(){var j=y.target?this:document,k=$(y.target||this,j),l=k[0],m=y.items,o=y.start,p=y.interval,q=y.navigation,r;if(!B)m=w();if(y.force)t({},o);$(y.prev||[],j)[c](z,-A,s);$(y.next||[],j)[c](z,A,s);if(!l.ssbound)k[c]('prev'+b,-A,s)[c]('next'+b,A,s)[c]('goto'+b,t);if(p)k[c]('start'+b,function(e){if(!p){v();p=1;u()}})[c]('stop'+b,function(){v();p=0});k[c]('notify'+b,function(e,a){var i=x(a);if(i>-1)o=i});l.ssbound=1;if(y.jump)(B?k:w())[c](z,function(e){t(e,x(e.target))});if(q)q=$(q,j)[c](z,function(e){e.data=Math.round(w().length/q.length)*q.index(this);t(e,this)});function s(e){e.data+=o;t(e,this)};function t(e,a){if(!isNaN(a)){e.data=a;a=l}var c=e.data,n,d=e.type,f=y.exclude?w().slice(0,-y.exclude):w(),g=f.length,h=f[c],i=y.duration;if(d)e.preventDefault();if(p){v();r=setTimeout(u,y.interval)}if(!h){n=c<0?0:n=g-1;if(o!=n)c=n;else if(!y.cycle)return;else c=g-n-1;h=f[c]}if(!h||d&&o==c||y.lock&&k.is(':animated')||d&&y.onBefore&&y.onBefore.call(a,e,h,k,w(),c)===!1)return;if(y.stop)k.queue('fx',[]).stop();if(y.constant)i=Math.abs(i/A*(o-c));k.scrollTo(h,i,y).trigger('notify'+b,[c])};function u(){k.trigger('next'+b)};function v(){clearTimeout(r)};function w(){return $(m,l)};function x(a){if(!isNaN(a))return a;var b=w(),i;while((i=b.index(a))==-1&&a!=l)a=a.parentNode;return i}})}})(jQuery);


// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){

	

	
	$('#slide_gallery').serialScroll({
		items:'li',
		offset: 150,
		
	duration:11000,
		force:true,
		axis:'x',
		stop:true,
		easing:'linear',
		lazy:false,// NOTE: it's set to true, meaning you can add/remove/reorder items and the changes are taken into account.
		interval:1, // yeah! I now added auto-scrolling
		step:3 // scroll 2 news each time
	});
	
	
	
	
});




function vsrp_scroll() {
	vsrp_obj.scrollTop = vsrp_obj.scrollTop + 1;
	vsrp_scrollPos++;
	if ((vsrp_scrollPos%vsrp_heightOfElm) == 0) {
		vsrp_numScrolls--;
		if (vsrp_numScrolls == 0) {
			vsrp_obj.scrollTop = '0';
			vsrp_content();
		} else {
			if (vsrp_scrollOn == 'true') {
				vsrp_content();
			}
		}
	} else {
		setTimeout("vsrp_scroll();", 10);
	}
}

var vsrp_Num = 0;
/*
Creates amount to show + 1 for the scrolling ability to work
scrollTop is set to top position after each creation
Otherwise the scrolling cannot happen
*/
function vsrp_content() {
	var tmp_vsrp = '';

	w_vsrp = vsrp_Num - parseInt(vsrp_numberOfElm);
	if (w_vsrp < 0) {
		w_vsrp = 0;
	} else {
		w_vsrp = w_vsrp%vsrp_array.length;
	}
	
	// Show amount of vsrru
	var elementsTmp_vsrp = parseInt(vsrp_numberOfElm) + 1;
	for (i_vsrp = 0; i_vsrp < elementsTmp_vsrp; i_vsrp++) {
		
		tmp_vsrp += vsrp_array[w_vsrp%vsrp_array.length];
		w_vsrp++;
	}

	vsrp_obj.innerHTML 	= tmp_vsrp;
	
	vsrp_Num 			= w_vsrp;
	vsrp_numScrolls 	= vsrp_array.length;
	vsrp_obj.scrollTop 	= '0';
	// start scrolling
	setTimeout("vsrp_scroll();", 5000);
}






var shutterLinks={},shutterSets={};function shutterAddLoad(a){if("undefined"!=typeof jQuery){jQuery(document).ready(a())}else{if(typeof window.onload!="function"){window.onload=a}else{oldonld=window.onload;window.onload=function(){if(oldonld){oldonld()}a()}}}}shutterReloaded={I:function(b){return document.getElementById(b)},settings:function(){var a=this,b=shutterSettings;a.L10n=b.L10n||["Previous","Next","Close","Full Size","Fit to Screen","Image","of","Loading..."];a.imageCount=b.imageCount||0;a.textBtns=b.textBtns||0;a.imgDir=b.imgDir||"/wp-content/plugins/shutter-reloaded/menu/";a.FS=b.FS||0;a.oneSet=b.oneSet||0},init:function(o){var p=this,n,e,b,h,f,c,s,r,l,q,d,g;if("object"!=typeof shutterSettings){shutterSettings={}}p.settings();for(h=0,f=document.links.length;h<f;h++){n=document.links[h];b=(n.href.indexOf("?")==-1)?n.href.slice(-4).toLowerCase():n.href.substring(0,n.href.indexOf("?")).slice(-4).toLowerCase();if(b!=".jpg"&&b!=".png"&&b!=".gif"&&b!="jpeg"){continue}if(o=="sh"&&n.className.toLowerCase().indexOf("shutter")==-1){continue}if(o=="lb"&&n.rel.toLowerCase().indexOf("lightbox")==-1){continue}if(n.className&&n.className.toLowerCase().indexOf("shutterset")!=-1){s=n.className.match(/shutterset[^\s]*/g)}else{if(n.rel&&n.rel.toLowerCase().indexOf("lightbox[")!=-1){s=n.rel.replace(/\s/g,"_")}else{if(p.oneSet){s="oneSetForAllLinks"}else{s=0,r=-1}}}if(s){if(!shutterSets[s]){shutterSets[s]=[]}r=shutterSets[s].push(h)}l=n.href.slice(n.href.lastIndexOf("/")+1);e=(n.title&&n.title!=l)?n.title:"";if(!e&&n.firstChild&&n.firstChild.nodeName=="IMG"){e=n.firstChild.title||""}shutterLinks[h]={link:n.href,num:r,set:s,title:e};n.onclick=new Function('shutterReloaded.make("'+h+'");return false;')}if(!p.textBtns){q=["close.gif","prev.gif","prev-d.gif","next.gif","next-d.gif","resize1.gif","resize2.gif","resize-d.gif","loading.gif"];for(d=0,c=q.length;d<c;d++){g=new Image();g.src=p.imgDir+q[d]}}},make:function(j,g){var n=this,q,r,b="",p="",s,c,a,l,o,f,e,h=-1,d,k,i,u,m;if(!n.Top){if(typeof window.pageYOffset!="undefined"){n.Top=window.pageYOffset}else{n.Top=(document.documentElement.scrollTop>0)?document.documentElement.scrollTop:document.body.scrollTop}}if(typeof n.pgHeight=="undefined"){n.pgHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)}if(g){n.FS=(g>0)?1:0}else{n.FS=shutterSettings.FS||0}if(n.resizing){n.resizing=null}window.onresize=new Function('shutterReloaded.resize("'+j+'");');document.documentElement.style.overflowX="hidden";if(!n.VP){n._viewPort();n.VP=true}if(!(f=n.I("shShutter"))){f=document.createElement("div");f.setAttribute("id","shShutter");document.getElementsByTagName("body")[0].appendChild(f);n.hideTags()}if(!(o=n.I("shDisplay"))){o=document.createElement("div");o.setAttribute("id","shDisplay");o.style.top=n.Top+"px";document.getElementsByTagName("body")[0].appendChild(o)}f.style.height=n.pgHeight+"px";m=n.textBtns?" | ":"";if(shutterLinks[j].num>1){q=shutterSets[shutterLinks[j].set][shutterLinks[j].num-2];a=n.textBtns?n.L10n[0]:'<img src="'+n.imgDir+'prev.gif" title="'+n.L10n[0]+'" />';b='<a href="#" onclick="shutterReloaded.make('+q+');return false">'+a+"</a>"+m;s=new Image();s.src=shutterLinks[q].link}else{b=n.textBtns?'<span class="srel-d">'+n.L10n[0]+"</span>"+m:'<img class="srel-d" src="'+n.imgDir+'prev-d.gif" title="'+n.L10n[0]+'" />'}if(shutterLinks[j].num!=-1&&shutterLinks[j].num<(shutterSets[shutterLinks[j].set].length)){r=shutterSets[shutterLinks[j].set][shutterLinks[j].num];l=n.textBtns?n.L10n[1]:'<img src="'+n.imgDir+'next.gif" title="'+n.L10n[1]+'" />';p='<a href="#" onclick="shutterReloaded.make('+r+');return false">'+l+"</a>"+m;c=new Image();c.src=shutterLinks[r].link}else{p=n.textBtns?'<span class="srel-d">'+n.L10n[1]+"</span>"+m:'<img class="srel-d" src="'+n.imgDir+'next-d.gif" title="'+n.L10n[1]+'" />'}k=n.textBtns?n.L10n[2]:'<img src="'+n.imgDir+'close.gif" title="'+n.L10n[2]+'" />';d=((shutterLinks[j].num>0)&&n.imageCount)?" "+n.L10n[5]+"&nbsp;"+shutterLinks[j].num+"&nbsp;"+n.L10n[6]+"&nbsp;"+shutterSets[shutterLinks[j].set].length:"";if(n.FS){i=n.textBtns?n.L10n[4]:'<img src="'+n.imgDir+'resize2.gif" title="'+n.L10n[4]+'"	/>'}else{i=n.textBtns?n.L10n[3]:'<img src="'+n.imgDir+'resize1.gif" title="'+n.L10n[3]+'" />';h=1}fsbtn_d=n.textBtns?'<span class="srel-d">'+n.L10n[3]+"</span>"+m:'<img class="srel-d" src="'+n.imgDir+'resize-d.gif" title="'+n.L10n[3]+'" />';u='<span id="fullSize"><a href="#" onclick="shutterReloaded.make('+j+", "+h+');return false">'+i+"</a>"+m+'</span><span id="fullSize-d">'+fsbtn_d+"</span>";if(!(e=n.I("shNavBar"))){e=document.createElement("div");e.setAttribute("id","shNavBar");document.getElementsByTagName("body")[0].appendChild(e)}e.innerHTML=m+b+'<a href="#" onclick="shutterReloaded.hideShutter();return false">'+k+"</a>"+m+p+u+d;o.innerHTML='<div id="shWrap"><img src="'+shutterLinks[j].link+'" id="shTopImg" onload="shutterReloaded.showImg();" onclick="shutterReloaded.hideShutter();" /><div id="shTitle">'+shutterLinks[j].title+"</div></div>";window.setTimeout(function(){shutterReloaded.loading()},2000)},loading:function(){var c=this,b,d,a;if((a=c.I("shWrap"))&&a.style.visibility=="visible"){return}if(!(b=c.I("shShutter"))){return}if(c.I("shWaitBar")){return}d=document.createElement("div");d.setAttribute("id","shWaitBar");d.style.top=c.Top+"px";d.innerHTML='<img src="'+c.imgDir+'loading.gif" title="'+c.L10n[7]+'" />';b.appendChild(d)},hideShutter:function(){var c=this,d,b,a;if(d=c.I("shDisplay")){d.parentNode.removeChild(d)}if(b=c.I("shShutter")){b.parentNode.removeChild(b)}if(a=c.I("shNavBar")){a.parentNode.removeChild(a)}c.hideTags(true);window.scrollTo(0,c.Top);window.onresize=c.FS=c.Top=c.VP=null;document.documentElement.style.overflowX=""},resize:function(c){var b=this,a;if(b.resizing){return}if(!b.I("shShutter")){return}a=b.I("shWrap");if(a){a.style.visibility="hidden"}window.setTimeout(function(){shutterReloaded.resizing=null},500);window.setTimeout(new Function('shutterReloaded.VP = null;shutterReloaded.make("'+c+'");'),100);b.resizing=true},_viewPort:function(){var d=this,b=window.innerHeight?window.innerHeight:0,f=document.body.clientHeight?document.body.clientHeight:0,c=document.documentElement?document.documentElement.clientHeight:0,a,e;if(b>0){d.wHeight=((b-f)>1&&(b-f)<30)?f:b;d.wHeight=((d.wHeight-c)>1&&(d.wHeight-c)<30)?c:d.wHeight}else{d.wHeight=(c>0)?c:f}a=document.documentElement?document.documentElement.clientWidth:0;e=window.innerWidth?window.innerWidth:document.body.clientWidth;d.wWidth=(a>1)?a:e},showImg:function(){var m=this,g=m.I("shShutter"),a=m.I("shDisplay"),i=m.I("shTopImg"),f=m.I("shTitle"),n=m.I("shNavBar"),c,l,b,k,j,e,d,h=0;if(!g){return}if((c=m.I("shWrap"))&&c.style.visibility=="visible"){return}if(l=m.I("shWaitBar")){l.parentNode.removeChild(l)}g.style.width=a.style.width="";f.style.width=(i.width-4)+"px";b=n.offsetHeight?f.offsetHeight+n.offsetHeight:30;k=m.wHeight-7-b;if(m.FS){if(i.width>(m.wWidth-10)){g.style.width=a.style.width=i.width+10+"px"}document.documentElement.style.overflowX=""}else{window.scrollTo(0,m.Top);if(i.height>k){i.width=i.width*(k/i.height);i.height=k;h=1}if(i.width>(m.wWidth-16)){i.height=i.height*((m.wWidth-16)/i.width);i.width=m.wWidth-16;h=1}f.style.width=(i.width-4)+"px";n.style.bottom="0px"}j=m.Top+i.height+b+10;if(j>m.pgHeight){g.style.height=j+"px"}window.scrollTo(0,m.Top);if((m.FS&&(i.height>k||i.width>m.wWidth))||h){m.I("fullSize").style.display="inline";m.I("fullSize-d").style.display="none"}e=(k-i.height)*0.45;d=(e>3)?Math.floor(e):3;a.style.top=m.Top+d+"px";n.style.bottom="0";c.style.visibility="visible"},hideTags:function(a){var f=document.getElementsByTagName("select"),g=document.getElementsByTagName("object"),b=document.getElementsByTagName("embed"),h=document.getElementsByTagName("iframe"),e=(a)?"visible":"hidden",d,c;for(d=0,c=f.length;d<c;d++){f[d].style.visibility=e}for(d=0,c=g.length;d<c;d++){g[d].style.visibility=e}for(d=0,c=b.length;d<c;d++){b[d].style.visibility=e}for(d=0,c=h.length;d<c;d++){h[d].style.visibility=e}}};
