
jQuery(function($) { 
	
	$('.ptv_box p a').each(function(i) {
		var bau = $(this).find('strong').text()
		$(this).addClass(bau);
	});
	
	$('.ptv_box .Acasa').attr('href','/acasa/').removeAttr("target");
	$('.ptv_box .Animal').attr('href','/animal-planet/').removeAttr("target");
	$('.ptv_box .Antena1').attr('href','/antena-1/').removeAttr("target");
	$('.ptv_box .AXN').attr('href','/axn/').removeAttr("target");
	$('.ptv_box .B1').attr('href','/b1tv/').removeAttr("target");
	$('.ptv_box .Discovery').attr('href','/discovery-channel/').removeAttr("target");
	$('.ptv_box .Eurosport').attr('href','/eurosport/').removeAttr("target");
	$('.ptv_box .HBO').attr('href','/hbo/').removeAttr("target");
	$('.ptv_box .Kanal').attr('href','/kanal-d/').removeAttr("target");
	$('.ptv_box .N24').attr('href','/n24/').removeAttr("target");
	$('.ptv_box .National').attr('href','/national-geographic/').removeAttr("target");
	$('.ptv_box .OTV').attr('href','/otv/').removeAttr("target");
	$('.ptv_box .Prima').attr('href','/primatv/').removeAttr("target");
	$('.ptv_box .PRO').attr('href','/protv/').removeAttr("target");
	$('.ptv_box .Realitatea').attr('href','/realitatea-tv/').removeAttr("target");
	$('.ptv_box .Sport.ro').attr('href','/sport-ro/').removeAttr("target");
	$('.ptv_box .TVR').attr('href','/tvr1/').removeAttr("target");
	
	
});

function OnPlay(channelUrl, channelName)
{
	if (detectPlugin()) 
	{
		if(document.getElementById('SopPlayer').GetState(1) == 0) //
		{
			alert("Player hasn't been initialized!");
			return;
		}
		document.getElementById('SopPlayer').SetChannelName(channelName);	
		document.getElementById('SopPlayer').SetSopAddress(channelUrl);
		document.getElementById('SopPlayer').Play();
	}
	else
	{
		alert("Please install Sopcast! Click the link above (Sopcast 3.0.3) or go to sopcast.org . If you have already installed Sopcast then you are either using Firefox or you need to click the golden bar at the top and select -Run ActiveX Control- For more info please check our forum http://12tv.youneed.us");
	}
}

var noinstallerr=0;
function detectPlugin()
{
    var pVersion;
    try
    {
        pVersion = document.getElementById('SopPlayer').GetVersion();  
	return true;
    }
    catch (e)
    {
	if (noinstallerr==0) {}
	noinstallerr=1;
        return false;
    }
}

