/*
This file contains a collection of JavaScript functions that can easily be reused. Many of the functions take advantage of the Core JavaScript Library found in core.js.
*/

/*
ExternalLinks
This script searches the page for hyperlinks with the class "external" and sets them to open in new windows.
-Jason Simanek 2008-07-21
*/

var ExternalLinks =
{
	init: function()
	{
		var extLinks = Core.getElementsByClass("external");

		for (var i = 0; i < extLinks.length; i++)
		{
			extLinks[i].onclick = ExternalLinks.clickHandler;
		}
	},
	clickHandler: function()
	{
		open(this.href);
		return false;
	}
};

Core.start(ExternalLinks);


/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feed Links
This script searches the page for hyperlinks with the class "feed" and sets them to open in new windows.
-Jason Simanek 2008-07-21
*/

var FeedLinks =
{
	init: function()
	{
		var fdLinks = Core.getElementsByClass("feed");

		for (var i = 0; i < fdLinks.length; i++)
		{
			fdLinks[i].onclick = FeedLinks.clickHandler;
		}
	},
	clickHandler: function()
	{
		open(this.href);
		return false;
	}
};

Core.start(FeedLinks);


/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Free Music Detail
This script searches the page for elements with the class "FreeMusicDetail" and sets them to not be displayed.
-Jason Simanek 2008-08-20
*/

var FreeMusicDetails =
{
	init: function()
	{
		var fmDetails = Core.getElementsByClass("FreeMusicDetail");

		for (var i = 0; i < fmDetails.length; i++)
		{
			fmDetails[i].style.display = 'none';
		}
	}
};

Core.start(FreeMusicDetails);


/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Link to Popup Window
All hyperlinks with the rel="popup" attribute will open in a new 500px square window.
*/

var PopupWindow =
{
	init: function() 
	{
		$('A[rel="popup"]').click( function() {
        		window.open( $(this).attr('href'),this,'width=500,height=500' );
			return false;
		});
	}
   
};

Core.start(PopupWindow);

/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Another Function Goes Here
*/