/**************************/
/* General-use functions: */
/**************************/


/* Function for caching alt and rollover images upon page load */

function imgCache() {
	var d=document;
	if(d.images) { 
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=imgCache.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}
	}
}


/* Cursor mod for Firefox */

$(document).ready(function () {
	$('a').mouseenter(function () {
		$(this).css('cursor','pointer');
	});
});
$(document).ready(function () {
	$('.hc').mouseenter(function () {
		$(this).css('cursor','pointer');
	});
});


/* Wipeout search box on focus */

$(document).ready(function () {
	var already_focused = 0;
	$('#site_search_terms').focus(function () {
		if (already_focused == 0) {
			$(this).attr('value','');
		}
		already_focused = 1;	
	});
});


/* Highlight fields in inline forms */

$(document).ready(function () {
	$('.inf').focus(function () {
		$(this).addClass('inf-on');
	});
	$('.inf').blur(function () {
		$(this).removeClass('inf-on');
	});
});


/* Hide/reveal action for blog comments */
/*
$(document).ready(function () {

	if ($('#blog_post_comments').length)
	{
		$('#blog_post_comments').hide();
	}
	if ($('.blog_comment_form').length)
	{
		$('.blog_comment_form').hide();
	}
	
	if ($('#blog_comments_show').length)
	{
		$('#blog_comments_show').click(function () {
			$('#blog_post_comments').show();
			$('.blog_comment_form').show();
		});
	}
	
});
*/


/****************************/
/* Site-specific functions: */
/****************************/


/* Cache the hover state images */
$(document).ready(function () {
	imgCache(
		'/fb_site/images/logo-mini-b.png', 
		'/fb_site/images/mn-blog-b.png', 
		'/fb_site/images/mn-events-b.png', 
		'/fb_site/images/mn-customers-b.png', 
		'/fb_site/images/mn-howitworks-b.png', 
		'/fb_site/images/mn-modules-b.png', 
		'/fb_site/images/bg-left-menu-a.png', 
		'/fb_site/images/bg-home-uq-arrow-1.png', 
		'/fb_site/images/bg-home-uq-arrow-2.png', 
		'/fb_site/images/bg-home-uq-arrow-3.png', 
		'/fb_site/images/bg-home-uq-arrow-4.png', 
		'/fb_site/images/bg-home-uq-arrow-5.png'
	);
});

/* Top left logo hover */
$(document).ready(function () {

	$('#top_logo').mouseenter(function () {
		$('#tl_logo').attr('src','/fb_site/images/logo-mini-b.png');
		$('#top_logo_hover').show();
	});
	$('#top_logo').mouseleave(function () {
		$('#tl_logo').attr('src','/fb_site/images/logo-mini-a.png');
		$('#top_logo_hover').hide();
	});

});

/* Wipeout email signup boxes on focus */
$(document).ready(function () {
	$('#h_mailing_list_name').focus(function () {
		$(this).attr('value','');
	});
	$('#h_mailing_list_email').focus(function () {
		$(this).attr('value','');
	});
});

