var currentHeaderImage = 8;

window.addEvent('domready', function(){

  var list = $$('a');
		list.each(function(element)
		{
			element.addEvent('click', function()
				{
					if ( this.href.match('fbbnew') || this.href.match('floridabusinessbank.com') || this.href.match('netteller.com') )
					{
						//window.location=this.href
					}
					else
					{
						var content = '<p><span style="font-size: 18px; font-weight: bold; color: #990000;">Important Notice:</span></p><p><strong>You Are Leaving Florida Business Bank.</strong> By clicking Continue, you will be taken to a website that is not affiliated with Florida Business Bank and may offer a different privacy policy and level of security. Florida Business Bank is not responsible for and does not endorse, guarantee or monitor content, availability, viewpoints, products or services that are offered or expressed on other websites.</p><p>You can click "Cancel" to stay on this page or click "Continue" to continue on to the requested page.</p><p align="center"><strong><div class="noticeButton"><a href="javascript:void(0);" class="closeSticky">Cancel</a></div><div  class="noticeButton"><a href="'+this.href+'">Continue</a></div></strong></p>';
						new StickyWin.Modal({
							content: content,
							relativeTo: this,
							relativeTo: $('window'),
							position: 'center',
							modalOptions: { modalStyle:{'background-color':'#000000','opacity':.8} }
							});
					
						return false;
					}
				});
		});
		
		// Home ----------------------------------------------------------------------------------------------------------------
		$('button-home').addEvent('mouseenter', function()
				{
					this.setStyle("background-color", "#598600");
				});
		$('button-home').addEvent('mouseleave', function()
				{
					this.setStyle("background-color", "");
				});

		// Online Banking ----------------------------------------------------------------------------------------------------------------
		$('button-online_banking').addEvent('mouseenter', function()
				{
					this.setStyle("background-color", "#598600");
				});
		$('button-online_banking').addEvent('mouseleave', function()
				{
					this.setStyle("background-color", "");
				});
		
		// Contact Us ----------------------------------------------------------------------------------------------------------------
		$('button-contact_us').addEvent('mouseenter', function()
				{
					this.setStyle("background-color", "#598600");
				});
		$('button-contact_us').addEvent('mouseleave', function()
				{
					this.setStyle("background-color", "");
				});

	if (pageId == 'home')
		{
			headerImageLoop = setInterval( "headerImageChanger(currentHeaderImage)", 4000 );
		}

});


//////////////-------------- FUNCTIONS ----------------//////////////
function headerImageChanger(imageId)
	{
		var slide = new Fx.Morph('headerImage', {duration: 'long', transition: Fx.Transitions.Quad.easeOut});

		switch(imageId)
		{
			case 1:
				slide.start({left:-560});
				currentHeaderImage = 2;
				break;   
			case 2:
				slide.start({left:-1120});
				currentHeaderImage = 3;
				break;
			case 3:
				slide.start({left:-1680});
				currentHeaderImage = 4;
				break;
			case 4:
				slide.start({left:-2240});
				currentHeaderImage = 5;
				break;
			case 5:
				slide.start({left:-2800});
				currentHeaderImage = 6;
				break;
			case 6:
				slide.start({left:-3360});
				currentHeaderImage = 7;
				break;
			case 7:
				slide.start({left:-3920});
				currentHeaderImage = 8;
				break;
			case 8: // same as 1
				$('headerImage').setStyle('left',0);
				slide.start({left:-560});
				currentHeaderImage = 2;
				break;
		}
	};