﻿function playVideo(containerID, videoURL, width, height) {
    if (videoURL.length > 0) {
        jQuery('#' + containerID).show();
        width = width ? width : 556;
        height = height ? height : 433;
        jQuery('#' + containerID).css("width", width);
        jQuery('#' + containerID).css("height", height);
        flowplayer(containerID, "/include/gyproc/flowplayer-3.2.5.swf", {
            clip: {
                url: videoURL,
                autoPlay: false
            },
            plugins: {
                controls: {
                    url: '/include/gyproc/flowplayer.controls-3.2.3.swf'
                }
            }
        });
    } else {
        jQuery('#' + containerID).hide();
    }
}

function playYouTubeVideo(containerID, videoId, width, height) {
    if (videoId.length > 0) {
        jQuery('#' + containerID).show();
        width = width ? width : 550;
        height = height ? height : 443;
        jQuery('#' + containerID).css("width", width);
        jQuery('#' + containerID).css("height", height);
        src = "http://www.youtube.com/v/" + videoId;
        iframe = '<iframe title="YouTube video player" width="' + width + '" height="' + height + '" src="' + src + '" frameborder="0" allowfullscreen="true"></iframe>';
        jQuery('#' + containerID).html(iframe);
    } else {
        jQuery('#' + containerID).hide();
    }
}
