jQuery(document).ready(function($) {
		// Add a class to body tag when browser window is less than 1024px size//){
		$(window).resize(function(){
			if ($(window).width() < 1024) 
				{$('body').addClass('too-narrow');
			} else {
				$('body').removeClass('too-narrow');
			}
		})
});

jQuery( document ).ready( function() {
		jQuery( '#username, #password' ).focus( function() {
				if( jQuery( this ).val() == 'Username' )
					jQuery( this ).val( '' );
					
				// If password, convert to password field
				if( jQuery( this ).attr( 'id' ) == 'password' ) {
					jQuery( '#password' ).hide();
					jQuery( '#realpassword' ).show();
					jQuery( '#realpassword' ).focus();
				}
				
		});
		
		jQuery( '#username, #realpassword' ).blur( function() {
			
				var replace;
				replace = jQuery( this ).attr( 'id' );
										
				if( jQuery( this ).val() == '' && jQuery( this ).attr( 'id' ) == 'username' )
					jQuery( this ).val( replace.charAt(0).toUpperCase() + replace.slice(1) );
					
				if( jQuery( this ).attr( 'id' ) == 'realpassword' && jQuery( this ).val() == '' ) {
						jQuery( '#realpassword' ).hide();
						jQuery( '#password' ).show();
				}
		});
		
});

/* Datepicker
--------------------------------------------------------------------------------------- */
jQuery("#date_from").datepicker({ showOn: 'both', dateFormat: 'yy-mm-dd', buttonImage: '/wp-content/themes/nav-starter-2.0/images/interface/calendar.png', buttonImageOnly: true });
jQuery("#date_to").datepicker({ showOn: 'both', dateFormat: 'yy-mm-dd', buttonImage: '/wp-content/themes/nav-starter-2.0/images/interface/calendar.png', buttonImageOnly: true });
	
