function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}

function popitup(url) {
	newwindow=window.open(url,'name','height=300,width=450');
	if (window.focus) {newwindow.focus()}
	return false;
}


	// Online banking login
	function doLoginRefresh()
	{
		   var x = document.forms.Remote;
		   
		   if (x.AccessIDVisible.value != "" && x.AccessIDVisible.value != "Enter Access ID") {
				   x.AccessID.value = x.AccessIDVisible.value;
				   x.AccessIDVisible.value = "";
				   x.nmUID.value = x.AccessID.value;

				   //setAction();
				   return true;
		   } else {
				   alert("Please Enter a valid Access ID.  Thank you!"); 
				   return false;
		   }       
	}
           
window.addEvent('domready', function(){	


	// Online Banking Login
	
	if ($chk($('obContainer'))) {								 
		// Online Banking Buttons
				
		$('ecom').setStyle('margin-top', 0);
		$('ecorp').setStyle('margin-top', 5);
					
		function loginToClick() {
			var loginToSelected = Cookie.read('ob-selected');
			document.id('ecom').removeClass('active');
			document.id('ecorp').removeClass('active');
			if (loginToSelected == "ecom") {
				//alert('Got ecom');
				document.id('ecom').morph({
					'margin-top': 0
			    });
			    document.id('oblinks').morph({
					'display': 'block'
			    });
				document.id('ecorp').morph({
					'margin-top': 5
			    });
			    document.id('obSelect').morph({
					//'display': 'none',
					'margin-top': '-25px'
			    });
			    document.id('obSelectxy').morph({
					'height': 20
			    });
			    document.id('accessfieldxy').morph({
					'margin-top': 0
			    });
			    document.Remote.action = 'https://web17.secureinternetbank.com/PBI_PBI1961/PBI1961.ashx?WCI=remotelogin&rt=121142669&logonby=connect3&prmaccess=account ';
			    document.id('ecom').addClass('active');
			} else if (loginToSelected == "ecorp") {
				//alert('Got ecorp');
				document.id('ecorp').morph({
					'margin-top': 0
			    });
			    document.id('oblinks').morph({
					'display': 'none'
			    });

				document.id('ecom').morph({
					'margin-top': 5
			    });
			    document.id('obSelect').morph({
					'margin-top': 13
			    });
			    document.id('obSelectxy').morph({
					'height': 40
			    });
			    document.id('accessfieldxy').morph({
					'margin-top': 22
			    });
				document.Remote.action = 'https://www.fiservla10.com/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T&RT=121142669&MFA=2';
				document.id('ecorp').addClass('active');
			}
			}
		loginToClick();
		
		document.id('ecom').addEvents({
			click: function(){
				var obCookie = Cookie.write('ob-selected', 'ecom', {duration: 365});
				loginToClick();
			}
		});
		document.id('ecorp').addEvents({
			click: function(){
				var obCookie = Cookie.write('ob-selected', 'ecorp', {duration: 365});
				loginToClick();
			}
		});
	}
									 
								 
	//Random background images
	randNum = $random(1, 3);
	var randbg = 'randbg' + randNum;
	$(document.body).addClass(randbg);
	
	//**Nav panel animation
		//IE initialize
	    $$('div.navpanel table').each(function(el){
			el.setStyle('margin-top','-200px');
		});
	
		$$('div.navpanel table').set('morph', {
			duration: 350
		});
		
		$$('ul.nav li').addEvents({
		
			mouseenter: function(){
				this.getElements('div.navpanel table').morph({
					'margin-top': 0
				});
			},
			
			mouseleave: function(){
				this.getElements('div.navpanel table').morph({
					'margin-top': '-200px'
				});
			}
		});
	
	//**Nav list animation 
	
		//IE initialize
		$$('.panel_content ul li').each(function(el){
			el.setStyles({
				'background-position': '0px 6px',
				'padding-left': 12
			});
		});
		
		//Animation
		$$('.panel_content ul li').set('morph', {
		duration: 200
		});
		
		$$('.panel_content ul li').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'padding-left': 17,
			'background-position': '5px 6px'
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'padding-left': 12,
			'background-position': '0px 6px'
		  });
		}
		
		});
			
	// Table Alternating colors
	//$$('table.styledtable2 tr:odd').addClass('odd');
	//$$('table.styledtable2 tr:even').addClass('even');	
						 
	// Table Alternating colors
	function updateTableColors() {
		var count = 0;
		$$('table.styledtable tr').each(function(el) {
			el.addClass(count++ % 2 == 0 ? 'odd' : 'even');
		});
	};
	updateTableColors();
	
	//**Search "Login" button illumination
	
		//IE initialize
	   $$('.searchBtn').each(function(el){
			el.setStyle('opacity','0.1');
		});
		$$('.searchBtn').set('morph', {
			duration: 450
		});
		
		$$('.searchBtn').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'opacity': 1
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'opacity': 0.1
		  });
		}
		
		});
	
	//**Online Banking "Login" button illumination
	
		//IE initialize
	   $$('.btn_go').each(function(el){
			el.setStyle('opacity','0.1');
		});
		$$('.btn_go').set('morph', {
			duration: 250
		});
		
		$$('.btn_go').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'opacity': 1
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'opacity': 0.1
		  });
		}
		
		});
		

	
	//**Features animation
	$$('div.featureContent').each(function(el){
			el.setStyle('background-position','62px 10px');
		});
	$$('div.feature').each(function(el){
		el.set('morph', {duration: '250'});
		el.addEvents({
			'mouseover': function(){
				//this.morph({'margin-top': 8});	
				this.getElements('div.featureContent').each(function(d){
					d.morph({'background-position': '62px -30px'});	
				});
			},
			'mouseout': function(){
				//this.morph({'margin-top': 14});
				this.getElements('div.featureContent').each(function(d){
					d.morph({'background-position': '62px 10px'});	
				});
			}
		});
	
	});
	
	//**Features "more" animation
	
		//IE initialize
	    $$('.more').each(function(el){
			el.setStyle('background-position','95px 5px');
		});
	
		$$('.more').set('morph', {
			duration: 250
		});
		
		$$('.more').addEvents({
		
			mouseenter: function(){
				this.morph({
					'background-position': '95px -20px'
				});
				this.getElements('a.morelink').morph({
					'padding-top': 3
				});
			},
			
			mouseleave: function(){
				this.morph({
					'background-position': '95px 5px'
				});
				this.getElements('a.morelink').morph({
					'padding-top': 20
				});
			}
		});
		
		//**Quicklinks animation
		$$('#quicklinks ul li a').set('morph', {
			duration: 250
		});
		
		$$('#quicklinks ul li a').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'padding-left': 5
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'padding-left': 0
		  });
		}
		
		});	
		
		//**News animation
		$$('#news ul li a').set('morph', {
			duration: 250
		});
		
		$$('#news ul li a').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'padding-left': 4,
			'padding-right': 0
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'padding-left': 0,
			'padding-right': 4
		  });
		}
		
		});	
		
		//**Subnav animation
	
		//IE Initialize
		$$('.subnav li').each(function(el){
			el.setStyles({
				'background-position': '0px 24px',
				'padding-left': '0px'
			});
		});
		
		//animation 1
		$$('.subnav li').set('morph', {
		duration: 350
		});
		
		$$('.subnav li').addEvents({
		
		mouseenter: function(){
		  this.morph({
			'background-position': '0px 0px',
			'padding-left': '5px'
		  });
		},
		
		mouseleave: function(){
		  this.morph({
			'background-position': '0px 24px',
			'padding-left': '0px'
		  });
		}
		
		});
		
		//**Subpage Promo animation
	
		//IE initialize - disabled***
	    //$$('.subpromo').each(function(el){
		//	el.setStyle('margin-top','10px');
		//});
	
		//$$('.subpromo').set('morph', {
		//	duration: 350
		//});
		
		//$$('.subpromo').addEvents({
		
		//	mouseenter: function(){
		//		this.morph({
		//			'margin-top': 5
		//		});
		//	},
			
		//	mouseleave: function(){
		//		this.morph({
		//			'margin-top': 10
		//		});
		//	}
		//});
		
		//**h2 animation
	
		//IE Initialize - disabled***
		//$$('.content h2').each(function(el){
		//	el.setStyles({
		//		'padding-left': '0px'
		//	});
		//});
		
		//animation 1
		//$$('.content h2').set('morph', {
		//duration: 200
		//});
		
		//$$('.content h2').addEvents({
		
		//mouseenter: function(){
		//  this.morph({
		//	'padding-left': '20px'
		//  });
		//},
		
		//mouseleave: function(){
		//  this.morph({
		//	'padding-left': '0px'
		//  });
		//}
		
		//});
		
}); 

