$(document).ready(function() {
	enableIEMenu();
	setupPromoBoxes();
	setupPromoBoxes2();	setupPromoBoxes3();
	enableNewsBox2Scroller();
});

enableIEMenu = function() {
	$('#main_menu').bind("mouseover", function() {		
		this.className = "hover";
	});
	
	$('#main_menu').bind("mouseout", function() {
		this.className = "";	
	});
}



/* Code for lower promo boxes on index.asp */
var SIGNUP_URL = "http://www.myclients.ca/customers/springbanklinks/springbanklinks_signup.htm"

setupPromoBoxes = function() {
	$('div.promo_box').hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	});

	$('div.promo_box').click( function() { window.open(SIGNUP_URL); } );
}
/* End */


/* Code for lower right promo boxes on index.asp */
var SIGNUP_URL2 = "../PDF/Springbank.2008 gps.pdf"

setupPromoBoxes2 = function() {
	$('div.GPS').hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	});

	$('div.GPS').click( function() { window.open(SIGNUP_URL2); } );	
}
/* End */


/* Code for top right second scrolling boxes*/
var green_url = "../greenthinking.asp"

setupPromoBoxes3 = function() {
	$('div#hl_fish').hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	});

	$('div#hl_fish').click( function() { window.open(green_url); } );	
}
/* End */



/* Code for 2 promotion boxes at the top of the template */ 
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;
var headlines = new Array();

enableNewsBox2Scroller = function() {
	headline_count = $("div.headline").size();	
	
	for (var i = 0; i < headline_count; i++) {
		headlines[i] = $("div.headline:eq(" + i + ")");
		headlines[i].hide();
	}
		
	headlines[current_headline].show();
	
	headline_interval = setTimeout(headline_rotate,2250);
}

function headline_rotate() {
	current_headline = (old_headline + 1) % headline_count;
	
	headlines[old_headline].fadeOut("slow", function(){
		headlines[current_headline].fadeIn("slow");
	});
	
	old_headline = current_headline;
	
	setTimeout(headline_rotate, 2250);
	
	/*
	headlines[old_headline].animate({top: -100},"slow", function() {
		$(this).css("top", "66px");
	});
		
	headlines[current_headline].show().animate({top: 0},"slow");
	
	
	*/
}
/* End */
