// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function slideSwitch() {
		var $active = $('#slideshow IMG.active');

		if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

		var $next =  $active.next().length ? $active.next()
			: $('#slideshow IMG:first');

		$active.addClass('last-active');

		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 2000, function() {
				$active.removeClass('active last-active');
			});
			
	}
	
function testimonialSwitch() {
                var $active = $('#testimonialThumb IMG.active');

                if ( $active.length == 0 ) $active = $('#testimonialThumb IMG:last');

                var $next =  $active.next().length ? $active.next()
                        : $('#testimonialThumb IMG:first');

                $active.addClass('last-active');

                $next.css({opacity: 0.0})
                        .addClass('active')
                        .animate({opacity: 1.0}, 2000, function() {
                                $active.removeClass('active last-active');
                        });
                        
        }


// Provides the proper address for the movie depending on browser - Clinical Efficacy Charts

	function restart_chart(movieName) { 
		objswf = swfobject.getObjectById(movieName); 
		objswf.replay_flash_chart();	}


$(document).ready(function(){  
	
	
	 $('#patient_image_upload').attr('name',  $('#patient_image_upload').attr('name') + '[]');
		 
	 $('#patient_image_upload').MultiFile({  
	  STRING:{remove: '<img src=\"/images/trash_icon.gif\" height=\"16\" width=\"16\" alt=\"x\"/>' },
	  list: '#patient_image_upload-list'
	 });
   	
  
	
});

function triggerRotatingPics(){
	setInterval( "slideSwitch()", 6000 );
	setInterval( "testimonialSwitch()", 6000 );
}

swfobject.registerObject("chart1swf", "9.0.0", "expressInstall.swf");
swfobject.registerObject("chart2swf", "9.0.0", "expressInstall.swf");
swfobject.registerObject("chart3_1swf", "9.0.0", "expressInstall.swf");
swfobject.registerObject("chart3_2swf", "9.0.0", "expressInstall.swf");
swfobject.registerObject("safetyswf1", "9.0.0", "expressInstall.swf");
swfobject.registerObject("safetyswf2", "9.0.0", "expressInstall.swf");



//prepNav(); // don't delete this, this now prepares the nav (obviously)'
