;(function($){
	$(function(){
		// cycle the images in the homepage banner
		$("#homeBanner").after('<div class="controlBox"></div>').cycle({
			fx: 'fade',
			pager: '.controlBox',
			fastOnEvent: 1,
			speed: 1000,
			timeout: 8000,
			
			pagerAnchorBuilder: function(idx, slide) {
				return '<span class="controlBoxItem"><a href="#">'+(idx+1)+'</a></span>';
			}
		});
		
		// fire click event on underlying img when banner mask is clicked
		$("#homeBannerMask").click(function() {
			var event = "";
			$("#homeBanner .imgBox").each(function() {
				if($(this).css('display') == "block")
				{
					event = $(this).children('a').attr('href');
					//$(location).attr('href', event);
					window.location=event;
				}
			});
			
			return false;
		});

		// fire click event on underlying img when feature masks are clicked
		$("#leftFeatureMask").click(function() {
			if ($("#leftFeature a")) {
				if ($("#leftFeature a").attr('target') =='_blank') {
					window.open($("#leftFeature a").attr('href'), '_blank');
				}
				else {
					location.href=$("#leftFeature a").attr('href');
				}
			}
			return false;
		});

		$("#rightFeatureMask").click(function() {
			if ($("#rightFeature a")) {
				if ($("#rightFeature a").attr('target') == '_blank') {
					window.open($("#rightFeature a").attr('href'), '_blank');
				}
				else {
					location.href=$("#rightFeature a").attr('href');
				}
			}
			return false;
		});
	});//$.ready()
})(jQuery);

