$(document).ready(function(){ 
		// Bookmark class
		var url = 'http://fuxxr.com';
		var title = 'fuxxr: Porn Aggregator';


		if(window.opera) {  
			$(".site-name").attr("rel","sidebar");  
			$(".site-name").attr("href", url);  
			$(".site-name").attr("title", title);  
		}
		
		$('.site-name').click(function(){
			if ( window.sidebar ) { 
				window.sidebar.addPanel(title, url,"");
			} else if ( window.external ) { 
				window.external.AddFavorite( url, title); }
			else if ( window.opera ) { 
				void(0);
			} else {
				alert("Sorry! Your browser doesn't support automatic bookmarking. Bookmark by pressing Command-D."); 
			}
		});

		// Logo
		$('#logo').click(function(){ window.location = 'http://fuxxr.com/' })

		// Search
		$('#search_what').focus(function(){ $(this).val('').css('font-style', 'normal') });
		$('#search_button').hover(function(){ $(this).css('cursor', 'pointer') }, function(){ $(this).css('cursor', 'normal') });
		$('#search_button').click(function(){ $('#search_form').submit() });

		// Homemade images
		function get_path ( str ) { return str.substring(0, str.lastIndexOf('/')); }
		$('.hmvideo').hover(
			function() { $(this).attr('src', get_path($(this).attr('src')) + '/anm.gif') },
			function() { $(this).attr('src', get_path($(this).attr('src')) + '/th.jpg') }
		);

		// Hilite the selected object
		$('.hlite').fadeTo('slow', 0.05).fadeTo('slow', 1);

		var cat_open = false;
		$('.domain,.dspan').click(function(){
			if ( ! cat_open ) {
				$('#categories').slideDown().css('display','block');
			} else {
				$('#categories').slideUp();
			}
			cat_open = ! cat_open;
		});
});

/*
# vim:syntax=javascript
 */
