Drupal.locale = { 'pluralFormula': function ($n) { return Number((((($n%10)==1)&&(($n%100)!=11))?(0):((((($n%10)>=2)&&(($n%10)<=4))&&((($n%100)<10)||(($n%100)>=20)))?(1):2))); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Objevila se AJAX HTTP chyba.","HTTP Result Code: !status":"V\u00fdsledn\u00fd k\u00f3d HTTP je: !status","An AJAX HTTP request terminated abnormally.":"AJAX HTTP po\u017eadavek skon\u010dil neobvykle.","Debugging information follows.":"N\u00e1sleduj\u00ed informace pro lad\u011bn\u00ed.","Path: !uri":"Cesta: !uri","StatusText: !statusText":"Text stavu: !statusText","ResponseText: !responseText":"Text odpov\u011bdi:  !responseText","ReadyState: !readyState":"ReadyState: !readyState","Loading":"Na\u010d\u00edt\u00e1n\u00ed","(active tab)":"(aktivn\u00ed z\u00e1lo\u017eka)","Hide":"Skr\u00fdt","Show":"Uk\u00e1zat","Re-order rows by numerical weight instead of dragging.":"Zm\u011b\u0148te po\u0159ad\u00ed \u0159\u00e1dk\u016f pomoc\u00ed \u010d\u00edseln\u00e9 v\u00e1hy m\u00edsto p\u0159eta\u017een\u00ed my\u0161\u00ed.","Show row weights":"Uka\u017e v\u00e1hy \u0159\u00e1dk\u016f","Hide row weights":"Skryj v\u00e1hy \u0159\u00e1dk\u016f","Drag to re-order":"Pro p\u0159eskupen\u00ed p\u0159et\u00e1hn\u011bte my\u0161\u00ed","Changes made in this table will not be saved until the form is submitted.":"Zm\u011bny proveden\u00e9 v t\u00e9to tabulce budou ulo\u017eeny a\u017e po odesl\u00e1n\u00ed  formul\u00e1\u0159e.","Next":"N\u00e1sleduj\u00edc\u00ed","Cancel":"Zru\u0161it","Disabled":"Vypnuto","Enabled":"Zapnuto","Edit":"Upravit","none":"\u017e\u00e1dn\u00e9","Upload":"Nahr\u00e1t","Configure":"Nastaven\u00ed","Done":"Hotovo","Select all rows in this table":"Ozna\u010dit v\u0161echny \u0159\u00e1dky v t\u00e9to tabulce","Deselect all rows in this table":"Zru\u0161it ozna\u010den\u00ed v\u0161ech \u0159\u00e1dek v t\u00e9to tabulce","Not published":"Nevyd\u00e1no","Please wait...":"Pros\u00edm \u010dekejte...","Not enabled":"Nepovolen","Only files with the following extensions are allowed: %files-allowed.":"Povoleny jsou pouze soubory s n\u00e1sleduj\u00edc\u00edmi p\u0159\u00edponami: %files-allowed.","By @name on @date":"U\u017eivatel @name dne @date","By @name":"Dle @name","Not in menu":"Nen\u00ed v menu","Alias: @alias":"Alias: @alias","No alias":"\u017d\u00e1dn\u00fd alias","New revision":"Nov\u00e1 revize","The changes to these blocks will not be saved until the \u003cem\u003eSave blocks\u003c\/em\u003e button is clicked.":"Zm\u011bny v t\u011bchto bloc\u00edch se neprojev\u00ed, dokud je neulo\u017e\u00edte pomoc\u00ed tla\u010d\u00edtka \u003cem\u003eUlo\u017eit bloky\u003c\/em\u003e.","Show shortcuts":"Zobrazit zkratky","This permission is inherited from the authenticated user role.":"Pr\u00e1va byla zd\u011bd\u011bna z ov\u011b\u0159en\u00e9 u\u017eivatelsk\u00e9 role.","No revision":"\u017d\u00e1dn\u00e1 revize","@number comments per page":"Po\u010det koment\u00e1\u0159\u016f na str\u00e1nku: @number","Requires a title":"Vy\u017eaduje n\u00e1zev","Not restricted":"Nen\u00ed omezeno","Not customizable":"Nelze p\u0159izp\u016fsobit","Restricted to certain pages":"Omezen\u00fd na ur\u010dit\u00fd str\u00e1nky","The block cannot be placed in this region.":"Blok nem\u016f\u017ee b\u00fdt um\u00edst\u011bn do tohoto regionu.","Customize dashboard":"P\u0159izp\u016fsobit ovl\u00e1dac\u00ed panel","Hide summary":"Skr\u00fdt souhrn","Edit summary":"Upravit souhrn","Don't display post information":"Nezobrazovat informace o p\u0159\u00edsp\u011bvku","@title dialog":"@title dialog","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"Vybran\u00fd soubor %filename nelze nahr\u00e1t. Jsou povoleny pouze soubory s t\u011bmito p\u0159\u00edponami: %extensions.","Autocomplete popup":"Vyskakovac\u00ed okno automatick\u00e9ho dokon\u010dov\u00e1n\u00ed","Searching for matches...":"Hled\u00e1m shody...","Hide shortcuts":"Skr\u00fdt zkratky"}} };;
jQuery(
	 function ($) {
   

				//	Fuild layout example 2
				$(window).resize(function() {
					var newWidth = $(window).width();
		$("#fooF1").carouFredSel({
    scroll		: {
		items			: null,		
		fx				: "scroll",
		easing			: "swing",
		duration		: 600,
		pauseOnHover	: true,
		queue			: true,
		mousewheel		: true,
		wipe			: false,
		event			: "click",
		conditions		: null,
		onBefore		: null,
		onAfter			: null,
		onEnd			: null },
     auto		: {
		play			: true,
		pauseDuration	: 6500,		//	5 * auto.duration
		delay			: 0,
		items			: null,		//	scroll.items
		fx				: null,		//	scroll.fx
		easing			: null,		//	scroll.easing
		duration		: 0.05,		//	scroll.duration
		pauseOnHover	: true,		//	scroll.pauseOnHover
		queue			: null,		//	scroll.queue
		mousewheel		: null,		//	scroll.mousewheel
		conditions		: null,		//	scroll.conditions
		onBefore		: null,		//	scroll.onBefore
		onAfter			: null,		//	scroll.onAfter
		onEnd			: null,		//	scroll.onEnd
		onPauseStart	: null,
		onPauseEnd		: null,
		onPausePause	: null 	}
        });	
				});
				$(window).resize();
			}
);
var resizeDelay = 3;
var resizeIncrement = 4;
var imgCache = new Object();


function getCacheTag (imgElement) {
	return imgElement.src + "~" + imgElement.offsetLeft + "~" + imgElement.offsetTop;
}

function cachedImg (imgElement, increment) {
	this.img = imgElement;
	this.cacheTag = getCacheTag(imgElement);
	this.originalSrc = imgElement.src;
	
	var h = imgElement.height;
	var w = imgElement.width;
	this.originalHeight = h;
	this.originalWidth = w;
	
	increment = (!increment) ? resizeIncrement : increment;
	this.heightIncrement = Math.ceil(Math.min(1, (h / w)) * increment);
	this.widthIncrement = Math.ceil(Math.min(1, (w / h)) * increment);
}


function resizeImg (imgElement, percentChange, newImageURL) {

	var pct = (percentChange) ? percentChange / 100 : 1;

	var cacheTag = imgElement.getAttribute("cacheTag");
	if (!cacheTag) {
		cacheTag = getCacheTag(imgElement);
		imgElement.setAttribute("cacheTag", cacheTag);
	}

	var cacheVal = imgCache[cacheTag];
	if (!cacheVal) {
		imgCache[cacheTag] = new Array(new cachedImg(imgElement), pct);
	} else {
		cacheVal[1] = pct;
	}

	if (newImageURL)
		imgElement.src = newImageURL;

	resizeImgLoop(cacheTag);
	return true;
}


function resizeImgLoop (cacheTag) {
	// get information about the image element from the image cache
	var cacheVal = imgCache[cacheTag];
	if (!cacheVal)
		return false;
	
	var cachedImageObj = cacheVal[0];
	var imgElement = cachedImageObj.img;
	var pct = cacheVal[1];
	var plusMinus = (pct > 1) ? 1 : -1;
	var hinc = plusMinus * cachedImageObj.heightIncrement;
	var vinc = plusMinus * cachedImageObj.widthIncrement;
	var startHeight = cachedImageObj.originalHeight;
	var startWidth = cachedImageObj.originalWidth;
	
	var currentMargin = parseInt(imgElement.style.margin.replace('px',''));
		
	var currentHeight = imgElement.height;
	var currentWidth = imgElement.width;
	var endHeight = Math.round(startHeight * pct);
	var endWidth = Math.round(startWidth * pct);
	
	// if the image is already the right size, we can exit
	if ( (currentHeight == endHeight) || (currentWidth == endWidth) )
		return true;

	var newHeight = currentHeight + hinc;
	var newWidth = currentWidth + vinc;
	if (pct > 1) {
		if ((newHeight >= endHeight) || (newWidth >= endWidth)) {
			newHeight = endHeight;
			newWidth = endWidth;
		}
	} else {
		if ((newHeight <= endHeight) || (newWidth <= endWidth)) {
			newHeight = endHeight;
			newWidth = endWidth;
		}
	}
	margin = currentMargin-((resizeIncrement / 2) * plusMinus) ;
//	imgElement.style({'margin' :margin_left  + 'px'});
	imgElement.style.margin= margin  + 'px';

	// set the image element to the new height and width

	imgElement.height = newHeight;
	imgElement.width = newWidth;

	if ((newHeight == cachedImageObj.originalHeight) || (newWidth == cachedImageObj.originalwidth)) {
		imgElement.src = cachedImageObj.originalSrc;
	}
	
	// shrink or grow again in a few milliseconds
	setTimeout("resizeImgLoop('" + cacheTag + "')", resizeDelay);
}






function image_width_plus( img_width, id, max ) {  
    timer = null; 
    img_padding=10  ;   
    //objekt z daneho identifikatoru  
    idImg = document.getElementById(id);
//    Imgover = idImg.onMouseOver();  
    //podminka pro porovnani velikosti  
    if(img_width <= max ) {  
        //v pripade pravdy vytvorime novou velikost  
        img_width += 5;
        img_padding -= 1;  
        //a nastavime nvoou velikost  
        idImg.style.width = ( img_width ) + "px";
        idImg.style.paddingLeft = ( img_padding ) + "px";        
        //rekurzivne volame funkci pro zvetsovani obrazku  
        timer = setTimeout("image_width_plus(" + img_width + ",'" + id + "', " + max + ");", 5);  
    } else {  
        //clearTimeout('timer');  
        return true;  
    }  
} 

function image_width_minus( img_width, id, min ) {  
    timer = null;      
    //objekt z daneho identifikatoru                    
    idImg = document.getElementById(id);  
    //podminka pro porovnani velikosti          
    if(img_width >= min ) {  
        //v pripade pravdy vytvorime novou velikost      
        img_width -= 5;    
        //a nastavime nvoou velikost    
        idImg.style.width = ( img_width ) + "px";       
         //rekurzivne volame funkci pro zmensovani obrazku           
        timer = setTimeout("image_width_minus(" + img_width + ",'" + id + "', " + min + ");", 1);  
    } else {  
        //clearTimeout('timer');  
        return true;  
    }  
}

function resize_plus( id, max ){  
    //objekt z daneho identifikatoru               
    idImg = document.getElementById(id);   
    //volame funkci pro zvetseni obrazku  
    //jako prvni parametr uvedeme soucasnou velikost obrazku   
    image_width_plus( idImg.width, id, max ); 
}  

function resize_minus( id, min ){  
    //objekt z daneho identifikatoru               
    idImg = document.getElementById(id);  
    //volame funkci pro zmenseni obrazku  
    //jako prvni parametr uvedeme soucasnou velikost obrazku  
    image_width_minus( idImg.width, id, min );  
} 
;
/*	
 *	jQuery carouFredSel 4.5.2
 *	Demo's and documentation:
 *	caroufredsel.frebsite.nl
 *	
 *	Copyright (c) 2011 Fred Heusschen
 *	www.frebsite.nl
 *
 *	Dual licensed under the MIT and GPL licenses.
 *	http://en.wikipedia.org/wiki/MIT_License
 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
 */


eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(y($){7($.1y.1t)B;$.1y.1t=y(o){7(11.Y==0){K(C,\'4q 5r 5s 1u "\'+11.5t+\'".\');B 11}7(11.Y>1){B 11.1N(y(){$(11).1t(o)})}9 r=11,$13=11[0];r.3K=y(o,b,c){9 e=[\'8\',\'14\',\'L\',\'S\',\'T\',\'Z\'];o=34($13,o);1u(9 a=0,l=e.Y;a<l;a++){o[e[a]]=34($13,o[e[a]])}7(A o.14==\'U\'){7(o.14<=50)o.14={\'8\':o.14};E o.14={\'1d\':o.14}}E{7(A o.14==\'1e\')o.14={\'1n\':o.14}}7(A o.8==\'U\')o.8={\'D\':o.8};E 7(o.8==\'18\')o.8={\'D\':o.8,\'G\':o.8,\'17\':o.8};7(b)29=$.1U(C,{},$.1y.1t.3L,o);6=$.1U(C,{},$.1y.1t.3L,o);6.d={};6.1C=I;6.35=I;7(6.8.2E==0&&A c==\'U\'){6.8.2E=c}z.1O=(6.1O==\'3M\'||6.1O==\'19\')?\'T\':\'S\';9 f=[[\'G\',\'36\',\'1V\',\'17\',\'4r\',\'2a\',\'19\',\'2b\',\'1f\',0,1,2,3],[\'17\',\'4r\',\'2a\',\'G\',\'36\',\'1V\',\'2b\',\'19\',\'3a\',3,2,1,0]];9 g=f[0].Y,4s=(6.1O==\'2c\'||6.1O==\'19\')?0:1;1u(9 d=0;d<g;d++){6.d[f[0][d]]=f[4s][d]}9 h=r.M(),3N=3O(h,6,\'2a\',I);7(6.X==\'L\'){K(C,\'2F 5u "X: L" 1D 2n, 2o "1g: 2G".\');6.X=I;6.1g=\'2G\'}7(6[6.d[\'17\']]==\'L\'){6[6.d[\'17\']]=3N;6.8[6.d[\'17\']]=3N}7(!6.8[6.d[\'G\']]){6.8[6.d[\'G\']]=(3P(h,6,\'1V\'))?\'18\':h[6.d[\'1V\']](C)}7(!6.8[6.d[\'17\']]){6.8[6.d[\'17\']]=(3P(h,6,\'2a\'))?\'18\':h[6.d[\'2a\']](C)}7(!6[6.d[\'17\']]){6[6.d[\'17\']]=6.8[6.d[\'17\']]}1h(6.8.D){F\'+1\':F\'-1\':F\'3b\':F\'3b+\':F\'3c\':F\'3c+\':6.35=6.8.D;6.8.D=I;V}7(!6.8.D){7(6.8[6.d[\'G\']]==\'18\'){6.8.D=\'18\'}E{7(A 6[6.d[\'G\']]==\'U\'){6.8.D=1z.3d(6[6.d[\'G\']]/6.8[6.d[\'G\']])}E{9 i=3Q(w.2H(),6,\'36\');6.8.D=1z.3d(i/6.8[6.d[\'G\']]);6[6.d[\'G\']]=6.8.D*6.8[6.d[\'G\']];7(!6.35)6.1g=I}7(6.8.D==\'5v\'||6.8.D<0){K(C,\'1P a 3R U 2I D 8: 5w 3e "1".\');6.8.D=1}6.8.D=3f(6.8.D,6)}}7(!6[6.d[\'G\']]){7(6.8.D!=\'18\'&&6.8[6.d[\'G\']]!=\'18\'){6[6.d[\'G\']]=6.8.D*6.8[6.d[\'G\']];6.1g=I}E{6[6.d[\'G\']]=\'18\'}}7(6.8.D==\'18\'){6.1C=C;6.3g=(6[6.d[\'G\']]==\'18\')?3Q(w.2H(),6,\'36\'):6[6.d[\'G\']];7(6.1g===I){6[6.d[\'G\']]=\'18\'}6.8.D=2J(h,6,0);7(6.8.D>z.8.J){6.8.D=z.8.J}}7(A 6.X==\'1o\'){6.X=0}7(A 6.1g==\'1o\'){6.1g=(6[6.d[\'G\']]==\'18\')?I:\'2G\'}6.8.1E=6.8.D;6.15=I;6.X=4t(6.X);7(6.1g==\'2b\')6.1g=\'19\';7(6.1g==\'3S\')6.1g=\'2c\';1h(6.1g){F\'2G\':F\'19\':F\'2c\':7(6[6.d[\'G\']]!=\'18\'){9 p=3h(2p(h,6),6);6.15=C;6.X[6.d[1]]=p[1];6.X[6.d[3]]=p[0]}V;2d:6.1g=I;6.15=(6.X[0]==0&&6.X[1]==0&&6.X[2]==0&&6.X[3]==0)?I:C;V}7(A 6.8.2q!=\'U\')6.8.2q=6.8.D;7(A 6.14.8!=\'U\')6.14.8=(6.1C)?\'18\':6.8.D;7(A 6.14.1d!=\'U\')6.14.1d=5x;6.L=2K($13,6.L,I,C);6.S=2K($13,6.S);6.T=2K($13,6.T);6.Z=2K($13,6.Z,C);6.L=$.1U(C,{},6.14,6.L);6.S=$.1U(C,{},6.14,6.S);6.T=$.1U(C,{},6.14,6.T);6.Z=$.1U(C,{},6.14,6.Z);7(A 6.Z.3i!=\'1a\')6.Z.3i=I;7(A 6.Z.3T!=\'y\')6.Z.3T=$.1y.1t.4u;7(A 6.L.1i!=\'1a\')6.L.1i=C;7(A 6.L.3U!=\'U\')6.L.3U=0;7(A 6.L.2e!=\'U\')6.L.2e=(6.L.1d<10)?5y:6.L.1d*5;7(6.L.4v){K(C,\'4w.4v-5z 1D 5A 5B 5C.\')}7(6.1F){6.1F=3V(6.1F)}7(6.K){K(C,\'3j G: \'+6.G);K(C,\'3j 17: \'+6.17);7(6[6.d[\'G\']]==\'18\')K(C,\'5D \'+6.d[\'G\']+\': \'+6.3g);K(C,\'4x 5E: \'+6.8.G);K(C,\'4x 5F: \'+6.8.17);K(C,\'3k 2I 8 D: \'+6.8.D);7(6.L.1i)K(C,\'3k 2I 8 3W 5G: \'+6.L.8);7(6.S.12)K(C,\'3k 2I 8 3W 4y: \'+6.S.8);7(6.T.12)K(C,\'3k 2I 8 3W 4z: \'+6.T.8)}};r.4A=y(){7(r.O(\'1W\')==\'3l\'||r.O(\'1W\')==\'5H\'){K(6.K,\'5I 5J-5K "1W" 5L 5M "5N" 4B "4C".\')}9 a={\'3X\':r.O(\'3X\'),\'1W\':r.O(\'1W\'),\'2b\':r.O(\'2b\'),\'2c\':r.O(\'2c\'),\'3S\':r.O(\'3S\'),\'19\':r.O(\'19\'),\'G\':r.O(\'G\'),\'17\':r.O(\'17\'),\'3Y\':r.O(\'3Y\'),\'1f\':r.O(\'1f\'),\'3a\':r.O(\'3a\'),\'3Z\':r.O(\'3Z\')};w.O(a).O({\'5O\':\'41\',\'1W\':(a.1W==\'3l\')?\'3l\':\'4C\'});r.1j(\'4D\',a).O({\'3X\':\'42\',\'1W\':\'3l\',\'2b\':0,\'19\':0,\'3Y\':0,\'1f\':0,\'3a\':0,\'3Z\':0});7(6.15){r.M().1N(y(){9 m=1X($(11).O(6.d[\'1f\']));7(2f(m))m=0;$(11).1j(\'1v\',m)})}};r.4E=y(){r.43();r.W(\'1G.Q\'+N,y(e){e.1k();r.H(\'1Y\');6.L.1i=I;z.1Z=\'44\'});r.W(\'5P.Q\'+N,y(e){});r.W(\'1Y.Q\'+N,y(e,g){e.1k();7(A g==\'1a\'){K(C,\'5Q a 4F 5R 1D 2n, 2o 2L "1G" 2M 1H.\');r.H(\'1G\');B}z.1Z=C;7(1q.3m.L!=1A)5S(1q.3m.L);7(1q.2g.L!=1A)4G(1q.2g.L);7(1q.2g.3n!=1A)4G(1q.2g.3n);9 a=6.L.2e-1q.2r,2h=3o-1z.2s(a*3o/6.L.2e);7(2h!=0){7(6.L.4H)6.L.4H.1b($13,2h,a)}});r.W(\'1i.Q\'+N,y(e,b,c,d){e.1k();r.H(\'1Y\');9 v=[b,c,d],t=[\'1e\',\'U\',\'1a\'],a=2t(v,t);9 b=a[0],c=a[1],d=a[2];7(b!=\'S\'&&b!=\'T\')b=z.1O;7(A c!=\'U\')c=0;7(d)6.L.1i=C;7(!6.L.1i){B e.1Q()}z.1Z=I;9 f=6.L.2e-1q.2r,4I=f+c;2h=3o-1z.2s(f*3o/6.L.2e);1q.3m.L=3p(y(){7(z.20){r.H(\'1i\',b)}E{1q.2r=0;r.H(b,6.L)}},4I);7(6.L.2u===\'5T\'){1q.2g.L=5U(y(){1q.2r+=50},50)}7(6.L.4J&&2h==0){6.L.4J.1b($13,2h,f)}7(6.L.4K){1q.2g.3n=3p(y(){6.L.4K.1b($13,2h,f)},c)}});r.W(\'S.Q\'+N+\' T.Q\'+N,y(e,b,f,g){e.1k();7(z.1Z==\'44\'||r.1D(\':41\')){e.1Q();B K(6.K,\'3j 44 4B 41: 1P 2N.\')}9 v=[b,f,g],t=[\'1l\',\'U/1e\',\'y\'],a=2t(v,t);9 b=a[0],f=a[1],g=a[2];7(A b!=\'1l\'||b==1A)b=6[e.2i];7(A g==\'y\')b.2O=g;7(A f!=\'U\'){7(f==\'D\'){7(!6.1C)f=6.8.D}E{7(A b.8==\'U\')f=b.8;E 7(A 6[e.2i].8==\'U\')f=6[e.2i].8;E 7(6.1C)f=\'D\';E f=6.8.D}}7(b.1d>0){7(z.20){7(b.1m)r.H(\'1m\',[e.2i,[b,f,g]]);e.1Q();B K(6.K,\'3j 5V 2N.\')}7(6.8.2q>=z.8.J){e.1Q();B K(6.K,\'1P 4L 8 (\'+z.8.J+\', \'+6.8.2q+\' 4M): 1P 2N.\')}}1q.2r=0;7(b.45&&!b.45.1b($13)){e.1Q();B K(6.K,\'5W "45" 5X I.\')}r.H(\'4N\'+e.2i,[b,f]);7(6.1F){9 s=6.1F,c=[b,f];1u(9 j=0,l=s.Y;j<l;j++){9 d=e.2i;7(!s[j][1])c[0]=s[j][0].2P(\'2v\',e.2i);7(!s[j][2])d=(d==\'S\')?\'T\':\'S\';c[1]=f+s[j][3];s[j][0].H(\'4N\'+d,c)}}});r.W(\'5Y.Q\'+N,y(e,d,f){e.1k();9 g=r.M();7(!6.1B){7(z.8.P==0){7(6.2w){r.H(\'T\',z.8.J-1)}B e.1Q()}}7(6.15)1r(g,6);7(6.1C){7(A f!=\'U\'){f=46(g,6,z.8.J-1)}}7(!6.1B){7(z.8.J-f<z.8.P){f=z.8.J-z.8.P}}7(6.1C){9 h=2J(g,6,z.8.J-f);6.8.1E=6.8.D;6.8.D=3f(h,6)}7(6.15)1r(g,6,C);7(f==0){e.1Q();B K(6.K,\'0 8 3e 14: 1P 2N.\')}K(6.K,\'4O \'+f+\' 8 4y.\');z.8.P+=f;2Q(z.8.P>=z.8.J)z.8.P-=z.8.J;7(!6.1B){7(z.8.P==0&&d.3q)d.3q.1b($13);7(!6.2w)21(6,z.8.P)}r.M().16(z.8.J-f).5Z(r);7(z.8.J<6.8.D+f){r.M().16(0,(6.8.D+f)-z.8.J).3r(C).2R(r)}9 g=r.M(),1R=4P(g,6,f),1w=4Q(g,6),2j=g.1I(f-1),22=1R.2k(),2l=1w.2k();7(6.15)1r(g,6);7(6.1g)9 p=3h(1w,6);7(d.1p==\'4R\'&&6.8.1E<f){9 i=g.16(6.8.1E,f).2S(),3s=6.8[6.d[\'G\']];6.8[6.d[\'G\']]=\'18\'}E{9 i=I}9 j=2x(g.16(0,f),6,\'G\'),1J=3t(23(1w,6,C),6,!6.15);7(i)6.8[6.d[\'G\']]=3s;7(6.15){1r(g,6,C);1r(22,6,6.X[6.d[1]]);1r(2j,6,6.X[6.d[3]])}7(6.1g){6.X[6.d[1]]=p[1];6.X[6.d[3]]=p[0]}9 k={},47={},2y={},2z={},R=d.1d;7(d.1p==\'42\')R=0;E 7(R==\'L\')R=6.14.1d/6.14.8*f;E 7(R<=0)R=0;E 7(R<10)R=j/R;9 l={1d:R,1n:d.1n};7(d.3u)d.3u.1b($13,1R,1w,1J,R);7(6.15){9 m=6.X[6.d[3]];2y[6.d[\'1f\']]=2j.1j(\'1v\');47[6.d[\'1f\']]=2l.1j(\'1v\')+6.X[6.d[1]];2z[6.d[\'1f\']]=22.1j(\'1v\');2j.1G().1x(2y,l);22.1G().1x(2z,l);2l.1G().1x(47,l)}E{9 m=0}k[6.d[\'19\']]=m;7(6[6.d[\'G\']]==\'18\'||6[6.d[\'17\']]==\'18\'){w.1G().1x(1J,l)}1h(d.1p){F\'1K\':F\'24\':F\'1L\':9 n=r.3r().2R(w);V}1h(d.1p){F\'1L\':n.M().16(0,f).1s();F\'1K\':F\'24\':n.M().16(6.8.D).1s();V}1h(d.1p){F\'25\':1S(d,r,0,R);V;F\'1K\':n.O({\'3v\':0});1S(d,n,1,R);1S(d,r,1,R,y(){n.1s()});V;F\'24\':48(d,r,n,6,R,C);V;F\'1L\':4a(d,r,n,6,R,C,f);V}1h(d.1p){F\'25\':F\'1K\':F\'24\':F\'1L\':3w=R;R=0;V}z.20=C;9 o=f;r.O(6.d[\'19\'],-j);r.1x(k,{1d:R,1n:d.1n,2T:y(){z.20=I;9 a=6.8.D+o-z.8.J;7(a>0){r.M().16(z.8.J).1s();1R=r.M().16(z.8.J-(o-a)).4S().60(r.M().16(0,a).4S())}7(i)i.3x();7(6.15){9 b=r.M().1I(6.8.D+o-1);b.O(6.d[\'1f\'],b.1j(\'1v\'))}9 c=y(){7(d.2O){d.2O.1b($13,1R,1w,1J)}1h(d.1p){F\'25\':F\'1K\':r.O(\'4T\',\'\');V}7(1m.Y){3p(y(){r.H(1m[0][0],1m[0][1]);1m.4U()},1)}};1h(d.1p){F\'25\':F\'1L\':1S(d,r,1,3w,c);V;2d:c();V}}});r.H(\'2m\',[I,1J]).H(\'1i\',R)});r.W(\'61.Q\'+N,y(e,f,g){e.1k();9 h=r.M();7(!6.1B){7(z.8.P==6.8.D){7(6.2w){r.H(\'S\',z.8.J-1)}B e.1Q()}}7(6.15)1r(h,6);7(6.1C){7(A g!=\'U\'){g=6.8.D}}9 i=(z.8.P==0)?z.8.J:z.8.P;7(!6.1B){7(6.1C){9 j=2J(h,6,g),4b=46(h,6,i-1)}E{9 j=6.8.D,4b=6.8.D}7(g+j>i){g=i-4b}}7(6.1C){9 j=4c(h,6,g,i);2Q(6.8.D-g>=j&&g<z.8.J){g++;j=4c(h,6,g,i)}6.8.1E=6.8.D;6.8.D=3f(j,6)}7(6.15)1r(h,6,C);7(g==0){e.1Q();B K(6.K,\'0 8 3e 14: 1P 2N.\')}K(6.K,\'4O \'+g+\' 8 4z.\');z.8.P-=g;2Q(z.8.P<0)z.8.P+=z.8.J;7(!6.1B){7(z.8.P==6.8.D&&f.3q)f.3q.1b($13);7(!6.2w)21(6,z.8.P)}7(z.8.J<6.8.D+g){r.M().16(0,(6.8.D+g)-z.8.J).3r(C).2R(r)}9 h=r.M(),1R=4d(h,6),1w=4e(h,6,g),2j=h.1I(g-1),22=1R.2k(),2l=1w.2k();7(6.15)1r(h,6);7(6.1g)9 p=3h(1w,6);7(f.1p==\'4R\'&&6.8.1E<g){9 k=h.16(6.8.1E,g).2S(),3s=6.8[6.d[\'G\']];6.8[6.d[\'G\']]=\'18\'}E{9 k=I}9 l=2x(h.16(0,g),6,\'G\'),1J=3t(23(1w,6,C),6,!6.15);7(k)6.8[6.d[\'G\']]=3s;7(6.15){1r(h,6,C);1r(22,6,6.X[6.d[1]]);1r(2l,6,6.X[6.d[1]])}7(6.1g){6.X[6.d[1]]=p[1];6.X[6.d[3]]=p[0]}9 m={},2z={},2y={},R=f.1d;7(f.1p==\'42\')R=0;E 7(R==\'L\')R=6.14.1d/6.14.8*g;E 7(R<=0)R=0;E 7(R<10)R=l/R;9 n={1d:R,1n:f.1n};7(f.3u)f.3u.1b($13,1R,1w,1J,R);7(6.15){2z[6.d[\'1f\']]=22.1j(\'1v\');2y[6.d[\'1f\']]=2j.1j(\'1v\')+6.X[6.d[3]];2l.O(6.d[\'1f\'],2l.1j(\'1v\')+6.X[6.d[1]]);22.1G().1x(2z,n);2j.1G().1x(2y,n)}m[6.d[\'19\']]=-l;7(6[6.d[\'G\']]==\'18\'||6[6.d[\'17\']]==\'18\'){w.1G().1x(1J,n)}1h(f.1p){F\'1K\':F\'24\':F\'1L\':9 o=r.3r().2R(w);V}1h(f.1p){F\'1K\':F\'24\':o.M().16(0,g).1s();o.M().16(6.8.D).1s();V;F\'1L\':o.M().16(6.8.1E).1s();V}1h(f.1p){F\'25\':1S(f,r,0,R);V;F\'1K\':o.O({\'3v\':0});1S(f,o,1,R);1S(f,r,1,R,y(){o.1s()});V;F\'24\':48(f,r,o,6,R,I);V;F\'1L\':4a(f,r,o,6,R,I,g);V}1h(f.1p){F\'25\':F\'1K\':F\'24\':F\'1L\':3w=R;R=0;V}z.20=C;9 q=g;r.1x(m,{1d:R,1n:f.1n,2T:y(){z.20=I;9 a=6.8.D+q-z.8.J,4V=(6.15)?6.X[6.d[3]]:0;r.O(6.d[\'19\'],4V);7(a>0){r.M().16(z.8.J).1s()}9 b=r.M().16(0,q).2R(r).2k();7(a>0){1w=2p(h,6)}7(k)k.3x();7(6.15){7(z.8.J<6.8.D+q){9 c=r.M().1I(6.8.D-1);c.O(6.d[\'1f\'],c.1j(\'1v\')+6.X[6.d[3]])}b.O(6.d[\'1f\'],b.1j(\'1v\'))}9 d=y(){7(f.2O){f.2O.1b($13,1R,1w,1J)}1h(f.1p){F\'25\':F\'1K\':r.O(\'4T\',\'\');V}7(1m.Y){3p(y(){r.H(1m[0][0],1m[0][1]);1m.4U()},1)}};1h(f.1p){F\'25\':F\'1L\':1S(f,r,1,3w,d);V;2d:d();V}}});r.H(\'2m\',[I,1J]).H(\'1i\',R)});r.W(\'2A.Q\'+N,y(e,b,c,d,f,g){e.1k();9 v=[b,c,d,f,g],t=[\'1e/U/1l\',\'U\',\'1a\',\'1l\',\'1e\'],a=2t(v,t);9 f=a[3],g=a[4];b=2U(a[0],a[1],a[2],z.8,r);7(b==0)B;7(A f!=\'1l\')f=I;7(z.20){7(A f!=\'1l\'||f.1d>0)B}7(g!=\'S\'&&g!=\'T\'){7(6.1B){7(b<=z.8.J/2)g=\'T\';E g=\'S\'}E{7(z.8.P==0||z.8.P>b)g=\'T\';E g=\'S\'}}7(g==\'S\')r.H(\'S\',[f,z.8.J-b]);E r.H(\'T\',[f,b])});r.W(\'4W.Q\'+N,y(e){7(z.8.P>0){r.62(r.M().16(z.8.P))}});r.W(\'1F.Q\'+N,y(e,s){7(s)s=3V(s);E 7(6.1F)s=6.1F;E B K(6.K,\'4q 4F 3e 1F.\');9 n=r.2P(\'2V\');1u(9 j=0,l=s.Y;j<l;j++){s[j][0].H(\'2A\',[n,s[j][3],C])}});r.W(\'1m.Q\'+N,y(e,a,b){7(A a==\'1o\'){B 1m}E 7(A a==\'y\'){a.1b($13,1m)}E 7(2W(a)){1m=a}E{1m.63([a,b])}});r.W(\'64.Q\'+N,y(e,b,c,d,f){e.1k();9 v=[b,c,d,f],t=[\'1e/1l\',\'1e/U/1l\',\'1a\',\'U\'],a=2t(v,t);9 b=a[0],c=a[1],d=a[2],f=a[3];7(A b==\'1l\'&&A b.2X==\'1o\')b=$(b);7(A b==\'1e\')b=$(b);7(A b!=\'1l\'||A b.2X==\'1o\'||b.Y==0)B K(6.K,\'1P a 3R 1l.\');7(A c==\'1o\')c=\'3y\';7(6.15){b.1N(y(){9 m=1X($(11).O(6.d[\'1f\']));7(2f(m))m=0;$(11).1j(\'1v\',m)})}9 g=c,2Y=\'2Y\';7(c==\'3y\'){7(d){7(z.8.P==0){c=z.8.J-1;2Y=\'4X\'}E{c=z.8.P;z.8.P+=b.Y}7(c<0)c=0}E{c=z.8.J-1;2Y=\'4X\'}}E{c=2U(c,f,d,z.8,r)}7(g!=\'3y\'&&!d){7(c<z.8.P)z.8.P+=b.Y}7(z.8.P>=z.8.J)z.8.P-=z.8.J;9 h=r.M().1I(c);7(h.Y){h[2Y](b)}E{r.4Y(b)}z.8.J=r.M().Y;r.H(\'2Z\');9 i=31(r,6);2B(6,z.8.J);21(6,z.8.P);r.H(\'2m\',[C,i])});r.W(\'65.Q\'+N,y(e,b,c,d){e.1k();9 v=[b,c,d],t=[\'1e/U/1l\',\'1a\',\'U\'],a=2t(v,t);9 b=a[0],c=a[1],d=a[2];7(A b==\'1o\'||b==\'3y\'){r.M().2k().1s()}E{b=2U(b,d,c,z.8,r);9 f=r.M().1I(b);7(f.Y){7(b<z.8.P)z.8.P-=f.Y;f.1s()}}z.8.J=r.M().Y;9 g=31(r,6);2B(6,z.8.J);21(6,z.8.P);r.H(\'2m\',[C,g])});r.W(\'2V.Q\'+N,y(e,a){e.1k();7(z.8.P==0)9 b=0;E 9 b=z.8.J-z.8.P;7(A a==\'y\')a.1b($13,b);B b});r.W(\'4Z.Q\'+N,y(e,a){e.1k();9 b=1z.2s(z.8.J/6.8.D-1);7(z.8.P==0)9 c=0;E 7(z.8.P<z.8.J%6.8.D)9 c=0;E 7(z.8.P==6.8.D&&!6.1B)9 c=b;E 9 c=1z.66((z.8.J-z.8.P)/6.8.D);7(c<0)c=0;7(c>b)c=b;7(A a==\'y\')a.1b($13,c);B c});r.W(\'67.Q\'+N,y(e,a){e.1k();$i=2p(r.M(),6);7(A a==\'y\')a.1b($13,$i);B $i});r.W(\'1Z.Q\'+N,y(e,a){e.1k();7(A a==\'y\')a.1b($13,z.1Z);B z.1Z});r.W(\'2v.Q\'+N,y(e,a,b,c){e.1k();9 d=I;7(A a==\'y\'){a.1b($13,6)}E 7(A a==\'1l\'){29=$.1U(C,{},29,a);7(b!==I)d=C;E 6=$.1U(C,{},6,a)}E 7(A a!=\'1o\'){7(A b==\'y\'){9 f=3z(\'6.\'+a);7(A f==\'1o\')f=\'\';b.1b($13,f)}E 7(A b!=\'1o\'){7(A c!==\'1a\')c=C;3z(\'29.\'+a+\' = b\');7(c!==I)d=C;E 3z(\'6.\'+a+\' = b\')}E{B 3z(\'6.\'+a)}}7(d){1r(r.M(),6);r.3K(29);9 g=31(r,6);2B(6,z.8.J);21(6,z.8.P);r.H(\'2m\',[C,g])}B 6});r.W(\'2Z.Q\'+N,y(e,a,b){e.1k();7(A a==\'1o\'||a.Y==0)a=$(\'68\');E 7(A a==\'1e\')a=$(a);7(A a!=\'1l\')B K(6.K,\'1P a 3R 1l.\');7(A b!=\'1e\'||b.Y==0)b=\'a.51\';a.69(b).1N(y(){9 h=11.52||\'\';7(h.Y>0&&r.M().53($(h))!=-1){$(11).26(\'4f\').4f(y(e){e.1T();r.H(\'2A\',h)})}})});r.W(\'2m.Q\'+N,y(e,b,c){e.1k();7(!6.Z.1c)B;7(A b==\'1a\'&&b){6.Z.1c.M().1s();1u(9 a=0,l=1z.2s(z.8.J/6.8.D);a<l;a++){9 i=r.M().1I(2U(a*6.8.D,0,C,z.8,r));6.Z.1c.4Y(6.Z.3T(a+1,i))}6.Z.1c.M().26(6.Z.1H).1N(y(a){$(11).W(6.Z.1H,y(e){e.1T();r.H(\'2A\',[a*6.8.D,0,C,6.Z])})})}9 d=r.2P(\'4Z\');6.Z.1c.M().32(\'54\').1I(d).3A(\'54\')});r.W(\'2C.Q\'+N,y(e,a){e.1k();7(a){r.H(\'4W\')}7(6.15){1r(r.M(),6)}r.H(\'1Y\').O(r.1j(\'4D\'));r.43();r.4g();w.6a(r)})};r.43=y(){r.26(\'.Q\'+N)};r.55=y(){r.4g();2B(6,z.8.J);21(6,z.8.P);7(6.L.2u){w.W(\'3B.Q\'+N,y(){r.H(\'1Y\')}).W(\'3C.Q\'+N,y(){r.H(\'1i\')})}7(6.S.12){6.S.12.W(6.S.1H+\'.Q\'+N,y(e){e.1T();r.H(\'S\')});7(6.S.2u){6.S.12.W(\'3B.Q\'+N,y(){r.H(\'1Y\')}).W(\'3C.Q\'+N,y(){r.H(\'1i\')})}}7(6.T.12){6.T.12.W(6.T.1H+\'.Q\'+N,y(e){e.1T();r.H(\'T\')});7(6.T.2u){6.T.12.W(\'3B.Q\'+N,y(){r.H(\'1Y\')}).W(\'3C.Q\'+N,y(){r.H(\'1i\')})}}7($.1y.1M){7(6.S.1M){w.1M(y(e,a){7(a>0){e.1T();3D=(A 6.S.1M==\'U\')?6.S.1M:1A;r.H(\'S\',3D)}})}7(6.T.1M){w.1M(y(e,a){7(a<0){e.1T();3D=(A 6.T.1M==\'U\')?6.T.1M:1A;r.H(\'T\',3D)}})}}7($.1y.56){9 b=(6.S.4h)?y(){r.H(\'S\')}:1A,33=(6.T.4h)?y(){r.H(\'T\')}:1A;7(33||33){9 c={\'6b\':30,\'6c\':30,\'6d\':C};1h(6.1O){F\'3M\':F\'57\':c.6e=33;c.6f=b;V;2d:c.6g=33;c.6h=b}w.56(c)}}7(6.Z.1c){7(6.Z.2u){6.Z.1c.W(\'3B.Q\'+N,y(){r.H(\'1Y\')}).W(\'3C.Q\'+N,y(){r.H(\'1i\')})}}7(6.S.27||6.T.27){$(4i).W(\'59.Q\'+N,y(e){9 k=e.5a;7(k==6.T.27){e.1T();r.H(\'T\')}7(k==6.S.27){e.1T();r.H(\'S\')}})}7(6.Z.3i){$(4i).W(\'59.Q\'+N,y(e){9 k=e.5a;7(k>=49&&k<58){k=(k-49)*6.8.D;7(k<=z.8.J){e.1T();r.H(\'2A\',[k,0,C,6.Z])}}})}7(6.L.1i){r.H(\'1i\',6.L.3U)}};r.4g=y(){$(4i).26(\'.Q\'+N);w.26(\'.Q\'+N);7(6.S.12)6.S.12.26(\'.Q\'+N);7(6.T.12)6.T.12.26(\'.Q\'+N);7(6.Z.1c)6.Z.1c.26(\'.Q\'+N);2B(6,\'2S\');21(6,\'32\');7(6.Z.1c){6.Z.1c.M().1s()}};r.2v=y(a,b){K(C,\'2F "2v" 3E 3F 1D 2n, 2o 2L "2v" 2M 1H.\');9 c=I;9 d=y(a){c=a};7(!a)a=d;7(!b)b=d;r.H(\'2v\',[a,b]);B c};r.5b=y(){K(C,\'2F "5b" 3E 3F 1D 2n, 2o 2L "2V" 2M 1H.\');B r.2P(\'2V\')};r.2C=y(){K(C,\'2F "2C" 3E 3F 1D 2n, 2o 2L "2C" 2M 1H.\');r.H(\'2C\');B r};r.5c=y(a,b){K(C,\'2F "5c" 3E 3F 1D 2n, 2o 2L "2Z" 2M 1H.\');r.H(\'2Z\',[a,b]);B r};7(r.2H().1D(\'.5d\')){9 u=r.2P(\'2V\');r.H(\'2C\',C)}E{9 u=I}9 w=r.6i(\'<6j 6k="5d" />\').2H(),z={\'1O\':\'T\',\'1Z\':C,\'20\':I,\'8\':{\'J\':r.M().Y,\'P\':0}},1q={\'2r\':0,\'2g\':{\'L\':1A,\'3n\':1A},\'3m\':{\'L\':1A}},6={},29=o,1m=[],N=$.1y.1t.N++;r.3K(29,C,u);r.4A();r.4E();r.55();7(6.8.2E!=0){9 s=6.8.2E;7(s===C){s=3G.6l.52;7(!s.Y)s=0}E 7(s===\'5e\'){s=1z.3d(1z.5e()*z.8.J)}r.H(\'2A\',[s,0,C,{1d:0},\'T\'])}9 x=31(r,6,I),5f=2p(r.M(),6);7(6.5g){6.5g.1b($13,5f,x)}r.H(\'2m\',[C,x]);r.H(\'2Z\');B 11};$.1y.1t.N=0;$.1y.1t.3L={\'K\':I,\'1F\':I,\'2w\':C,\'1B\':C,\'1O\':\'19\',\'8\':{\'2E\':0},\'14\':{\'1n\':\'6m\',\'2u\':I,\'1M\':I,\'4h\':I,\'1H\':\'4f\',\'1m\':I}};$.1y.1t.4u=y(a,b){B\'<a 6n="#"><5h>\'+a+\'</5h></a>\'};y 1S(a,c,x,d,f){9 o={\'1d\':d,\'1n\':a.1n};7(A f==\'y\')o.2T=f;c.1x({3v:x},o)}y 48(a,b,c,o,d,e){9 f=23(4d(b.M(),o),o,C)[0],4j=23(c.M(),o,C)[0],3H=(e)?-4j:f,28={},2D={};28[o.d[\'G\']]=4j;28[o.d[\'19\']]=3H;2D[o.d[\'19\']]=0;b.1x({3v:\'+=0\'},d);c.O(28).1x(2D,{1d:d,1n:a.1n,2T:y(){$(11).1s()}})}y 4a(a,b,c,o,d,e,n){9 f=23(4e(b.M(),o,n),o,C)[0],4k=23(c.M(),o,C)[0],3H=(e)?-4k:f,28={},2D={};28[o.d[\'G\']]=4k;28[o.d[\'19\']]=0;2D[o.d[\'19\']]=3H;c.O(28).1x(2D,{1d:d,1n:a.1n,2T:y(){$(11).1s()}})}y 2B(o,t){7(t==\'3x\'||t==\'2S\'){9 f=t}E 7(o.8.2q>=t){K(o.K,\'1P 4L 8: 6o 6p (\'+t+\' 8, \'+o.8.2q+\' 4M).\');9 f=\'2S\'}E{9 f=\'3x\'}7(o.S.12)o.S.12[f]();7(o.T.12)o.T.12[f]();7(o.Z.1c)o.Z.1c[f]()}y 21(o,f){7(o.1B||o.2w)B;9 a=(f==\'32\'||f==\'3A\')?f:I;7(o.T.12){9 b=a||(f==o.8.D)?\'3A\':\'32\';o.T.12[b](\'5i\')}7(o.S.12){9 b=a||(f==0)?\'3A\':\'32\';o.S.12[b](\'5i\')}}y 2t(c,d){9 e=[];1u(9 a=0,5j=c.Y;a<5j;a++){1u(9 b=0,5k=d.Y;b<5k;b++){7(d[b].3I(A c[a])>-1&&!e[b]){e[b]=c[a];V}}}B e}y 3V(s){7(!2W(s))s=[[s]];7(!2W(s[0]))s=[s];1u(9 j=0,l=s.Y;j<l;j++){7(A s[j][0]==\'1e\')s[j][0]=$(s[j][0]);7(A s[j][1]!=\'1a\')s[j][1]=C;7(A s[j][2]!=\'1a\')s[j][2]=C;7(A s[j][3]!=\'U\')s[j][3]=0}B s}y 4l(k){7(k==\'2c\')B 39;7(k==\'19\')B 37;7(k==\'3M\')B 38;7(k==\'57\')B 40;B-1}y 34(a,b){7(A b==\'y\')b=b.1b(a);7(A b==\'1o\')b={};B b}y 2K(a,b,c,d){7(A c!=\'1a\')c=I;7(A d!=\'1a\')d=I;b=34(a,b);7(A b==\'1e\'){9 e=4l(b);7(e==-1)b=$(b);E b=e}7(c){7(A b==\'1a\')b={\'3i\':b};7(A b.2X!=\'1o\')b={\'1c\':b};7(A b.1c==\'y\')b.1c=b.1c.1b(a);7(A b.1c==\'1e\')b.1c=$(b.1c)}E 7(d){7(A b==\'1a\')b={\'1i\':b};7(A b==\'U\')b={\'2e\':b}}E{7(A b.2X!=\'1o\')b={\'12\':b};7(A b==\'U\')b={\'27\':b};7(A b.12==\'y\')b.12=b.12.1b(a);7(A b.12==\'1e\')b.12=$(b.12);7(A b.27==\'1e\')b.27=4l(b.27)}B b}y 2U(a,b,c,d,e){7(A a==\'1e\'){7(2f(a))a=$(a);E a=1X(a)}7(A a==\'1l\'){7(A a.2X==\'1o\')a=$(a);a=e.M().53(a);7(a==-1)a=0;7(A c!=\'1a\')c=I}E{7(A c!=\'1a\')c=C}7(2f(a))a=0;E a=1X(a);7(2f(b))b=0;E b=1X(b);7(c){a+=d.P}a+=b;7(d.J>0){2Q(a>=d.J){a-=d.J}2Q(a<0){a+=d.J}}B a}y 2p(i,o){B i.16(0,o.8.D)}y 4P(i,o,n){B i.16(n,o.8.1E+n)}y 4Q(i,o){B i.16(0,o.8.D)}y 4d(i,o){B i.16(0,o.8.1E)}y 4e(i,o,n){B i.16(n,o.8.D+n)}y 46(i,o,s){9 t=0,x=0;1u(9 a=s;a>=0;a--){t+=i.1I(a)[o.d[\'1V\']](C);7(t>o.3g)B x;7(a==0)a=i.Y;x++}}y 2J(i,o,s){9 t=0,x=0;1u(9 a=s,l=i.Y-1;a<=l;a++){t+=i.1I(a)[o.d[\'1V\']](C);7(t>o.3g)B x;7(a==l)a=-1;x++}}y 4c(i,o,s,l){9 v=2J(i,o,s);7(!o.1B){7(s+v>l)v=l-s}B v}y 1r(i,o,m){9 x=(A m==\'1a\')?m:I;7(A m!=\'U\')m=0;i.1N(y(){9 t=1X($(11).O(o.d[\'1f\']));7(2f(t))t=0;$(11).1j(\'5l\',t);$(11).O(o.d[\'1f\'],((x)?$(11).1j(\'5l\'):m+$(11).1j(\'1v\')))})}y 23(i,o,a){5m=2x(i,o,\'G\',a);5n=4m(i,o,\'17\',a);B[5m,5n]}y 4m(i,o,a,b){7(A b!=\'1a\')b=I;7(A o[o.d[a]]==\'U\'&&b)B o[o.d[a]];7(A o.8[o.d[a]]==\'U\')B o.8[o.d[a]];9 c=(a.4n().3I(\'G\')>-1)?\'1V\':\'2a\';B 3O(i,o,c)}y 3O(i,o,a){9 s=0;i.1N(y(){9 m=$(11)[o.d[a]](C);7(s<m)s=m});B s}y 3Q(b,o,c){9 d=b[o.d[c]](),4o=(o.d[c].4n().3I(\'G\')>-1)?[\'6q\',\'6r\']:[\'6s\',\'6t\'];1u(a=0,l=4o.Y;a<l;a++){9 m=1X(b.O(4o[a]));7(2f(m))m=0;d-=m}B d}y 2x(i,o,a,b){7(A b!=\'1a\')b=I;7(A o[o.d[a]]==\'U\'&&b)B o[o.d[a]];7(A o.8[o.d[a]]==\'U\')B o.8[o.d[a]]*i.Y;9 d=(a.4n().3I(\'G\')>-1)?\'1V\':\'2a\',s=0;i.1N(y(){9 j=$(11);7(j.1D(\':D\')){s+=j[o.d[d]](C)}});B s}y 3P(i,o,a){9 s=I,v=I;i.1N(y(){c=$(11)[o.d[a]](C);7(s===I)s=c;E 7(s!=c)v=C;7(s==0)v=C});B v}y 3t(a,o,p){7(A p!=\'1a\')p=C;9 b=(o.15&&p)?o.X:[0,0,0,0];9 c={};c[o.d[\'G\']]=a[0]+b[1]+b[3];c[o.d[\'17\']]=a[1]+b[0]+b[2];B c}y 31(a,o,p){9 b=a.2H(),$i=a.M(),$v=2p($i,o),3J=3t(23($v,o,C),o,p);b.O(3J);7(o.15){9 c=$v.2k();c.O(o.d[\'1f\'],c.1j(\'1v\')+o.X[o.d[1]]);a.O(o.d[\'2b\'],o.X[o.d[0]]);a.O(o.d[\'19\'],o.X[o.d[3]])}a.O(o.d[\'G\'],3J[o.d[\'G\']]+(2x($i,o,\'G\')*2));a.O(o.d[\'17\'],4m($i,o,\'17\'));B 3J}y 4t(p){7(A p==\'1o\')B[0,0,0,0];7(A p==\'U\')B[p,p,p,p];E 7(A p==\'1e\')p=p.5o(\'6u\').6v(\'\').5o(\' \');7(!2W(p)){B[0,0,0,0]}1u(9 i=0;i<4;i++){p[i]=1X(p[i])}1h(p.Y){F 0:B[0,0,0,0];F 1:B[p[0],p[0],p[0],p[0]];F 2:B[p[0],p[1],p[0],p[1]];F 3:B[p[0],p[1],p[2],p[1]];2d:B[p[0],p[1],p[2],p[3]]}}y 3h(a,o){9 x=(A o[o.d[\'G\']]==\'U\')?1z.2s(o[o.d[\'G\']]-2x(a,o,\'G\')):0;1h(o.1g){F\'19\':B[0,x];V;F\'2c\':B[x,0];V;F\'2G\':2d:9 b=1z.2s(x/2),5p=1z.3d(x/2);B[b,5p];V}}y 3f(x,o){1h(o.35){F\'+1\':B x+1;V;F\'-1\':B x-1;V;F\'3b\':7(x%2==0)B x-1;V;F\'3b+\':7(x%2==0)B x+1;V;F\'3c\':7(x%2==1)B x-1;V;F\'3c+\':7(x%2==1)B x+1;V;2d:B x;V}}y 2W(a){B A(a)==\'1l\'&&(a 6w 6x)}y K(d,m){7(!d)B I;7(A m==\'1e\')m=\'1t: \'+m;E m=[\'1t:\',m];7(3G.4p&&3G.4p.5q)3G.4p.5q(m);B I}$.1y.51=y(o){B 11.1t(o)}})(4w);',62,406,'||||||opts|if|items|var|||||||||||||||||||||||||function|conf|typeof|return|true|visible|else|case|width|trigger|false|total|debug|auto|children|serial|css|first|cfs|a_dur|prev|next|number|break|bind|padding|length|pagination||this|button|tt0|scroll|usePadding|slice|height|variable|left|boolean|call|container|duration|string|marginRight|align|switch|play|data|stopPropagation|object|queue|easing|undefined|fx|tmrs|resetMargin|remove|carouFredSel|for|cfs_origCssMargin|c_new|animate|fn|Math|null|circular|variableVisible|is|oldVisible|synchronise|stop|event|eq|w_siz|crossfade|uncover|mousewheel|each|direction|Not|stopImmediatePropagation|c_old|fx_fade|preventDefault|extend|outerWidth|position|parseInt|pause|isPaused|isAnimated|nv_enableNavi|l_old|ms_getSizes|cover|fade|unbind|key|css_o|opts_orig|outerHeight|top|right|default|pauseDuration|isNaN|intervals|perc|type|l_cur|last|l_new|updatePageStatus|deprecated|use|getCurrentItems|minimum|pausePassed|ceil|sortParams|pauseOnHover|configuration|infinite|ms_getTotalSize|a_cur|a_old|slideTo|nv_showNavi|destroy|ani_o|start|The|center|parent|of|getVisibleItemsNext|getNaviObject|the|custom|scrolling|onAfter|triggerHandler|while|appendTo|hide|complete|getItemIndex|currentPosition|is_array|jquery|before|linkAnchors||setSizes|removeClass|wN|getObject|visibleAdjust|innerWidth||||marginBottom|odd|even|floor|to|cf_getVisibleItemsAdjust|maxDimention|cf_getAlignPadding|keys|Carousel|Number|absolute|timeouts|timer|100|setTimeout|onEnd|clone|orgW|mapWrapperSizes|onBefore|opacity|f_dur|show|end|eval|addClass|mouseenter|mouseleave|num|public|method|window|cur_l|indexOf|sz|init|defaults|up|lrgst_b|ms_getTrueLargestSize|ms_hasVariableSizes|ms_getTrueInnerSize|valid|bottom|anchorBuilder|delay|getSynchArr|scrolled|float|marginTop|marginLeft||hidden|none|unbind_events|stopped|conditions|getVisibleItemsPrev|a_new|fx_cover||fx_uncover|xI|getVisibleItemsNextTestCircular|getOldItemsNext|getNewItemsNext|click|unbind_buttons|wipe|document|new_w|old_w|getKeyCode|ms_getLargestSize|toLowerCase|arr|console|No|innerHeight|dx|cf_getPadding|pageAnchorBuilder|nap|jQuery|Item|backward|forward|build|or|relative|cfs_origCss|bind_events|carousel|clearInterval|onPausePause|dur2|onPauseEnd|onPauseStart|enough|needed|slide_|Scrolling|getOldItemsPrev|getNewItemsPrev|directscroll|get|filter|shift|new_m|jumpToStart|after|append|currentPage||caroufredsel|hash|index|selected|bind_buttons|touchwipe|down||keyup|keyCode|current_position|link_anchors|caroufredsel_wrapper|random|itm|onCreate|span|disabled|l1|l2|cfs_tempCssMargin|s1|s2|split|x2|log|element|found|selector|option|Infinity|Set|500|2500|plugin|no|longer|supported|Available|widths|heights|automatically|fixed|Carousels|CSS|attribute|should|be|static|overflow|finish|Pause|globally|clearTimeout|resume|setInterval|currently|Callback|returned|slide_prev|prependTo|concat|slide_next|prepend|push|insertItem|removeItem|round|currentVisible|body|find|replaceWith|min_move_x|min_move_y|preventDefaultEvents|wipeUp|wipeDown|wipeLeft|wipeRight|wrap|div|class|location|swing|href|hiding|navigation|paddingLeft|paddingRight|paddingTop|paddingBottom|px|join|instanceof|Array'.split('|'),0,{}));
/*	
 *	jQuery carouFredSel 4.5.2
 *	Demo's and documentation:
 *	caroufredsel.frebsite.nl
 *	
 *	Copyright (c) 2011 Fred Heusschen
 *	www.frebsite.nl
 *
 *	Dual licensed under the MIT and GPL licenses.
 *	http://en.wikipedia.org/wiki/MIT_License
 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
 */


(function($) {
	if ($.fn.carouFredSel) return;

	$.fn.carouFredSel = function(o) {
		if (this.length == 0) {
			debug(true, 'No element found for "'+this.selector+'".');
			return this;
		}
		if (this.length > 1) {
			return this.each(function() {
				$(this).carouFredSel(o);
			});
		}

		var $cfs = this,
			$tt0 = this[0];

		$cfs.init = function(o, setOrig, start) {
			var obs = ['items', 'scroll', 'auto', 'prev', 'next', 'pagination'];
			o = getObject($tt0, o);
			for (var a = 0, l = obs.length; a < l; a++) {
				o[obs[a]] = getObject($tt0, o[obs[a]]);
			}
			if (typeof o.scroll == 'number') {
				if (o.scroll <= 50)					o.scroll	= { 'items'		: o.scroll 	};
				else								o.scroll	= { 'duration'	: o.scroll 	};
			} else {
				if (typeof o.scroll == 'string')	o.scroll	= { 'easing'	: o.scroll 	};
			}
				 if (typeof o.items == 'number')	o.items		= { 'visible'	: o.items 	};
			else if (		o.items == 'variable')	o.items		= { 'visible'	: o.items,
																	'width'		: o.items, 
																	'height'	: o.items	};

			if (setOrig) opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);

			opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
			opts.d = {};
			opts.variableVisible = false;
			opts.visibleAdjust = false;

			if (opts.items.start == 0 && typeof start == 'number') {
				opts.items.start = start;
			}

			conf.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';

			var dims = [
				['width'	, 'innerWidth'	, 'outerWidth'	, 'height'	, 'innerHeight'	, 'outerHeight'	, 'left', 'top'	, 'marginRight'	, 0, 1, 2, 3],
				['height'	, 'innerHeight'	, 'outerHeight'	, 'width'	, 'innerWidth'	, 'outerWidth'	, 'top'	, 'left', 'marginBottom', 3, 2, 1, 0]
			];
			var dn = dims[0].length,
				dx = (opts.direction == 'right' || opts.direction == 'left') ? 0 : 1;

			for (var d = 0; d < dn; d++) {
				opts.d[dims[0][d]] = dims[dx][d];
			}

			var	all_itm = $cfs.children(),
				lrgst_b = ms_getTrueLargestSize(all_itm, opts, 'outerHeight', false);


			//	DEPRECATED
			if (opts.padding == 'auto') {
				debug(true, 'The option "padding: auto" is deprecated, use "align: center".');
				opts.padding = false;
				opts.align = 'center';
			}
			//	/DEPRECATED


			//	secondairy size set to auto -> measure largest size and set it
			if (opts[opts.d['height']] == 'auto') {
				opts[opts.d['height']] = lrgst_b;
				opts.items[opts.d['height']] = lrgst_b;
			}

			//	primairy item-size not set -> measure it or set to "variable"
			if (!opts.items[opts.d['width']]) {
				opts.items[opts.d['width']] = (ms_hasVariableSizes(all_itm, opts, 'outerWidth')) 
					? 'variable' 
					: all_itm[opts.d['outerWidth']](true);
			}

			//	secondairy item-size not set -> measure it or set to "variable"
			if (!opts.items[opts.d['height']]) {
				opts.items[opts.d['height']] = (ms_hasVariableSizes(all_itm, opts, 'outerHeight')) 
					? 'variable' 
					: all_itm[opts.d['outerHeight']](true);
			}

			//	secondairy size not set -> set to secondairy item-size
			if (!opts[opts.d['height']]) {
				opts[opts.d['height']] = opts.items[opts.d['height']];
			}

			switch (opts.items.visible) {
				case '+1':
				case '-1':
				case 'odd':
				case 'odd+':
				case 'even':
				case 'even+':
					opts.visibleAdjust = opts.items.visible;
					opts.items.visible = false;
					break;
			}

			//	visible-items not set
			if (!opts.items.visible) {
				//	primairy item-size variable -> set visible items variable
				if (opts.items[opts.d['width']] == 'variable') {
					opts.items.visible = 'variable';
				} else {
					//	primairy size is number -> calculate visible-items
					if (typeof opts[opts.d['width']] == 'number') {
						opts.items.visible = Math.floor(opts[opts.d['width']] / opts.items[opts.d['width']]);
					} else {
						//	measure and calculate primairy size and visible-items
						var maxS = ms_getTrueInnerSize($wrp.parent(), opts, 'innerWidth');
						opts.items.visible = Math.floor(maxS / opts.items[opts.d['width']]);
						opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
						if (!opts.visibleAdjust) opts.align = false;
					}
					if (opts.items.visible == 'Infinity' ||	opts.items.visible < 0) {
						debug(true, 'Not a valid number of visible items: Set to "1".');
						opts.items.visible = 1;
					}

					opts.items.visible = cf_getVisibleItemsAdjust(opts.items.visible, opts);
				}
			}

			//	primairy size not set -> calculate it or set to "variable"
			if (!opts[opts.d['width']]) {
				if (opts.items.visible != 'variable' && opts.items[opts.d['width']] != 'variable') {
					opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
					opts.align = false;
				} else {
					opts[opts.d['width']] = 'variable';
				}
			}

			//	variable primairy item-sizes with variabe visible-items
			if (opts.items.visible == 'variable') {
				opts.variableVisible = true;
				opts.maxDimention = (opts[opts.d['width']] == 'variable')
					? ms_getTrueInnerSize($wrp.parent(), opts, 'innerWidth')
					: opts[opts.d['width']];
				if (opts.align === false) {
					opts[opts.d['width']] = 'variable';
				}
				opts.items.visible = getVisibleItemsNext(all_itm, opts, 0);
				if (opts.items.visible > conf.items.total) {
					opts.items.visible = conf.items.total;
				}
			}

			if (typeof opts.padding == 'undefined') {
				opts.padding = 0;
			}

			//	align not set -> set to center if primairy size is number
			if (typeof opts.align == 'undefined') {
				opts.align = (opts[opts.d['width']] == 'variable')
					? false
					: 'center';
			}

			opts.items.oldVisible = opts.items.visible;
			opts.usePadding = false;
			opts.padding = cf_getPadding(opts.padding);

			if (opts.align == 'top') 		opts.align = 'left';
			if (opts.align == 'bottom') 	opts.align = 'right';

			switch (opts.align) {
				//	align: center, left or right
				case 'center':
				case 'left':
				case 'right':
					if (opts[opts.d['width']] != 'variable') {
						var p = cf_getAlignPadding(getCurrentItems(all_itm, opts), opts);
						opts.usePadding = true;
						opts.padding[opts.d[1]] = p[1];
						opts.padding[opts.d[3]] = p[0];
					}
					break;

				//	padding
				default:
					opts.align = false;
					opts.usePadding = (
						opts.padding[0] == 0 && 
						opts.padding[1] == 0 && 
						opts.padding[2] == 0 && 
						opts.padding[3] == 0
					) ? false : true;
					break;
			}

			if (typeof opts.items.minimum	!= 'number')	opts.items.minimum		= opts.items.visible;
			if (typeof opts.scroll.items	!= 'number')	opts.scroll.items		= (opts.variableVisible) ? 'variable' : opts.items.visible;
			if (typeof opts.scroll.duration	!= 'number')	opts.scroll.duration	= 500;

			opts.auto		= getNaviObject($tt0, opts.auto, false, true);
			opts.prev		= getNaviObject($tt0, opts.prev);
			opts.next		= getNaviObject($tt0, opts.next);
			opts.pagination	= getNaviObject($tt0, opts.pagination, true);

			opts.auto		= $.extend(true, {}, opts.scroll, opts.auto);
			opts.prev		= $.extend(true, {}, opts.scroll, opts.prev);
			opts.next		= $.extend(true, {}, opts.scroll, opts.next);
			opts.pagination	= $.extend(true, {}, opts.scroll, opts.pagination);

			if (typeof opts.pagination.keys				!= 'boolean')	opts.pagination.keys 			= false;
			if (typeof opts.pagination.anchorBuilder	!= 'function')	opts.pagination.anchorBuilder	= $.fn.carouFredSel.pageAnchorBuilder;
			if (typeof opts.auto.play					!= 'boolean')	opts.auto.play					= true;
			if (typeof opts.auto.delay					!= 'number')	opts.auto.delay					= 0;
			if (typeof opts.auto.pauseDuration			!= 'number')	opts.auto.pauseDuration			= (opts.auto.duration < 10) ? 2500 : opts.auto.duration * 5;


			//	DEPRECATED
			if (opts.auto.nap) {
				debug(true, 'jQuery.nap-plugin is no longer supported.');
			}
			//	/DEPRECATED


			if (opts.synchronise) {
				opts.synchronise = getSynchArr(opts.synchronise);
			}
			if (opts.debug) {
				debug(true, 'Carousel width: '+opts.width);
				debug(true, 'Carousel height: '+opts.height);
				if (opts[opts.d['width']] == 'variable') debug(true, 'Available '+opts.d['width']+': '+opts.maxDimention);
				debug(true, 'Item widths: '+opts.items.width);
				debug(true, 'Item heights: '+opts.items.height);
				debug(true, 'Number of items visible: '+opts.items.visible);
				if (opts.auto.play)		debug(true, 'Number of items scrolled automatically: '+opts.auto.items);
				if (opts.prev.button)	debug(true, 'Number of items scrolled backward: '+opts.prev.items);
				if (opts.next.button)	debug(true, 'Number of items scrolled forward: '+opts.next.items);
			}
		};	//	/init

		$cfs.build = function() {
			if ($cfs.css('position') == 'absolute' || $cfs.css('position') == 'fixed') {
				debug(opts.debug, 'Carousels CSS-attribute "position" should be "static" or "relative".');
			}

			var orgCSS = {
				'float'			: $cfs.css('float'),
				'position'		: $cfs.css('position'),
				'top'			: $cfs.css('top'),
				'right'			: $cfs.css('right'),
				'bottom'		: $cfs.css('bottom'),
				'left'			: $cfs.css('left'),
				'width'			: $cfs.css('width'),
				'height'		: $cfs.css('height'),
				'marginTop'		: $cfs.css('marginTop'),
				'marginRight'	: $cfs.css('marginRight'),
				'marginBottom'	: $cfs.css('marginBottom'),
				'marginLeft'	: $cfs.css('marginLeft')
			};
			$wrp.css(orgCSS).css({
				'overflow'		: 'hidden',
				'position'		: (orgCSS.position == 'absolute') ? 'absolute' : 'relative'
			});

			$cfs.data('cfs_origCss', orgCSS).css({
				'float'			: 'none',
				'position'		: 'absolute',
				'top'			: 0,
				'left'			: 0,
				'marginTop'		: 0,
				'marginRight'	: 0,
				'marginBottom'	: 0,
				'marginLeft'	: 0
			});
			if (opts.usePadding) {
				$cfs.children().each(function() {
					var m = parseInt($(this).css(opts.d['marginRight']));
					if (isNaN(m)) m = 0;
					$(this).data('cfs_origCssMargin', m);
				});
			}
		};	//	/build

		$cfs.bind_events = function() {
			$cfs.unbind_events();

			$cfs.bind('stop.cfs'+serial, function(e) {
				e.stopPropagation();
				$cfs.trigger('pause');
				opts.auto.play = false;
				conf.isPaused = 'stopped';
			});

			$cfs.bind('finish.cfs'+serial, function(e) {
				
			});

			$cfs.bind('pause.cfs'+serial, function(e, g) {
				e.stopPropagation();

				//	DEPRECATED
				if (typeof g == 'boolean') {
					debug(true, 'Pause a carousel globally is deprecated, use the "stop" custom event.');
					$cfs.trigger('stop');
					return;
				}
				//	/DEPRECATED

				conf.isPaused = true;

				if (tmrs.timeouts.auto 		!= null) clearTimeout(tmrs.timeouts.auto);
				if (tmrs.intervals.auto 	!= null) clearInterval(tmrs.intervals.auto);
				if (tmrs.intervals.timer 	!= null) clearInterval(tmrs.intervals.timer);

				var dur1 = opts.auto.pauseDuration - tmrs.pausePassed,
					perc = 100 - Math.ceil( dur1 * 100 / opts.auto.pauseDuration );

				if (perc != 0) {
					if (opts.auto.onPausePause) opts.auto.onPausePause.call($tt0, perc, dur1);
				}
			});

			$cfs.bind('play.cfs'+serial, function(e, dir, dla, sta) {
				e.stopPropagation();
				$cfs.trigger('pause');

				var v = [dir, dla, sta],
					t = ['string', 'number', 'boolean'],
					a = sortParams(v, t);

				var dir = a[0],
					dla = a[1],
					sta = a[2];

				if (dir != 'prev' && dir != 'next') dir = conf.direction;
				if (typeof dla != 'number') 		dla = 0;

				if (sta) opts.auto.play = true;
				if (!opts.auto.play) {
					return e.stopImmediatePropagation();
				}

				conf.isPaused = false;

				var dur1 = opts.auto.pauseDuration - tmrs.pausePassed,
					dur2 = dur1 + dla;
					perc = 100 - Math.ceil(dur1 * 100 / opts.auto.pauseDuration);

				tmrs.timeouts.auto = setTimeout(function() {
					if (conf.isAnimated) {
						$cfs.trigger('play', dir);
					} else {
						tmrs.pausePassed = 0;
						$cfs.trigger(dir, opts.auto);
					}
				}, dur2);

				if (opts.auto.pauseOnHover === 'resume') {
					tmrs.intervals.auto = setInterval(function() {
						tmrs.pausePassed += 50;
					}, 50);
				}
				if (opts.auto.onPauseEnd && perc == 0) {
					opts.auto.onPauseEnd.call($tt0, perc, dur1);
				}
				if (opts.auto.onPauseStart) {
					tmrs.intervals.timer = setTimeout(function() {
						opts.auto.onPauseStart.call($tt0, perc, dur1);
					}, dla);
				}
			});

			$cfs.bind('prev.cfs'+serial+' next.cfs'+serial, function(e, obj, num, clb) {
				e.stopPropagation();

				if (conf.isPaused == 'stopped' || $cfs.is(':hidden')) {
					e.stopImmediatePropagation();
					return debug(opts.debug, 'Carousel stopped or hidden: Not scrolling.');
				}
				var v = [obj, num, clb],
					t = ['object', 'number/string', 'function'],
					a = sortParams(v, t);

				var obj = a[0],
					num = a[1],
					clb = a[2];

				if (typeof obj != 'object' || obj == null)			obj = opts[e.type];
				if (typeof clb == 'function')						obj.onAfter = clb;
				
				if (typeof num != 'number') {
					if (num == 'visible') {
						if (!opts.variableVisible)						num = opts.items.visible;
					} else {
							 if (typeof obj.items == 'number') 			num = obj.items;
						else if (typeof opts[e.type].items == 'number')	num = opts[e.type].items;
						else if (opts.variableVisible)					num = 'visible';
						else											num = opts.items.visible;
					}
				}

				if (obj.duration > 0) {
					if (conf.isAnimated) {
						if (obj.queue) $cfs.trigger('queue', [e.type, [obj, num, clb]]);
						e.stopImmediatePropagation();
						return debug(opts.debug, 'Carousel currently scrolling.');
					}
					if (opts.items.minimum >= conf.items.total) {
						e.stopImmediatePropagation();
						return debug(opts.debug, 'Not enough items ('+conf.items.total+', '+opts.items.minimum+' needed): Not scrolling.');
					}
				}
				tmrs.pausePassed = 0;

				if (obj.conditions && !obj.conditions.call($tt0)) {
					e.stopImmediatePropagation();
					return debug(opts.debug, 'Callback "conditions" returned false.');
				}

				$cfs.trigger('slide_'+e.type, [obj, num]);

				if (opts.synchronise) {
					var s = opts.synchronise,
						c = [obj, num];
					for (var j = 0, l = s.length; j < l; j++) {
						var d = e.type;
						if (!s[j][1]) c[0] = s[j][0].triggerHandler('configuration', e.type);
						if (!s[j][2]) d = (d == 'prev') ? 'next' : 'prev';
						c[1] = num + s[j][3];
						s[j][0].trigger('slide_'+d, c);
					}
				}
			});

			$cfs.bind('slide_prev.cfs'+serial, function(e, sO, nI) {
				e.stopPropagation();
				var a_itm = $cfs.children();

				//	non-circular at start, scroll to end
				if (!opts.circular) {
					if (conf.items.first == 0) {
						if (opts.infinite) {
							$cfs.trigger('next', conf.items.total-1);
						}
						return e.stopImmediatePropagation();
					}
				}

				if (opts.usePadding) resetMargin(a_itm, opts);

				//	find number of items to scroll
				if (opts.variableVisible) {
					if (typeof nI != 'number') {
						nI = getVisibleItemsPrev(a_itm, opts, conf.items.total-1);
					}
				}

				//	prevent non-circular from scrolling to far
				if (!opts.circular) {
					if (conf.items.total - nI < conf.items.first) {
						nI = conf.items.total - conf.items.first;
					}
				}

				//	set new number of visible items
				if (opts.variableVisible) {
					var vI = getVisibleItemsNext(a_itm, opts, conf.items.total-nI);
					opts.items.oldVisible = opts.items.visible;
					opts.items.visible = cf_getVisibleItemsAdjust(vI, opts);
				}

				if (opts.usePadding) resetMargin(a_itm, opts, true);

				//	scroll 0, don't scroll
				if (nI == 0) {
					e.stopImmediatePropagation();
					return debug(opts.debug, '0 items to scroll: Not scrolling.');
				}
				debug(opts.debug, 'Scrolling '+nI+' items backward.');

				//	save new config
				conf.items.first += nI;
				while (conf.items.first >= conf.items.total) conf.items.first -= conf.items.total;

				//	non-circular callback
				if (!opts.circular) {
					if (conf.items.first == 0 && sO.onEnd) sO.onEnd.call($tt0);
					if (!opts.infinite) nv_enableNavi(opts, conf.items.first);
				}



				//	rearrange items
				$cfs.children().slice(conf.items.total-nI).prependTo($cfs);
				if (conf.items.total < opts.items.visible + nI) {
					$cfs.children().slice(0, (opts.items.visible+nI)-conf.items.total).clone(true).appendTo($cfs);
				}

				var a_itm = $cfs.children(),
					c_old = getOldItemsPrev(a_itm, opts, nI),
					c_new = getNewItemsPrev(a_itm, opts),
					l_cur = a_itm.eq(nI-1),
					l_old = c_old.last(),
					l_new = c_new.last();

				if (opts.usePadding) resetMargin(a_itm, opts);

				if (opts.align) var p = cf_getAlignPadding(c_new, opts);
				if (sO.fx == 'directscroll' && opts.items.oldVisible < nI) {
					var hiddenitems = a_itm.slice(opts.items.oldVisible, nI).hide(),
						orgW = opts.items[opts.d['width']];
					opts.items[opts.d['width']] = 'variable';
				} else {
					var hiddenitems = false;
				}

				var i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
					w_siz = mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);

				if (hiddenitems) opts.items[opts.d['width']] = orgW;

				if (opts.usePadding) {
					resetMargin(a_itm, opts, true);
					resetMargin(l_old, opts, opts.padding[opts.d[1]]);
					resetMargin(l_cur, opts, opts.padding[opts.d[3]]);
				}
				if (opts.align) {
					opts.padding[opts.d[1]] = p[1];
					opts.padding[opts.d[3]] = p[0];
				}
				var a_cfs = {},
					a_new = {},
					a_cur = {},
					a_old = {},
					a_dur = sO.duration;

					 if (sO.fx == 'none')	a_dur = 0;
				else if (a_dur == 'auto')	a_dur = opts.scroll.duration / opts.scroll.items * nI;
				else if (a_dur <= 0)		a_dur = 0;
				else if (a_dur < 10)		a_dur = i_siz / a_dur;

				var a_conf = {
					duration: a_dur,
					easing	: sO.easing
				};
				if (sO.onBefore) sO.onBefore.call($tt0, c_old, c_new, w_siz, a_dur);
				if (opts.usePadding) {
					var new_m = opts.padding[opts.d[3]];
					a_cur[opts.d['marginRight']] = l_cur.data('cfs_origCssMargin');
					a_new[opts.d['marginRight']] = l_new.data('cfs_origCssMargin') + opts.padding[opts.d[1]];
					a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');

					l_cur.stop().animate(a_cur, a_conf);
					l_old.stop().animate(a_old, a_conf);
					l_new.stop().animate(a_new, a_conf);

				} else {
					var new_m = 0;
				}
				a_cfs[opts.d['left']] = new_m;

				if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
					$wrp.stop().animate(w_siz, a_conf);
				}

				//	alternative effects
				switch(sO.fx) {
					case 'crossfade':
					case 'cover':
					case 'uncover':
						var $cf2 = $cfs.clone().appendTo($wrp);
						break;
				}
				switch(sO.fx) {
					case 'uncover':
						$cf2.children().slice(0, nI).remove();
					case 'crossfade':
					case 'cover':
						$cf2.children().slice(opts.items.visible).remove();
						break;
				}
				switch(sO.fx) {
					case 'fade':
						fx_fade(sO, $cfs, 0, a_dur);
						break;
					case 'crossfade':
						$cf2.css({ 'opacity': 0 });
						fx_fade(sO, $cf2, 1, a_dur);
						fx_fade(sO, $cfs, 1, a_dur, function() { $cf2.remove(); });
						break;
					case 'cover':
						fx_cover(sO, $cfs, $cf2, opts, a_dur, true);
						break;
					case 'uncover':
						fx_uncover(sO, $cfs, $cf2, opts, a_dur, true, nI);
						break;
				}
				switch(sO.fx) {
					case 'fade':
					case 'crossfade':
					case 'cover':
					case 'uncover':
						f_dur = a_dur;
						a_dur = 0;
						break;
				}
				//	/alternative effects

				conf.isAnimated = true;
				var c_nI = nI;
				$cfs.css(opts.d['left'], -i_siz);
				$cfs.animate(a_cfs, {
					duration: a_dur,
					easing	: sO.easing,
					complete: function() {
						conf.isAnimated = false;
						var overFill = opts.items.visible+c_nI-conf.items.total;
						if (overFill > 0) {
							$cfs.children().slice(conf.items.total).remove();
							c_old = $cfs.children().slice(conf.items.total-(c_nI-overFill)).get().concat( $cfs.children().slice(0, overFill).get() );
						}
						if (hiddenitems) hiddenitems.show();
						if (opts.usePadding) {
							var l_itm = $cfs.children().eq(opts.items.visible+c_nI-1);
							l_itm.css(opts.d['marginRight'], l_itm.data('cfs_origCssMargin'));
						}

						var fn = function() {
							if (sO.onAfter) {
								sO.onAfter.call($tt0, c_old, c_new, w_siz);
							}
							switch(sO.fx) {
								case 'fade':
								case 'crossfade':
									$cfs.css('filter', '');
									break;
							}
							if (queue.length) {
								setTimeout(function() {
									$cfs.trigger(queue[0][0], queue[0][1]);
									queue.shift();
								}, 1);
							}
						};
						switch(sO.fx) {
							case 'fade':
							case 'uncover':
								fx_fade(sO, $cfs, 1, f_dur, fn);
								break;

							default:
								fn();
								break;
						}
					}
				});
				$cfs.trigger('updatePageStatus', [false, w_siz]).trigger('play', a_dur);
			});

			$cfs.bind('slide_next.cfs'+serial, function(e, sO, nI) {
				e.stopPropagation();
				var a_itm = $cfs.children();

				//	non-circular at end, scroll to start
				if (!opts.circular) {
					if (conf.items.first == opts.items.visible) {
						if (opts.infinite) {
							$cfs.trigger('prev', conf.items.total-1);
						}
						return e.stopImmediatePropagation();
					}
				}

				if (opts.usePadding) resetMargin(a_itm, opts);

				//	find number of items to scroll
				if (opts.variableVisible) {
					if (typeof nI != 'number') {
						nI = opts.items.visible;
					}
				}

				var lastItemNr = (conf.items.first == 0) ? conf.items.total : conf.items.first;

				//	prevent non-circular from scrolling to far
				if (!opts.circular) {
					if (opts.variableVisible) {
						var vI = getVisibleItemsNext(a_itm, opts, nI),
							xI = getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
					} else {
						var vI = opts.items.visible,
							xI = opts.items.visible;
					}

					if (nI + vI > lastItemNr) {
						nI = lastItemNr - xI;
					}
				}

				//	set new number of visible items
				if (opts.variableVisible) {
					var vI = getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr);
					while (opts.items.visible - nI >= vI && nI < conf.items.total) {
						nI++;
						vI = getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr);
					}
					opts.items.oldVisible = opts.items.visible;
					opts.items.visible = cf_getVisibleItemsAdjust(vI, opts);
				}

				if (opts.usePadding) resetMargin(a_itm, opts, true);

				//	scroll 0, don't scroll
				if (nI == 0) {
					e.stopImmediatePropagation();
					return debug(opts.debug, '0 items to scroll: Not scrolling.');
				}
				debug(opts.debug, 'Scrolling '+nI+' items forward.');

				//	save new config
				conf.items.first -= nI;
				while (conf.items.first < 0) conf.items.first += conf.items.total;

				//	non-circular callback
				if (!opts.circular) {
					if (conf.items.first == opts.items.visible && sO.onEnd) sO.onEnd.call($tt0);
					if (!opts.infinite) nv_enableNavi(opts, conf.items.first);
				}



				//	rearrange items
				if (conf.items.total < opts.items.visible + nI) {
					$cfs.children().slice(0, (opts.items.visible+nI)-conf.items.total).clone(true).appendTo($cfs);
				}

				var a_itm = $cfs.children(),
					c_old = getOldItemsNext(a_itm, opts),
					c_new = getNewItemsNext(a_itm, opts, nI),
					l_cur = a_itm.eq(nI-1),
					l_old = c_old.last(),
					l_new = c_new.last();

				if (opts.usePadding) resetMargin(a_itm, opts);

				if (opts.align) var p = cf_getAlignPadding(c_new, opts);
				if (sO.fx == 'directscroll' && opts.items.oldVisible < nI) {
					var hiddenitems = a_itm.slice(opts.items.oldVisible, nI).hide(),
						orgW = opts.items[opts.d['width']];
					opts.items[opts.d['width']] = 'variable';
				} else {
					var hiddenitems = false;
				}

				var i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
					w_siz = mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);

				if (hiddenitems) opts.items[opts.d['width']] = orgW;

				if (opts.usePadding) {
					resetMargin(a_itm, opts, true);
					resetMargin(l_old, opts, opts.padding[opts.d[1]]);
					resetMargin(l_new, opts, opts.padding[opts.d[1]]);
				}
				if (opts.align) {
					opts.padding[opts.d[1]] = p[1];
					opts.padding[opts.d[3]] = p[0];
				}

				var a_cfs = {},
					a_old = {},
					a_cur = {},
					a_dur = sO.duration;

					 if (sO.fx == 'none')	a_dur = 0;
				else if (a_dur == 'auto')	a_dur = opts.scroll.duration / opts.scroll.items * nI;
				else if (a_dur <= 0)		a_dur = 0;
				else if (a_dur < 10)		a_dur = i_siz / a_dur;

				var a_conf = {
					duration: a_dur,
					easing	: sO.easing
				};
				if (sO.onBefore) sO.onBefore.call($tt0, c_old, c_new, w_siz, a_dur);
				if (opts.usePadding) {
					a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');
					a_cur[opts.d['marginRight']] = l_cur.data('cfs_origCssMargin') + opts.padding[opts.d[3]];
					l_new.css(opts.d['marginRight'], l_new.data('cfs_origCssMargin') + opts.padding[opts.d[1]]);
					l_old.stop().animate(a_old, a_conf);
					l_cur.stop().animate(a_cur, a_conf);
				}
				a_cfs[opts.d['left']] = -i_siz;
				if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
					$wrp.stop().animate(w_siz, a_conf);
				}

				//	alternative effects
				switch(sO.fx) {
					case 'crossfade':
					case 'cover':
					case 'uncover':
						var $cf2 = $cfs.clone().appendTo($wrp);
						break;
				}
				switch(sO.fx) {
					case 'crossfade':
					case 'cover':
						$cf2.children().slice(0, nI).remove();
						$cf2.children().slice(opts.items.visible).remove();
						break;
					case 'uncover':
						$cf2.children().slice(opts.items.oldVisible).remove();
						break;
				}
				switch(sO.fx) {
					case 'fade':
						fx_fade(sO, $cfs, 0, a_dur);
						break;
					case 'crossfade':
						$cf2.css({ 'opacity': 0 });
						fx_fade(sO, $cf2, 1, a_dur);
						fx_fade(sO, $cfs, 1, a_dur, function() { $cf2.remove(); });
						break;
					case 'cover':
						fx_cover(sO, $cfs, $cf2, opts, a_dur, false);
						break;
					case 'uncover':
						fx_uncover(sO, $cfs, $cf2, opts, a_dur, false, nI);
						break;
				}

				switch(sO.fx) {
					case 'fade':
					case 'crossfade':
					case 'cover':
					case 'uncover':
						f_dur = a_dur;
						a_dur = 0;
						break;
				}
				//	/alternative effects

				conf.isAnimated = true;
				var c_nI = nI;
				$cfs.animate(a_cfs, {
					duration: a_dur,
					easing	: sO.easing,
					complete: function() {
						conf.isAnimated = false;
						var overFill = opts.items.visible+c_nI-conf.items.total,
							new_m = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
						$cfs.css(opts.d['left'], new_m);
						if (overFill > 0) {
							$cfs.children().slice(conf.items.total).remove();
						}
						var l_itm = $cfs.children().slice(0, c_nI).appendTo($cfs).last();
						if (overFill > 0) {
							c_new = getCurrentItems(a_itm, opts);
						}
						if (hiddenitems) hiddenitems.show();
						if (opts.usePadding) {
							if (conf.items.total < opts.items.visible+c_nI) {
								var l_cur = $cfs.children().eq(opts.items.visible-1);
								l_cur.css(opts.d['marginRight'], l_cur.data('cfs_origCssMargin') + opts.padding[opts.d[3]]);
							}
							l_itm.css(opts.d['marginRight'], l_itm.data('cfs_origCssMargin'));
						}

						var fn = function() {
							if (sO.onAfter) {
								sO.onAfter.call($tt0, c_old, c_new, w_siz);
							}
							switch(sO.fx) {
								case 'fade':
								case 'crossfade':
									$cfs.css('filter', '');
									break;
							}
							if (queue.length) {
								setTimeout(function() {
									$cfs.trigger(queue[0][0], queue[0][1]);
									queue.shift();
								}, 1);
							}
						};
						switch(sO.fx) {
							case 'fade':
							case 'uncover':
								fx_fade(sO, $cfs, 1, f_dur, fn);
								break;

							default:
								fn();
								break;
						}
					}
				});
				$cfs.trigger('updatePageStatus', [false, w_siz]).trigger('play', a_dur);
			});

			$cfs.bind('slideTo.cfs'+serial, function(e, num, dev, org, obj, dir) {
				e.stopPropagation();

				var v = [num, dev, org, obj, dir],
					t = ['string/number/object', 'number', 'boolean', 'object', 'string'],
					a = sortParams(v, t);
				
				var obj = a[3],
					dir = a[4];

				num = getItemIndex(a[0], a[1], a[2], conf.items, $cfs);

				if (num == 0) return;
				if (typeof obj != 'object') obj = false;

				if (conf.isAnimated) {
					if (typeof obj != 'object' || obj.duration > 0) return;
				}

				if (dir != 'prev' && dir != 'next') {
					if (opts.circular) {
						if (num <= conf.items.total / 2) 	dir = 'next';
						else 								dir = 'prev';
					} else {
						if (conf.items.first == 0 ||
							conf.items.first > num)			dir = 'next';
						else								dir = 'prev';
					}
				}

				if (dir == 'prev')	$cfs.trigger('prev', [obj, conf.items.total-num]);
				else 				$cfs.trigger('next', [obj, num]);
			});
			
			$cfs.bind('jumpToStart.cfs'+serial, function(e) {
				if (conf.items.first > 0) {
					$cfs.prepend($cfs.children().slice(conf.items.first));
				}
			});

			$cfs.bind('synchronise.cfs'+serial, function(e, s) {
					 if (s) 				s = getSynchArr(s);
				else if (opts.synchronise)	s = opts.synchronise;
				else return debug(opts.debug, 'No carousel to synchronise.');

				var n = $cfs.triggerHandler('currentPosition');
				for (var j = 0, l = s.length; j < l; j++) {
					s[j][0].trigger('slideTo', [n, s[j][3], true]);
				}
			});

			$cfs.bind('queue.cfs'+serial, function(e, dir, opt) {
				if (typeof dir == 'undefined') {
					return queue;
				} else if (typeof dir == 'function') {
					dir.call($tt0, queue);
				} else if (is_array(dir)) {
					queue = dir;
				} else {
					queue.push([dir, opt]);
				}
			});

			$cfs.bind('insertItem.cfs'+serial, function(e, itm, num, org, dev) {
				e.stopPropagation();

				var v = [itm, num, org, dev],
					t = ['string/object', 'string/number/object', 'boolean', 'number'],
					a = sortParams(v, t);
				
				var itm = a[0],
					num = a[1],
					org = a[2],
					dev = a[3];

				if (typeof itm == 'object' && 
					typeof itm.jquery == 'undefined')	itm = $(itm);
				if (typeof itm == 'string') 			itm = $(itm);
				if (typeof itm != 'object' ||
					typeof itm.jquery == 'undefined' || 
					itm.length == 0) return debug(opts.debug, 'Not a valid object.');

				if (typeof num == 'undefined') num = 'end';

				if (opts.usePadding) {
					itm.each(function() {
						var m = parseInt($(this).css(opts.d['marginRight']));
						if (isNaN(m)) m = 0;
						$(this).data('cfs_origCssMargin', m);
					});
				}

				var orgNum = num,
					before = 'before';

				if (num == 'end') {
					if (org) {
						if (conf.items.first == 0) {
							num = conf.items.total-1;
							before = 'after';
						} else {
							num = conf.items.first;
							conf.items.first += itm.length
						}
						if (num < 0) num = 0;
					} else {
						num = conf.items.total-1;
						before = 'after';
					}
				} else {
					num = getItemIndex(num, dev, org, conf.items, $cfs);
				}
				if (orgNum != 'end' && !org) {
					if (num < conf.items.first) conf.items.first += itm.length;
				}
				if (conf.items.first >= conf.items.total) conf.items.first -= conf.items.total;

				var $cit = $cfs.children().eq(num);
				if ($cit.length) {
					$cit[before](itm);
				} else {
					$cfs.append(itm);
				}

				conf.items.total = $cfs.children().length;
				$cfs.trigger('linkAnchors');
				var sz = setSizes($cfs, opts);
				nv_showNavi(opts, conf.items.total);
				nv_enableNavi(opts, conf.items.first);
				$cfs.trigger('updatePageStatus', [true, sz]);
			});

			$cfs.bind('removeItem.cfs'+serial, function(e, num, org, dev) {
				e.stopPropagation();
				
				var v = [num, org, dev],
					t = ['string/number/object', 'boolean', 'number'],
					a = sortParams(v, t);
				
				var num = a[0],
					org = a[1],
					dev = a[2];

				if (typeof num == 'undefined' || num == 'end') {
					$cfs.children().last().remove();
				} else {
					num = getItemIndex(num, dev, org, conf.items, $cfs);
					var $cit = $cfs.children().eq(num);
					if ($cit.length){
						if (num < conf.items.first) conf.items.first -= $cit.length;
						$cit.remove();
					}
				}
				conf.items.total = $cfs.children().length;
				var sz = setSizes($cfs, opts);
				nv_showNavi(opts, conf.items.total);
				nv_enableNavi(opts, conf.items.first);
				$cfs.trigger('updatePageStatus', [true, sz]);
			});

			$cfs.bind('currentPosition.cfs'+serial, function(e, fn) {
				e.stopPropagation();
				if (conf.items.first == 0) var val = 0;
				else var val = conf.items.total - conf.items.first;
				if (typeof fn == 'function') fn.call($tt0, val);
				return val;
			});

			$cfs.bind('currentPage.cfs'+serial, function(e, fn) {
				e.stopPropagation();
				var max = Math.ceil(conf.items.total/opts.items.visible-1);
				if (conf.items.first == 0) var nr = 0;
				else if (conf.items.first < conf.items.total % opts.items.visible) var nr = 0;
				else if (conf.items.first == opts.items.visible && !opts.circular) var nr = max;
				else var nr = Math.round((conf.items.total-conf.items.first)/opts.items.visible);
				if (nr < 0) nr = 0;
				if (nr > max) nr = max;
				if (typeof fn == 'function') fn.call($tt0, nr);
				return nr;
			});

			$cfs.bind('currentVisible.cfs'+serial, function(e, fn) {
				e.stopPropagation();
				$i = getCurrentItems($cfs.children(), opts);
				if (typeof fn == 'function') fn.call($tt0, $i);
				return $i;
			});

			$cfs.bind('isPaused.cfs'+serial, function(e, fn) {
				e.stopPropagation();
				if (typeof fn == 'function') fn.call($tt0, conf.isPaused);
				return conf.isPaused;
			});

			$cfs.bind('configuration.cfs'+serial, function(e, a, b, c) {
				e.stopPropagation();
				var reInit = false;

				//	return entire configuration-object
				if (typeof a == 'function') {
					a.call($tt0, opts);

				//	set multiple options via object
				} else if (typeof a == 'object') {
					opts_orig = $.extend(true, {}, opts_orig, a);
					if (b !== false) reInit = true;
					else opts = $.extend(true, {}, opts, a);

				} else if (typeof a != 'undefined') {

					//	callback function for specific option
					if (typeof b == 'function') {
						var val = eval('opts.'+a);
						if (typeof val == 'undefined') val = '';
						b.call($tt0, val);

					//	set individual option
					} else if (typeof b != 'undefined') {
						if (typeof c !== 'boolean') c = true;
						eval('opts_orig.'+a+' = b');
						if (c !== false) reInit = true;
						else eval('opts.'+a+' = b');

					//	return value for specific option
					} else {
						return eval('opts.'+a);
					}
				}
				if (reInit) {
					resetMargin($cfs.children(), opts);
					$cfs.init(opts_orig);
					var siz = setSizes($cfs, opts);
					nv_showNavi(opts, conf.items.total);
					nv_enableNavi(opts, conf.items.first);
					$cfs.trigger('updatePageStatus', [true, siz]);
				}
				return opts;
			});

			$cfs.bind('linkAnchors.cfs'+serial, function(e, $con, sel) {
				e.stopPropagation();
				if (typeof $con == 'undefined' || $con.length == 0) $con = $('body');
				else if (typeof $con == 'string') $con = $($con);
				if (typeof $con != 'object') return debug(opts.debug, 'Not a valid object.');
				if (typeof sel != 'string' || sel.length == 0) sel = 'a.caroufredsel';
				$con.find(sel).each(function() {
					var h = this.hash || '';
					if (h.length > 0 && $cfs.children().index($(h)) != -1) {
						$(this).unbind('click').click(function(e) {
							e.preventDefault();
							$cfs.trigger('slideTo', h);
						});
					}
				});
			});

			$cfs.bind('updatePageStatus.cfs'+serial, function(e, build, sizes) {
				e.stopPropagation();
				if (!opts.pagination.container) return;
				if (typeof build == 'boolean' && build) {
					opts.pagination.container.children().remove();
					for (var a = 0, l = Math.ceil(conf.items.total/opts.items.visible); a < l; a++) {
						var i = $cfs.children().eq( getItemIndex(a*opts.items.visible, 0, true, conf.items, $cfs) );
						opts.pagination.container.append(opts.pagination.anchorBuilder(a+1, i));
					}
					opts.pagination.container.children().unbind(opts.pagination.event).each(function(a) {
						$(this).bind(opts.pagination.event, function(e) {
							e.preventDefault();
							$cfs.trigger('slideTo', [a * opts.items.visible, 0, true, opts.pagination]);
						});
					});
				}
				var cnr = $cfs.triggerHandler('currentPage');
				opts.pagination.container.children().removeClass('selected').eq(cnr).addClass('selected');
			});

			$cfs.bind('destroy.cfs'+serial, function(e, orgOrder) {
				e.stopPropagation();
				if (orgOrder) {
					$cfs.trigger('jumpToStart');
				}
				if (opts.usePadding) {
					resetMargin($cfs.children(), opts);
				}
				$cfs.trigger('pause').css($cfs.data('cfs_origCss'));
				$cfs.unbind_events();
				$cfs.unbind_buttons();
				$wrp.replaceWith($cfs);
			});
		};	//	/bind_events

		$cfs.unbind_events = function() {
			$cfs.unbind('.cfs'+serial);
		};	//	/unbind_events

		$cfs.bind_buttons = function() {
			$cfs.unbind_buttons();
			nv_showNavi(opts, conf.items.total);
			nv_enableNavi(opts, conf.items.first);
			if (opts.auto.pauseOnHover) {
				$wrp.bind('mouseenter.cfs'+serial, function() { $cfs.trigger('pause');	})
					.bind('mouseleave.cfs'+serial, function() { $cfs.trigger('play');	});
			}

			if (opts.prev.button) {
				opts.prev.button.bind(opts.prev.event+'.cfs'+serial, function(e) {
					e.preventDefault();
					$cfs.trigger('prev');
				});
				if (opts.prev.pauseOnHover) {
					opts.prev.button.bind('mouseenter.cfs'+serial, function() { $cfs.trigger('pause');	})
									.bind('mouseleave.cfs'+serial, function() { $cfs.trigger('play');	});
				}
			}

			if (opts.next.button) {
				opts.next.button.bind(opts.next.event+'.cfs'+serial, function(e) {
					e.preventDefault();
					$cfs.trigger('next');
				});
				if (opts.next.pauseOnHover) {
					opts.next.button.bind('mouseenter.cfs'+serial, function() { $cfs.trigger('pause'); 	})
									.bind('mouseleave.cfs'+serial, function() { $cfs.trigger('play');	});
				}
			}
			if ($.fn.mousewheel) {
				if (opts.prev.mousewheel) {
					$wrp.mousewheel(function(e, delta) { 
						if (delta > 0) {
							e.preventDefault();
							num = (typeof opts.prev.mousewheel == 'number') ? opts.prev.mousewheel : null;
							$cfs.trigger('prev', num);
						}
					});
				}
				if (opts.next.mousewheel) {
					$wrp.mousewheel(function(e, delta) { 
						if (delta < 0) {
							e.preventDefault();
							num = (typeof opts.next.mousewheel == 'number') ? opts.next.mousewheel : null;
							$cfs.trigger('next', num);
						}
					});
				}
			}
			if ($.fn.touchwipe) {
				var wP = (opts.prev.wipe) ? function() { $cfs.trigger('prev') } : null,
					wN = (opts.next.wipe) ? function() { $cfs.trigger('next') } : null;
				if (wN || wN) {
					var twOps = {
						'min_move_x': 30,
						'min_move_y': 30,
						'preventDefaultEvents': true
					};
					switch (opts.direction) {
						case 'up':
						case 'down':
							twOps.wipeUp = wN;
							twOps.wipeDown = wP;
							break;
						default:
							twOps.wipeLeft = wN;
							twOps.wipeRight = wP;
					}
					$wrp.touchwipe(twOps);
				}
			}
			if (opts.pagination.container) {
				if (opts.pagination.pauseOnHover) {
					opts.pagination.container.bind('mouseenter.cfs'+serial, function() { $cfs.trigger('pause'); })
											 .bind('mouseleave.cfs'+serial, function() { $cfs.trigger('play');	});
				}
			}
			if (opts.prev.key || opts.next.key) {
				$(document).bind('keyup.cfs'+serial, function(e) {
					var k = e.keyCode;
					if (k == opts.next.key)	{
						e.preventDefault();
						$cfs.trigger('next');
					}
					if (k == opts.prev.key) {
						e.preventDefault();
						$cfs.trigger('prev');
					}
				});
			}
			if (opts.pagination.keys) {
				$(document).bind('keyup.cfs'+serial, function(e) {
					var k = e.keyCode;
					if (k >= 49 && k < 58) {
						k = (k-49) * opts.items.visible;
						if (k <= conf.items.total) {
							e.preventDefault();
							$cfs.trigger('slideTo', [k, 0, true, opts.pagination]);
						}
					}
				});
			}
			if (opts.auto.play) {
				$cfs.trigger('play', opts.auto.delay);
			}
		};	//	/bind_buttons

		$cfs.unbind_buttons = function() {
			$(document).unbind('.cfs'+serial);
			$wrp.unbind('.cfs'+serial);
			if (opts.prev.button) 			opts.prev.button.unbind('.cfs'+serial);
			if (opts.next.button) 			opts.next.button.unbind('.cfs'+serial);
			if (opts.pagination.container)	opts.pagination.container.unbind('.cfs'+serial);
			nv_showNavi(opts, 'hide');
			nv_enableNavi(opts, 'removeClass');
			if (opts.pagination.container) {
				opts.pagination.container.children().remove();
			}
		};	//	/unbind_buttons




		//	DEPRECATED
		$cfs.configuration = function(a, b) {
			debug(true, 'The "configuration" public method is deprecated, use the "configuration" custom event.');
			var cr = false;
			var fn = function(val) { cr = val; };
			if (!a) a = fn;
			if (!b) b = fn;
			$cfs.trigger('configuration', [a, b]);
			return cr;
		};
		$cfs.current_position = function() {
			debug(true, 'The "current_position" public method is deprecated, use the "currentPosition" custom event.');
			return $cfs.triggerHandler('currentPosition');
		};
		$cfs.destroy = function() {
			debug(true, 'The "destroy" public method is deprecated, use the "destroy" custom event.');
			$cfs.trigger('destroy');
			return $cfs;
		};
		$cfs.link_anchors = function($c, se) {
			debug(true, 'The "link_anchors" public method is deprecated, use the "linkAnchors" custom event.');
			$cfs.trigger('linkAnchors', [$c, se]);
			return $cfs;
		};
		//	/DEPRECATED




		if ($cfs.parent().is('.caroufredsel_wrapper')) {
			var strt = $cfs.triggerHandler( 'currentPosition' );
			$cfs.trigger('destroy', true);
		} else {
			var strt = false;
		}
		
		var $wrp = $cfs.wrap('<div class="caroufredsel_wrapper" />').parent(),
			conf = {
				'direction'		: 'next',
				'isPaused'		: true,
				'isAnimated'	: false,
				'items'			: {
					'total'			: $cfs.children().length,
					'first'			: 0
				}
			},
			tmrs = {
				'pausePassed'	: 0,
				'intervals'		: {
					'auto'			: null,
					'timer'			: null
				},
				'timeouts'		: {
					'auto'			: null
				}
			},
			opts = {},
			opts_orig = o,
			queue = [],
			serial = $.fn.carouFredSel.serial++;

		$cfs.init(opts_orig, true, strt);
		$cfs.build();
		$cfs.bind_events();
		$cfs.bind_buttons();

		if (opts.items.start != 0) {
			var s = opts.items.start;
			if (s === true) {
				s = window.location.hash;
				if (!s.length) s = 0;
			} else if (s === 'random') {
				s = Math.floor(Math.random() * conf.items.total);
			}

			$cfs.trigger('slideTo', [s, 0, true, { duration: 0 }, 'next']);
		}
		var siz = setSizes($cfs, opts, false),
			itm = getCurrentItems($cfs.children(), opts);

		if (opts.onCreate) {
			opts.onCreate.call($tt0, itm, siz);
		}

		$cfs.trigger('updatePageStatus', [true, siz]);
		$cfs.trigger('linkAnchors');
		return this;
	};


	//	public
	$.fn.carouFredSel.serial = 0;
	$.fn.carouFredSel.defaults = {
		'debug'			: false,
		'synchronise'	: false,
		'infinite'		: true,
		'circular'		: true,
		'direction'		: 'left',
		'items'			: {
			'start'			: 0
		},
		'scroll'		: {
			'easing'		: 'swing',
			'pauseOnHover'	: false,
			'mousewheel'	: false,
			'wipe'			: false,
			'event'			: 'click',
			'queue'			: false
		}
	};

	$.fn.carouFredSel.pageAnchorBuilder = function(nr, itm) {
		return '<a href="#"><span>'+nr+'</span></a>';
	};


	//	private
	function fx_fade(sO, c, x, d, f) {
		var o = {
			'duration'	: d,
			'easing'	: sO.easing
		};
		if (typeof f == 'function') o.complete = f;
		c.animate({
			opacity: x
		}, o);
	}
	function fx_cover(sO, c1, c2, o, d, prev) {
		var old_w = ms_getSizes(getOldItemsNext(c1.children(), o), o, true)[0],
			new_w = ms_getSizes(c2.children(), o, true)[0],
			cur_l = (prev) ? -new_w : old_w,
			css_o = {},
			ani_o = {};
		css_o[o.d['width']] = new_w;
		css_o[o.d['left']] = cur_l;
		ani_o[o.d['left']] = 0;
		c1.animate({ opacity: '+=0' }, d);
		c2.css(css_o).animate(ani_o, {
			duration: d,
			easing: sO.easing,
			complete: function() {
				$(this).remove();
			}
		});
	}
	function fx_uncover(sO, c1, c2, o, d, prev, n) {
		var new_w = ms_getSizes(getNewItemsNext(c1.children(), o, n), o, true)[0],
			old_w = ms_getSizes(c2.children(), o, true)[0],
			cur_l = (prev) ? -old_w : new_w,
			css_o = {},
			ani_o = {};

		css_o[o.d['width']] = old_w;
		css_o[o.d['left']] = 0;
		ani_o[o.d['left']] = cur_l;
		c2.css(css_o).animate(ani_o, {
			duration: d,
			easing: sO.easing,
			complete: function() {
				$(this).remove();
			}
		});
	}

	function nv_showNavi(o, t) {
		if (t == 'show' || t == 'hide') {
			var f = t;
		} else if (o.items.minimum >= t) {
			debug(o.debug, 'Not enough items: hiding navigation ('+t+' items, '+o.items.minimum+' needed).');
			var f = 'hide';
		} else {
			var f = 'show';
		}
		if (o.prev.button) o.prev.button[f]();
		if (o.next.button) o.next.button[f]();
		if (o.pagination.container) o.pagination.container[f]();
	}
	function nv_enableNavi(o, f) {
		if (o.circular || o.infinite) return;
		var fx = (f == 'removeClass' || f == 'addClass') ? f : false;
		if (o.next.button) {
			var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass';
			o.next.button[fn]('disabled');
		}
		if (o.prev.button) {
			var fn = fx || (f == 0) ? 'addClass' : 'removeClass';
			o.prev.button[fn]('disabled');
		}
	}
	function sortParams(vals, typs) {
		var _arr = [];
		for (var a = 0, l1 = vals.length; a < l1; a++) {
			for (var b = 0, l2 = typs.length; b < l2; b++) {
				if (typs[b].indexOf(typeof vals[a]) > -1 && !_arr[b]) {
					_arr[b] = vals[a];
					break;
				}
			}
		}
		return _arr;
	}
	function getSynchArr(s) {
		if (!is_array(s)) 		s = [[s]];
		if (!is_array(s[0]))	s = [s];
		for (var j = 0, l = s.length; j < l; j++) {
			if (typeof s[j][0] == 'string')		s[j][0] = $(s[j][0]);
			if (typeof s[j][1] != 'boolean')	s[j][1] = true;
			if (typeof s[j][2] != 'boolean')	s[j][2] = true;
			if (typeof s[j][3] != 'number')		s[j][3] = 0;
		}
		return s;
	}
	function getKeyCode(k) {
		if (k == 'right')	return 39;
		if (k == 'left')	return 37;
		if (k == 'up')		return 38;
		if (k == 'down')	return 40;
		return -1;
	}
	function getObject($tt, obj) {
		if (typeof obj == 'function')	obj = obj.call($tt);
		if (typeof obj == 'undefined')	obj = {};
		return obj;
	}
	function getNaviObject($tt, obj, pagi, auto) {
		if (typeof pagi != 'boolean') pagi = false;
		if (typeof auto != 'boolean') auto = false;

		obj = getObject($tt, obj);
		if (typeof obj == 'string') {
			var temp = getKeyCode(obj);
			if (temp == -1) obj = $(obj);
			else 			obj = temp;
		}

		//	pagination
		if (pagi) {
			if (typeof obj 				== 'boolean')	obj = { 'keys': obj };
			if (typeof obj.jquery 		!= 'undefined')	obj = { 'container': obj };
			if (typeof obj.container	== 'function')	obj.container = obj.container.call($tt);
			if (typeof obj.container	== 'string')	obj.container = $(obj.container);

		//	auto
		} else if (auto) {
			if (typeof obj == 'boolean')				obj = { 'play': obj };
			if (typeof obj == 'number')					obj = { 'pauseDuration': obj };

		//	prev + next
		} else {
			if (typeof obj.jquery	!= 'undefined')		obj = { 'button': obj };
			if (typeof obj 			== 'number')		obj = { 'key': obj };
			if (typeof obj.button	== 'function')		obj.button = obj.button.call($tt);
			if (typeof obj.button	== 'string')		obj.button = $(obj.button);
			if (typeof obj.key		== 'string')		obj.key = getKeyCode(obj.key);
		}			

		return obj;
	}
	function getItemIndex(num, dev, org, items, $cfs) {
		if (typeof num == 'string') {
			if (isNaN(num)) num = $(num);
			else 			num = parseInt(num);
		}
		if (typeof num == 'object') {
			if (typeof num.jquery == 'undefined') num = $(num);
			num = $cfs.children().index(num);
			if (num == -1) num = 0;
			if (typeof org != 'boolean') org = false;
		} else {
			if (typeof org != 'boolean') org = true;
		}
		if (isNaN(num))	num = 0;
		else 			num = parseInt(num);
		if (isNaN(dev))	dev = 0;
		else 			dev = parseInt(dev);

		if (org) {
			num += items.first;
		}
		num += dev;
		if (items.total > 0) {
			while (num >= items.total)	{	num -= items.total; }
			while (num < 0)				{	num += items.total; }
		}
		return num;
	}

	function getCurrentItems(i, o) {
		return i.slice(0, o.items.visible);
	}
	function getOldItemsPrev(i, o, n) {
		return i.slice(n, o.items.oldVisible+n);
	}
	function getNewItemsPrev(i, o) {
		return i.slice(0, o.items.visible);
	}
	function getOldItemsNext(i, o) {
		return i.slice(0, o.items.oldVisible);
	}
	function getNewItemsNext(i, o, n) {
		return i.slice(n, o.items.visible+n);
	}

	function getVisibleItemsPrev(i, o, s) {
		var t = 0,
			x = 0;

		for (var a = s; a >= 0; a--) {
			t += i.eq(a)[o.d['outerWidth']](true);
			if (t > o.maxDimention) return x;
			if (a == 0) a = i.length;
			x++;
		}
	}
	function getVisibleItemsNext(i, o, s) {
		var t = 0,
			x = 0;

		for (var a = s, l = i.length-1; a <= l; a++) {
			t += i.eq(a)[o.d['outerWidth']](true);
			if (t > o.maxDimention) return x;
			if (a == l) a = -1;
			x++;
		}
	}
	function getVisibleItemsNextTestCircular(i, o, s, l) {
		var v = getVisibleItemsNext(i, o, s);
		if (!o.circular) {
			if (s + v > l) v = l - s;
		}
		return v;
	}

	function resetMargin(i, o, m) {
		var x = (typeof m == 'boolean') ? m : false;
		if (typeof m != 'number') m = 0;
		i.each(function() {
			var t = parseInt($(this).css(o.d['marginRight']));
			if (isNaN(t)) t = 0;
			$(this).data('cfs_tempCssMargin', t);
			$(this).css(o.d['marginRight'], ((x) ? $(this).data('cfs_tempCssMargin') : m + $(this).data('cfs_origCssMargin')));
		});
	}
	function ms_getSizes(i, o, wrapper) {
		s1 = ms_getTotalSize(i, o, 'width', wrapper);
		s2 = ms_getLargestSize(i, o, 'height', wrapper);
		return [s1, s2];
	}
	function ms_getLargestSize(i, o, dim, wrapper) {
		if (typeof wrapper != 'boolean') wrapper = false;
		if (typeof o[o.d[dim]] == 'number' && wrapper) return o[o.d[dim]];
		if (typeof o.items[o.d[dim]] == 'number') return o.items[o.d[dim]];
		var di2 = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight';
		return ms_getTrueLargestSize(i, o, di2);
	}
	function ms_getTrueLargestSize(i, o, dim) {
		var s = 0;
		i.each(function() {
			var m = $(this)[o.d[dim]](true);
			if (s < m) s = m;
		});
		return s;
	}
	function ms_getTrueInnerSize($el, o, dim) {
		var siz = $el[o.d[dim]](),
			arr = (o.d[dim].toLowerCase().indexOf('width') > -1) ? ['paddingLeft', 'paddingRight'] : ['paddingTop', 'paddingBottom'];
		for (a = 0, l = arr.length; a < l; a++) {
			var m = parseInt($el.css(arr[a]));
			if (isNaN(m)) m = 0;
			siz -= m;
		}
		return siz;
	}
	function ms_getTotalSize(i, o, dim, wrapper) {
		if (typeof wrapper != 'boolean') wrapper = false;
		if (typeof o[o.d[dim]] == 'number' && wrapper) return o[o.d[dim]];
		if (typeof o.items[o.d[dim]] == 'number') return o.items[o.d[dim]] * i.length;
		var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight',
			s = 0;
		i.each(function() {
			var j = $(this);
			if (j.is(':visible')) {
				s += j[o.d[d]](true);
			}
		});
		return s;
	}
	function ms_hasVariableSizes(i, o, dim) {
		var s = false,
			v = false;
		i.each(function() { 
			c = $(this)[o.d[dim]](true);
			if (s === false) s = c;
			else if (s != c) v = true;
			if (s == 0)		 v = true;
		});
		return v;
	}

	function mapWrapperSizes(ws, o, p) {
		if (typeof p != 'boolean') p = true;
		var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0];
		var wra = {};
			wra[o.d['width']] = ws[0] + pad[1] + pad[3];
			wra[o.d['height']] = ws[1] + pad[0] + pad[2];

		return wra;
	}
	function setSizes($c, o, p) {
		var $w = $c.parent(),
			$i = $c.children(),
			$v = getCurrentItems($i, o),
			sz = mapWrapperSizes(ms_getSizes($v, o, true), o, p);

		$w.css(sz);

		if (o.usePadding) {
			var $l = $v.last();
			$l.css(o.d['marginRight'], $l.data('cfs_origCssMargin') + o.padding[o.d[1]]);
			$c.css(o.d['top'], o.padding[o.d[0]]);
			$c.css(o.d['left'], o.padding[o.d[3]]);
		}
		$c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2));
		$c.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
		return sz;
	}

	function cf_getPadding(p) {
		if (typeof p == 'undefined') return [0, 0, 0, 0];
		
		if (typeof p == 'number') return [p, p, p, p];
		else if (typeof p == 'string') p = p.split('px').join('').split(' ');

		if (!is_array(p)) {
			return [0, 0, 0, 0];
		}
		for (var i = 0; i < 4; i++) {
			p[i] = parseInt(p[i]);
		}
		switch (p.length) {
			case 0: return [0, 0, 0, 0];
			case 1: return [p[0], p[0], p[0], p[0]];
			case 2: return [p[0], p[1], p[0], p[1]];
			case 3: return [p[0], p[1], p[2], p[1]];
			default: return [p[0], p[1], p[2], p[3]];
		}
	}
	function cf_getAlignPadding(itm, o) {
		var x = (typeof o[o.d['width']] == 'number') ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0;
		switch (o.align) {
			case 'left':
				return [0, x];
				break;
			case 'right':
				return [x, 0];
				break;
			case 'center':
			default:
				var x1 = Math.ceil(x/2), x2 = Math.floor(x/2);
				return [x1, x2];
				break;
		}
	}
	function cf_getVisibleItemsAdjust(x, o) {
		switch (o.visibleAdjust) {
			case '+1':
				return x + 1;
				break;
			case '-1':
				return x - 1;
				break;
			case 'odd':
				if (x % 2 == 0) return x - 1;
				break;
			case 'odd+':
				if (x % 2 == 0) return x + 1;
				break;
			case 'even':
				if (x % 2 == 1) return x - 1;
				break;
			case 'even+':
				if (x % 2 == 1) return x + 1;
				break;
			default:
				return x;
				break;
		}
	}

	function is_array(a) {
		return typeof(a) == 'object' && (a instanceof Array);
	}

	function debug(d, m) {
		if (!d) return false;
		if (typeof m == 'string') m = 'carouFredSel: ' + m;
		else m = ['carouFredSel:', m];

		if (window.console && window.console.log) window.console.log(m);
		return false;
	}



	$.fn.caroufredsel = function(o) {
		return this.carouFredSel(o);
	};

})(jQuery);;
/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/

// Speed of the automatic slideshow
var slideshowSpeed = 10000;

// Variable to store the images we need to set as background
// which also includes some text and url's.
var photos = [ {
		"title" : "E-Shop",
		"image" : "h3.jpg",
		"url" : "http://eshop.silvershop.cz",
		"firstline" : "Vánoční dárky jednoduše a rychle ? ",
		"secondline" : "navštivte náš e-shop"
	}, {
		"title" : "Office",
		"image" : "h2.jpg",
		"url" : "http://eshop.silvershop.cz",
		"firstline" : "Rychlý nákup ? ",
		"secondline" : "silvershop.cz"
	}, {
		"title" : "Mount",
		"image" : "h1.jpg",
		"url" : "http://eshop.silvershop.cz",
		"firstline" : "  ........",
		"secondline" : "!!!!!!!!"
	}, {
		"title" : "Mount",
		"image" : "h4.jpg",
		"url" : "http://eshop.silvershop.cz",
		"firstline" : "??????????????????????",
		"secondline" : "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	}, {
		"title" : "Ita",
		"image" : "h5.jpg",
		"url" : "http://eshop.silvershop.cz3",
		"firstline" : "+ + + + + + +",
		"secondline" : "- - - - - - - - - -"
	}
];




jQuery(function($) {
		
	var interval;
		// Start playing the animation
		interval = setInterval(function() {
		}, slideshowSpeed);
    	

	
	
	var activeContainer = 1;	
	var currentImg = 0;
	var animating = false;
	var navigate = function(direction) {
		// Check if no animation is running. If it is, prevent the action
		if(animating) {
			return;
		}
		
		// Check which current image we need to show
		if(direction == "next") {
			currentImg++;
			if(currentImg == photos.length + 1) {
				currentImg = 1;
			}
		} else {
			currentImg--;
			if(currentImg == 0) {
				currentImg = photos.length;
			}
		}
		
		// Check which container we need to use
		var currentContainer = activeContainer;
		if(activeContainer == 1) {
			activeContainer = 2;
		} else {
			activeContainer = 1;
		}
		
		showImage(photos[currentImg - 1], currentContainer, activeContainer);
		
	};
	
	var currentZindex = -1;
	var showImage = function(photoObject, currentContainer, activeContainer) {
		animating = true;
		
		// Make sure the new container is always on the background
		currentZindex--;
		
		// Set the background image of the new active container  url('images/slideshows/header.png');  location.hostname
		$("#headerimg" + activeContainer).css({
			"background-image" : "url('http://"+location.hostname+"/web/images/slideshows/" + photoObject.image + "')",
			"display" : "block"
//			"z-index" : currentZindex
		});
		// Hide the header text
		$("#headertxt").css({"display" : "none"});
		
		// Set the new header text
		$("#firstline").html(photoObject.firstline);
		$("#secondline")
			.attr("href", photoObject.url)
			.html(photoObject.secondline);

		
		
		// Fade out the current container
		// and display the header text when animation is complete
		$("#headerimg" + currentContainer).fadeOut(function() {
			setTimeout(function() {
				$("#headertxt").css({"display" : "block"});
				animating = false;
			}, 500);
		});
	};
	
	var stopAnimation = function() {
			// Clear the interval
		clearInterval(interval);
	};
	

	// Start playing the animation
	interval = setInterval(function() {
		navigate("next");
	}, slideshowSpeed);
	
});;
// ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

(function ($, document, window) {
    var
    // Default settings object.	
    // See http://jacklmoore.com/colorbox for details.
    defaults = {
        transition: "elastic",
        speed: 300,
        width: false,
        initialWidth: "600",
        innerWidth: false,
        maxWidth: false,
        height: false,
        initialHeight: "450",
        innerHeight: false,
        maxHeight: false,
        scalePhotos: true,
        scrolling: true,
        inline: false,
        html: false,
        iframe: false,
        fastIframe: true,
        photo: false,
        href: false,
        title: false,
        rel: false,
        opacity: 0.9,
        preloading: true,
        current: "image {current} of {total}",
        previous: "previous",
        next: "next",
        close: "close",
        open: false,
        returnFocus: true,
        loop: true,
        slideshow: false,
        slideshowAuto: true,
        slideshowSpeed: 2500,
        slideshowStart: "start slideshow",
        slideshowStop: "stop slideshow",
        onOpen: false,
        onLoad: false,
        onComplete: false,
        onCleanup: false,
        onClosed: false,
        overlayClose: true,		
        escKey: true,
        arrowKey: true,
        top: false,
        bottom: false,
        left: false,
        right: false,
        fixed: false,
        data: undefined
    },
	
    // Abstracting the HTML and event identifiers for easy rebranding
    colorbox = 'colorbox',
    prefix = 'cbox',
    boxElement = prefix + 'Element',
    
    // Events	
    event_open = prefix + '_open',
    event_load = prefix + '_load',
    event_complete = prefix + '_complete',
    event_cleanup = prefix + '_cleanup',
    event_closed = prefix + '_closed',
    event_purge = prefix + '_purge',
    
    // Special Handling for IE
    isIE = $.browser.msie && !$.support.opacity, // Detects IE6,7,8.  IE9 supports opacity.  Feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome, hence the user-agent test.
    isIE6 = isIE && $.browser.version < 7,
    event_ie6 = prefix + '_IE6',
    
    // Cached jQuery Object Variables
    $overlay,
    $box,
    $wrap,
    $content,
    $topBorder,
    $leftBorder,
    $rightBorder,
    $bottomBorder,
    $related,
    $window,
    $loaded,
    $loadingBay,
    $loadingOverlay,
    $title,
    $current,
    $slideshow,
    $next,
    $prev,
    $close,
    $groupControls,
    
    // Variables for cached values or use across multiple functions
    settings,
    interfaceHeight,
    interfaceWidth,
    loadedHeight,
    loadedWidth,
    element,
    index,
    photo,
    open,
    active,
    closing,
    loadingTimer,
    publicMethod,
    div = "div";

	// ****************
	// HELPER FUNCTIONS
	// ****************
    
	// Convience function for creating new jQuery objects
    function $tag(tag, id, css) {
        var element = document.createElement(tag);
        
        if (id) {
            element.id = prefix + id;
        }
        
        if (css) {
            element.style.cssText = css;
        }
        
        return $(element);
    }

	// Determine the next and previous members in a group.
	function getIndex(increment) {
		var 
		max = $related.length, 
		newIndex = (index + increment) % max;
		
		return (newIndex < 0) ? max + newIndex : newIndex;
	}

	// Convert '%' and 'px' values to integers
	function setSize(size, dimension) {
		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10));
	}
	
	// Checks an href to see if it is a photo.
	// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
	function isImage(url) {
		return settings.photo || /\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(url);
	}
	
	// Assigns function results to their respective properties
	function makeSettings() {
        var i;
        settings = $.extend({}, $.data(element, colorbox));
        
		for (i in settings) {
			if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
			    settings[i] = settings[i].call(element);
			}
		}
        
		settings.rel = settings.rel || element.rel || 'nofollow';
		settings.href = settings.href || $(element).attr('href');
		settings.title = settings.title || element.title;
        
        if (typeof settings.href === "string") {
            settings.href = $.trim(settings.href);
        }
	}

	function trigger(event, callback) {
		$.event.trigger(event);
		if (callback) {
			callback.call(element);
		}
	}

	// Slideshow functionality
	function slideshow() {
		var
		timeOut,
		className = prefix + "Slideshow_",
		click = "click." + prefix,
		start,
		stop,
		clear;
		
		if (settings.slideshow && $related[1]) {
			start = function () {
				$slideshow
					.text(settings.slideshowStop)
					.unbind(click)
					.bind(event_complete, function () {
						if (index < $related.length - 1 || settings.loop) {
							timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
						}
					})
					.bind(event_load, function () {
						clearTimeout(timeOut);
					})
					.one(click + ' ' + event_cleanup, stop);
				$box.removeClass(className + "off").addClass(className + "on");
				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
			};
			
			stop = function () {
				clearTimeout(timeOut);
				$slideshow
					.text(settings.slideshowStart)
					.unbind([event_complete, event_load, event_cleanup, click].join(' '))
					.one(click, function () {
						publicMethod.next();
						start();
					});
				$box.removeClass(className + "on").addClass(className + "off");
			};
			
			if (settings.slideshowAuto) {
				start();
			} else {
				stop();
			}
		} else {
            $box.removeClass(className + "off " + className + "on");
        }
	}

	function launch(target) {
		if (!closing) {
			
			element = target;
			
			makeSettings();
			
			$related = $(element);
			
			index = 0;
			
			if (settings.rel !== 'nofollow') {
				$related = $('.' + boxElement).filter(function () {
					var relRelated = $.data(this, colorbox).rel || this.rel;
					return (relRelated === settings.rel);
				});
				index = $related.index(element);
				
				// Check direct calls to ColorBox.
				if (index === -1) {
					$related = $related.add(element);
					index = $related.length - 1;
				}
			}
			
			if (!open) {
				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
				
				$box.show();
				
				if (settings.returnFocus) {
					try {
						element.blur();
						$(element).one(event_closed, function () {
							try {
								this.focus();
							} catch (e) {
								// do nothing
							}
						});
					} catch (e) {
						// do nothing
					}
				}
				
				// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
				
				// Opens inital empty ColorBox prior to content being loaded.
				settings.w = setSize(settings.initialWidth, 'x');
				settings.h = setSize(settings.initialHeight, 'y');
				publicMethod.position();
				
				if (isIE6) {
					$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
						$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
					}).trigger('resize.' + event_ie6);
				}
				
				trigger(event_open, settings.onOpen);
				
				$groupControls.add($title).hide();
				
				$close.html(settings.close).show();
			}
			
			publicMethod.load(true);
		}
	}

	// ****************
	// PUBLIC FUNCTIONS
	// Usage format: $.fn.colorbox.close();
	// Usage from within an iframe: parent.$.fn.colorbox.close();
	// ****************
	
	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
		var $this = this;
		
        options = options || {};
        
		publicMethod.init();
		
		if (!$this[0]) {
			if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
                return $this;
            }
            // if no selector was given (ie. $.colorbox()), create a temporary element to work with
			$this = $('<a/>');
			options.open = true; // assume an immediate open
		}
		
		if (callback) {
			options.onComplete = callback;
		}
		
		$this.each(function () {
			$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
			$(this).addClass(boxElement);
		});
		
        if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
			launch($this[0]);
		}
        
		return $this;
	};

	// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
	// This preps ColorBox for a speedy open when clicked, and minimizes the burdon on the browser by only
	// having to run once, instead of each time colorbox is opened.
	publicMethod.init = function () {
		if (!$box) {
			
			// If the body is not present yet, wait for DOM ready
			if (!$('body')[0]) {
				$(publicMethod.init);
				return;
			}
			
			// Create the markup and append to BODY
			$window = $(window);
			$box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
			$overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
			$wrap = $tag(div, "Wrapper");
			$content = $tag(div, "Content").append(
				$loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'),
				$loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic")),
				$title = $tag(div, "Title"),
				$current = $tag(div, "Current"),
				$next = $tag(div, "Next"),
				$prev = $tag(div, "Previous"),
				$slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
				$close = $tag(div, "Close")
			);
			
			$wrap.append( // The 3x3 Grid that makes up ColorBox
				$tag(div).append(
					$tag(div, "TopLeft"),
					$topBorder = $tag(div, "TopCenter"),
					$tag(div, "TopRight")
				),
				$tag(div, false, 'clear:left').append(
					$leftBorder = $tag(div, "MiddleLeft"),
					$content,
					$rightBorder = $tag(div, "MiddleRight")
				),
				$tag(div, false, 'clear:left').append(
					$tag(div, "BottomLeft"),
					$bottomBorder = $tag(div, "BottomCenter"),
					$tag(div, "BottomRight")
				)
			).find('div div').css({'float': 'left'});
			
			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
			
			$('body').prepend($overlay, $box.append($wrap, $loadingBay));
			
			// Cache values needed for size calculations
			interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
			interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
			loadedHeight = $loaded.outerHeight(true);
			loadedWidth = $loaded.outerWidth(true);
			
			// Setting padding to remove the need to do size conversions during the animation step.
			$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
			
			// Setup button events.
			// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
			$next.click(function () {
				publicMethod.next();
			});
			$prev.click(function () {
				publicMethod.prev();
			});
			$close.click(function () {
				publicMethod.close();
			});
			
			$groupControls = $next.add($prev).add($current).add($slideshow);
			
			$overlay.click(function () {
				if (settings.overlayClose) {
					publicMethod.close();
				}
			});
			
			// Set Navigation Key Bindings
			$(document).bind('keydown.' + prefix, function (e) {
				var key = e.keyCode;
				if (open && settings.escKey && key === 27) {
					e.preventDefault();
					publicMethod.close();
				}
				if (open && settings.arrowKey && $related[1]) {
					if (key === 37) {
						e.preventDefault();
						$prev.click();
					} else if (key === 39) {
						e.preventDefault();
						$next.click();
					}
				}
			});
		}
	};
	
	publicMethod.remove = function () {
		$box.add($overlay).remove();
		$box = null;
		$('.' + boxElement).removeData(colorbox).removeClass(boxElement);
	};

	publicMethod.position = function (speed, loadedCallback) {
        var top = 0, left = 0, offset = $box.offset();
        
        $window.unbind('resize.' + prefix);

        // remove the modal so that it doesn't influence the document width/height        
        $box.css({top: -99999, left: -99999});

        if (settings.fixed && !isIE6) {
            $box.css({position: 'fixed'});
        } else {
            top = $window.scrollTop();
            left = $window.scrollLeft();
            $box.css({position: 'absolute'});
        }

		// keeps the top and left positions within the browser's viewport.
        if (settings.right !== false) {
            left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
        } else if (settings.left !== false) {
            left += setSize(settings.left, 'x');
        } else {
            left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
        }
        
        if (settings.bottom !== false) {
            top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
        } else if (settings.top !== false) {
            top += setSize(settings.top, 'y');
        } else {
            top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
        }
        
        $box.css({top: offset.top, left: offset.left});
        
		// setting the speed to 0 to reduce the delay between same-sized content.
		speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
        
		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
		// it can invoke an obscure IE bug when using iframes.
		$wrap[0].style.width = $wrap[0].style.height = "9999px";
		
		function modalDimensions(that) {
			// loading overlay height has to be explicitly set for IE6.
			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
			$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
		}
		
		$box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left}, {
			duration: speed,
			complete: function () {
				modalDimensions(this);
				
				active = false;
				
				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
				
				if (loadedCallback) {
					loadedCallback();
				}
                
                setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
                    $window.bind('resize.' + prefix, publicMethod.position);
                }, 1);
			},
			step: function () {
				modalDimensions(this);
			}
		});
	};

	publicMethod.resize = function (options) {
		if (open) {
			options = options || {};
			
			if (options.width) {
				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
			}
			if (options.innerWidth) {
				settings.w = setSize(options.innerWidth, 'x');
			}
			$loaded.css({width: settings.w});
			
			if (options.height) {
				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
			}
			if (options.innerHeight) {
				settings.h = setSize(options.innerHeight, 'y');
			}
			if (!options.innerHeight && !options.height) {
				$loaded.css({height: "auto"});
				settings.h = $loaded.height();
			}
			$loaded.css({height: settings.h});
			
			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
		}
	};

	publicMethod.prep = function (object) {
		if (!open) {
			return;
		}
		
		var callback, speed = settings.transition === "none" ? 0 : settings.speed;
		
		$loaded.remove();
		$loaded = $tag(div, 'LoadedContent').append(object);
		
		function getWidth() {
			settings.w = settings.w || $loaded.width();
			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
			return settings.w;
		}
		function getHeight() {
			settings.h = settings.h || $loaded.height();
			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
			return settings.h;
		}
		
		$loaded.hide()
		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
		.prependTo($content);
		
		$loadingBay.hide();
		
		// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
		//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
		
        $(photo).css({'float': 'none'});
        
		// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
		if (isIE6) {
			$('select').not($box.find('select')).filter(function () {
				return this.style.visibility !== 'hidden';
			}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
				this.style.visibility = 'inherit';
			});
		}
		
		callback = function () {
            var preload, i, total = $related.length, iframe, frameBorder = 'frameBorder', allowTransparency = 'allowTransparency', complete, src, img;
            
            if (!open) {
                return;
            }
            
            function removeFilter() {
                if (isIE) {
                    $box[0].style.removeAttribute('filter');
                }
            }
            
            complete = function () {
                clearTimeout(loadingTimer);
                $loadingOverlay.hide();
                trigger(event_complete, settings.onComplete);
            };
            
            if (isIE) {
                //This fadeIn helps the bicubic resampling to kick-in.
                if (photo) {
                    $loaded.fadeIn(100);
                }
            }
            
            $title.html(settings.title).add($loaded).show();
            
            if (total > 1) { // handle grouping
                if (typeof settings.current === "string") {
                    $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
                }
                
                $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
                $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
				
                if (settings.slideshow) {
                    $slideshow.show();
                }
				
                // Preloads images within a rel group
                if (settings.preloading) {
					preload = [
						getIndex(-1),
						getIndex(1)
					];
					while ((i = $related[preload.pop()])) {
						src = $.data(i, colorbox).href || i.href;
						if ($.isFunction(src)) {
							src = src.call(i);
						}
						if (isImage(src)) {
							img = new Image();
							img.src = src;
						}
					}
                }
            } else {
                $groupControls.hide();
            }
            
            if (settings.iframe) {
                iframe = $tag('iframe')[0];
                
                if (frameBorder in iframe) {
                    iframe[frameBorder] = 0;
                }
                if (allowTransparency in iframe) {
                    iframe[allowTransparency] = "true";
                }
                // give the iframe a unique name to prevent caching
                iframe.name = prefix + (+new Date());
                if (settings.fastIframe) {
                    complete();
                } else {
                    $(iframe).one('load', complete);
                }
                iframe.src = settings.href;
                if (!settings.scrolling) {
                    iframe.scrolling = "no";
                }
                $(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function () {
                    iframe.src = "//about:blank";
                });
            } else {
                complete();
            }
            
            if (settings.transition === 'fade') {
                $box.fadeTo(speed, 1, removeFilter);
            } else {
                removeFilter();
            }
		};
		
		if (settings.transition === 'fade') {
			$box.fadeTo(speed, 0, function () {
				publicMethod.position(0, callback);
			});
		} else {
			publicMethod.position(speed, callback);
		}
	};

	publicMethod.load = function (launched) {
		var href, setResize, prep = publicMethod.prep;
		
		active = true;
		
		photo = false;
		
		element = $related[index];
		
		if (!launched) {
			makeSettings();
		}
		
		trigger(event_purge);
		
		trigger(event_load, settings.onLoad);
		
		settings.h = settings.height ?
				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
				settings.innerHeight && setSize(settings.innerHeight, 'y');
		
		settings.w = settings.width ?
				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
				settings.innerWidth && setSize(settings.innerWidth, 'x');
		
		// Sets the minimum dimensions for use in image scaling
		settings.mw = settings.w;
		settings.mh = settings.h;
		
		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
		if (settings.maxWidth) {
			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
		}
		if (settings.maxHeight) {
			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
		}
		
		href = settings.href;
		
        loadingTimer = setTimeout(function () {
            $loadingOverlay.show();
        }, 100);
        
		if (settings.inline) {
			// Inserts an empty placeholder where inline content is being pulled from.
			// An event is bound to put inline content back when ColorBox closes or loads new content.
			$tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
				$(this).replaceWith($loaded.children());
			});
			prep($(href));
		} else if (settings.iframe) {
			// IFrame element won't be added to the DOM until it is ready to be displayed,
			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
			prep(" ");
		} else if (settings.html) {
			prep(settings.html);
		} else if (isImage(href)) {
			$(photo = new Image())
			.addClass(prefix + 'Photo')
			.error(function () {
				settings.title = false;
				prep($tag(div, 'Error').text('This image could not be loaded'));
			})
			.load(function () {
				var percent;
				photo.onload = null; //stops animated gifs from firing the onload repeatedly.
				
				if (settings.scalePhotos) {
					setResize = function () {
						photo.height -= photo.height * percent;
						photo.width -= photo.width * percent;	
					};
					if (settings.mw && photo.width > settings.mw) {
						percent = (photo.width - settings.mw) / photo.width;
						setResize();
					}
					if (settings.mh && photo.height > settings.mh) {
						percent = (photo.height - settings.mh) / photo.height;
						setResize();
					}
				}
				
				if (settings.h) {
					photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
				}
				
				if ($related[1] && (index < $related.length - 1 || settings.loop)) {
					photo.style.cursor = 'pointer';
					photo.onclick = function () {
                        publicMethod.next();
                    };
				}
				
				if (isIE) {
					photo.style.msInterpolationMode = 'bicubic';
				}
				
				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
					prep(photo);
				}, 1);
			});
			
			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
				photo.src = href;
			}, 1);
		} else if (href) {
			$loadingBay.load(href, settings.data, function (data, status, xhr) {
				prep(status === 'error' ? $tag(div, 'Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
			});
		}
	};
        
	// Navigates to the next page/image in a set.
	publicMethod.next = function () {
		if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
			index = getIndex(1);
			publicMethod.load();
		}
	};
	
	publicMethod.prev = function () {
		if (!active && $related[1] && (index || settings.loop)) {
			index = getIndex(-1);
			publicMethod.load();
		}
	};

	// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
	publicMethod.close = function () {
		if (open && !closing) {
			
			closing = true;
			
			open = false;
			
			trigger(event_cleanup, settings.onCleanup);
			
			$window.unbind('.' + prefix + ' .' + event_ie6);
			
			$overlay.fadeTo(200, 0);
			
			$box.stop().fadeTo(300, 0, function () {
                 
				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
				
				trigger(event_purge);
				
				$loaded.remove();
				
				setTimeout(function () {
					closing = false;
					trigger(event_closed, settings.onClosed);
				}, 1);
			});
		}
	};

	// A method for fetching the current element ColorBox is referencing.
	// returns a jQuery object.
	publicMethod.element = function () {
		return $(element);
	};

	publicMethod.settings = defaults;
    
	// Bind the live event before DOM-ready for maximum performance in IE6 & 7.
	$('.' + boxElement, document).live('click', function (e) {
        // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
        // See: http://jacklmoore.com/notes/click-events/
        if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
            e.preventDefault();
            launch(this);
        }
    });

	// Setup ColorBox
	publicMethod.init();

}(jQuery, document, this));;
(function ($) {

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .colorbox(settings.colorbox);
  }
};

{
  $(document).bind('cbox_complete', function () {
    Drupal.attachBehaviors('#cboxLoadedContent');
  });
}

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxStockholmsyndromeStyle = {
  attach: function (context, settings) {
    $(document).bind('cbox_open', function () {
      // Hide close button initially.
      $('#cboxClose', context).css('opacity', 0);
    });
    $(document).bind('cbox_load', function () {
      // Hide close button. (It doesn't handle the load animation well.)
      $('#cboxClose', context).css('opacity', 0);
    });
    $(document).bind('cbox_complete', function () {
      // Show close button with a delay.
      $('#cboxClose', context).fadeTo('fast', 0, function () {$(this).css('opacity', 1)});
    });
  }
};

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxLoad = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $.urlParams = function (url) {
      var p = {},
          e,
          a = /\+/g,  // Regex for replacing addition symbol with a space
          r = /([^&=]+)=?([^&]*)/g,
          d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
          q = url.split('?');
      while (e = r.exec(q[1])) {
        e[1] = d(e[1]);
        e[2] = d(e[2]);
        switch (e[2].toLowerCase()) {
          case 'true':
          case 'yes':
            e[2] = true;
            break;
          case 'false':
          case 'no':
            e[2] = false;
            break;
        }
        if (e[1] == 'width') { e[1] = 'innerWidth'; }
        if (e[1] == 'height') { e[1] = 'innerHeight'; }
        p[e[1]] = e[2];
      }
      return p;
    };
    $('a, area, input', context)
      .filter('.colorbox-load')
      .once('init-colorbox-load-processed', function () {
        var params = $.urlParams($(this).attr('href'));
        $(this).colorbox($.extend({}, settings.colorbox, params));
      });
  }
};

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxInline = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $.urlParam = function(name, url){
      if (name == 'fragment') {
        var results = new RegExp('(#[^&#]*)').exec(url);
      }
      else {
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
      }
      if (!results) { return ''; }
      return results[1] || '';
    };
    $('a, area, input', context).filter('.colorbox-inline').once('init-colorbox-inline-processed').colorbox({
      transition:settings.colorbox.transition,
      speed:settings.colorbox.speed,
      opacity:settings.colorbox.opacity,
      slideshow:settings.colorbox.slideshow,
      slideshowAuto:settings.colorbox.slideshowAuto,
      slideshowSpeed:settings.colorbox.slideshowSpeed,
      slideshowStart:settings.colorbox.slideshowStart,
      slideshowStop:settings.colorbox.slideshowStop,
      current:settings.colorbox.current,
      previous:settings.colorbox.previous,
      next:settings.colorbox.next,
      close:settings.colorbox.close,
      overlayClose:settings.colorbox.overlayClose,
      maxWidth:settings.colorbox.maxWidth,
      maxHeight:settings.colorbox.maxHeight,
      innerWidth:function(){
        return $.urlParam('width', $(this).attr('href'));
      },
      innerHeight:function(){
        return $.urlParam('height', $(this).attr('href'));
      },
      title:function(){
        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
      },
      iframe:function(){
        return $.urlParam('iframe', $(this).attr('href'));
      },
      inline:function(){
        return $.urlParam('inline', $(this).attr('href'));
      },
      href:function(){
        return $.urlParam('fragment', $(this).attr('href'));
      }
    });
  }
};

})(jQuery);
;
// Image Node Auto-Format with Auto Image Grouping.
// Original version by Steve McKenzie.
// Altered by Stella Power for jQuery version.

(function ($) {

function parse_url(url, param) {
  param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  url = url.replace(/&amp;/, "&");
  var regexS = "[\\?&]"+param+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(url);
  if (results === null) {
    return "";
  }
  else {
    return results[1];
  }
}


function lightbox2_init_triggers(classes, rel_type, custom_class) {
  if (classes == '' || rel_type == 0) {
    return;
  }
  var settings = Drupal.settings.lightbox2;

  var link_target  = "";
  if (settings.node_link_target !== 0) {
    link_target = 'target="'+ settings.node_link_target +'"';
  }

  $("a:has("+classes+")").each(function(i) {
    if ((!settings.disable_for_gallery_lists && !settings.disable_for_acidfree_gallery_lists) || (!$(this).parents("td.giAlbumCell").attr("class") && !$(this).parents(".galleries").length && !$(this).parents(".acidfree-folder").length && !$(this).parents(".acidfree-list").length) || ($(this).parents(".galleries").length && !settings.disable_for_gallery_lists) || (($(this).parents(".acidfree-folder").length || $(this).parents(".acidfree-list").length) && !settings.disable_for_acidfree_gallery_lists)) {
      var child = $(this).find(classes);
      // Ensure the child has a class attribute we can work with.
      if ($(child).attr("class")) {
        // Set the alt text.
        var alt = $(child).attr("alt");
        if (!alt) {
          alt = "";
        }

        // Set the image node link text.
        var link_text = settings.node_link_text;
        var download_link_text = settings.download_link_text;
        var rewrite = 1;

        // Set the rel attribute.
        var rel = "lightbox";
        var lightframe = false;
        if (rel_type == "lightframe_ungrouped") {
          rel = "lightframe[]";
          lightframe = true;
        }
        else if (rel_type == "lightframe") {
          lightframe = true;
        }
        else if (rel_type == "lightbox_ungrouped") {
          rel = "lightbox[]";
        }
        if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
          rel = rel_type + "[" + $(child).attr("class") + "]";
        }

        // Set the basic href attribute - need to ensure there's no language
        // string (e.g. /en) prepended to the URL.
        var id = null;
        var href = $(child).attr("src");
        var download = null;
        var orig_href = $(this).attr("href");
        var pattern = new RegExp(settings.file_path);
        if (orig_href.match(pattern)) {
          var lang_pattern = new RegExp(Drupal.settings.basePath + "\\w\\w\\/");
          orig_href = orig_href.replace(lang_pattern, Drupal.settings.basePath);
        }
        var frame_href = orig_href;
        // Handle flickr images.
        if ($(child).attr("class").match("flickr-photo-img") ||
          $(child).attr("class").match("flickr-photoset-img")) {
          href = $(child).attr("src").replace("_s.", ".").replace("_t.", ".").replace("_m.", ".").replace("_b.", ".");
          if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
            rel = rel_type + "[flickr]";
            if ($(child).parents("div.block-flickr").attr("class")) {
              id = $(child).parents("div.block-flickr").attr("id");
              rel = rel_type + "["+ id +"]";
            }
          }
          download = href;
        }

        // Handle "image-img_assist_custom" images.
        else if ($(child).filter("img[class*=img_assist_custom]").size()) {
          // Image assist uses "+" signs for spaces which doesn't work for
          // normal links.
          if (settings.display_image_size != "original") {
            orig_href = orig_href.replace(/\+/, " ");
            href = $(child).attr("src").replace(new RegExp("\\.img_assist_custom-[0-9]+x[0-9]+"), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size));
            if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
              rel = rel_type + "[node_images]";
            }
            if (lightframe) {
              frame_href = orig_href + "/lightbox2";
            }
          }
          else {
            rewrite = 0;
          }
        }

        // Handle "inline" images.
        else if ($(child).attr("class").match("inline")) {
          href = orig_href;
        }

        // Handle gallery2 block images.
        else if ($(child).attr("class").match("ImageFrame_image") || $(child).attr("class").match("ImageFrame_none")) {
          var thumb_id = parse_url(href, "g2_itemId");
          var new_id = parse_url(orig_href, "g2_itemId");
          if (new_id && thumb_id) {
            var g2pattern = new RegExp("g2_itemId="+thumb_id);
            var replacement = "g2_itemId="+ new_id;
            href = href.replace(g2pattern, replacement);
          }
          rel = rel_type + "[gallery2]";
          if ($(child).parents("div.block-gallery").attr("class")) {
            id = $(child).parents("div.block-gallery").attr("id");
            rel = rel_type + "["+ id +"]";
          }
          download = href;
        }


        // Set the href attribute.
        else if (settings.image_node_sizes != '()' && !custom_class) {
          if (settings.display_image_size != "original") {
            href = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)).replace(/(image\/view\/\d+)(\/[\w\-]*)/, ((settings.display_image_size === "")?"$1/_original":"$1/"+ settings.display_image_size));
            if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
              rel = rel_type + "[node_images]";
              if ($(child).parents("div.block-multiblock,div.block-image").attr("class")) {
                id = $(child).parents("div.block-multiblock,div.block-image").attr("id");
                rel = rel_type + "["+ id +"]";
              }
            }
            download = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), "").replace(/(image\/view\/\d+)(\/[\w\-]*)/, "$1/_original");
            if (lightframe) {
              frame_href = orig_href + "/lightbox2";
            }
          }
          else {
            rewrite = 0;
          }
        }
        // Modify the image url.
        var img_title = $(child).attr("title");
        if (!img_title) {
          img_title = $(this).attr("title");
          if (!img_title) {
            img_title = $(child).attr("alt");
          }
          $(child).attr({title: img_title});
        }
        if (lightframe) {
          href = frame_href;
        }
        if (rewrite) {
          if (!custom_class) {
            var title_link = "";
            if (link_text.length) {
              title_link = "<br /><br /><a href=\"" + orig_href + "\" id=\"lightbox2-node-link-text\" "+ link_target +" >"+ link_text + "</a>";
            }
            if (download_link_text.length && download) {
              title_link = title_link + " - <a href=\"" + download + "\" id=\"lightbox2-download-link-text\" target=\"_blank\">" + download_link_text + "</a>";
            }
            rel = rel + "[" + img_title + title_link + "]";
            $(this).attr({
              rel: rel,
              href: href
            });
          }
          else {
            if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
              rel = rel_type + "[" + $(child).attr("class") + "]";
              if ($(child).parents("div.block-image").attr("class")) {
                id = $(child).parents("div.block-image").attr("id");
                rel = rel_type + "["+ id +"]";
              }
            }
            rel = rel + "[" + img_title + "]";
            $(this).attr({
              rel: rel,
              href: orig_href
            });
          }
        }
      }
    }

  });
}

function lightbox2_image_nodes() {
  var settings = Drupal.settings.lightbox2;

  // Don't do it on the image assist popup selection screen.
  var img_assist = document.getElementById("img_assist_thumbs");
  if (!img_assist) {

    // Select the enabled image types.
    lightbox2_init_triggers(settings.trigger_lightbox_classes, "lightbox_ungrouped");
    lightbox2_init_triggers(settings.custom_trigger_classes, settings.custom_class_handler, true);
    lightbox2_init_triggers(settings.trigger_lightbox_group_classes, "lightbox");
    lightbox2_init_triggers(settings.trigger_slideshow_classes, "lightshow");
    lightbox2_init_triggers(settings.trigger_lightframe_classes, "lightframe_ungrouped");
    lightbox2_init_triggers(settings.trigger_lightframe_group_classes, "lightframe");
  }
}

Drupal.behaviors.initAutoLightbox = {
  attach: function(context, settings) {
    lightbox2_image_nodes();
  }
};

//End jQuery block
}(jQuery));
;

