/* 
 * Changelog
 * 2.6:   Added image lazy Load
 * 2.5.2: Additional link
 * 2.5.1: first round of internal link eventracking
 * 2.5:   jQuery Selector optimizations 5-15-2010
 *
 */


(function ($) {
	$(document).ready(function () {
								
								
$(".post img, #relatedEntries img, .postThumb img").lazyload({ 
    effect : "fadeIn"
});								
								
		$('#content div.collectionPreview').hover(function () {
			$(this).addClass('collectionPreviewHover')
		}, function () {
			$(this).removeClass('collectionPreviewHover')
		});
		$('#content div.collectionPreview').live('click', function () {
			var link = $(this).children('h4:eq(0)').children('a').attr('href');
			window.location = link;
			return false;
		});
		
		/* Segment internal links for eventracking */
		$('#menu a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Primary Navi', $(this).html()]);							
		});
		$('#footer-tag-cloud a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Footer Tag Cloud', $(this).html()]);							
		});
		$('#footer-cats a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Footer Categories', $(this).html()]);							
		});	
		$('#footer-navi a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Footer Navi', $(this).html()]);
		});	
		$('#content a.smartlink').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Seo Smartlink', $(this).html()]);									 
		});
		$('#categories-330178842 a, #categories-330178841 a, #categories-330178843 a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Sidebar Category', $(this).html()]);									 
		});
		$('#recent-posts-3 a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Sidebar Recent Posts', $(this).html()]);									 
		});
		$('#latestMini h3 a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Blog Index', 'Header']);									 
		});
		$('#latestMini p.miniinfo a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Blog Index', 'Comments']);									 
		});
		$('#latestMini div.postThumb a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Blog Index', 'Thumbnail']);									 
		});	
		$('#latestMini div.readit a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Blog Index', 'Read Full']);									 
		});
		$('div.archivepost h2 a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Archive|Tag', 'Header']);									 
		});
		$('div.archivepost .postThumb a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Archive|Tag', 'Thumb']);									 
		});
		$('div.archivepost a.viewEntire').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Archive|Tag', 'View Entire']);									 
		});
		$('div.archivepost small a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Archive|Tag', 'Comments']);									 
		});
		$('#gallery-image-area a').live('click', function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Gallery', 'Large Image']);									 
		});	
		$('#gallery-meta-area .gallery-more-info a').live('click', function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Gallery', 'Meta: '+$(this).html()]);									 
		});
		$('#photoInfo a').click(function(){
			_gaq.push(['_trackEvent', 'Internal Click', 'Photo Info', $(this).html()]);									 										 
		});
		
		
		$('a[rel="lightbox"],a[rel="lightbox-100"]').fancybox({
			'zoomOpacity': true,
			'overlayShow': true,
			'zoomSpeedIn': 500,
			'zoomSpeedOut': 500,
			'centerOnScroll': false,
			'overlayOpacity': 0.5
		});


		
		/* Add to Cart widget */
		var photoPriceWidget = 	$('#photoPrices');
		if(photoPriceWidget.is('*')){
			//photoPriceWidget.find('li:last').children('.addToCartNotif').show();
			photoPriceWidget.find('li')
				.hover(function () {
					$(this).addClass("highlight")
				}, function () {
					$(this).removeClass("highlight")
				})
				.click(function () {
					$(this).children('input').attr('checked', 'checked')
				});
				
			$('#addtocartbutton').click(function () {
				var cartmessage = $('#cartMessage');
				cartmessage.html('<img src="' + skinPath + '/images/ajax-loader.gif" />');
				var checkedSize = photoPriceWidget.find("input[@name='printPrices']:checked");
				var printSize = checkedSize.siblings('.printSize').html();
				var printPrice = checkedSize.siblings('.price').html();
				var photoId = photoPriceWidget.attr("class");
				photoId = photoId.replace('-', '=');
				cartmessage.load(skinPath + '/ajax.php?function=addToCart&size=' + printSize + '&' + photoId + '&price=' + printPrice + '&random=' + (new Date()).getTime(), function () {
					$('.cartlink').load(skinPath + '/ajax.php?function=calculateCart&random=' + (new Date()).getTime(), function () {
						$('#cartInfo').slideDown()
					})
				})
			});
			
		} /* end if($('#photoPrices').is('*')) */
		$('.cartlink').load(skinPath + '/ajax.php?function=calculateCart&random=' + (new Date()).getTime());
		if ($('.cartlink:first').html() != 'Cart: 0 items - $0.00') {
			$('#cartInfo').slideDown()
		};
		$('.cartQty').change(function () {
			$('#googleCheckout, #paypalCheckout').hide();
			$('#cartTotal').html('<img src="' + skinPath + '/images/ajax-loader.gif" />');
			var tableRow = $(this).parent().parent();
			var itemId = $(this).attr('id').split('_');
			if ($(this).val() == 0) {
				tableRow.css('background-color', '#f00');
				$.get(skinPath + '/ajax.php?function=removeItemFromCart&itemId=' + itemId[1] + '&random=' + (new Date()).getTime(), function () {
					tableRow.children('td').fadeOut(600, function () {
						updateCart()
					})
				})
			}
			else if (($(this).val() < 0) || (!isNumeric($(this).val()))) {
				alert("Invalid Quantity. Setting Quantity to 1");
				$(this).val(1);
				updateCart()
			}
			else {
				var linePrice = $(this).parent().next();
				linePrice.html('<img src="' + skinPath + '/images/ajax-loader.gif" />');
				var bcolor = tableRow.css('background-color');
				tableRow.css('background-color', '#FFFF88');
				linePrice.load(skinPath + '/ajax.php?function=updateQty&itemId=' + itemId[1] + '&quantity=' + $(this).val() + '&random=' + (new Date()).getTime(), function () {
					updateCart();
					tableRow.css('background-color', bcolor)
				})
			}
		});
		$('.removeItem').click(function () {
			$('#googleCheckout, #paypalCheckout').hide();
			$('#cartTotal').html('<img src="' + skinPath + '/images/ajax-loader.gif" />');
			var tableRow = $(this).parent().parent();
			var itemId = tableRow.children('.qty').children('.cartQty').attr('id').split('_');
			tableRow.css('background-color', '#f00');
			$.get(skinPath + '/ajax.php?function=removeItemFromCart&itemId=' + itemId[1] + '&random=' + (new Date()).getTime(), function () {
				tableRow.children('td').fadeOut(600, function () {
					updateCart()
				})
			})
		});

		function updateCart() {
			$('.cartlink').load(skinPath + '/ajax.php?function=calculateCart&random=' + (new Date()).getTime());
			$('#cartTotal').load(skinPath + '/ajax.php?function=calculateCart&subTotal=TRUE&random=' + (new Date()).getTime());
			$('#googlecheckoutinfo').load(skinPath + '/ajax.php?function=updateGoogle&random=' + (new Date()).getTime(), function () {
				$('#googleCheckout').fadeIn()
			});
			$('#paypalcheckoutinfo').load(skinPath + '/ajax.php?function=updatePaypal&random=' + (new Date()).getTime(), function () {
				$('#paypalCheckout').fadeIn()
			})
		}
		$('ul.popularTabs li').click(function () {
			$('.activeTab').removeClass('activeTab');
			$('.popularContentHeight').css('height', $('.popularContentHeight').height());
			$(this).addClass('activeTab');
			if ($(this).attr('id') == 'tcTab') var loadtype = 'topContent';
			else if ($(this).attr('id') == 'recentPop') var loadtype = 'recent';
			else var loadtype = 'topPhotos';
			var show = $('.popularContent:eq(' + $('.popularTabs li').index(this) + ')');
			if (show.html() == '') {
				var tab = $(this);
				tab.css('width', tab.width() + 'px');
				var tabTitle = tab.html();
				tab.html('<img src="' + skinPath + '/images/tab-loader.gif" style="margin: 0 auto; padding: 0"/>');
				show.load(skinPath + '/ajax.php?function=topRankedGet&get=' + loadtype, function () {
					tab.html(tabTitle);
					$('.pcshowing').fadeOut(150, function () {
						$('.popularContentHeight').animate({
							'height': $(show).height()
						}, 200, function () {
							$(show).fadeIn(200);
							$('.pcshowing').removeClass('pcshowing');
							$(show).addClass('pcshowing')
						})
					})
				})
			}
			else {
				$('.pcshowing').fadeOut(150, function () {
					$('.popularContentHeight').animate({
						'height': $(show).height()
					}, 200, function () {
						$(show).fadeIn(200);
						$('.pcshowing').removeClass('pcshowing');
						$(show).addClass('pcshowing')
					})
				})
			}
		});
		$('div.flickListDetails').each(function () {
			var src = $(this).find('img').attr('src');
			$("<img>").attr("src", src)
		});
		$('li.flickListItem').live('mouseover', function () {
			var thisList = $(this).parent();
			var thisContainer = thisList.parent();
			var index = thisList.children('li').index(this);
			thisContainer.find('.fldshowing').removeClass('fldshowing');
			thisContainer.children('.flickListDetails:eq(' + index + ')').addClass('fldshowing')
		}, function () {});
		$('#gallery-pager li').hover(function () {
			$(this).addClass('gallery-pager-hover')
		}, function () {
			$(this).removeClass('gallery-pager-hover')
		});
		$('#gallery-pager li').click(function () {
			$('#gallery-thumb-height').css('height', $('#gallery-thumb-height').height());
			var index = $('#gallery-pager li').index(this);
			$('.active-gallery-page').removeClass('active-gallery-page');
			$(this).addClass('active-gallery-page');
			$('.galleryPage-showing').hide().removeClass('galleryPage-showing');
			$('.galleryPage:eq(' + index + ')').fadeIn().addClass('galleryPage-showing')
		});
		var autoLoad = true;
		//if ($('.gallery-thumb:eq(0)').is('*')) $('.gallery-thumb:eq(0)').showGalleryImage(true);
		$('li.gallery-thumb a').click(function (e) {
			e.preventDefault();											  	
			$(this).parent('li.gallery-thumb').showGalleryImage(false)
		});
		var onMouseOutOpacity = 0.67;
		$('.gallery-thumb').opacityrollover({
			mouseOutOpacity: onMouseOutOpacity,
			mouseOverOpacity: 1.0,
			fadeSpeed: 'fast',
			exemptionSelector: '.gallery-selected'
		});
		$('.embedCode').click(function () {
			$(this).focus().select()
		});
		
		$('#gallery-large-image', $('#kp-gallery')).load(function(){
			var imgh = $(this).height();
			var imgw = $(this).width();
			$('#gallery-loader').css({
				'width': imgw + 'px',
				'height': imgh + 'px'						
			});		
		});
		
	});
	$.fn.showGalleryImage = function (isAutoLoad) {
		var gallerySize = 'large';
		if ($(this).hasClass('small-gallery')) gallerySize = 'small';
		$('.gallery-selected').css('opacity', 0.67).removeClass('gallery-selected');
		$(this).addClass('gallery-selected');
		$(this).css('opacity', 1.0);
		var newImageId = $(this).find('img').attr('id').split('_');
		var imageID = newImageId[1];
		var fullImage = $('#gallery-large-image');
		fullImage.css('opacity', 0.50);
		$.getJSON(skinPath + '/ajax.php?function=galleryGetImage&imageID=' + imageID + '&size=' + gallerySize, function (data) {
			$('#fb-like').html('<iframe src="http://www.facebook.com/plugins/like.php?href=' + escape(data.url) + '&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=verdana&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:335px; height:30px"></iframe>');
			if (!isAutoLoad) {
				$.post(blogUrl + "/index.php", {
					ak_action: "api_record_view",
					ids: imageID,
					type: "category"
				}, false, "json");
				_gaq.push(['_trackEvent', 'Gallery Click', $('.gallery-title').html(), data.title]);
				_gaq.push(['_trackEvent', 'Single Image Thumb Clicks', data.title, $('.gallery-title').html()])
			}
			else {
				$.post(blogUrl + "/index.php", {
					ak_action: "api_record_view",
					ids: imageID,
					type: "Archive"
				}, false, "json")
			}
			var loadImg = new Image;
			$(loadImg).load(function () {
				fullImage.fadeOut(function () {
					fullImage.attr('src', data.image_path);
					newHeight = fullImage.height();
					newWidth = fullImage.width();
					$('#gallery-photo-title').html(data.title);
					$('.photo-year').html(data.date);
					$('.gallery-more-info a, #gallery-loader a').attr('href', data.url);
					$('#htmlembedCode').val('<a href="' + data.url + '"><img src="' + data.share_path + '" alt="' + data.title + ', a film photograph by Kip Praslowicz"/></a>');
					$('#bbembedCode').val('[URL="' + data.url + '"][IMG]' + data.share_path + '[/IMG][/URL]');
					$('#gallery-loader').animate({
						'width': newWidth + 'px',
						'height': newHeight + 'px'
					}, 250, function () {
						fullImage.css('opacity', 1).fadeIn()
					})
				})
			}).attr('src', data.image_path)
		})
	};
	var defaults = {
		mouseOutOpacity: 0.67,
		mouseOverOpacity: 1.0,
		fadeSpeed: 'fast',
		exemptionSelector: '.selected'
	};
	$.fn.opacityrollover = function (settings) {
		$.extend(this, defaults, settings);
		var config = this;

		function fadeTo(element, opacity) {
			var $target = $(element);
			if (config.exemptionSelector) $target = $target.not(config.exemptionSelector);
			$target.fadeTo(config.fadeSpeed, opacity)
		}
		this.css('opacity', this.mouseOutOpacity).hover(function () {
			fadeTo(this, config.mouseOverOpacity)
		}, function () {
			fadeTo(this, config.mouseOutOpacity)
		});
		return this
	};

	function isNumeric(form_value) {
		if (form_value.match(/^\d+$/) == null) return false;
		else return true
	}
})(jQuery);

/*Fancybox*/
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}(';(7($){$.b.2n=7(){v z.2z(7(){9 1A=$(z).n(\'2o\');5(1A.16(/^3u\\(["\']?(.*\\.2k)["\']?\\)$/i)){1A=3w.$1;$(z).n({\'2o\':\'3c\',\'2f\':"3D:3U.3n.4g(3m=F, 3Z="+($(z).n(\'45\')==\'2Q-3i\'?\'3k\':\'3q\')+", S=\'"+1A+"\')"}).2z(7(){9 Y=$(z).n(\'Y\');5(Y!=\'38\'&&Y!=\'2N\')$(z).n(\'Y\',\'2N\')})}})};9 y,4,11=C,p=1B 1m,1F,1q=1,1z=/\\.(3H|3L|2k|4q|3S)(.*)?$/i;9 Q=($.2C.3x&&2G($.2C.3J.2K(0,1))<8);$.b.c=7(Z){Z=$.3e({},$.b.c.2S,Z);9 30=z;7 32(){y=z;4=Z;34();v C};7 34(){5(11)v;5($.1X(4.23)){4.23()}4.j=[];4.h=0;5(Z.j.O>0){4.j=Z.j}q{9 K={};5(!y.1x||y.1x==\'\'){9 K={g:y.g,L:y.L};5($(y).1I("1f:1C").O){K.19=$(y).1I("1f:1C")}4.j.1S(K)}q{9 1b=$(30).2f("a[1x="+y.1x+"]");9 K={};3o(9 i=0;i<1b.O;i++){K={g:1b[i].g,L:1b[i].L};5($(1b[i]).1I("1f:1C").O){K.19=$(1b[i]).1I("1f:1C")}4.j.1S(K)}3B(4.j[4.h].g!=y.g){4.h++}}}5(4.1Y){5(Q){$(\'1P, 21, 1W\').n(\'1M\',\'4c\')}$("#1k").n(\'1V\',4.2E).I()}1c()};7 1c(){$("#1l, #1g, #U, #H").X();9 g=4.j[4.h].g;5(g.16(/#/)){9 W=13.3y.g.48(\'#\')[0];W=g.4a(W,\'\');W=W.2K(W.2Y(\'#\'));1o(\'<6 k="3a">\'+$(W).o()+\'</6>\',4.1w,4.1J)}q 5(g.16(1z)){p=1B 1m;p.S=g;5(p.3s){2d()}q{$.b.c.2J();$(p).x().15(\'3F\',7(){$(".J").X();2d()})}}q 5(g.16("1a")||y.3X.2Y("1a")>=0){1o(\'<1a k="2P" 42="$.b.c.2y()" 4s="3Q\'+B.V(B.3W()*3Y)+\'" 2j="0" 3f="0" S="\'+g+\'"></1a>\',4.1w,4.1J)}q{$.3j(g,7(2s){1o(\'<6 k="3v">\'+2s+\'</6>\',4.1w,4.1J)})}};7 2d(){5(4.2L){9 w=$.b.c.1i();9 r=B.2e(B.2e(w[0]-36,p.f)/p.f,B.2e(w[1]-3C,p.d)/p.d);9 f=B.V(r*p.f);9 d=B.V(r*p.d)}q{9 f=p.f;9 d=p.d}1o(\'<1f 4p="" k="3O" S="\'+p.S+\'" />\',f,d)};7 2g(){5((4.j.O-1)>4.h){9 g=4.j[4.h+1].g;5(g.16(1z)){1s=1B 1m();1s.S=g}}5(4.h>0){9 g=4.j[4.h-1].g;5(g.16(1z)){1s=1B 1m();1s.S=g}}};7 1o(1e,f,d){11=F;9 N=4.2h;5(Q){$("#t")[0].1E.2i("d");$("#t")[0].1E.2i("f")}5(N>0){f+=N*2;d+=N*2;$("#t").n({\'u\':N+\'D\',\'2p\':N+\'D\',\'2r\':N+\'D\',\'A\':N+\'D\',\'f\':\'2t\',\'d\':\'2t\'});5(Q){$("#t")[0].1E.2v(\'d\',\'(z.2x.3b - 20)\');$("#t")[0].1E.2v(\'f\',\'(z.2x.3d - 20)\')}}q{$("#t").n({\'u\':0,\'2p\':0,\'2r\':0,\'A\':0,\'f\':\'2A%\',\'d\':\'2A%\'})}5($("#m").1D(":1d")&&f==$("#m").f()&&d==$("#m").d()){$("#t").1T("2I",7(){$("#t").1y().1H($(1e)).22("1p",7(){1h()})});v}9 w=$.b.c.1i();9 2M=(f+36)>w[0]?w[2]:(w[2]+B.V((w[0]-f-36)/2));9 2O=(d+1r)>w[1]?w[3]:(w[3]+B.V((w[1]-d-1r)/2));9 M={\'A\':2M,\'u\':2O,\'f\':f+\'D\',\'d\':d+\'D\'};5($("#m").1D(":1d")){$("#t").1T("1p",7(){$("#t").1y();$("#m").1U(M,4.2U,4.2W,7(){$("#t").1H($(1e)).22("1p",7(){1h()})})})}q{5(4.26>0&&4.j[4.h].19!==1O){$("#t").1y().1H($(1e));9 P=4.j[4.h].19;9 17=$.b.c.1L(P);$("#m").n({\'A\':(17.A-18)+\'D\',\'u\':(17.u-18)+\'D\',\'f\':$(P).f(),\'d\':$(P).d()});5(4.1N){M.1V=\'I\'}$("#m").1U(M,4.26,4.35,7(){1h()})}q{$("#t").X().1y().1H($(1e)).I();$("#m").n(M).22("1p",7(){1h()})}}};7 2F(){5(4.h!=0){$("#1g, #2m").x().15("R",7(e){e.2H();4.h--;1c();v C});$("#1g").I()}5(4.h!=(4.j.O-1)){$("#1l, #2u").x().15("R",7(e){e.2H();4.h++;1c();v C});$("#1l").I()}};7 1h(){2F();2g();$(T).1v(7(e){5(e.1Z==27){$.b.c.1n();$(T).x("1v")}q 5(e.1Z==37&&4.h!=0){4.h--;1c();$(T).x("1v")}q 5(e.1Z==39&&4.h!=(4.j.O-1)){4.h++;1c();$(T).x("1v")}});5(4.1t){$(13).15("25 28",$.b.c.2w)}q{$("6#m").n("Y","38")}5(4.2a){$("#2b").R($.b.c.1n)}$("#1k, #U").15("R",$.b.c.1n);$("#U").I();5(4.j[4.h].L!==1O&&4.j[4.h].L.O>0){$(\'#H 6\').o(4.j[4.h].L);$(\'#H\').I();3N.1S([\'3P\',\'3R\',\'3T 1m 3V\',4.j[4.h].L])}5(4.1Y&&Q){$(\'1P, 21, 1W\',$(\'#t\')).n(\'1M\',\'1d\')}5($.1X(4.1R)){4.1R()}11=C};v z.x(\'R\').R(32)};$.b.c.2w=7(){9 l=$.b.c.1i();$("#m").n(\'A\',(($("#m").f()+36)>l[0]?l[2]:l[2]+B.V((l[0]-$("#m").f()-36)/2)));$("#m").n(\'u\',(($("#m").d()+1r)>l[1]?l[3]:l[3]+B.V((l[1]-$("#m").d()-1r)/2)))};$.b.c.1j=7(G,2R){v 2G($.47(G.49?G[0]:G,2R,F))||0};$.b.c.1L=7(G){9 l=G.4b();l.u+=$.b.c.1j(G,\'4d\');l.u+=$.b.c.1j(G,\'4f\');l.A+=$.b.c.1j(G,\'4h\');l.A+=$.b.c.1j(G,\'4j\');v l};$.b.c.2y=7(){$(".J").X();$("#2P").I()};$.b.c.1i=7(){v[$(13).f(),$(13).d(),$(T).4l(),$(T).4n()]};$.b.c.2l=7(){5(!$("#J").1D(\':1d\')){2T(1F);v}$("#J > 6").n(\'u\',(1q*-40)+\'D\');1q=(1q+1)%12};$.b.c.2J=7(){2T(1F);9 l=$.b.c.1i();$("#J").n({\'A\':((l[0]-40)/2+l[2]),\'u\':((l[1]-40)/2+l[3])}).I();$("#J").15(\'R\',$.b.c.1n);1F=4u($.b.c.2l,3l)};$.b.c.1n=7(){11=F;$(p).x();$("#1k, #U").x();5(4.2a){$("#2b").x()}$("#U, .J, #1g, #1l, #H").X();5(4.1t){$(13).x("25 28")}1u=7(){$("#1k, #m").X();5(4.1t){$(13).x("25 28")}5(Q){$(\'1P, 21, 1W\').n(\'1M\',\'1d\')}5($.1X(4.1Q)){4.1Q()}11=C};5($("#m").1D(":1d")!==C){5(4.24>0&&4.j[4.h].19!==1O){9 P=4.j[4.h].19;9 17=$.b.c.1L(P);9 M={\'A\':(17.A-18)+\'D\',\'u\':(17.u-18)+\'D\',\'f\':$(P).f(),\'d\':$(P).d()};5(4.1N){M.1V=\'X\'}$("#m").2V(C,F).1U(M,4.24,4.2q,1u)}q{$("#m").2V(C,F).1T("2I",1u)}}q{1u()}v C};$.b.c.2X=7(){9 o=\'\';o+=\'<6 k="1k"></6>\';o+=\'<6 k="2b">\';o+=\'<6 s="J" k="J"><6></6></6>\';o+=\'<6 k="m">\';o+=\'<6 k="2B">\';o+=\'<6 k="U"></6>\';o+=\'<6 k="E"><6 s="E 3z"></6><6 s="E 41"></6><6 s="E 3h"></6><6 s="E 43"></6><6 s="E 3A"></6><6 s="E 44"></6><6 s="E 3p"></6><6 s="E 46"></6></6>\';o+=\'<a g="2Z:;" k="1g"><1G s="29" k="2m"></1G></a><a g="2Z:;" k="1l"><1G s="29" k="2u"></1G></a>\';o+=\'<6 k="t"></6>\';o+=\'<6 k="H"></6>\';o+=\'</6>\';o+=\'</6>\';o+=\'</6>\';$(o).31("3E");$(\'<2D 3r="0" 4e="0" 3G="0"><33><14 s="H" k="4i"></14><14 s="H" k="3I"><6></6></14><14 s="H" k="4k"></14></33></2D>\').31(\'#H\');5(Q){$("#2B").3t(\'<1a s="4m" 3K="2Q" 2j="0"></1a>\');$("#U, .E, .H, .29").2n()}};$.b.c.2S={2h:10,2L:F,1N:C,26:0,24:0,2U:3g,35:\'1K\',2q:\'1K\',2W:\'1K\',1w:3M,1J:4r,1Y:F,2E:0.3,2a:F,1t:F,j:[],23:2c,1R:2c,1Q:2c};$(T).4t(7(){$.b.c.2X()})})(4o);',62,279,'||||opts|if|div|function||var||fn|fancybox|height||width|href|itemCurrent||itemArray|id|pos|fancy_outer|css|html|imagePreloader|else||class|fancy_content|top|return||unbind|elem|this|left|Math|false|px|fancy_bg|true|el|fancy_title|show|fancy_loading|item|title|itemOpts|pad|length|orig_item|isIE|click|src|document|fancy_close|round|target|hide|position|settings||busy||window|td|bind|match|orig_pos||orig|iframe|subGroup|_change_item|visible|value|img|fancy_left|_finish|getViewport|getNumeric|fancy_overlay|fancy_right|Image|close|_set_content|normal|loadingFrame|50|objNext|centerOnScroll|__cleanup|keydown|frameWidth|rel|empty|imageRegExp|image|new|first|is|style|loadingTimer|span|append|children|frameHeight|swing|getPosition|visibility|zoomOpacity|undefined|embed|callbackOnClose|callbackOnShow|push|fadeOut|animate|opacity|select|isFunction|overlayShow|keyCode||object|fadeIn|callbackOnStart|zoomSpeedOut|resize|zoomSpeedIn||scroll|fancy_ico|hideOnContentClick|fancy_wrap|null|_proceed_image|min|filter|_preload_neighbor_images|padding|removeExpression|frameborder|png|animateLoading|fancy_left_ico|fixPNG|backgroundImage|right|easingOut|bottom|data|auto|fancy_right_ico|setExpression|scrollBox|parentNode|showIframe|each|100|fancy_inner|browser|table|overlayOpacity|_set_navigation|parseInt|stopPropagation|fast|showLoading|substr|imageScale|itemLeft|relative|itemTop|fancy_frame|no|prop|defaults|clearInterval|zoomSpeedChange|stop|easingChange|build|indexOf|javascript|matchedGroup|appendTo|_initialize|tr|_start|easingIn|||absolute||fancy_div|clientHeight|none|clientWidth|extend|hspace|300|fancy_bg_e|repeat|get|crop|66|enabled|Microsoft|for|fancy_bg_w|scale|cellspacing|complete|prepend|url|fancy_ajax|RegExp|msie|location|fancy_bg_n|fancy_bg_s|while|60|progid|body|load|border|jpg|fancy_title_main|version|scrolling|gif|425|_gaq|fancy_img|_trackEvent|fancy_iframe|Lightbox|jpeg|Large|DXImageTransform|Views|random|className|1000|sizingMethod||fancy_bg_ne|onload|fancy_bg_se|fancy_bg_sw|backgroundRepeat|fancy_bg_nw|curCSS|split|jquery|replace|offset|hidden|paddingTop|cellpadding|borderTopWidth|AlphaImageLoader|paddingLeft|fancy_title_left|borderLeftWidth|fancy_title_right|scrollLeft|fancy_bigIframe|scrollTop|jQuery|alt|bmp|355|name|ready|setInterval'.split('|'),0,{}))

/* jQuery Cookies */
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/* Image Lazy Load */
(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options);}
var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear");}else{if(counter++>settings.failurelimit){return false;}}});var temp=$.grep(elements,function(element){return!element.loaded;});elements=$(temp);});}
this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"));}
if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder);}else{$(self).removeAttr("src");}
self.loaded=false;}else{self.loaded=true;}
$(self).one("appear",function(){if(!this.loaded){$("<img />").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))
[settings.effect](settings.effectspeed);self.loaded=true;}).attr("src",$(self).attr("original"));};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});$(settings.container).trigger(settings.event);return this;};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop();}else{var fold=$(settings.container).offset().top+$(settings.container).height();}
return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}else{var fold=$(settings.container).offset().left+$(settings.container).width();}
return fold<=$(element).offset().left-settings.threshold;};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop();}else{var fold=$(settings.container).offset().top;}
return fold>=$(element).offset().top+settings.threshold+$(element).height();};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft();}else{var fold=$(settings.container).offset().left;}
return fold>=$(element).offset().left+settings.threshold+$(element).width();};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"});})(jQuery);