$(document).ready(function() {

    /*SlideShow*/
    if ($('ul.slideshow').length > 0) {
        $('ul.slideshow').each(function() {
            $(this).innerfade({
                speed: 3000,
                timeout: 5000,
                type: 'sequence',
                containerheight: 280
            });
        });
    }

    if ($('ul.testimonial-slideshow').length > 0) {
        $('ul.testimonial-slideshow').each(function() {
            $(this).innerfade({
                speed: 2000,
                timeout: 7000,
                type: 'random',
                containerheight: 200
            });
        });
    }

    /*Video*/
    if ($('.video-small').length > 0) {
        $('.video-small').each(function(i) {
            $this = $(this);
            var flashvars = {};
            flashvars.videoSource = $this.children('a.src').attr('rel');

            if (window.location.search.indexOf('autoplay=true') > 0) {
                flashvars.AutoPlay = 'true';
            } else {
                flashvars.AutoPlay = 'false';
            }

            flashvars.FixedInterface = 'true';
            flashvars.Transparent = 'true';
            
            var params = {};
            params.scale = 'noscale';
            params.quality = 'high';
            params.wmode = 'transparent';
            params.allowfullscreen = 'true';
            params.allowScriptAccess = 'sameDomain';
            params.align = 'middle';
            params.bgcolor = '#000000';

            var attributes = {};
            attributes.id = 'video-player-' + i;
            attributes.name = 'video-player-' + i;

            swfobject.embedSWF(pathprefix + 'flash/finalmed-player.swf', 'video-player-' + i, "335", "231", '9.0.45', 'flash/expressInstall.swf', flashvars, params, attributes);
        });
    }
    if ($('.video-large').length > 0) {
        $('.video-large').each(function(i) {
            $this = $(this);
            var flashvars = {};
            flashvars.videoSource = $this.children('a.src').attr('rel');

            if (window.location.search.indexOf('autoplay=true') > 0) {
                flashvars.AutoPlay = 'true';
            } else {
                flashvars.AutoPlay = 'false';
            }

            flashvars.FixedInterface = 'false';
            flashvars.Transparent = 'true';
            
            var params = {};
            params.scale = 'noscale';
            params.quality = 'high';
            params.wmode = 'transparent';
            params.allowfullscreen = 'true';
            params.allowScriptAccess = 'sameDomain';
            params.align = 'middle';
            params.bgcolor = '#000000';

            var attributes = {};
            attributes.id = 'video-player-' + i;
            attributes.name = 'video-player-' + i;

            swfobject.embedSWF(pathprefix + 'flash/finalmed-player-large.swf', 'video-player-' + i, "650", "364", '9.0.45', 'flash/expressInstall.swf', flashvars, params, attributes);
        });
    }
    if ($('.video-extralarge').length > 0) {
        $('.video-extralarge').each(function(i) {
            $this = $(this);
            var flashvars = {};
            flashvars.videoSource = $this.children('a.src').attr('rel');
            
			flashvars.AutoPlay = 'false';
            
            flashvars.FixedInterface = 'true';
            flashvars.Transparent = 'true';

            var params = {};
            params.scale = 'noscale';
            params.quality = 'high';
            params.wmode = 'transparent';
            params.allowfullscreen = 'true';
            params.allowScriptAccess = 'sameDomain';
            params.align = 'middle';
            params.bgcolor = '#000000';

            var attributes = {};
            attributes.id = 'video-player-' + i;
            attributes.name = 'video-player-' + i;

            swfobject.embedSWF(pathprefix + 'flash/finalmed-player-extralarge.swf', 'video-player-' + i, "690", "430", '9.0.45', 'flash/expressInstall.swf', flashvars, params, attributes);
        });
    }
}); 
 
   



   
   