function showRelatedVideo(videoSetId)
{
	jQuery('#relatedVideo').load('/AnswersTV/Handler/GetRelatedVideos.ashx?videoSetId=' + videoSetId);
	jQuery('#topBaner').load('/AnswersTV/Handler/GetTopBaner.ashx?videoSetId=' + videoSetId);
}

function launchVideo(position)
{
	var id_str = jQuery('#id' + position).val();
	var id_val = parseInt(id_str);
	
	replaceVideos(position);
	thisMovie('media').launchRelatedVideo(id_val, 'Menu');
}

function replaceVideos(position)
{
	var currentVideo =
		eval('(' + jQuery('#currentVideo').val() + ')');
	var oldCurrentVideo = 
		eval('(' + jQuery('#currentVideo').val() + ')');
	
	currentVideo.VideoSetId = parseInt(jQuery('#id' + position).val());
	currentVideo.ImageUrl = jQuery('#thumbnail' + position).attr('src');
	currentVideo.Title = jQuery('#title' + position).text();
	currentVideo.Description = jQuery('#description' + position).text();
	//currentVideo.Duration = jQuery('#duration' + position).text();
	
	jQuery('#id' + position).val(oldCurrentVideo.VideoSetId);
	jQuery('#thumbnail' + position).attr('src', oldCurrentVideo.ImageUrl);
	jQuery('#title' + position).text(oldCurrentVideo.Title);
	jQuery('#description' + position).text(oldCurrentVideo.Description);
	//jQuery('#duration' + position).text(oldCurrentVideo.Duration);	
	
	var result = '{"VideoSetId":' + currentVideo.VideoSetId + 
		',"Title":"' + currentVideo.Title + 
		'","Description":"' + currentVideo.Description + 
		//'","Duration":"' + currentVideo.Duration + 
		'","ImageUrl":"' + currentVideo.ImageUrl + '"}';
	
	jQuery('#currentVideo').val(result);
}

function thisMovie(movieName) 
{
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
        return document[movieName];
    }
}
