// JavaScript Document



/*
================================
  jQuery
================================
*/

$(document).ready(function() {
	
	$("#accordion").accordion({ fillspace: true });
	$("#accordion").accordion({ active: 0 });
	
	$("#number_slideshow").number_slideshow({
		slideshow_autoplay: 'enable',//enable disable
		slideshow_time_interval: '5000',
		slideshow_window_background_color: "#FFFFFF",
		slideshow_window_padding: '0',
		slideshow_window_width: '592',
		slideshow_window_height: '270',
		slideshow_border_size: '2',
		slideshow_border_color: '#CCCCCC',
		slideshow_show_button: 'enable',//enable disable
		slideshow_show_title: 'disable',//enable disable
		slideshow_button_text_color: '#FFFFFF',
		slideshow_button_background_color: '#00274f',
		slideshow_button_current_background_color: '#003e7e',
		slideshow_button_border_color: '#000',
		slideshow_button_border_size: '0'
	});
	
	$(".archiveTitle").click(function() {
		$(this).parent().children(".archive").slideToggle();
		
	});
	
	
	
	// Dundalk Progress Slideshow
	$("a[rel^='prettyPhoto']").prettyPhoto({
		
		animation_speed: 'normal', /* fast/slow/normal */
		slideshow: 5000, /* false OR interval time in ms */
		autoplay_slideshow: true, /* true/false */
		opacity: 0.80, /* Value between 0 and 1 */
		show_title: true, /* true/false */
		allow_resize: true, /* Resize the photos bigger than viewport. true/false */
		default_width: 800,
		default_height: 600,
		counter_separator_label: ' of ', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
		horizontal_padding: 20, /* The padding on each side of the picture */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		wmode: 'opaque', /* Set the flash wmode attribute */
		autoplay: true, /* Automatically start videos: True/False */
		modal: false, /* If set to true, only the close button will close the window */
		deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
		overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
		keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
		changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
		callback: function(){}, /* Called when prettyPhoto is closed */
		ie6_fallback: true,
		social_tools: ''
		
	});
	
	
	// Job Listings on Career Opportunities page
	$(".jobTitle").click(function() {
		$(this).siblings(".jobDescription").slideToggle();
	});
	
});




/*
================================
  SET FOOTER HEIGHT
================================
*/

window.onload = function() {
	setFooter();
	startList();
}
window.onresize = function() {
	setFooter();
}

function setAction() {
	//Fill in the Routing number below.
	var rtNum = "255070351";
	var x = document.forms.Remote;
	
	x.action = 'https://web2.secureinternetbank.com/pbi_pbi1961/Pbi1961.asp?WCI=RemoteLogin&RT=255070351&LogonBy=connect3&PRMACCESS=Portfolio';
}

function doLoginRefresh() {
	var x = document.forms.Remote;
	
	if (x.AccessIDVisible.value != "") {
		x.AccessID.value = x.AccessIDVisible.value;
		x.AccessIDVisible.value = "";
		
		setAction();
		return true;
	} else {
		alert("Please Enter a valid Access ID.  Thank you!");
		return false;
	}
}
// JavaScript Document

//Get window height
function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight=
			document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}


//Set footer
function setFooterOld() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight= document.getElementById('content').offsetHeight;
			var footerElement= document.getElementById('footer');
			var footerHeight=footerElement.offsetHeight;
			//if (windowHeight-(contentHeight+footerHeight)>=0) {
			footerElement.style.position='relative';
			//footerElement.style.top=(windowHeight-
			//(contentHeight+footerHeight))+'px';
			//footerElement.style.top=( contentHeight+footerHeight)+'px';
			footerElement.style.top=( contentHeight+14)+'px';
			//}
			//else {
			//footerElement.style.position='static';
			//}
		}
	}
}

//Set footer
function setFooter() {
	//if (document.getElementById) {
//		var windowHeight=getWindowHeight();
//		if (windowHeight>0) {
//			var contentHeight = document.getElementById('content').offsetHeight;
//			var footerElement = document.getElementById('footer');
//			var footerHeight = footerElement.offsetHeight;
//			//	if (windowHeight-(contentHeight+footerHeight)>=0) {
//					footerElement.style.position = 'static';
//					//footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
//					footerElement.style.top = (contentHeight) + 'px';
//			//	}
//			//	else {
//					//footerElement.style.position='static';
//			//	}
//		}
//	}
}

function startList() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}



/*
================================
  LEAVE NOTICE
================================
*/

$(function(){
	$('a[rel=external]').leaveNotice({
		siteName: 'Baltimore County Saving Bank',
		exitMessage:"<p>By clicking the Continue link below, you will be leaving the BCSB website. All hyperlinks to outside website are provided solely as a convenience to users of BCSB’s site. BCSB has made a limited effort to determine that these links function properly. However, linked sites are not under the control of BCSB and BCSB is not responsible for the contents of any linked site or any link contained in a linked site. Even if you access an institution’s site by means of the link provided by BCSB, you are responsible for confirming the identity, authenticity and security of any company you visit and transact business with online. The inclusion of a link does not imply or constitute an endorsement by BCSB of that institution, its ownership or management, the products or services it offers or any advertisers or sponsors appearing on that website.</p>",
		timeOut: 15000
	});
});


/*
================================
  SIDE BAR 
================================
*/
function openDir( form ) { 
	var newIndex = form.fieldname.selectedIndex; 
	if ( newIndex == 0 ) { 
		alert( "Please select a location!" ); 
	} else { 
		cururl = form.fieldname.options[ newIndex ].value; 
		window.location.assign( cururl ); 
	} 
} 
