var undefined;
function show_video(video)
{
	
	video.uiconf_id == undefined ? video.uiconf_id=6530692:video.uiconf_id = video.uiconf_id;
	video.target == undefined ? video.target='#video_landing_player':video.target = video.target;
	video.bgcolor == undefined ? video.bgcolor='#000000':video.bgcolor = video.bgcolor;
	video.height == undefined ? video.height = '375': video.height = video.height;
	video.width == undefined ? video.width = '610' : video.width = video.width;
	video.autoplay == undefined ? video.autoplay = false : video.autoplay=video.autoplay;
	video.title == undefined? video.title='No title' : video.title = video.title;
	video.description == undefined ? video.description = 'No Description' : video.description = video.description;
	
	vHtml ='<object id="kaltura_player" name="kaltura_player" type="application/x-shockwave-flash" allowfullscreen="true" allownetworking="all" allowscriptaccess="always" height="'+video.height+'" width="'+video.width+'" bgcolor="'+video.bgcolor+'" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/'+video.uiconf_id+'/'+video.entry_id+'" data="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/'+video.uiconf_id+'/entry_id/'+video.entry_id+'">';
	vHtml+='<param name="allowFullScreen" value="true" />';
	vHtml+='<param name="allowNetworking" value="all" />';
	vHtml+='<param name="allowScriptAccess" value="always" />';
	vHtml+='<param name="bgcolor" value="'+video.bgcolor+'" />';
	vHtml+='<param name="flashVars" value="&amp;{FLAVOR}" />';
	vHtml+='<param name="flashVars" value="&autoPlay='+video.autoplay+'" />';
	vHtml+='<param name="wmode" value="opaque"/>';
	vHtml+='<param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/entry_id/'+video.entry_id+'" />';
	vHtml+='<a href="http://corp.kaltura.com">video platform</a> <a href="http://corp.kaltura.com/video_platform/video_management">video management</a>';
	vHtml+='<a href="http://corp.kaltura.com/solutions/video_solution">video solutions</a>';
	vHtml+='<a href="http://corp.kaltura.com/video_platform/video_publishing">video player</a>';
	vHtml+='<a rel="media:thumbnail" href="http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/'+video.entry_id+'/width/'+video.width+'/height/'+video.height+'/bgcolor/'+video.bgcolor+'/type/2"></a>';
	vHtml+='<span property="dc:description" content="'+video.description+'"></span><span property="media:title" content="'+video.title+'"></span> <span property="media:width" content="'+video.width+'"></span><span property="media:height" content="'+video.height+'"></span> <span property="media:type" content="application/x-shockwave-flash"></span> ';
	vHtml+='</object>';
	
	$(video.target).html(vHtml);
}

function show_videolanding(video,scroll)
{
	if(scroll)
	{
		$('html,body').animate({scrollTop: $('#video_player_region').offset().top - 100}, 1000, function(){
			
			video.uiconf_id == undefined ? video.uiconf_id=6530692:video.uiconf_id = video.uiconf_id;
			video.target == undefined ? video.target='#video_landing_player':video.target = video.target;
			video.bgcolor == undefined ? video.bgcolor='#000000':video.bgcolor = video.bgcolor;
			video.height == undefined ? video.height = '375': video.height = video.height;
			video.width == undefined ? video.width = '610' : video.width = video.width;
			video.autoplay == undefined ? video.autoplay = false : video.autoplay=video.autoplay;
			video.title == undefined? video.title='No title' : video.title = video.title;
			video.description == undefined ? video.description = 'No Description' : video.description = video.description;
			
			vHtml ='<object id="kaltura_player" name="kaltura_player" type="application/x-shockwave-flash" allowfullscreen="true" allownetworking="all" allowscriptaccess="always" height="'+video.height+'" width="'+video.width+'" bgcolor="'+video.bgcolor+'" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/'+video.uiconf_id+'/'+video.entry_id+'" data="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/'+video.uiconf_id+'/entry_id/'+video.entry_id+'">';
			vHtml+='<param name="allowFullScreen" value="true" />';
			vHtml+='<param name="allowNetworking" value="all" />';
			vHtml+='<param name="allowScriptAccess" value="always" />';
			vHtml+='<param name="bgcolor" value="'+video.bgcolor+'" />';
			vHtml+='<param name="flashVars" value="&amp;{FLAVOR}" />';
			vHtml+='<param name="flashVars" value="&autoPlay='+video.autoplay+'" />';
			vHtml+='<param name="wmode" value="opaque"/>';
			vHtml+='<param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/entry_id/'+video.entry_id+'" />';
			vHtml+='<a href="http://corp.kaltura.com">video platform</a> <a href="http://corp.kaltura.com/video_platform/video_management">video management</a>';
			vHtml+='<a href="http://corp.kaltura.com/solutions/video_solution">video solutions</a>';
			vHtml+='<a href="http://corp.kaltura.com/video_platform/video_publishing">video player</a>';
			vHtml+='<a rel="media:thumbnail" href="http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/'+video.entry_id+'/width/'+video.width+'/height/'+video.height+'/bgcolor/'+video.bgcolor+'/type/2"></a>';
			vHtml+='<span property="dc:description" content="'+video.description+'"></span><span property="media:title" content="'+video.title+'"></span> <span property="media:width" content="'+video.width+'"></span><span property="media:height" content="'+video.height+'"></span> <span property="media:type" content="application/x-shockwave-flash"></span> ';
			vHtml+='</object>';
			
			$(video.target).html(vHtml);
			$('.video_landing_player_section h2').html(video.title);
			$('.video_landing_player_section h4').html(video.description);
		});
	}
	else
	{
			video.uiconf_id == undefined ? video.uiconf_id=6530692:video.uiconf_id = video.uiconf_id;
			video.target == undefined ? video.target='#video_landing_player':video.target = video.target;
			video.bgcolor == undefined ? video.bgcolor='#000000':video.bgcolor = video.bgcolor;
			video.height == undefined ? video.height = '375': video.height = video.height;
			video.width == undefined ? video.width = '610' : video.width = video.width;
			video.autoplay == undefined ? video.autoplay = false : video.autoplay=video.autoplay;
			video.title == undefined? video.title='No title' : video.title = video.title;
			video.description == undefined ? video.description = 'No Description' : video.description = video.description;
			
			vHtml ='<object id="kaltura_player" name="kaltura_player" type="application/x-shockwave-flash" allowfullscreen="true" allownetworking="all" allowscriptaccess="always" height="'+video.height+'" width="'+video.width+'" bgcolor="'+video.bgcolor+'" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/'+video.uiconf_id+'/'+video.entry_id+'" data="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/'+video.uiconf_id+'/entry_id/'+video.entry_id+'">';
			vHtml+='<param name="allowFullScreen" value="true" />';
			vHtml+='<param name="allowNetworking" value="all" />';
			vHtml+='<param name="allowScriptAccess" value="always" />';
			vHtml+='<param name="bgcolor" value="'+video.bgcolor+'" />';
			vHtml+='<param name="flashVars" value="&amp;{FLAVOR}" />';
			vHtml+='<param name="flashVars" value="&autoPlay='+video.autoplay+'" />';
			vHtml+='<param name="wmode" value="opaque"/>';
			vHtml+='<param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1324331130/wid/_726562/uiconf_id/6530692/entry_id/'+video.entry_id+'" />';
			vHtml+='<a href="http://corp.kaltura.com">video platform</a> <a href="http://corp.kaltura.com/video_platform/video_management">video management</a>';
			vHtml+='<a href="http://corp.kaltura.com/solutions/video_solution">video solutions</a>';
			vHtml+='<a href="http://corp.kaltura.com/video_platform/video_publishing">video player</a>';
			vHtml+='<a rel="media:thumbnail" href="http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/'+video.entry_id+'/width/'+video.width+'/height/'+video.height+'/bgcolor/'+video.bgcolor+'/type/2"></a>';
			vHtml+='<span property="dc:description" content="'+video.description+'"></span><span property="media:title" content="'+video.title+'"></span> <span property="media:width" content="'+video.width+'"></span><span property="media:height" content="'+video.height+'"></span> <span property="media:type" content="application/x-shockwave-flash"></span> ';
			vHtml+='</object>';
			
			$(video.target).html(vHtml);
			$('.video_landing_player_section h2').html(video.title);
			$('.video_landing_player_section h4').html(video.description);
	}
		
}

/*
function displayFullVideo(target, thumbnail, videos, width, height,autoplay)
{
	//uiconf_id 6530692
  mw.setConfig('EmbedPlayer.EnableIframeApi', false );
  mw.setConfig('EmbedPlayer.OverlayControls', false );
  
	$('#youtube_player_wrapper').css({width: width, height: height});     
 $(target).css({width: width, height: height});     

  mw.ready(function(){
    mw.load('EmbedPlayer', function(){
      $j(target).embedPlayer({
          'poster' : thumbnail,
          'OverlayControls' : true,
          'sources' : videos,
          'autoplay':autoplay,
           
      });     
    });
  });
}


function showVideo(thumbnail, entry_id, widget_location, title, description,autoplay,width,height)
{
	
	if(height == null)
	{
		height = 400;
	}
	if(width == null)
	{
		width = 644;
	}
	console.log(autoplay);
	 
	
	thumbnail = "http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/"+entry_id+"/width/"+width+"/height/"+height+"/bgcolor/000000/type/2";
	if(widget_location == 'video_landing' || widget_location == 'video_detail_landing')
	{
		if(autoplay == 'true')
		{
				if(widget_location == 'video_landing')
				{
					$('html,body').animate({scrollTop: $('#video_player_region').offset().top - 100}, 1000, function(){
					
					
						$.post('/site/GetFlavors',{'entry_id': entry_id},function(data){
							$('#youtube_player_wrapper').html('<div id="youtube_player" style="display: none;"></div>');
							displayFullVideo('#youtube_player',
												thumbnail,
												data,
												width,
												height,
												autoplay
											);
							//console.log(title);
							$('.video_landing_player_section').children('h2').html(title);
							$('.video_landing_player_section').children('h4').html(description);
					 
						},'json');
					
					
					
					});
				}
				else
				{
					$.post('/site/GetFlavors',{'entry_id': entry_id},function(data){
							$('#youtube_player_wrapper').html('<div id="youtube_player" style="display: none;"></div>');
							displayFullVideo('#youtube_player',
												thumbnail,
												data,
												width,
												height,
												autoplay
											);
							//console.log(title);
							$('.video_landing_player_section').children('h2').html(title);
							$('.video_landing_player_section').children('h4').html(description);
					 
						},'json');
				}
		}
		else
		{
			$.post('/site/GetFlavors',{'entry_id': entry_id},function(data){
				$('#youtube_player_wrapper').html('<div id="youtube_player" style="display: none;"></div>');
				displayFullVideo('#youtube_player',
									thumbnail,
									data,
									width,
									height,
									autoplay
								);
				//console.log(title);
				$('.video_landing_player_section').children('h2').html(title);
				$('.video_landing_player_section').children('h4').html(description);
		 
			},'json');
		}
	}
	else
	{
		
	}
	
}

function getFlavors()
{
	 
}

function showVideoLandingPages(entry_id)
{
	showVideo('http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/'+entry_id+'/width/610/height/344/bgcolor/000000/type/2',entry_id, 'video_landing','','','false',610,375);
}


$(document).ready(function(){
	var Kalturaflavors = '';
	$('.tabbed-video-trigger').click(function(){
		var currTab = $(this);
		entry_id=$(this).attr('rel');
		 
		$.post('/site/GetFlavors',{'entry_id': entry_id},function(data){
		
			$('#youtube_player_wrapper').remove();
			currTab.before('<div id="youtube_player_wrapper" style="position: absolute;"><div id="youtube_player" style="display: none;"></div></div>');
			displayFullVideo('#youtube_player',
							'http://cdnbakmi.kaltura.com/p/726562/sp/72656200/thumbnail/entry_id/'+entry_id+'/width/435/height/275/bgcolor/000000/type/2',
							data,
							435,
							275,
							true
							);
		},'json');
	});
	
	$('.video-trigger2').click(function(){
		entry_id=$(this).attr('rel');
		thumbnail = $(this).attr('src');
		//alert($(this).parents('.main_cont_area').attr('class'));
		
		if($('#youtube_player_wrapper').length !=0)
		{
			$('#youtube_player_wrapper').appendTo($(this).parent().next().after());
			$('#youtube_player_wrapper').html('<div id="youtube_player" style="display: none;"></div>');
		}
		else
		{
			 
			$(this).parent().next().after('<div id="youtube_player_wrapper" style="clear:both; margin-bottom: 10px;"><div id="youtube_player" style="display: none;"></div></div>');
		}
		
		$.post('/site/GetFlavors',{'entry_id': entry_id},function(data){
			$('#youtube_player_wrapper').html('<div id="youtube_player" style="display: none;"></div>');
			displayFullVideo('#youtube_player',
								thumbnail,
								data,
								610,
								457,
								true
							);
			//console.log(title);
			$('.video_landing_player_section').children('h2').html(title);
			$('.video_landing_player_section').children('h4').html(description);
			
		},'json');
		 
	});
			
});

*/



