﻿$(document).ready(function()
{
    var objFlash;
    var strPlayerID;

    //audio player
    $('.PodPlayer').each(function()
        {
            strPlayerID = $(this).attr('id');
            var strPath = $(this).find('input').val();
            
            objFlash = new SWFObject(strPath, strPlayerID, '290', '24', '8', '#201900');
            objFlash.addParam('wmode', 'transparent');
            objFlash.write(strPlayerID);
        }
    );
    
    //video player
    var strPlayerURL = '';
    var strVideoURL = '';
    var strPreviewURL = '';
    var strVidWidth = '600'
    var strVidHeight = '470'
    
    $('.VidPlayer').each(function()
    {
        strPlayerID = $(this).attr('id');
        strPlayerURL = $(this).find('.PlayerURL input').val();
        strVideoURL = $(this).find('.VideoURL input').val();
        strPreviewURL = $(this).find('.PreviewURL input').val();
        strVidWidth = $(this).find('.VidWidth input').val();
        strVidHeight = $(this).find('.VidHeight input').val();
        $(this).css('width', strVidWidth);

        objFlash = new SWFObject(strPlayerURL, strPlayerID, strVidWidth, strVidHeight, '8');
        objFlash.addParam('wmode', 'transparent');
        objFlash.addParam('allowfullscreen', 'true');
        objFlash.addVariable('stretching', 'fill');
        objFlash.addVariable('width', strVidWidth);
        objFlash.addVariable('height', strVidHeight);
        objFlash.addVariable('file', strVideoURL);
        objFlash.addVariable('image', strPreviewURL);
        objFlash.addVariable('backcolor', '0x000000');
        objFlash.addVariable('frontcolor', '0xCCCCCC');
        objFlash.addVariable('lightcolor', '0x99AA99');
        objFlash.write(strPlayerID);
    });
    $('.VideoLink .NoJavaScript').hide();
    $('.VideoLink a').show().css('display', 'block'); 
    $('.Podcast-Episode .Audio').css('width', '310px').css('float', 'left');
    $('.Podcast-Episode .Video').css('width', '95px').css('float', 'left'); 
});
