

$(function(){
		   
	//simple crossfading slideshow
		$('.fadein img:gt(0)').hide();
		setInterval(function(){
		  $('.fadein :first-child').fadeOut('slow')
			 .next('img').fadeIn('slow')
			 .end().appendTo('.fadein');}, 
		  9000);
			   
		
		  //Flickr Integration
		$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=17266918@N00&lang=en-us&format=json&jsoncallback=?", function(data){
		  $.each(data.items, function(i,item){
			 i = i++;
			$("<img/>").attr("src", item.media.m).appendTo(".flickr")
			  .wrap("<a href='" + item.link + "'></a>");
			  // convert to small thumb
				$(".flickr img").each(function() {
					var smallThumb = $(this).attr("src").replace(/_m.jpg$/i,'_s.jpg');
					$(this).attr("src", smallThumb);
				});
				if ( i == 5 ) return false;
		  });
		});	 
	
	//twitter integration
	$(".twitter").getTwitter({
						userName: "blanksky",
						numTweets: 1,
						loaderText: "Loading tweets...",
						slideIn: false,
						slideDuration: 750,
						showHeading: true,
						headingText: "Recently said...",
						showProfileLink: true,
						showTimestamp: true
					});

	//easy slider
	$("#box").easySlider({
		controlsBefore:	'<p id="controls">',
		controlsAfter:	'</p>',
		auto: false, 
		pause: 9000,
		speed: 400,
		continuous: true
		
	});
//launch vertex modal flash example
	$('#vertex').click(function(){
		var src = "http://blanksky.com/links/10th/index.html";
		$.modal('<iframe src="' + src + '" height="700" width="800" style="border:0">', {
			closeHTML:"",
			containerCss:{
				backgroundColor:"#000",
				borderColor:"#000",
				height:700,
				padding:0,
				width:800
			},
			overlayClose:true,
			escClose:true
		});
	});
//launch rtdc modal flash example
	$('#rtdc').click(function(){
		var src = "http://blanksky.com/links/RTDCdemo/index.html";
		$.modal('<iframe src="' + src + '" height="495" width="700" style="border:0">', {
			closeHTML:"",
			containerCss:{
				backgroundColor:"#000",
				borderColor:"#000",
				height:495,
				padding:0,
				width:700
			},
			overlayClose:true,
			escClose:true
		});
	});
//launch pbs example
	$('#pbs').click(function(){
		$.modal('<img width="900" height="792"  src="images/modal-pbsteachers.jpg" />');
	});
//launch eben modal flash example
	$('#ebenefits1').click(function(){
		$.modal('<img width="1016" height="765"  src="images/modal-ebenefits-brand.jpg" />');
	});
//launch eben modal flash example
	$('#ebenefits2').click(function(){
		$.modal('<img width="930" height="602"  src="images/modal-ebenefits-collateral.jpg" />');
	});
	
	
});
