/* 
 *  Kansas Attorney General Scripts
 *  Site by New Media Campaigns
 */

$(document).ready(function() {
    
    // Open external links in a new window
	$('a[href^="http://"]').attr("target", "_blank");
	
	//Start pretty photo
	$('a[rel^="prettyPhoto"]').prettyPhoto();
	
	// Clear textboxes on focus
    $('.autoclear').autoClear();
    
    flowplayer("video", "/~ksag2/files/flowplayer-3.1.2.swf", {
        clip: {
            autoBuffering: true,
            autoPlay: true
            },
        plugins: {
            controls: {
                play: true, 
                volume: false, 
                mute: true, 
                time: false, 
                stop: false, 
                playlist: false, 
                fullscreen: true,
                scrubber: false
            }
        }    
    });
    

    
});

// Clears the default text when an input receives
// focus and reinstates it if it is left blank
(function($) {
 
    $.fn.autoClear = function() {	
        return this.each(function() {
            $(this).focus(function() {
                if( this.value == this.defaultValue ) {
                    this.value = "";
                }
            })
            .blur(function() {
                if( !this.value.length ) {
                    this.value = this.defaultValue;
                }
            });
        });
    };
	
})(jQuery);