$(document).ready(function() {

// net nav

$("#netnav a").append("<span></span>");

$("#netnav a").hover(function() {
  $(this).find("span").fadeToggle("fast");
  var hoverText = $(this).attr("title");
  $(this).find("span").text(hoverText);
  $(this).removeAttr("title");
}, function() {$(this).find("span").fadeToggle("fast");});

//Fancybox
	$(".playvideo").fancybox({
	'padding':0,
	'width':640,
	'height':480,
	'scrolling':'no'
	});
	$(".fancybox").fancybox({'padding':0});



	//Turn all the select boxes into rating controls
    $(".rating").rating({showCancel: false,startValue: null,});	

	$('.clearme').focus(function() {$(this).val("");});

//Favorites
	// Load in the hidden content
        $('.favorited.not_saved').append('<a class="Favorites_Save Favorites_Trigger icon iconstar" style="display:none;" href="{permalink="fav/a/"}">save</a>');
        $('.favorited.not_saved').append('<a class="Favorites_Delete Favorites_Trigger icon iconcross" style="display:none;" href="{permalink="fav/a//delete/"}">delete</a>');
        $('.favorited.saved').append('<a class="Favorites_Save Favorites_Trigger icon iconstar" style="display:none;" href="{permalink="fav/a/"}">save</a>');

        // Apply the event handlers
	$('a.Favorites_Save') .click (function() {
		var link = $(this).attr('href')
		$('.Favorites_Status').load(link, function() {$('.Favorites_Delete').fadeIn();});
		$(this).fadeOut();
		return false;
	});
	$('a.Favorites_Save_Full') .click (function() {
		var link = $(this).attr('href')
		$('.Favorites_Status').load(link, function() {$('.Favorites_Delete').fadeIn();});
		$(this).fadeOut();
		return false;
	});

	$('a.Favorites_Delete') .click (function() {
		var link = $(this).attr('href')
		$('.Favorites_Status').load(link, function() {$('.Favorites_Save').show();});
		$(this).hide();
		return false;
	});

	$('.extlogin').click(function(){
		$('#social_login_form input[name=provider]').val($(this).attr('rel'));
		$('#social_login_form').submit();
	});

	$('a.buttongo').live('click', function(){$(this).text('loading\u2026');});

$("textarea#embed").live('click',function(event) {this.select();});
$("input#gomaths").live('click',function(event) {this.select();});
$("input#shorturl").live('click',function(event) {this.select();});

});

function edmodosave() {
var h=document.getElementsByTagName('head')[0];
var s=document.createElement('script');
s.type='text/javascript';
s.src="http://edmodo.com/js/bookmarklet.js?" + Math.floor(Math.random()*99999);
h.appendChild(s);
}
