var banner = 
{
	'#banner a' : function(el)
	{
		el.addClassName('track');
		el.writeAttribute('track','/Banners/HQ/en-HQ/' + el.title);
	},
	'#promotion' : function(el)
	{
		el.onclick = function()
		{
			$('promotion').toggle();
		}
	},
	'.promotion' : function (el){
		el.onclick = function()
		{
			($('promotion').visible()) ? msg.start() : msg.stop();
			$('promotion').toggle();			
			return false;			
		}
	},
	'.banner.next' : function (el){
		el.onclick = function(){
			msg.next();
			return false;
		}
	},
	'.banner.previous' : function (el){
		el.onclick = function(){
			msg.previous();
			return false;
		}
	},
	'.banner.pause' : function (el){
		el.onclick = function(){
			msg.pause();
			return false;
		}
	},
	'.banner.resume' : function (el){
		el.onclick = function(){
			msg.resume();
			return false;
		}
	},
	'#contentbox' : function(el){
		if(readCookie('contentlayer'))
			el.style.display = "none";
	},
	'#contentbox .contentboxheader a' : function(el)
	{
		el.onclick = function()
		{		
		
			$('contentbox').toggle();
			createCookie('contentlayer','true','90','/')
			
			return false;
		}
	},
	'a.contentbox' : function(el){
		el.onclick = function()
		{
		
			$('contentbox').toggle()
			return false;
		}
	}
}

var local =
{
	'.presentation' : function (el)
	{
		el.onclick = function()
		{
			window.open(el.href, '_blank', 'width=500, height=360');
			return false;
		}
	}
}

var events = 
{
	'button#advanced' : function(el)
	{
		if(readCookie("eventAdvanced"))
		{
			$("advancedfields").toggle();
		}
		
		
		el.onclick = function()
		{
			if($("advancedfields").visible())
			{
				eraseCookie("eventAdvanced");
			}
			else
			{
				createCookie("eventAdvanced",true)			
			}

			$("advancedfields").toggle();
		}
	}
	,
	'.eventplace' : function(el)
	{
		el.onclick = function()
		{
			$("eventplace").toggle();
			return false;
		}
	}
	,
	'.organizer' : function(el)
	{
		el.onclick = function()
		{
			$("organizer").toggle();
			return false;
		}
	}	
}

var courses = 
{
	'a#busy' : function(el)
	{
		
		$$('tr.busy').each(function(s){s.toggle();return false;})
		el.onclick = function()
		{
			$$('tr.busy').each(function(s){s.toggle();return false;})
			return false;
		}
	}
	,
	'a.speaker' : function(el)
	{
		el.onclick = function()
		{
			el.next().toggle();
			return false;
		}
	}
	,
	'a#courseLevel' : function(el)
	{
		el.onclick = function()
		{
			$('legend').toggle();
			return false;
		}
	}
	,
	'a#courseregistration' : function(el)
	{
		el.onclick = function()
		{
			$('courseRegForm').toggle();
			return false;
		}
	}
}

Behaviour.register(banner);
Behaviour.register(local);
Behaviour.register(events);
Behaviour.register(courses);