

/*	
------------------------------------------------	
	JQUERY STUFF
------------------------------------------------	
*/


// ################################################################################################################################ //
this.jQuerySmoothScroll = function(){
	
	
// ########################################## //
// jQuery SmoothScroll to top or Anchor ID 
//	e.g. <a href="#two">    <a href="#top">


$(function(){

    $('a[href*=#]').click(function() {   
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {      
            var $target = $(this.hash);            
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');            
            if ($target.length) {            
                var targetOffset = $target.offset().top;               
                $('html,body').animate({scrollTop: targetOffset}, 400);                    
                return false;                
            }            
        }        
    });    
});
// ########################################### //


// ############ End SmoothScroll ############# //
};
// ################################################################################################################################ //




// ################################################################################################################################ //

// ########################################## //
// jQuery More / Less

this.jQuerySmoothMoreLess = function(){

  $('div#synopsis p.synopsis').expander({
    slicePoint:       450,  // the number of characters at which the contents will be sliced into two parts. 
                            // Note: any tag names in the HTML that appear inside the sliced element before 
                            // the slicePoint will be counted along with the text characters.
    widow:            4,  // a threshold of sorts for whether to initially hide/collapse part of the element's contents. 
                          // If after slicing the contents in two there are fewer words in the second part than 
                          // the value set by widow, we won't bother hiding/collapsing anything.
    expandText:       'More&nbsp;&raquo;', // text displayed in a link instead of the hidden part of the element. 
                                      // clicking this will expand/show the hidden/collapsed text
    expandPrefix:     '&hellip; &nbsp;&nbsp;',
    collapseTimer:    0, // number of milliseconds after text has been expanded at which to collapse the text again
    expandEffect:     'fadeIn',
    expandSpeed:      '',   // speed in milliseconds of the animation effect for expanding the text
    userCollapse:     true, // allow the user to re-collapse the expanded text.
    userCollapseText: '&laquo;&nbsp;Less',  // text to use for the link to re-collapse the text
    userCollapsePrefix: ''		// no Comma after last item!!!!! dont work with IE 6+7						 
	});
  
  
    $('#movieinfo dd.cast').expander({
    slicePoint:       90,  // the number of characters at which the contents will be sliced into two parts. 
                            // Note: any tag names in the HTML that appear inside the sliced element before 
                            // the slicePoint will be counted along with the text characters.
    widow:            4,  // a threshold of sorts for whether to initially hide/collapse part of the element's contents. 
                          // If after slicing the contents in two there are fewer words in the second part than 
                          // the value set by widow, we won't bother hiding/collapsing anything.
    expandText:       'More Cast&nbsp;&raquo;', // text displayed in a link instead of the hidden part of the element. 
														//clicking this will expand/show the hidden/collapsed text
    expandPrefix:     '',
    userCollapseText: '&laquo;&nbsp;Less Cast',  // text to use for the link to re-collapse the text
    userCollapsePrefix: ''		// no Comma after last item!!!!! dont work with IE 6+7						 
	});


    $('#movieinfo dd.crew').expander({
    slicePoint:       46,  // the number of characters at which the contents will be sliced into two parts. 
                            // Note: any tag names in the HTML that appear inside the sliced element before 
                            // the slicePoint will be counted along with the text characters.
    widow:            4,  // a threshold of sorts for whether to initially hide/collapse part of the element's contents. 
                          // If after slicing the contents in two there are fewer words in the second part than 
                          // the value set by widow, we won't bother hiding/collapsing anything.
    expandText:       'More Crew&nbsp;&raquo;', // text displayed in a link instead of the hidden part of the element. 
														//clicking this will expand/show the hidden/collapsed text
    expandPrefix:     '',
    userCollapseText: '&laquo;&nbsp;Less Crew',  // text to use for the link to re-collapse the text
    userCollapsePrefix: ''		// no Comma after last item!!!!! dont work with IE 6+7					 
	});
	
// ############ End More / Less ############# //
};
// ################################################################################################################################ //





// ################################################################################################################################ //
// ################################################################################################################################ //
  
// starting the script fuctions on page load

$(document).ready(function(){
	jQuerySmoothScroll();
	jQuerySmoothMoreLess();
});

// ################################################################################################################################ //
// ################################################################################################################################ //










// ################################################################################################################################ //

// ########################################## //
// jQuery NivoSlider Settings

//this.jQueryNivoSlider = function(){
	$(window).load(function() {

	$('#shufflestack').nivoSlider({
		effect:'fade', //Specify sets like: 'sliceDown, sliceDownLeft, sliceUp, sliceUpLeft, sliceUpDown, sliceUpDownLeft, fold, fade, random'
		slices:40,
		animSpeed:1000,
		pauseTime:6000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //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
	});





// ############ End NivoSlider ############# //
//};
});
// ################################################################################################################################ //






// ################################################################################################################################ //
// ################################################################################################################################ //

// Video scr //

var trailerLong = {
   objectType: 'swf',
   swfOptions: {
      version: '9', 
	  flashvars: { file:'&mediaURL=media/fatal_rescue_150sec_640.mov&teaserURL=xx.jpg&allowSmoothing=true&autoPlay=true&buffer=6&showTimecode=true&loop=false&controlColor=0xcccccc&controlBackColor=0x000000&scaleFullscreen=true&showScalingButton=true&defaultVolume=100&crop=true&onClick=togglePlay'
      },
      params: { 
         menu: 'false', 
         allowscriptaccess: 'always', 
         allowfullscreen: 'true', 
         wmode: 'transparent'
      }
   },
   width: 640,
   height: 352,
   objectWidth: 640, 
   objectHeight: 352, 
   dimmingOpacity: 0.50, 
   fadeInOut: true,
   transitions : ['expand'],
   preserveContent: false, 
   allowSizeReduction: false,
   wrapperClassName: 'borderless-html', 
   maincontentText: 'You need to upgrade your Flash player'         
};

        



var trailerShort = {
   objectType: 'swf',
   swfOptions: {
      version: '9',
      flashvars: { file:'&mediaURL=media/fatal_rescue_060sec_640.mov&teaserURL=xx.jpg&allowSmoothing=true&autoPlay=true&buffer=6&showTimecode=true&loop=false&controlColor=0xcccccc&controlBackColor=0x000000&scaleFullscreen=true&showScalingButton=true&defaultVolume=100&crop=true&onClick=togglePlay'
      },
      params: { 
         menu: 'false', 
         allowscriptaccess: 'always', 
         allowfullscreen: 'true', 
         wmode: 'transparent'
      }
   },
   width: 640,
   height: 352,
   objectWidth: 640, 
   objectHeight: 352, 
   dimmingOpacity: 0.50, 
   fadeInOut: true,
   transitions : ['expand'],
   preserveContent: false, 
   allowSizeReduction: false,
   wrapperClassName: 'borderless-html', 
   maincontentText: 'You need to upgrade your Flash player'         
};





// ################################################################################################################################ //
// ################################################################################################################################ //





/*	
------------------------------------------------	
	HIGHSLIDE STUFF
	855c0ad6054fae0b8a901b7d3e1b1e53
------------------------------------------------	
*/



/* to make the expander close with second click on thumb */
/* a tag need this: onclick="if (closeFromThumb(this, galleryOptions)) return false; else return hs.expand(this)" */

function closeFromThumb(thumb) {
   var exp = hs.getExpander(thumb);
   if (exp) { // meaning there is an open expander connected to the thumb
      exp.close();
      return true; // success closing the exp
   } else {
      return false; // no exp was found
   }
}

hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top left',
	useOnHtml: true,
	hideOnMouseOut: true,
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});

hs.graphicsDir = 'js/highslide/graphics/';
hs.transitions = ['expand', 'crossfade'];
//hs.transitions = ["fade"];
hs.fadeInOut = true;
hs.dimmingOpacity = 0.50;
hs.showCredits=false;
hs.align = 'center';
hs.dimmingDuration = 500;
hs.outlineType = 'drop-shadow-trans';
hs.wrapperClassName= 'borderless-image';
hs.expandCursor = null; // null disables
hs.restoreCursor = null; // null disables
//hs.objectLoadTime = 'after';  // loads swf after the expander
//hs.outlineType = null; // kills the white table and frame in the Highslide
//]]>





// Add the slideshow controller
if (hs.addSlideshow) hs.addSlideshow({
	slideshowGroup: 'gallery',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		className: 'large-dark',
		opacity: '0.75',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '-20',
		hideOnMouseOut: true
	}
});





// Start - Stop the NivoSlider if a Highslide is opened or closed //

hs.Expander.prototype.onBeforeExpand = function () {
   //return confirm("pause the slider");
   $('#shufflestack').data('nivo:vars').stop = true; //Stop the Slider
   
   /* Execute Email scramble script in Ajax Highslide */
    $(document).ready(function(){
        $('a.email').each(function(){
            e = this.rel.replace('/','@');
            this.href = 'ma' + 'ilt' + 'o:' + e;
            $(this).text(e);
        });
    });
}


hs.Expander.prototype.onBeforeClose = function () {
   //return confirm("start the slider");
    $('#shufflestack').data('nivo:vars').stop = false; //Stop the Slider
}







// ################################################################################################################################ //
// ################################################################################################################################ //


