﻿var youtube;

function OpenModal(targetName) {
    switch (targetName) {
        case 'YouTubePlayerPanel':
            youtube = ModalPopup(document.getElementById(targetName), null, null);
            youtube.Open();
            break;

    }
}

function CloseModal(targetName) {
    switch (targetName) {
        case 'YouTubePlayerPanel':
            youtube.Close();
            youtube = null;

            //START PLAYER
            if ($get('Scroller') != null) {
                PlayScroller();
            }
            break;
    }
}

function CloseReviewModal(targetName) {
	switch (targetName) {
		case 'YouTubePlayerPanel':
			youtube.Close();
			youtube = null;

			//START PLAYER
			if ($get('Scroller') != null) {
				PlayScroller();
			}
			break;
	}
}


function PlayYouTube(videoID) {
    var code = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/' + videoID + '?fs=1&amp;hl=en_GB&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + videoID + '?fs=1&amp;hl=en_GB&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>';

    document.getElementById('YouTubePlayer').innerHTML = code;
    OpenModal('YouTubePlayerPanel');

    //PAUSE PLAYER
    PauseScroller();

}

function ShowYouTube(videoID) {
    var code = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/' + videoID + '?fs=1&amp;hl=en_GB&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + videoID + '?fs=1&amp;hl=en_GB&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>';

    document.getElementById('YouTubePlayer').innerHTML = code;
    OpenModal('YouTubePlayerPanel');

}

function ChangeImage(url) {

    $get('divMainImage').innerHTML = '<img src="' + url + '" alt="Article Image" />';

}
