// PRETTYPHOTO
$(document).ready(function(){
    $("a[rel^='ideators']").prettyPhoto({
	social_tools: false,
	deeplinking: false
	});
});
  
  


// BIG IDEAS HEADLINES CYCLE

$(document).ready(function() {
$('#header').cycle({
		fx: 'scrollDown',
		next: '#header',
		speed: 500,
		timeout: 7000,
		height: 225,
		cleartypeNoBg: true
	});
});




// IDEATORS CYCLE

$(document).ready(function() {
$('#ideators').cycle({
		fx: 'scrollLeft',
		speed: 500,
		timeout: 10000,
    	pager:  '#pager'
	});
});




// CURRENTLY THINKING CYCLE

$(document).ready(function() {
$('#currently-thinking ul').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 15000,
		random: 0,
		cleartypeNoBg: true,
    	next:  '#currently-thinking ul' 
	});
});




// FLICKR PHOTOFEED


$(document).ready(function(){					
	$.getJSON("http://api.flickr.com/services/feeds/groups_pool.gne?id=1695627@N22&format=json&jsoncallback=?", displayImages);
	function displayImages(data) {																																   
		var iStart = Math.floor(Math.random()*(11));	
		var iCount = 0;								
		var htmlString = "<ul>";					
		$.each(data.items, function(i,item){
			if (iCount > iStart && iCount < (iStart + 13)) {
				var sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");		
				htmlString += '<li><a href="' + item.link + '" target="_blank">';
				htmlString += '<img src="' + sourceSquare + '" alt="' + item.title + '" title="' + item.title + '"/>';
				htmlString += '</a></li>';
			}
			iCount++;
		});		
	$('.flickr_badge').html(htmlString + "</ul>");
	}
});
