/* 
Berkshire Bank styles
author: Marcel Moreau for Bridgeline Software: http://bridgelinesw.com

Contents
- SUCKERFISH DROPDOWNS
- INPUT CLEAR
- ABOUT US HOVERS
- COMPARISON TABLES


/*  SUCKERFISH DROPDOWNS
------------------------------------*/
// -- utility nav
sfHover = function() {
	var sfEls = document.getElementById("dd").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*  INPUT CLEAR
------------------------------------*/
function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = "";
} 
function resetText(thefield){
	if (thefield.value=="")
	thefield.value = thefield.defaultValue;
}

/*  MAIN NAV BACKGROUND IMAGE AND LAST IMAGE PIPE
------------------------------------*/
$(document).ready(function() {
	var nav = $('#navMain');
	var listitem = $('#navMain > li');
	var tab = $('#navMain li a');
	var selected = $('#navMain li.selected');
	var count = listitem.index($('#navMain li.selected'));

	$(listitem).hover(
		function(){
			$(this).addClass('hover');
			$(listitem).removeClass('selected');
		}
		,
		function(){
			$(this).removeClass('hover');
			if (selected.length == 1) {
				$(listitem[count]).addClass('selected');
				$('#navMain').addClass('subnav');
			}
		 }
	);
	
	// show subnav's background image on hover of anywhere in area
	$(nav).hover(
		function(){
			$(nav).addClass('subnav');
		}
		,
		function(){
		     if (selected.length == 0) {
			     $(nav).removeClass('subnav');
				
		     }
		 }
	);	 
	if (selected.length == 1){
		$(nav).addClass('subnav');
	}	
	
	$('#navMain li li:last-child').addClass('none');
});


/*  ABOUT US HOVERS
------------------------------------*/
$(document).ready(function() {
	var person = $('#hovers div');
	
	$(person).hover( 
		function(){$(this).children('p').fadeIn(100)}
		,
		function(){$(this).children('p').fadeOut(100)}
	);
});

/*  COMPARISON TABLES
------------------------------------*/
$(document).ready(function() {
	$(".comparison td:nth-child(even), .comparison th:nth-child(even)").addClass("zebra");
	$(".comparison tr td:first-child").addClass("label");
});

/*  LAST FOOTER PIPE
------------------------------------*/
$(document).ready(function() {
	$(".navFooter li:last").css({"background" : "none"});
});
