jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		temp = new Image();
		temp.src = arguments[i];
	}
}

$(function(){
	
	$('a.active').removeClass('over');
	$('a.active').removeAttr('href');
	$('a.active img').each (
		function() {
			this.src = this.src.replace('.jpg', '_over.jpg');
			this.src = this.src.replace('.png', '_over.png');
		}
	);
	
	$('a.over img').hover(
		function() {
			this.src = this.src.replace('.jpg', '_over.jpg');
			this.src = this.src.replace('.png', '_over.png');
			
			if ($(this).hasClass('fix'))
				$(this).css('top','1px');
		},
		function() {
			this.src = this.src.replace('_over.jpg', '.jpg');
			this.src = this.src.replace('_over.png', '.png');
			
			if ($(this).hasClass('fix'))
				$(this).css('top','0px');
		}
	);
	
	
	$('a.over img').each(
		function(){
			$.preloadImages(
				(this.src.match('.jpg'))
					? this.src.replace('.jpg', '_over.jpg')
					: this.src.replace('.png', '_over.png'));
		}
	)
	
	$(window).load(
	    function() {
	    	$(document).pngFix();
	    }
	);
});

var submitSearch = function()
{
	var root = $('#HdnRoot').val();
	var search_terms = $('#TxtSearch').val();
	
	//redirect search
	document.location = root + 'search/index/' + search_terms;
}

var checkEnter = function(e)
{
	if (e && e.which) {
		e = e;
		characterCode = e.which;
	}
	else {
		e = event;
		characterCode = e.keyCode;
	}
	
	if(characterCode == 13)
	{
		submitSearch();
	}
}
var MP3_params = {
	menu: "false",
	scale: "noScale",
	allowFullscreen: "true",
	allowScriptAccess: "always",
	bgcolor: "#FFFFFF",
	wmode: "transparent"
};
var MP3_attributes = {
	id:"MP3PlayerButton"
};