function DisplayFlash(videopath, imagepath, width, height, flashContainer, flashHeader, flashTitle, flashPlayerPath)
{  
    var container = document.getElementById(flashContainer);
    var header = document.getElementById(flashHeader);
    var title = document.getElementById(flashTitle);

    var so = new SWFObject(flashPlayerPath,'mpl',width,height,'8');
    so.addParam('allowscriptaccess','always');
    so.addParam('allowfullscreen','true');
    so.addVariable('width',width);
    so.addVariable('height',height);
    so.addVariable('file','' + videopath);
    so.addVariable('image','' + imagepath);
    so.addVariable('displayheight',height);
    so.addVariable('displaywidth',width);
    so.addVariable('javascriptid','jstest');
    so.addVariable('enablejs','true');
    so.addVariable('type', 'flv');

    container.style.display = 'block';
    container.style.zIndex = 5;
    try {
        var height = parseInt(height,10)+25;
        var top = parseInt((window.innerHeight - height) / 2, 10);
        //header.style.top = top;
        header.style.top = top+'px';

        //var width = parseInt(width, 10) + 25;
        var width = parseInt(width, 10);
        
        var left = parseInt((window.innerWidth - width) / 2, 10);
        
        //header.style.left = left;
        header.style.left = left + 'px';
        //FF
        scrollTo(0, 0);
    } catch(e) {
        var viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
        var viewportheight = document.getElementsByTagName('body')[0].clientHeight;
        var height = parseInt(height, 10) + 25;
        var top = parseInt((viewportheight - height) / 2, 10);
        header.style.top = top;
        header.style.offset

        //var width = parseInt(width, 10) + 25;
        var width = parseInt(width, 10);
        
        var left = parseInt((viewportwidth - width) / 2, 10);
        header.style.left = left;
        //IE
        scrollTo(0, top-100);
    }

    so.write(container);
    //title.innerHTML = '&#160;&#160;' + title;
    header.style.width = width;
    header.style.display = 'block';
    header.style.zIndex = 50;
}

function PositionPlayButton(previewPlayButtonID, previewDivID, videopath, imagepath, width, height, flashContainer, flashHeader, flashTitle) 
{


    var previewDiv = document.getElementById(previewDivID);
    var previewPlayButton = document.getElementById(previewPlayButtonID);
    
    var img = new Image();
    img.src = imagepath;
    
    var imgPlayButton = new Image();
    imgPlayButton.src = previewPlayButton.src;
    
    
    if (previewDiv != null)
    {
      if(img.height > 0)
      {
        previewDiv.style.height = img.height + 'px';
      }
      else
      {
        previewDiv.style.height = "150px"
      }
      if(img.width > 0)
      {
        previewDiv.style.width = img.width + 'px';
      }
      else
      {
        previewDiv.style.width = "200px"
      } 
    }
        
    previewDiv.style.cursor = "pointer";
    previewPlayButton.style.cursor = "pointer";
    
    previewPlayButton.style.position = "absolute";
    previewPlayButton.style.left = (img.width-imgPlayButton.width)/2 + 'px';
    previewPlayButton.style.top = (img.height - imgPlayButton.height) / 2 + 'px';
}

