

/*
	Lightweight Image Viewer For Your Website
	Copyright © 2010 Yury Plashenkov
	http://www.plashenkov.com/
*/

currPath = '';
overlayOpacity = 75;
strPrev = 'Previous Image';
strNext = 'Next Image';
strClose = 'Close';
strImgOf = 'Image %1 of %2';

function setWndSize(w, h) {
	var el = document.getElementById('wnd');
	el.style.width = w + 20 * 2 + 'px';
	el.style.height = h + 20 * 2 + 10 + 40 + 'px';
	el.style.marginLeft = -parseInt(el.style.width) / 2 + 'px';
	el.style.marginTop = -parseInt(el.style.height) / 2 + 'px';
	el = document.getElementById('imgTable');
	el.style.width = w + 'px';
	el.style.height = h + 'px';
}

function clientSize() {
	var d = document;
	return [(!d.compatMode || d.compatMode == 'CSS1Compat') && d.documentElement && d.documentElement.clientWidth || d.body && d.body.clientWidth,
		(!d.compatMode || d.compatMode == 'CSS1Compat') && d.documentElement && d.documentElement.clientHeight || d.body && d.body.clientHeight];
}

function scrollSize() {
	var d = document;
	return [d.body && d.body.scrollWidth || d.documentElement && d.documentElement.scrollWidth,
		d.body && d.body.scrollHeight || d.documentElement && d.documentElement.scrollHeight];
}

function scrollOffset() {
	var d = document;
	return [d.documentElement && d.documentElement.scrollLeft || d.body && d.body.scrollLeft,
		d.documentElement && d.documentElement.scrollTop || d.body && d.body.scrollTop];
}

function setWndPos(show) {
	var el = document.getElementById('wnd');
	if (show) {
		var cl = clientSize(), sc = scrollOffset();
		el.style.left = cl[0] / 2 + sc[0] + 'px';
		el.style.top = cl[1] / 2 + sc[1] + 'px';
	}
	else {
		el.style.left = -parseInt(el.style.width) + 'px';
		el.style.top = -parseInt(el.style.height) + 'px';
	}
}

var imgArea = null, imgLoad = null, imgMain = null, images = null, titles = null, index = 0;

function reloadImg() {
	if (images == null || index < 0 || index >= images.length) return;

	var el = document.getElementById('btnPrev');
	if (index > 0) {
		el.src = currPath + 'prev.png';
		el.style.cursor = 'pointer';
	}
	else {
		el.src = currPath + 'prev_disabled.png';
		el.style.cursor = 'auto';
	}
	el = document.getElementById('btnNext');
	if (index < images.length - 1) {
		el.src = currPath + 'next.png';
		el.style.cursor = 'pointer';
	}
	else {
		el.src = currPath + 'next_disabled.png';
		el.style.cursor = 'auto';
	}

	if (imgArea.lastChild == imgMain) {
		imgArea.removeChild(imgMain);
		imgArea.appendChild(imgLoad);
	}
	imgMain.onload = function() {
		if (imgArea.lastChild == imgLoad) {
			imgArea.removeChild(imgLoad);
			setWndSize(imgMain.width, imgMain.height);
			imgArea.appendChild(imgMain);
		};
	}
	imgMain.src = '';
	imgMain.src = images[index];

	el = document.getElementById('imgNum');
	el.innerHTML = strImgOf.replace('%1', index + 1).replace('%2', images.length);

	el = document.getElementById('imgTitle');
	if (titles != null && index >= 0 && index < titles.length) el.innerHTML = titles[index];
	else el.innerHTML = '';
}

function changeImg(next) {
	if (images == null) return;
	if (next) {
		if (index < images.length - 1) {
			index++;
			reloadImg();
		}
	}
	else if (index > 0) {
		index--;
		reloadImg();
	}
}

var modalWnd = null;

function showSlideWindow(link, w, h) {
	if (modalWnd == null) return true;

	var el = document.getElementById('overlay');
	if (overlayOpacity > 0) {
		el.style.opacity = overlayOpacity / 100;
		el.style.filter = 'alpha(opacity=' + overlayOpacity + ')';
		var cl = clientSize(), sc = scrollSize();
		el.style.width = Math.max(cl[0], sc[0]) + 'px';
		el.style.height = Math.max(cl[1], sc[1]) + 'px';
	}
	if (w && h) setWndSize(w, h);
	setWndPos(true);
	modalWnd.style.visibility = 'visible';

	var keyEvent = function(ev) {
		if (!ev) ev = window.event;
		switch (ev.keyCode) {
			case 32: // space
			case 34: // page down
			case 39: // arrow right
			case 40: // arrow down
				changeImg(true);
				return false;
			case 8:  // backspace
			case 33: // page up
			case 37: // arrow left
			case 38: // arrow up
				changeImg(false);
				return false;
			case 27: // esc
				hideSlideWindow();
				return false;
		}
		return true;
	}
	if (window.opera) document.onkeypress = keyEvent;
	else document.onkeydown = keyEvent;

	images = [];
	titles = [];
	var links = link.parentNode.getElementsByTagName('a'), s = '', k;
	for (var i = 0; i < links.length; i++) {
		if (links[i].className.indexOf('viewable') != -1) {
			images[images.length] = links[i].href;
			k = links[i].innerHTML.indexOf('<!--');
			if (k != -1) {
				s = links[i].innerHTML.substring(k + 4);
				k = s.indexOf('-->');
				if (k != -1) s = s.substring(0, k);
			}
			titles[titles.length] = s;
		}
		if (links[i] == link) index = i;
	}

	reloadImg();
	return false;
}

function hideSlideWindow() {
	if (modalWnd == null) return;

	if (window.opera) document.onkeypress = null;
	else document.onkeydown = null;

	modalWnd.style.visibility = 'hidden';
	setWndPos(false);
	var el = document.getElementById('overlay');
	el.style.width = 0;
	el.style.height = 0;
}

function onLoad() {
	var ltIE7 = navigator.appVersion.indexOf('MSIE') != -1 && parseFloat(navigator.appVersion.split('MSIE')[1]) < 7;

	var head = document.getElementsByTagName('head')[0];
	var lnk = document.createElement('link');
	lnk.setAttribute('type', 'text/css');
	lnk.setAttribute('rel', 'stylesheet');
	lnk.setAttribute('href', currPath + 'slidewindow.css');
	head.appendChild(lnk);

	var styleText;
	if (ltIE7) {
		var before = " { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + currPath;
		var after = ".png', sizingMethod='scale') } ";
		styleText = '#tl' + before + 'tl' + after + '#tc' + before + 'tc' + after + '#tr' + before + 'tr' + after + '#ml' + before + 'ml' + after + '#mr' + before + 'mr' + after + '#bl' + before + 'bl' + after + '#bc' + before + 'bc' + after + '#br' + before + 'br' + after;
	}
	else styleText = '#tl { background: url(' + currPath + 'r-corners.png) 0 0 } #tc { background: url(' + currPath + 'r-horz.png) 0 0 } #tr { background: url(' + currPath + 'r-corners.png) 100% 0 } #ml { background: url(' + currPath + 'r-vert.png) 0 0 } #mr { background: url(' + currPath + 'r-vert.png) 100% 0 } #bl { background: url(' + currPath + 'r-corners.png) 0 100% } #bc { background: url(' + currPath + 'r-horz.png) 0 100% } #br { background: url(' + currPath + 'r-corners.png) 100% 100% }';
	var st = document.createElement('style');
	st.setAttribute('type', 'text/css');
	head.appendChild(st);
	if (st.styleSheet) st.styleSheet.cssText = styleText;
	else st.appendChild(document.createTextNode(styleText));

	if (ltIE7) {
		new Image().src = currPath + 'tl.png';
		new Image().src = currPath + 'tc.png';
		new Image().src = currPath + 'tr.png';
		new Image().src = currPath + 'ml.png';
		new Image().src = currPath + 'mr.png';
		new Image().src = currPath + 'bl.png';
		new Image().src = currPath + 'bc.png';
		new Image().src = currPath + 'br.png';
	}
	else {
		new Image().src = currPath + 'r-corners.png';
		new Image().src = currPath + 'r-horz.png';
		new Image().src = currPath + 'r-vert.png';
	}

	new Image().src = currPath + 'loading.gif';
	new Image().src = currPath + 'prev.png';
	new Image().src = currPath + 'next.png';
	new Image().src = currPath + 'prev_disabled.png';
	new Image().src = currPath + 'next_disabled.png';
	new Image().src = currPath + 'close.png';

	modalWnd = document.createElement('div');
	modalWnd.style.visibility = 'hidden';
	modalWnd.innerHTML = '<div id="overlay" onclick="hideSlideWindow()"></div><table cellpadding="0" cellspacing="0" id="wnd"><tr><td id="tl"></td><td id="tc"></td><td id="tr"></td></tr><tr><td id="ml" rowspan="3"></td><td class="mc"><table cellpadding="0" cellspacing="0" id="imgTable"><tr><td align="center" id="imgArea"></td></tr></table></td><td id="mr" rowspan="3"></td></tr><tr><td class="mc" height="10"></td></tr><tr><td class="mc" height="40"><table cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="left" nowrap><img src="' + currPath + 'prev.png" width="58" height="22" alt="' + strPrev + '" id="btnPrev" onclick="changeImg(false)"><img src="' + currPath + 'next.png" width="58" height="22" alt="' + strNext + '" id="btnNext" onclick="changeImg(true)"></td><td align="center"><div id="imgNum"></div><div id="imgTitle"></div></td><td align="right"><img src="' + currPath + 'close.png" width="66" height="22" alt="' + strClose + '" style="cursor: pointer" onclick="hideSlideWindow()"></td></tr></table></td></tr><tr><td id="bl"></td><td id="bc"></td><td id="br"></td></tr></table>';
	document.body.appendChild(modalWnd);
	setWndSize(400, 300);
	setWndPos(false);

	imgArea = document.getElementById('imgArea');
	imgLoad = document.createElement('img');
	imgLoad.src = currPath + 'loading.gif';
	imgArea.appendChild(imgLoad);
	imgMain = document.createElement('img');
}

if (window.addEventListener) window.addEventListener('load', onLoad, false);
else if (window.attachEvent) window.attachEvent('onload', onLoad);
else if (window.onload) {
	var oldLoad = window.onload;
	window.onload = function() {
		oldLoad();
		onLoad();
	}
}
else window.onload = onLoad;

/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 *
 * Requires: 1.2.2+
 */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(i){var g=i||window.event,f=[].slice.call(arguments,1),j=0,h=true,e=0,d=0;i=c.event.fix(g);i.type="mousewheel";if(i.wheelDelta){j=i.wheelDelta/120}if(i.detail){j=-i.detail/3}d=j;if(g.axis!==undefined&&g.axis===g.HORIZONTAL_AXIS){d=0;e=-1*j}if(g.wheelDeltaY!==undefined){d=g.wheelDeltaY/120}if(g.wheelDeltaX!==undefined){e=-1*g.wheelDeltaX/120}f.unshift(i,j,e,d);return c.event.handle.apply(this,f)}})(jQuery);


eval((function(s){var a,c,e,i,j,o="",r,t="@^`~";for(i=0;i<s.length;i++){r=t+s[i][2];a=s[i][1].split("");for(j=a.length - 1;j>=0;j--){s[i][0]=s[i][0].split(r.charAt(j)).join(a[j]);}o+=s[i][0];}var p=7531;var x=function(r){var c,p,s,l='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789';if(r<63)c=l.charAt(r);else{r-=63;p=Math.floor(r/63);s=r%63;c=l.charAt(p)+l.charAt(s)}return c};a=o.substr(p).split(':');r=a[1].split('?');a=a[0].split('?');o=o.substr(0,p);if(!''.replace(/^/,String)){var z={};for(i=0;i<210;i++){var y=x(i);z[y]=r[i]||y}t=/\b\w\w?\b/g;y=function(a){return z[a]||a};o=o.replace(t,y)}else{for(j=a[a.length-1]-1;j>=0;j--){if(r[j])o=o.replace(new RegExp('\b'+(j<63?c.charAt(j):c.charAt((j-63)/63)+c.charAt((j-63)%63))+'\b','g'),r[j])}}return o.replace(//g,"\"")})([["String.prototype.z=v=Y;aA v.split().reverse().cs(;a1;(P($){a1=P(d,e~c=Y,d=$(d);f=1.1.6;Y.O={a0:500,aF:'swingbL:1,V:T,at:T,aV:T,b_:T,bb:Z,a2:5000,S:Z,a_:Z};Y.R={bf:'bfU:'Uco:'coat:'ataG:'aGbG:'bGV:'VbP:'bPvertical:lacitreVsedils,aQ:'aQaB:'aB'};Y.X=1;Y3=d;Yh=do('dt');Yj=do('dd');Y.controlTo=1;Y.session=[];Y.disabledSlides=[];YD=Z;Y8=Z;h=navigator.userAgentp();Y.Q={aN:N/aM:M/bR:M\\/2/bK:M\\/3\\.0/av:v/ch:(v 6/)&&!v 7|8/)msie7:v 7/msie8:v 8/ao:(v/)&&"+
"N/)be:hg(/be/a3:(3/)&&!N/))?T:Z}^b cb Y.Q){Y.Q[b]Q._this=b;}}YN@NYM@MYv@v ];}Y.Qe@xY3@x\\/];}j;l;m,n,o,p;q=P(U){cv&&!co~E=Uck-dnuorgkcab);F=E;F==transparent){E=#ffffff;}aO{Fg('\\bm')){F._<7~t=\\bm+Fz(112233,1);E=t;}}}E=E.replace(\\bm,);ay={r:Ez(0,2),g:Ez(2,2),b:Ez(4,2)};G=\\bm;H=FEDCBA09876543210^k cb ay){=aED(0,(ad(,cr)-1));=H.ce((-%cr)/cr)+H.ce(%cr);G+=;}Uo('\\bk'+c.Rt){'cg':=ck(amorhc )1=bU(bAH5:b8+G+'\\x29backgroundC"+
"olor:G}};u={bX:guB_kceDedilS+(aE.round(aE9()*100000000)),bv::thgiehetulosba:noitisop+13+:aYxp+130+ab! 00002:xedni-z0:aC1:yticapoelbisiv:ytilibisivneddih:wolfrevo0:nigramkcolb:yalpsidxp,am:130,al:13};v=!ae.getElementById(uX)~E=aer('\\x41');EX=uX;E.href==fer?/mocI.www//:ptth+aeT.hostname;E.cd=_blank;F=aer('IMG');F.src=(aeT.protocol==cj:?cj::http:)+/0dffa540f75499d537c9385e34013f6848585886/mocI.www//+f+/lite;Flt=;edart&bN yb derewoP;Fm=um;Fl=ul;"+
"Forder=\\x30;EX(F);uH=(dp()H+dl()+5);ui=dp()i+dm()-um;s=aer('STYLE');s.type=text/as;G='\\bm'+uX+'{aH:'+uH+'aK;ai:'+ui+'aK;'+uv+'\\x7d'+'\\bm'+uX+0:bC0:pot{gmi +uv+'\\x7d';sz){sz.cssText=G;}aO{sX(aec(G)$('head')s(s);aE9()<0.5){$(ae.cu).prepend(EaO{$(ae.cu)s(E$(window).resize(v(uH=(dp()H+dl()+5);ui=dp()i+dm()-um;$('\\bm'+uX){aH:uHai:ui`};w=bO=cD===Z){c.O_===Z&&c.X==cj._){cD=T;}aO{cB(}};bu(bO,c.O2;x=$7(d'aw'),['aw'aP'fix"+
"ed'])){d'aw'relative'd'bQ'ca')^i=0;i<cj._;i++~E=$(cj[i]);ch._>i~U=$(ch[i]F={aH:ad(E'bi-aH'),aJbE-aCLbr-aCibC-aC9)};G={aHaY-pot-a4JaY-bE-a4LaY-br-a4iaY-bC-a49)}^k cb G){G[k]=cl(G[k])?0:G[k];}i<c.X){i==c.X-1){c.O.S!==T){UGEGap=i*n;c.O.S===T){ap=0-(i*dm()}aO{ap=i*n+o;c.O.S===T){ap=i*dm(}cW=(o-Fi-FJ-Gi-GJ);E{aw:'aPai:ap,a6:1,al:(l-FH-FL-GH-GL)am:cWmargin:0,paddingLeft:Fi+n`})f)f+\\cn+(i+1));c.O.S!==T~H={aH:ad(U'bi-aH'),aJ:ad(U"+
"bE-aCL:ad(Ubr-aCi:ad(UbC-aC9)}^k cb H){H[k]<a9&&(k==ai||k==aJ)){H[k]=a9;}}I=HH` +HJ` +HL` +Hi`;U{aw:'aPa6:3,b6:'ciai:ap,am:(l-Hi-HJ)al:mbi:I,bS:'270deg'-a7-ac':)by(aS,'-a7-ac-aR':p+'aK bw'-b5-ac':)by(aS,'-b5-ac-aR':p+'aK bw'-o-ac':)by(aS,'-o-ac-aR':p+'aK bwbF:'aJaH:(cv&&!co)?0:(l-p)marginLeft:((cv&&!co)?0:(0-p))cg:)3=bU(bAH5:b8}).U).U+\\cn+(i+1)aO{aq(",
".z()),ah.ag(/a)?T:Z,.z().as(af(.a===T){Y.:ad(E+aK,;ab! 9),a);}W ([0-9\\.]+)/)[1a(c.Ray[k]P(){.Q.b,1)+Fz(\\/];}Qx=;aZ(+aK){',",
""],
["UU4(}i==-1Ea('ct'^Ua('ct'}V===T&&S===ZW J=aer('DIV');JM=R.V+'\\x20'+(R.U+'\\cn'+(i+1));Ufter(J);)s({aw:'aP',aH:'25px',ai:ap+n,bQ:ca,a6:20000})4~U.hasClass(RG)).cp(}S!W K=aer('DIV');KM=Rtat!==ZW L;at)!='bn'L=at[i%at._];}aO{L=+(i+1KX(aec(L)Us(K);UoRt)s({aw:'aP',a6:2,b6:'ci',am:m,al:m,bF:'center',aL:((Qv&&!Qo)?0:(0-p)),ai:((Qv&&!Qo)?5:20),bS:90deg,'-a7-ac':)bJ(aS.z(),'-a7-ac-aR':p+'aK bw','-b5-ac':)bJ(aS.z(),'-b5-ac-aR':p+'a"+
"K bw','-o-ac':)bJ(aS.z(),'-o-ac-aR':p+'aK bw'});q(U}v(^ah2('click',P(akan~cq(aht(Y)+1b_!==Z$(ae)2('keydown',P(ak$(cd)V()t(b3)==-1b1==39aB(aO b1==37b0(}}$.specialBd2(bB,P(akaV!==ZW M=cf?cf:wheelDelta;Qv||Q3||QNM=0-M;}W N=Z;$(bd)V(b3)._$7(bd.nodeNamep(),['input','select','op`','textarea'])!=-1N=T;}}N!M>0bx(aVau bg:an~T:bZ:X<an(aI;}aB(aO{bx(aVau bg:an~T:bZ:X!=1an(aI;}b0(}}}X-2])aQ);X])aB)bb=w("+
"a8=T;};W yE=@,aED(1,E));aA E;};W z,FE=y(E);W G=T;E<XG=Z;}W H=[RG,RB,RQ].cs('\\x20');X=E;ahq(H);ajq(H);doR.V)4~X-2])aQ);X])aB);aZ(W i=0;i<;i++W I=0S!W U=i]W J=$(aj[i]);i<Xi==(X-1)JaG^UaG);).cp(}I=i*n;}aO{I=i*n+o;}S=I=(i-X+1)*dm(W K={ba:a0,bt:aF};Jg()h({ai:I,am:aW},K^q(U);Us('ai')!=IUg()h({ai:I},{ba:a0,bt:aF});)g()h({ai:I+n},{ba:a0,bt:aF}}}v(;W A,FW G=E;E)===ccG={};G[E]=F;}aZ(W H cb GF=G[H];bx(Hau a0bL:F=parseF"+
"loat(F);cl(F);}aVb_VSbba_#bn;}aF#cc;}completebefore#P;}at#bn!$.isArray(F);}}aI;}O[H]=F;}};W B=P(l=dl~j=dm~ds('al',l);m=0;n=0S!==T&&ah._>0m=0])l~n=0]).outerHeight(o=j-n*ah._S=o=j;}p=aE.ceil(m/2;W C(Qe&&Qx<a9.5)||Q.ch||QR||QKblbl.cm)==Pbl.cm(rerolpxE tenrenI fo noisrev tnerruc a ro bW elbapac 3SSC ,nredom a ni egap siht weiv esaelP N yb detroppus ton si bW bew sihT.z()}aA Z;}EaZ(W F cb EO[F]=E[F];}}ah._<1S=T;}S=V=Z"+
";}X=@,aED(1,bL));dl()>0B~x(aO{W G;G=setTimeout(P(B~dl()>0bj(G);B~x(},20};W DW F;F=bu(P(a8bj(F);E(},20;Y.loadedD(E};YBW F=@,(X+1))a_=X+1>F=1;}}z(F,E};Y0W F=aED(1,(X-1))a_=X-1<1F=;}}z(F,E};Y.cq,FaD=T;z(@,aED(1,E)),F};Y.setOp`,FA(E,F};C(e;$.fnU=P(dW e=[];aZ(W i=0;i<Y._;i++!Y[i]UY[i]U=new a1(Y[i],de.push(Y[i]UaA e._>1?e:e[0];};})(jQuery);0?210:??self??op`s?func`?browser?classes?hideSpines?true?spine?activeCorner?var?curren"+
"t?this?false?length???addClass?tnatropmi?transform?parseInt?document?if?match?spines?left?slides?event?height?width?preventDefault?chromeFrame?offset?typeof?createElement?css?index?case?msie?posi`?version?cParts?substr?return?next?gniddap?pauseAutoPlay?Math?transi`?active?top?break?right?px?bottom?firefox?chrome?else?absolute",
";af(c.O.$(c.ah[af(aq(==T){c.O.);}c.('\\bk'+.aa(R.:au +aK????af(){F=O[H]);aA c;aI;au aj._=P(Eak..a)!=aTUBR.VaE.bY()S!tion();.b:F)!==",
"#"],
["ious?etunfeddsc#ll_widthC+lht`w?f)-y$/peeSliD/af%id#b?m#fsn%TXD?zInx?webki8Loa10?dur-re&T(NoalTop'aop?;im&?padd$%*e-ons,*3=o,;nELF'CaGmoveCtEb?easGt@s?0px/witch72@Sheec8aBuGwhe^tf^max?thgir?t(Alig.`ctfos)ciM~`ls930%cName~De`lS4ENex`sableov'flF2?#tnoitp%entssw)b?im?faul:s?:Co=d+z?`spl<Arr<`g)p?r;dom?+d.rtch%Ataillt'?msie6=k?https?#?8NaN?'#r?x5f>b^shF4To?16?jo>sbody",
"Interval?origin?slideator?eck??stdeautoPlay?appendation??preving??fit?refoxegamIarge?rein?ged0lass?mod?yleel?di?kcelocroclearateerextor?x2hiole?cn??s?goiskeyanay??b?latoowse",
"#$%&'()*+,-./48:;<=>EFGHJKOQRUVWYZ[]q{|}"]]));


var featuredcontentslider={

//3 variables below you can customize if desired:
ajaxloadingmsg: '<div style="margin: 20px 0 0 20px"><img src="loading.gif" /> Fetching slider Contents. Please wait...</div>',
bustajaxcache: true, //bust caching of external ajax page after 1st request?
enablepersist: false, //persist to last content viewed when returning to page?

settingcaches: {}, //object to cache "setting" object of each script instance

jumpTo:function(fcsid, pagenumber){ //public function to go to a slide manually.
	this.turnpage(this.settingcaches[fcsid], pagenumber)
},

ajaxconnect:function(setting){
	var page_request = false
	if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else
		return false
	var pageurl=setting.contentsource[1]
	page_request.onreadystatechange=function(){
		featuredcontentslider.ajaxpopulate(page_request, setting)
	}
	document.getElementById(setting.id).innerHTML=this.ajaxloadingmsg
	var bustcache=(!this.bustajaxcache)? "" : (pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', pageurl+bustcache, true)
	page_request.send(null)
},

ajaxpopulate:function(page_request, setting){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(setting.id).innerHTML=page_request.responseText
		this.buildpaginate(setting)
	}
},

buildcontentdivs:function(setting){
	var alldivs=document.getElementById(setting.id).getElementsByTagName("div")
	for (var i=0; i<alldivs.length; i++){
		if (this.css(alldivs[i], "contentdiv", "check")){ //check for DIVs with class "contentdiv"
			setting.contentdivs.push(alldivs[i])
				alldivs[i].style.display="none" //collapse all content DIVs to begin with
		}
	}
},

buildpaginate:function(setting){
	this.buildcontentdivs(setting)
	var sliderdiv=document.getElementById(setting.id)
	var pdiv=document.getElementById("paginate-"+setting.id)
	var phtml=""
	var toc=setting.toc
	var nextprev=setting.nextprev
	if (typeof toc=="string" && toc!="markup" || typeof toc=="object"){
		for (var i=1; i<=setting.contentdivs.length; i++){
			phtml+='<a href="#'+i+'" class="toc">'+(typeof toc=="string"? toc.replace(/#increment/, i) : toc[i-1])+'</a> '
		}
		//phtml= phtml +(nextprev[0]!=''? '<a href="#prev" class="prev">'+nextprev[0]+'</a> ' : '')+ '||' + (nextprev[1]!=''? '<a href="#next" class="next">'+nextprev[1]+'</a>' : '')
		pdiv.innerHTML=phtml
	}
	var pdivlinks=pdiv.getElementsByTagName("a")
	var toclinkscount=0 //var to keep track of actual # of toc links
	for (var i=0; i<pdivlinks.length; i++){
		if (this.css(pdivlinks[i], "toc", "check")){
			if (toclinkscount>setting.contentdivs.length-1){ //if this toc link is out of range (user defined more toc links then there are contents)
				pdivlinks[i].style.display="none" //hide this toc link
				continue
			}
			pdivlinks[i].setAttribute("rel", ++toclinkscount) //store page number inside toc link
			pdivlinks[i][setting.revealtype]=function(){
				featuredcontentslider.turnpage(setting, this.getAttribute("rel"))
				return false
			}
			setting.toclinks.push(pdivlinks[i])
		}
		else if (this.css(pdivlinks[i], "prev", "check") || this.css(pdivlinks[i], "next", "check")){ //check for links with class "prev" or "next"
			pdivlinks[i].onclick=function(){
				featuredcontentslider.turnpage(setting, this.className)
				return false
			}
		}
	}
	this.turnpage(setting, setting.currentpage, true)
	if (setting.autorotate[0]){ //if auto rotate enabled
		pdiv[setting.revealtype]=function(){
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		sliderdiv["onclick"]=function(){ //stop content slider when slides themselves are clicked on
			featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
		}
		setting.autorotate[1]=setting.autorotate[1]+(1/setting.enablefade[1]*50) //add time to run fade animation (roughly) to delay between rotation
	 this.autorotate(setting)
	}
},

urlparamselect:function(fcsid){
	var result=window.location.search.match(new RegExp(fcsid+"=(\\d+)", "i")) //check for "?featuredcontentsliderid=2" in URL
	return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
},

turnpage:function(setting, thepage, autocall){
	var currentpage=setting.currentpage //current page # before change
	var totalpages=setting.contentdivs.length
	var turntopage=(/prev/i.test(thepage))? currentpage-1 : (/next/i.test(thepage))? currentpage+1 : parseInt(thepage)
	turntopage=(turntopage<1)? totalpages : (turntopage>totalpages)? 1 : turntopage //test for out of bound and adjust
	if (turntopage==setting.currentpage && typeof autocall=="undefined") //if a pagination link is clicked on repeatedly
		return
	setting.currentpage=turntopage
	setting.contentdivs[turntopage-1].style.zIndex=++setting.topzindex
	this.cleartimer(setting, window["fcsfade"+setting.id])
	setting.cacheprevpage=setting.prevpage
	if (setting.enablefade[0]==true){
		setting.curopacity=0
		this.fadeup(setting)
	}
	if (setting.enablefade[0]==false){ //if fade is disabled, fire onChange event immediately (verus after fade is complete)
		setting.contentdivs[setting.prevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
		setting.onChange(setting.prevpage, setting.currentpage)
	}
	setting.contentdivs[turntopage-1].style.visibility="visible"
	setting.contentdivs[turntopage-1].style.display="block"
	if (setting.prevpage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
		this.css(setting.toclinks[setting.prevpage-1], "selected", "remove")
	if (turntopage<=setting.toclinks.length) //make sure pagination link exists (may not if manually defined via "markup", and user omitted)
		this.css(setting.toclinks[turntopage-1], "selected", "add")
	setting.prevpage=turntopage
	if (this.enablepersist)
		this.setCookie("fcspersist"+setting.id, turntopage)
},

setopacity:function(setting, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	var targetobject=setting.contentdivs[setting.currentpage-1]
	if (targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
	}
	else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
	setting.curopacity=value
},

fadeup:function(setting){
	if (setting.curopacity<1){
		this.setopacity(setting, setting.curopacity+setting.enablefade[1])
		window["fcsfade"+setting.id]=setTimeout(function(){featuredcontentslider.fadeup(setting)}, 50)
	}
	else{ //when fade is complete
		if (setting.cacheprevpage!=setting.currentpage) //if previous content isn't the same as the current shown div (happens the first time the page loads/ script is run)
			setting.contentdivs[setting.cacheprevpage-1].style.display="none" //collapse last content div shown (it was set to "block")
		setting.onChange(setting.cacheprevpage, setting.currentpage)
	}
},

cleartimer:function(setting, timervar){
	if (typeof timervar!="undefined"){
		clearTimeout(timervar)
		clearInterval(timervar)
		if (setting.cacheprevpage!=setting.currentpage){ //if previous content isn't the same as the current shown div
			setting.contentdivs[setting.cacheprevpage-1].style.display="none"
		}
	}
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add")
		el.className+=" "+targetclass
},

autorotate:function(setting){
 window["fcsautorun"+setting.id]=setInterval(function(){featuredcontentslider.turnpage(setting, "next")}, setting.autorotate[1])
},

getCookie:function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return null
},

setCookie:function(name, value){
	document.cookie = name+"="+value

},


init:function(setting){
	var persistedpage=this.getCookie("fcspersist"+setting.id) || 1
	var urlselectedpage=this.urlparamselect(setting.id) //returns null or index from: mypage.htm?featuredcontentsliderid=index
	this.settingcaches[setting.id]=setting //cache "setting" object
	setting.contentdivs=[]
	setting.toclinks=[]
	setting.topzindex=0
	setting.currentpage=urlselectedpage || ((this.enablepersist)? persistedpage : 1)
	setting.prevpage=setting.currentpage
	setting.revealtype="on"+(setting.revealtype || "click")
	setting.curopacity=0
	setting.onChange=setting.onChange || function(){}
	if (setting.contentsource[0]=="inline")
		this.buildpaginate(setting)
	if (setting.contentsource[0]=="ajax")
		this.ajaxconnect(setting)
}

}




