jQuery(document).ready(function()
{
  // jQuery('#keywordSearch').toggleVal();
});


function loadNewsVideo(news_id, wsdl_url)
{
    $("#player").hide();
    $("#localPlayer").hide();
	$.post(wsdl_url, { action: "newsvideoload", id: news_id }, 
		function on_VideoXMLPosted(data)
	    {
	        var resultXML = data;
	        var output = '';
	        video = resultXML.getElementsByTagName('video');

	        if ((video != undefined) && (typeof(video) == "object"))
	        {
	        	typeVideo = video[0].getAttribute('type');  
		    	id = video[0].getAttribute('id');
		    	title = video[0].getAttribute('title');
		    	output = video[0].getAttribute('videoHTML');
		        thumbnailURL = video[0].getAttribute('thumbnailURL');
		        
		        if(typeVideo == 'upload')
		        {
		        	var videoName = '/uploaded_files/gallery/video/'+output;
		        	$("#localPlayer").show();			        	
					$f("localPlayer", { 
					    src: "/flash/flowplayer-3.1.1.swf", 
					    wmode: 'transparent'
					});
					//alert(videoName);
		        	$f(0).play(videoName);

		        }
		        else if(typeVideo == 'link')
		        {
		        	var videoName = output;
		        	$("#localPlayer").show();
					$f("localPlayer", { 
						width: 400,
						height:270,
					    src: "/flash/flowplayer-3.1.1.swf", 
					    wmode: 'transparent'
					});			        	
					$f("localPlayer", "/flash/flowplayer-3.1.1.swf");	        	
		        	$f(0).play(videoName);
		        }	        
		        else
		        {
		        	$("#player").empty();
		        	$("#player").show();
		        	$("#player").html(output);
		        }
	        }

	        return true;
	    }
	);
}
