//** Initialize Video player =======================	$.runVideoPlayer = function(video_name, run_player, video_poster, sharing, link) {			jwplayer(run_player).setup({			'autostart': false,			'controlbar': 'bottom',			'width': 425,			'height': 265,			//file: '/video/videos.xml',			'file': video_name,			'image': video_poster,			'backcolor':'#000000',			'frontcolor':'#777e83',			'lightcolor':'#FFFFFF',			'screencolor':'#1a1919',			'stretching':'uniform',			'wmode':'transparent',			'bgcolor':'#000000',			'logo': {				'position': 'top-left',				'file':'/img/global/logo_player_new.png',				'hide': false			},			//skin:'/video/js/player/skins/fsjw48.zip',			'modes': [        		{type: 'flash', src: '/mediaplayer/player_assets/player.swf'},        		{type: 'html5'}    		],    		    		'plugins': {       			'sharing-3': {           			'code': sharing,       				'link': link       			}    		}		});	}	$.extend({  		getUrlVars: function(){    		var vars = [], hash;    		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');    		for(var i = 0; i < hashes.length; i++)    	{      		hash = hashes[i].split('=');      		vars.push(hash[0]);      		vars[hash[0]] = hash[1];    	}    	return vars;  	},  		getUrlVar: function(name){    		return $.getUrlVars()[name];  		}	});	$.loadPlayListItem = function(playlist_item, autoplay, playlist, initialload) {				// Get the video variables				var video_poster_path = "";		if (playlist == "1") {						//If the video is being parsed by a thumbnail link and needs to play in the main feature player						var video_url = playlist_item.attr('href'),				player_id = "video-container0",				video_poster_path = playlist_item.find('img').attr('src'),				video_title = playlist_item.siblings('h3').html(),				video_description = playlist_item.siblings('blockquote').html();							$('.video_title').fadeOut(function() {				$(this).fadeIn('slow').html(video_title);				});			$('.video_description').fadeOut(function() {				$(this).fadeIn('slow').html(video_description);			});		} else {					//If the video needs to play in a standalone video tag						var video_url = playlist_item.attr('src'),			player_id = playlist_item.attr('id'),			video_poster_path = playlist_item.attr('poster');					}					// Check whether the video is from YouTube, will open a new web page or has been uploaded locally.				if (video_url.match('http://') == 'http://' && video_url.match(window.location.host) != window.location.host) {			if (video_url.match('youtu') == 'youtu' ) {			 	var	video_location = 'youtube';			 } else {			 	var	video_location = 'external';			 }		} else {			 var video_location = 'local';		}				if (video_location == 'youtube') {				// If video is on YouTube, get the video code and run the player function, parsing the YouTube video url as the video file.		// This is neccasary. if you just use the straight video embed link, it tries to put the YouTube flash player inside the Longtail flash player we are using.					var video_id = video_url.replace('http://youtu.be/', ''),				video_file = 'http://www.youtube.com/watch?v='+video_id,				sharing_code = '%3Ciframe%20width%3D%22560%22%20height%3D%22315%22%20src%3D%22http%3A%2F%2Fwww.youtube.com%2Fembed%2F'+video_id+'%22%20frameborder%3D%220%22%20allowfullscreen%3E%3C%2Fiframe%3E';					} else if (video_location == 'external'){				// If video is on another site, get the poster image, wrap it in the video url link and remove the video player completely.			//	playlist_item.parent(".video-wrapper").append('<a href="'+video_url+'" target="_blank"><img src="'+video_poster_path+'"></a>');		//	playlist_item.remove();							} else {		// If video has been uploaded locally, get the video file url & run the player.			var video_url_string = (video_url.match(window.location.host) == window.location.host) ? video_url : 'http%3A%2F%2F'+window.location.host+video_url ;					var	video_file = video_url,				sharing_code = '%3Cembed%20src%3D%22http%3A%2F%2F'+window.location.host+'%2Fmediaplayer%2Fplayer_assets%2Fplayer.swf%3Ffile%3D'+video_url_string+'%22%20width%3D%22480%22%20height%3D%22300%22%20allowfullscreen%3D%22true%22%20%2F%3E';		}				var thisURL = window.location.host + window.location.search;		if (playlist == '1') {			thisURL = thisURL.split("&")[0];			var link_code = 'http://' + thisURL + '&file=' + video_url + '&pl=1';		} else { 			var link_code = 'http://' + thisURL;		}				if (initialload == '1') {			$.runVideoPlayer(video_file, player_id, video_poster_path, sharing_code, link_code);		} else {				//var showControls = (video_file.match('youtu') == 'youtu' ) ? "none" : "bottom";				jwplayer(player_id).load({					'image': video_poster_path, 					'file': video_file,					'sharing.code': sharing_code, 					'sharing.link': link_code 				}).play();			}				return false			}			$(document).ready(function($) {	// TABS container		var thisHash = 	document.location.hash;	$(".tab_content").hide(); //Hide all content		 if (thisHash) {	 			$(thisHash + '_s').fadeIn(); //Fade in the active ID content		$("a[href='"+thisHash+"']").parents("li").addClass("active"); //Add "active" class to selected tab	 } else {	 		$("ol.tabs li:first").addClass("active"); //Activate first tab		$(".tab_content:first").show(); //Show first tab content		}			//On Click Event	$("ol.tabs li").click(function() {		$("ol.tabs li").removeClass("active"); //Remove any "active" class		$(this).addClass("active"); //Add "active" class to selected tab		$(".tab_content").hide(); //Hide all tab content		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content		$(activeTab + '_s').fadeIn(); //Fade in the active ID content			});		var run_from_playlist = '0',		initial_player_id = '0';			// Run video in player on thumbnail click		$("ul.playlist li a").click(function() {			$.loadPlayListItem($(this), "noplay", run_from_playlist, '0');			$('html,body').animate({scrollTop: 0}, 700);			$('.now-playing').removeClass('now-playing')			$(this).parent().addClass('now-playing');						return false			});				// Initial featured Video		$('video').show().each(function () {					$(this).attr({			"id": "video-container"+initial_player_id		});		if (!$('ul.playlist').length > 0) {		// Function for multiple players with no playlist: 			// If there is no playlist, run the player function for each video instance on the page.			$.loadPlayListItem($(this), "noplay", run_from_playlist, '1');			}			initial_player_id++;	});			if ($('ul.playlist').length > 0) {			$('.video_title, .video_description, .playlist li').hide();			var li_interval = 0;		$('ul.playlist').children('li').hide().each(function() {			$(this).delay(li_interval).fadeIn().children('a');			li_interval += 200;		});		// if url contains movie file e.g. from an external link		var vidfile =  $.getUrlVar('file');			if(vidfile && !document.location.hash) {			vidfile = decodeURIComponent(vidfile);			var tabcontentid = $('.playlist li a[href*="'+vidfile+'"]').parents('div').attr('id');			var tabid = tabcontentid.substr(0,tabcontentid.length - 2);					$('#nav-tabs ol li a[href="#'+tabid+'"]').parent().click();			$('.now-playing').removeClass('now-playing')			$('ul.playlist li a[href*="'+vidfile+'"]').each(function(){				run_from_playlist = '1';				$.loadPlayListItem($(this), "noplay", run_from_playlist, '1');			}).parent().addClass('now-playing');				} else {					// if there is an existing video src, clear it now:			$("video").attr({				"src": ""			});				// Function for one player and a playlist			run_from_playlist = '1';				// Get initial video to run in player			if ($('.featured_video a').length > 0) {				$('.featured_video a').parent().addClass('now-playing');				$.loadPlayListItem($(".featured_video a"), "noplay", run_from_playlist, '1');							} else {				$('ul.playlist:first li:first-child').addClass('now-playing');				$.loadPlayListItem($("ul.playlist:first  li:first-child a"), "noplay", run_from_playlist, '1');			}							}				}			});
