//To control the "current page" styles for the nav
var Highlight = 
{
	curpage: '',
	
	init: function()
	{	
		if ($('outercontainer')) {
			$('outercontainer').addClassName(Highlight.curpage);
		}	
	}
}
Event.observe(window, 'load', Highlight.init);

//Functions to control external links
var ExternalLinks = 
{
	init: function() 
	{
		var extLinks = $$('a.external');
		
		for (i=0; i<extLinks.length; i++)
		{
			Event.observe(extLinks[i], 'click', ExternalLinks.openNew.bindAsEventListener(extLinks[i]));	
		}
	},
	
	openNew: function(event) 
	{
		open(this.href);
		Event.stop(event);
	}
}
Event.observe(window, 'load', ExternalLinks.init);

//Functions to square up the columns
var EvenColumns = 
{
	init: function() 
	{
		var lheight = $('content').getHeight() - 70;
		var rheight = $('secondarycontent').getHeight();
		
		if (rheight > lheight)
		{
			var newheight = rheight + 50;
			$('content').setStyle({height: newheight+'px'}) 	
		}
	}

} 
Event.observe(window, 'load', EvenColumns.init);

//Functions to make sure the logo prints
var PrintLogo =
{
	init: function()
	{
		var logoimg = new Element('img', { 'class': 'logo', 'src': '/blog/wp-content/themes/cardinal/images/logo.gif' });
		var parentdiv = $('header');
		parentdiv.appendChild(logoimg);
	}
}
Event.observe(window, 'load', PrintLogo.init);

//Controls the sidebar jump menu
var JumpMenu = 
{
	init: function()
	{
		if ($('archives_jump')) {
			var arc = $('archives_jump');
			arc.observe('change', JumpMenu.getArchivePage.bindAsEventListener(arc));	
		}
	},
	
	getArchivePage: function(event)
	{
		document.location.href = this.options[this.selectedIndex].value;
	}
	
}
Event.observe(window, 'load', JumpMenu.init);