$(document).ready(function() { 

	// Superfish popout menu
	$('#menu ul').supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    21,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();

	// Show wait button
	$('.waitbtn').click(function() { $(this).attr('value','Please wait...'); });
	
	// Open external links in new window
	$('a[rel="external"]').click(function(){ window.open(this.href); return false; }); 

	// Display confirm message when button clicked
	$('.confirm').click(function(){ return window.confirm("Are you sure you want to " + this.title.charAt(0).toLowerCase() + this.title.substr(1) + "?"); });

	// Show/Hide username and password on login form
	$('#username').focus(function() { if($(this).val() == 'username') $(this).val(''); });
	$('#username').blur(function() { if($(this).val() == '') $(this).val('username'); });
	$('#password').focus(function() { if($(this).val() == 'password') $(this).val(''); });
	$('#password').blur(function() { if($(this).val() == '') $(this).val('password'); });


});

