$(document).ready(function() {

	$('#lostdisc').hide();
	$('#founddisc').hide();
	$('#claimdisc').hide();

	var Toggled = false;

	$('a.togglelost').click(function(){ 
		if(Toggled==false){$('a.togglelost').html('Hide the Lost Disc Form &#171;'); 
			Toggled=true;
			} else { 
				$('a.togglelost').html('Show the Lost Disc Form &#187;');
			Toggled=false;
			} $("#lostdisc").slideToggle(600);
		return false; 
	}); 
	
	var Toggled2 = false;

	$('a.togglefound').click(function(){ 
		if(Toggled2==false){$('a.togglefound').html('Hide the Found Disc Form &#171;'); 
			Toggled2=true;
			} else { 
				$('a.togglefound').html('Show the Found Disc Form &#187;');
			Toggled2=false;
			} $("#founddisc").slideToggle(600);
		return false; 
	});

	var Toggled3 = false;

	$('a.toggleclaim').click(function(){ 
		if(Toggled3==false){$('a.toggleclaim').html('Hide the Disc Claim Form &#171;'); 
			Toggled3=true;
			} else { 
				$('a.toggleclaim').html('Show the Disc Claim Form &#187;');
			Toggled3=false;
			} $("#claimdisc").slideToggle(600);
		return false; 
	}); 


	// Hide the secret rodent area at the bottom of the page	 	 
	 $('#secret').hide();
		
	 $('a.rodent').click(function() {
	   $('#secret').toggle(0);
	   return false;
	 });
	 
	 
	// Captify - http://masterfidgeter.com/projects/captify
	$('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});	 
	 
	 

	// ScrollTohttp://plugins.jquery.com/project/ScrollTo 	 
	jQuery(function( $ ){
		$.localScroll.defaults.axis = 'xy';
		// Scroll initially if there's a hash (#something) in the url 
		$.localScroll.hash({
			// target: '#content', // Could be a selector or a jQuery object too.
			queue:true,
			duration:2000
		});
		$.localScroll({
			// target: '#content', // Could be a selector or a jQuery object too.
			queue:true,
			duration:2000,
			hash:true,
			onBefore:function( e, anchor, $target ){
				// The 'this' is the settings object, can be modified
			},
			onAfter:function( anchor, settings ){
				// The 'this' contains the scrolled element (#content)
			}
		});
	});
	
 	// 

	$.Juitter.start({
		searchType:"fromUser", // needed, you can use "searchWord", "fromUser", "toUser"
		searchObject:"fcdiscgolf", // needed, you can insert a username here or a word to be searched for, if you wish multiple search, separate the words by comma.

		// The values below will overwrite the ones on the Juitter default configuration. 
		// They are optional here.
		// I'm changing here as a example only
		lang:"en", // restricts the search by the given language
		live:"live-15", // the number after "live-" indicates the time in seconds to wait before request the Twitter API for updates.
		placeHolder:"juitterContainer", // Set a place holder DIV which will receive the list of tweets example <div id="juitterContainer"></div>
		loadMSG: "Loading messages...", // Loading message, if you want to show an image, fill it with "image/gif" and go to the next variable to set which image you want to use on 
		imgName: "loader.gif", // Loading image, to enable it, go to the loadMSG var above and change it to "image/gif"
		total: 4, // number of tweets to be show - max 100
		readMore: "<img src='wordpress/wp-content/themes/discgolf/images/external_12x12.png' alt='Read on Twitter' />", // read more message to be show after the tweet content
		nameUser:"image" // insert "image" to show avatar of "text" to show the name of the user that sent the tweet 
	});	
	$("#aRodrigo").click(function(){
		$(".jlinks").removeClass("on");
		$(this).addClass("on");									  
		$.Juitter.start({
			searchType:"fromUser",
			searchObject:"mrjuitter,rodrigofante",
			live:"live-120" // it will be updated every 120 seconds/2 minutes
		});
	});
	$("#aIphone").click(function(){
		$(".jlinks").removeClass("on");
		$(this).addClass("on");									   
		$.Juitter.start({
			searchType:"searchWord",
			searchObject:"iPhone,apple,ipod",
			live:"live-20"  // it will be update every 20 seconds 
		});
	});
	$("#aJuitter").click(function(){
		$(".jlinks").removeClass("on");
		$(this).addClass("on");								  
		$.Juitter.start({
			searchType:"searchWord",
			searchObject:"Juitter",
			live:"live-180" // it will be updated every 180 seconds/3 minutes
		});
	});

	$(function(){
		$('#nav ol li a')
			.css( {backgroundPosition: "0px 340px"} )
			.mouseover(function(){
				$(this).stop().animate({backgroundPosition:"(0px 240px)"}, {duration:500})
			})
			.mouseout(function(){
				$(this).stop().animate({backgroundPosition:"(0px 340px)"}, {duration:600, complete:function(){
					$(this).css({backgroundPosition: "0px 340px"})
			}})
		})
	});	
});