// JavaScript Document
	/*function sendUrlToFlash(itemUrl)
	{alert(itemUrl);
		var _baseURL = "rtmp://ntteurope.fcod.llnwd.net/a1225/r1/mp4:";//"f/01/2009/06/891989_UCL_MD06_Barcelona_Shakhtar_091208_clip.m4v"
		getSwf("VideoPlayer").playThis(_baseURL + itemUrl);
	}*/
	

	function getSwf(name)
	{
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window[name];
		} else {
			return document[name];
		}	
	}
	
	function highlightMatch(what) {
		$j(what).addClass('selectedOver');
	}
	
	function delightMatch(what) {
		$j(what).removeClass('selectedOver');
	}
	
	function myhide()
	{
		
		$j('#col2').hide();
		$j('#related').hide();
		//$j('#bb').attr("class","bodyEnlarge");
	}
	
	function myshow()
	{
		$j('#related').show();
		$j('#col2').show();
		//$j('#bb').attr("class","body");
	}
	
	function ReloadMatch(CompetitionID,Season,MDorRound,MatchID,who) 
{	

	$j('.selected').addClass('alreadyselected').removeClass('selected');
	$j(who).addClass('selected');
	
	if (CompetitionID==1 || CompetitionID==9 || CompetitionID==14) {
	
		$j.ajax({
			type:"GET",
			url:'/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Matchday=' + MDorRound + '/Match=' + MatchID + '/_SubHeaderMatchBox.html',
			success:function(html)
			{
				$j('#SubHeader').html(html);
			}	
		});
		
		$j.ajax({
			type:"GET",
			url:'/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Matchday=' + MDorRound + '/Match=' + MatchID + '/_MatchVideoFlash.html',
			success:function(html)
			{
				$j('#MatchContainer').html(html);
			}	
		});
		//var header = new Ajax.Updater('SubHeader','/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Matchday=' + MDorRound + '/Match=' + MatchID + '/_SubHeaderMatchBox.html',{method:'get',evalScripts:true,encoding:'UTF-8'});
		//var box = new Ajax.Updater('MatchContainer','/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Matchday=' + MDorRound + '/Match=' + MatchID + '/_MatchVideoFlash.html',{method:'get',evalScripts:true,encoding:'UTF-8'});
	}
	else{
		$j.ajax({
			type:"GET",
			url:'/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Round=' + MDorRound + '/Match=' + MatchID + '/_SubHeaderMatchBox.html',
			success:function(html)
			{
				$j('#SubHeader').html(html);
			}	
		});
		
		$j.ajax({
			type:"GET",
			url:'/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Round=' + MDorRound + '/Match=' + MatchID + '/_MatchVideoFlash.html',
			success:function(html)
			{
				$j('#MatchContainer').html(html);
			}	
		});
		//var header = new Ajax.Updater('SubHeader','/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Round=' + MDorRound + '/Match=' + MatchID + '/_SubHeaderMatchBox.html',{method:'get',evalScripts:true,encoding:'UTF-8'});
		//var box = new Ajax.Updater('MatchContainer','/Video/Competitions/' + CompetitionName(CompetitionID) + '/Season=' + Season + '/Round=' + MDorRound + '/Match=' + MatchID + '/_MatchVideoFlash.html',{method:'get',evalScripts:true,encoding:'UTF-8'});	
	}
}
	
	function reveal()
	{
		e = document.getElementById('event');
		ac = document.getElementById('AmountCrypt');
		a = document.getElementById('Amount');
		vc = document.getElementById('VideoCrypt');
		
		if(e.className == 'event')
		{
			//e.className ='eventRevealed';
			if(stat == 'player')
			{
				ac.style.display ='none';
				a.style.display = 'inline';
				
				vc.style.display = 'none';
			}
			else
			{
				ac.style.display ='none';
				a.style.display = 'inline';
				
				vc.style.display = 'none';
			}
		}
		
		$j('.videoCrypt').removeClass("videoCrypt");
	}
	
	function openCloseMenu()
	{
		$j('#menuBackground').slideToggle("fast");
	}
	
	
	var comboBox = {
		competition:null,
		season:null,
		matchday:null,
		load:function(competition, season)
		{
			comboBox.competition = competition;
			comboBox.season = season;
			$j.ajax({
				type:"GET",
				url:"/video/Competitions/" + comboBox.competition + "/Season=" + comboBox.season + "/_ajaxListMatchDays.html",
				success:function(html)
				{
					$j('#menuOverflow').append(html);
				}	
			});
		},
		
		change:function(matchday)
		{
			$j.ajax({
				type:"GET",
				url:"/video/Competitions/" + comboBox.competition + "/Season=" + comboBox.season + "/Matchday=" + matchday + "/_ajaxListMatches.html",
				success:function(html)
				{
					$j('#relBottom').html(html);
					slider.init();
					$j('#menuBackground').slideToggle("fast");
				}	
			});
		},
		
		changeRound:function(round)
		{
			$j.ajax({
				type:"GET",
				url:"/video/Competitions/" + comboBox.competition + "/Season=" + comboBox.season + "/Round=" + round + "/_ajaxListMatches.html",
				success:function(html)
				{
					$j('#relBottom').html(html);
					slider.init();
					$j('#menuBackground').slideToggle("fast");
				}	
			});
		}
	
	} 
	
	
	var slider = {
	
		numeroslide: 0,
		maxnumeroslide: 0,
		
		init:function()
		{
			var conta = $j('.conta').length;
			var larghezza = 110 * conta;
			var larghezzaViewport = $j('#nowMatch').width();
			
			var resto = (larghezza - larghezzaViewport);
			
			$j('#bar').width(larghezza);
			
			if(resto > 0)
			{
				slider.numeroslide = resto / 110;
				slider.maxnumeroslide = resto / 110;
			}
			else
			{
				slider.numeroslide = 0;
				slider.maxnumeroslide = 0;
			}
			$j('#nowMatch').animate({marginLeft:"0px"});
			$j('#leftArrow').addClass("end");
			
			if(larghezza != 0 && larghezza > 440)
			{
				$j('#rightArrow').removeClass("end");
			}
			else
			{
				$j('#rightArrow').addClass("end");
			}
			
		},
		
		slideLeft:function()
		{
			if(slider.numeroslide < slider.maxnumeroslide)
			{
				$j('#nowMatch').animate({marginLeft:"+=110px"});
				slider.numeroslide++ ;
			}
			slider.checkArrows();
		},
		
		slideRight:function()
		{
			if(slider.numeroslide > 0)
			{
				$j('#nowMatch').animate({marginLeft:"-=110px"});
				slider.numeroslide-- ;
			}
			slider.checkArrows();
		},
		
		checkArrows:function()
		{
			if(slider.numeroslide > 0)
			{
				$j('#rightArrow').removeClass("end");
			}
			else
			{
				$j('#rightArrow').addClass("end");;
			}
			if(slider.numeroslide < slider.maxnumeroslide)
			{
				$j('#leftArrow').removeClass("end");
			}
			else
			{
				$j('#leftArrow').addClass("end");
			}
				
		}
	
		
	};
	
	
	var Accordion = {
		top:true,
		bottom:false,
		
		collapseExpand:function(who)
		{
			switch(who)
			{
				case 'top':
					if(Accordion.top) {Accordion.collapse(who, 'bottom');Accordion.top = false;}
					else {Accordion.expand(who, 'bottom');Accordion.top = true;Accordion.bottom = false;$j('#btntop').attr('src', '/ml/images/video/uvs/NEW_2008/popupFlash/trueimg/collapse.jpg');}
				break;
				
				case 'bottom':
					if(Accordion.bottom) {Accordion.collapse(who, 'top');Accordion.bottom = false;}
					else {Accordion.expand(who, 'top'); Accordion.bottom = true; Accordion.top = false;$j('#btnbottom').attr('src', '/ml/images/video/uvs/NEW_2008/popupFlash/trueimg/collapse.jpg');}
				break;
			}
			
			
		},
		
		expand:function(who, other)
		{
			$j('#'+who).animate({height:"112px"});
			
			if($j('#'+other).height() != 0) {$j('#'+other).animate({height:"0px"});$j('#btn' + other).attr('src', '/ml/images/video/uvs/NEW_2008/popupFlash/trueimg/expand.jpg');}
		},
		
		collapse:function(who, other)
		{
			if($j('#' + other).height() != 0){
				$j('#'+who).animate({height:"0px"});
			}
		}
		
		
	};
