if (!window.ic08_video)
	window.ic08_video = {};

ic08_video.Page = function() 
{
}

ic08_video.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		this.button_play = this.control.content.FindName ("button_play");
		this.button_play.cursor="Hand";
		
		this.button_play_mouseEnter = this.control.content.FindName ("button_play_mouseEnter");
		this.button_play_mouseLeave = this.control.content.FindName ("button_play_mouseLeave");
		this.button_play_mouseDown = this.control.content.FindName ("button_play_mouseDown");
		
		this.button_play.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.button_MouseEnter));
		this.button_play.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.button_MouseLeave));
		this.button_play.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.button_MouseDown));
		this.button_play.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.button_MouseUp));
		
		this.button_pause = this.control.content.FindName ("button_pause");
		this.button_pause.cursor="Hand";
		this.button_pause_mouseEnter = this.control.content.FindName ("button_pause_mouseEnter");
		this.button_pause_mouseLeave = this.control.content.FindName ("button_pause_mouseLeave");
		this.button_pause_mouseDown = this.control.content.FindName ("button_pause_mouseDown");
		this.button_pause.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.button_MouseEnter));
		this.button_pause.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.button_MouseLeave));
		this.button_pause.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.button_MouseDown));
		this.button_pause.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.button_MouseUp));
		
		this.button_stop = this.control.content.FindName ("button_stop");
		this.button_stop.cursor="Hand";
		this.button_stop_mouseEnter = this.control.content.FindName ("button_stop_mouseEnter");
		this.button_stop_mouseLeave = this.control.content.FindName ("button_stop_mouseLeave");
		this.button_stop_mouseDown = this.control.content.FindName ("button_stop_mouseDown");
		this.button_stop.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.button_MouseEnter));
		this.button_stop.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.button_MouseLeave));
		this.button_stop.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.button_MouseDown));
		this.button_stop.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.button_MouseUp));
		
		this.button_close = this.control.content.FindName ("button_close");
		this.button_close.cursor="Hand";
		this.button_close_mouseDown = this.control.content.FindName ("button_close_mouseDown");
		this.button_close.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.button_MouseDown));
	},
	


	button_MouseEnter: function(sender, eventArgs)
	{
		if (sender.Name.toString() == "button_play")
		{
			this.button_play_mouseEnter.begin();
		}
		if (sender.Name.toString() == "button_pause")
		{
			this.button_pause_mouseEnter.begin();
		}
		if (sender.Name.toString() == "button_stop")
		{
			this.button_stop_mouseEnter.begin();
		}
	},
	button_MouseLeave: function(sender, eventArgs)
	{
		if (sender.Name.toString() == "button_play")
		{
			this.button_play_mouseLeave.begin();
		}
		if (sender.Name.toString() == "button_pause")
		{
			this.button_pause_mouseLeave.begin();
		}
		if (sender.Name.toString() == "button_stop")
		{
			this.button_stop_mouseLeave.begin();
		}
	},
	
	button_MouseDown: function(sender, eventArgs)
	{
		if (sender.Name.toString() == "button_play")
		{
			this.button_play_mouseDown.begin();
			sender.findName("video_src").play();

		}
		if (sender.Name.toString() == "button_pause")
		{
			this.button_pause_mouseDown.begin();
			sender.findName("video_src").pause();
		}
		if (sender.Name.toString() == "button_stop")
		{
			this.button_stop_mouseDown.begin();
			sender.findName("video_src").stop();
		}
		if (sender.Name.toString() == "button_close")
		{
			this.button_close_mouseDown.begin();
			setTimeout("runSilverLight()",250);
		}
	},
	button_MouseUp: function(sender, eventArgs)
	{
		if (sender.Name.toString() == "button_play")
		{
			this.button_play_mouseLeave.begin();
		}
		if (sender.Name.toString() == "button_pause")
		{
			this.button_pause_mouseLeave.begin();
		}
		if (sender.Name.toString() == "button_stop")
		{
			this.button_stop_mouseLeave.begin();
		}
	}

}



function runSilverLight()
{
	var itemToSwap = document.getElementById("slDiv");
	var itemToSwap2 = document.getElementById("bgDiv");
	var itemToSwap3 = document.getElementById("sldownload");
	var itemToSwap4 = document.getElementById("trackingPict");
	if(itemToSwap.style.display=="none")
		{
			itemToSwap.style.display="inline";
			itemToSwap2.style.display="inline";
			itemToSwap3.style.display="inline";
			itemToSwap4.src="http://go.microsoft.com/?linkid=7493665";
		}
	    else
		{
			itemToSwap.style.display="none";
			itemToSwap2.style.display="none";
			itemToSwap3.style.display="none";
			document.body.style.overflow="auto";
		}
}


function runDownloadSL()
{
	theURL = "http://go.microsoft.com/fwlink/?LinkID=86008";
	window.open(theURL, 'popup', '');
	runSilverLight();	
}

function CloseAllButOne(varID,tbName)
{
      	
	for(i=1;i<=4;i++)
	{
	   var controlName = tbName+i;
	   itemToSwap = document.all[controlName];
	   //alert(controlName);
	   if(i == varID) 
	    {
	          itemToSwap.style.display="inline";
	    }
	    else 
	    {
		 itemToSwap.style.display="none";
		}
	}     

}

function viewDetails(_varID)
{
      var controlName = _varID
      var itemToSwap = document.all[controlName];
	//alert(itemToSwap.style.display)  ;
	   if(itemToSwap.style.display == "inline") 
	    {
	          itemToSwap.style.display="none";
	    }
	    else 
	    {
		 itemToSwap.style.display="inline";
		}

}

function changeTabPict(varOn, varOff1, varOff2, varOff3)
{
	itemToSwap1 = document.all[varOn];
	itemToSwap2 = document.all[varOff1];
	itemToSwap3 = document.all[varOff2];
	itemToSwap4 = document.all[varOff3];
	
	//alert(varOn.src)
	
	itemToSwap1.src = '/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/' + itemToSwap1.name + '_on.gif';
	itemToSwap2.src = '/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/' + itemToSwap2.name + '_off.gif';
	itemToSwap3.src = '/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/' + itemToSwap3.name + '_off.gif';
	itemToSwap4.src = '/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/' + itemToSwap4.name + '_off.gif';
	
	

}

function findPos() {
	window.location="#top";
	document.body.style.overflow="hidden";
	
}

function changeBgImage2()
{
	newImage = "url(/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/topbanner6_sdc.gif)";
	//document.getElementById('tabbg').style.backgroundImage = newImage;

}

function changeBgImage1()
{
	newImage = "url(/brasil/educacao/comunidadeacademica/shared/img/imaginecup/2008/topbanner6.gif)";
	//document.getElementById('tabbg').style.backgroundImage = newImage;

}
