var message	= "Please be advised that you are leaving TexasBank's website. This link is provided as a courtesy. TexasBank does not endorse or control the content of third party websites.";

var $j=jQuery.noConflict();

$j(document).ready( function() {

	$j("#obLogin form label").overlabel();

	if ($j.browser.msie && !($j.browser.version.substr(0,1) < 7) || !($j.browser.msie)) {
		$j("ul#primaryNav li a").blend();
	}

	$j("#homeFeaturedProducts ul li").css({backgroundPosition: "0 0"});
			
	$j("#homeFeaturedProducts ul li").hover(
		function(){
			$j("img", this).fadeOut("fast");
				$j("h3", this).stop().animate({paddingTop: "4px"}, 250);
				$j(this).stop().animate({backgroundPosition: "0 -114px"}, 250, function() {	
    $j("p", this).fadeIn("fast");
			});
		},
		function(){
			$j("p", this).hide();
			$j("h3", this).stop().animate({paddingTop: "118px"}, 250);
				$j(this).stop().animate({backgroundPosition: "0 0"}, 250, function() {
    $j("img", this).fadeIn("fast");
			});
		}
	);

	$j("#homeFeaturedProducts ul li, #obLoginLink, #featuredProduct, #secondaryProducts ul li").click(function(){
		window.location=$j(this).find("a").attr("href");
	});

	$j("#secondaryProducts ul li").hover(
		function(){
   $j(this).addClass("active");
		},
		function(){
			$j(this).removeClass("active");
		}
	);

});

Cufon.set("selector", jQuery);
Cufon.replace("#homeFeaturedProducts h3, #featuredProduct h1, body#aboutUs h1.aboutUs, #landingPage #content h1, #landingPage #bottomContent", { separate: "none" });

/* Warn */
function warn() {
	return(alert(message));
}

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

	var alertLinks = $$( "a.warn" );
	var confirmLinks = $$( "a.confirm" );

	alertLinks.each(function(element, i) {
		element.addEvent('click', warn);
	});

	confirmLinks.each(function(element, i) {
		element.addEvent('click', function( event ){
   event = new Event(event);
			if( confirm(message) ) {
				return true;
			} else {
				event.stop();
				return false;
			}
		});
	});

});

/* target="_blank" */
window.addEvent('domready', function() {

	if ($$("a[href*=.pdf]")) {
		$$("a[href*=.pdf]").setProperty("target","_blank");	
	}
	
	if ($$("a[href='http://www.ncua.gov/']")) {
		$$("a[href='http://www.ncua.gov/']").setProperty("target","_blank"); 
	}
	
	if ($$("a[href='http://www.fdic.gov/']")) {
		$$("a[href='http://www.fdic.gov/']").setProperty("target","_blank"); 
	}
	
	if ($$("a[href='http://www.hud.gov/']")) {
		$$("a[href='http://www.hud.gov/']").setProperty("target","_blank"); 
	}

	if ($$("a[href='http://portal.hud.gov/portal/page/portal/HUD/']")) {
		$$("a[href='http://portal.hud.gov/portal/page/portal/HUD/']").setProperty("target","_blank"); 
	}

});