// function getFourSquareData(){
// 	
// 	var markup = "<div><p>${title}</p><p>${description}</p></div>";
// 	$.template( "foursquare-feed", markup );
// 
// 	jQuery.get('http://pipes.yahoo.com/pipes/pipe.run?_id=8e2c7b64192c91f2f269ee33f6f001fb&_render=json',{},function(data){
// 		var items = data.value.items;
// 		$( "#movieList" ).empty();
//   		$.tmpl( "foursquare-feed", items).appendTo( "#twitterSearch" );
// 	},'JSON');
// }

$(document).ready(function() {

	// $("#load-video").click(function(){
	// 	$('#homepage-video').html('<object width="620" height="379"><param name="movie" value="http://www.youtube.com/v/mgp7GwHxV14?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1&amp;color1=0xFFFFFF&amp;color2=0xFFFFFF&amp;autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mgp7GwHxV14?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1&amp;color1=0xFFFFFF&amp;color2=0xFFFFFF&amp;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="620" height="379"></embed></object>');
	// 	return false;
	// })

	$("#menu-main").superfish({
		animation : {opacity:"show"},
		speed:         200,
		disableHI:     false,  
		dropShadows:   false,
		autoArrows:    false,
		delay : 1000
	});

	$("#staff-profiles").superfish({
		animation : {opacity:"show"},
		speed:         100,
		disableHI:     false,  
		dropShadows:   false,
		autoArrows:    false,
		delay : 500
	});

	
	$("#email-address").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
	

	$('#twitterUserTimeline').liveTwitter('jumpwiremedia', {limit: 5, refresh: false, mode: 'user_timeline', showAuthor: true, imageSize: 48, rate: 9000000});
	$("#twitterSearch").liveTwitter({user: 'jumpwiremedia', list: 'jumpwireteam'}, {imageSize: 48, limit: 6, rate: 9000000, mode: 'list'});

	// add active class to default selection
	$('#timelineLinks li:first a, #searchLinks li:first a').addClass('active');

	$('#timelineLinks a').each(function(){
		// var query = $(this).text();
		var query = $(this).attr('rel')
		var username = query.replace(/^@/, '');
		$(this).click(function(){
			// Clear the tweets
			$('#twitterUserTimeline').each(function(){this.twitter.clear()});
			// Update the search
			$('#twitterUserTimeline').liveTwitter(username);
			// Refresh
			$('#twitterUserTimeline').each(function(){this.twitter.refresh(true)});
			// remove active class from selection
			$('#timelineLinks a.active').removeClass('active')
			// add active class to new selection
			$(this).addClass('active');
			return false;
		});
	});

	// $('#jwm-team-twitter').click(function(){
	// 	// Clear the tweets
	// 	$('#twitterSearch').each(function(){this.twitter.clear()});
	// 	// Update the search
	// 	$("#twitterSearch").liveTwitter({user: 'blaindy', list: 'jumpwiremedia'});
	// 	// remove active class from selection
	// 	$('#searchLinks a.active').removeClass('active')
	// 	// add active class to new selection
	// 	$(this).addClass('active');
	// 	return false;
	// });

	// $('#jwm-team-foursquare').click(function(){
	// 	// Clear the tweets
	// 	$('#twitterSearch').each(function(){this.twitter.clear()});
	// 	// Update the search
	// 	getFourSquareData()
	// 	// $('#twitterSearch').html('&nbsp;');
	// 	// remove active class from selection
	// 	$('#searchLinks a.active').removeClass('active')
	// 	// add active class to new selection
	// 	$(this).addClass('active');
	// 	return false;
	// });

	var tweetLimit = 5;

	$('#load-more').click(function() {
		tweetLimit += 5; //This is incrementing it by 5.

		$("#twitterUserTimeline").liveTwitter(false, {limit: tweetLimit});
		$('#twitterUserTimeline').each(function(){this.twitter.clear()});
		$('#twitterUserTimeline').each(function(){this.twitter.refresh(true)});

		$("#twitterSearch").liveTwitter(false, {limit: tweetLimit});
		$('#twitterSearch').each(function(){this.twitter.clear()});
		$('#twitterSearch').each(function(){this.twitter.refresh(true)});

		return false;
	});


});

