$(document).ready(function(){

	if($('body#home')[0]){
		// enable rollover on the four pillars
		$('#content-frame div.pillar').hover(
			function(){
				$('>div', this).show();
				$('#inner-offer').fadeOut();
			},
			function(){
				// if any of the pillars are showing, don't fade in
				setTimeout(function(){
					if($('#content-frame div.pillar > div:visible').length < 1){
						$('#inner-offer').fadeIn();
					}
				}, 100);
				$('>div', this).hide();
			}
		);

		$.getJSON('http://picasaweb.google.com/data/feed/api/user/californiacartwheelcenter/album/Slideshow/?kind=photo&imgmax=800&access=public&alt=json&callback=?', function(data){
			var $ul = $('<ul>').appendTo('#slideshow');
			// kill the first slide
			$('#first-slide').fadeOut(function(){
				var picsCount = data.feed.entry.length;
				for(var i = 0; i < picsCount; i++){
					var pic = data.feed.entry[i];
					$ul.append('<li style="width: 928px; height: 580px;"><img src="' + pic.media$group.media$content[0].url + '?imgmax=800"/></li>');
				}
				// now fade in the new slideshow
				$ul.show().cycle('fade');
$('li', $ul).css('border', '1px #00B2EB solid');
				/*
				$ul.fadeIn(function(){
					// cycle the whole thing
					$ul.cycle('fade');
				});
				*/
			});
		});

		/*
		// run the flickr slideshow
		var galinit = function(ul){
			$('#first-slide').fadeOut(function(){
				// remove the subhead graphic
				$(this).remove();
				// remove the inputs so cycle doesn't treat them as slides
				$('input', ul).remove();
				// set the dimensions of the slideshow list and show it
				$(ul).css({'width': '928px', 'height': '580px'});
				// set the dimensions of each slide
				$('li', ul).css({'width': '928px', 'height': '580px', 'display': 'none'});
				// fade in the slideshow
				$(ul).fadeIn(function(){
					// cycle the whole thing
					$(ul).cycle('fade');
				});
			});
		}
		$('#slideshow').flickr({
			api_key: '72d4a4b433dbba8facb5cdc68fef7612',
			type: 'photoset',
			photoset_id: '72157604652820359',
			user_id: 'brizbane',
			//size: 'b',
			//thumb_size: 'm',
			per_page: 20,
			callback: galinit
		});
		*/
	}


});
