// Custom Plugins
(function($) {
	// Input box default text plugin
	$.fn.bobInputDefaultText = function() {
		return this.each(function() {
			var $obj = $(this);
			$obj.focus(function() {
				if( $obj.val() == $(this)[0].defaultValue ) {
					$obj.val('');
			}});
			$obj.blur(function() {
				if( ! $obj.val().length ) {
					$obj.val($obj[0].defaultValue);
				}
			});
		});
	};
}) (jQuery);


// OnLoad Events
$(document).ready(function() {
	var isDesktopBrowser = ($(window).width() > 599);
	
    // Manage input box default values
    $('#footer #nnjjt-nnjjt').bobInputDefaultText();

    
	// Add modal behavior to links to videos
	if (isDesktopBrowser) {
		$('#contentPrimary a.video, #contentSecondary a.video').colorbox({initialWidth: '100px', initialHeight: '100px', innerWidth:640, innerHeight:385, iframe:true});
	}
    
	// Add modal behavior to links to select images
	if (isDesktopBrowser) {
		$('#contentPrimary a.modalPhoto, #contentSecondary a.modalPhoto').colorbox({scalePhotos: true, scrolling: false, initialWidth: '50px', initialHeight: '50px', maxWidth: '90%', maxHeight: '90%'});
	}
    
    // Add current weather
    $('#weather').load('/utility/current-weather');
});

