$(document).ready(function()
{
	if (!$.browser.msie)
	{
		$('.twitter-blurb').corner();
		$('.dose ul li').corner();		
	}
	if ($.browser.mozilla)
	{
		$('body').addClass('ff');
	}
	$('ul#nav li').hover(function(){
		$(this).addClass("hover");
	}, function(){
		$(this).removeClass("hover");		
	});
	$('.charter-members > div').corner('left');
	$('.hidden-options').set_show_sharing_options();
	$('.sis-player').replace_with_player();
	$('li.search').click(function(){
		$('li.search input').focus();
	});
	$('li.search').create_fancy_search_box_for_whining_retards_on_internet_forum();
});

$.fn.create_fancy_search_box_for_whining_retards_on_internet_forum = function()
{
	return this.each(function(){
		var input_obj = this;

		if ($('input', this).val().length < 1) $(this).addClass('for_the_morons');

		$('input', this).focus(function(){
			$(input_obj).removeClass('for_the_morons');			
		});

		$('input', this).blur(function(){
			if ($(this).val().length < 1) $(input_obj).addClass('for_the_morons');
		});
		
	});
};

$.fn.set_show_sharing_options = function()
{
	return this.each(function()
	{
		$(this).mouseenter(function()
		{
			$(this).children().children().show();
		}).mouseleave(function()
		{
			$(this).children().children().hide();
		});
	});
};

$.fn.replace_with_player = function()
{
	return this.each(function(){
		var player = this;

		player.uuid = $(this).attr('id');
		player.mp3file = $('a.mp3-file', player).attr('href');
		player.downloads = $('a.mp3-file', player).hasClass('download-file');
		player.params = {
			allowscriptaccess: 'always',
			bgcolor: '#F7F6F6', 
			menu: 'false', 
			wmode: 'opaque'
		};
		player.flashvars = {
			audioURL:player.mp3file,
			amazonURL:'http://www.amazon.com',
			appleURL:'http://www.apple.com'
		};
		
		if (player.downloads) player.flashvars.downloadAllowed = true;
		
		player.attribs = [];
		player.swfo = swfobject.embedSWF("/wp-content/themes/strangersinstereo/assets/swf/sis_player.swf",player.uuid,"367","62","9.0.0",'/wp-content/themes/strangersinstereo/assets/swf/expressInstall.swf', player.flashvars, player.params, player.attribs);
	});
};
