/* Author: UT Med School Office of Communications: Eric Rasch ms.web@uth.tmc.edu (713) 500-5530
*/

//	=BEGIN: FancyBox Options
		//  URL Source: http://fancybox.net/blog
		//	.............................................................. 
				jQuery(document).ready(function() { // This is used for formating the FancyBox on the registration pop-up form
			jQuery(".show").fancybox({
				'autoDimensions'  : true, // if true, this overrides the width/height settings below 
				'width'           : 300,
				'height'          : 600,
				'centerOnScroll'  : true,
				'titleShow'       : false,
				'transitionIn'    : 'fade',
				'transitionOut'   : 'fade'
			});
		});

		jQuery(document).ready(function() { // This is used for formating the FancyBox on the report an error form
			jQuery(".error-button").fancybox({
				'autoDimensions'  : false, // if true, this overrides the width/height settings below 
				'width'           : 400,
				'height'          : 600,
				'centerOnScroll'  : true,
				'titleShow'       : false,
				'transitionIn'    : 'fade',
				'transitionOut'   : 'fade',
				'type'            : 'iframe'

			});
		});

		jQuery(document).ready(function() {
		
			/* This is basic - uses default settings */
			
			jQuery("a.fancyimg").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'overlayOpacity'	:	0.8,
				'overlayColor'		:	'#000',
				'titleShow'       : true,
				'titlePosition'   : 'inside',
				'speedIn'         :	600, 
				'speedOut'        :	200
			});
			
			/* Using custom settings */
			
			jQuery("a#inline").fancybox({
				'hideOnContentClick': true
			});
		
			/* Apply fancybox to multiple items */
			
			jQuery("a.group").fancybox({
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'speedIn'		:	600, 
				'speedOut'		:	200, 
				'overlayShow'	:	false
			});
			
			jQuery("a[rel=group1]").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'overlayOpacity'	:	0.8,
				'overlayColor'		:	'#000',
				'titleShow'       : true,
				'titlePosition'   : 'outside'
			});

		});

		//	.............................................................. 
		//	=END: FancyBox Options
		

//	=BEGIN: Gravity Forms: Make a readonly field
//  This will allow you disable certain fields from being editable on forms. On the advanced tab for each field add a "disable" class.
//  URL Source: http://forum.gravityhelp.com/topic/make-a-readonly-field#post-7034
//	.............................................................. 
		jQuery(document).ready(function($){
			//$(".gform_wrapper .disable input").attr('disabled','disabled');
			
			$(".gform_wrapper .disable input, .gform_wrapper .disable select").attr('disabled','disabled');
		});
//	.............................................................. 
//	=END: Gravity Forms: Make a readonly field


//	=BEGIN: Form Input Default Values With The jQuery valueFx() Plugin
//  URL Source: http://www.kevinleary.net/form-input-default-values-jquery-valuefx-plugin/
//	.............................................................. 
jQuery.fn.valueFx = function() {
	return this.each(function(){
		var $field = $(this);
		var $value = $(this).val();
		var $newVal;	
		$field.addClass('placeholder');
		$field.focus(function(){
			if($field.hasClass('input')){
				if (($value == '') || ($value == $value)) {
					$field.removeClass('placeholder').addClass('focus').val('');
					$newVal = $(this).val();
				}
			}
		});
		$field.blur(function(){
			$newVal = $(this).val();
			if ($newVal == '') {
				$field.val($value).removeClass('focus').addClass('placeholder');
			} else {
				$field.removeClass('placeholder').removeClass('valueFx');
			}
		});
	});
};
//	.............................................................. 
//	=END: Form Input Default Values With The jQuery valueFx() Plugin


//	=BEGIN: Nivo Slider options
//  URL Source: http://nivo.dev7studios.com/#usage
//	.............................................................. 

$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'fade', 
        slices:1,
        animSpeed:500, //Slide transition speed
        pauseTime:3000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.8, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
});

//	.............................................................. 
//	=END: Nivo Slider options
