var $j=jQuery.noConflict();
var bankname = "Bluegrass Community Bank"
var alertText = "Please be advised that you are leaving " + bankname + "'s website. This link is provided as a courtesy.  " + bankname + " does not endorse or control the content of third party websites.";

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

	$j("a.confirm").click( function() {						   
		if (!confirmAlert($j(this).attr('href'))){
			return false;			
		}
	});
	
	if( $j().fancybox ){	
	    $j("#flashLink a").addClass("iframe");
		$j("#flashLink a").fancybox({
			'hideOnContentClick': false,
			'frameWidth': 530,
			'frameHeight': 500,
			'overlayOpacity': 0.8,
			'centerOnScroll': false
		});
	}
	
	function adjustSWFHeight() {
	    if(document.body.clientHeight <= 800)
	        document.getElementById("dna").style.height = "680px";
	    else
	        document.getElementById("dna").style.height = "100%";

	    if(document.body.clientWidth <= 1000)
	        document.getElementById("dna").style.width= "1000px";
	    else
	        document.getElementById("dna").style.width= "100%";
	}
	
	adjustSWFHeight();
	
});

//controls speedbumps
function confirmAlert(url){
	jConfirm(alertText, "Confirm", function(r) {
		if( r ){
			window.open(url);
		} else {
			return false;
		}
	});
	return false;
}
function confirmAlert2(url){
	if (!confirmAlert(url)) 
		return false; 
}

//function called from flash to create popup link
//destination:String can only = "contactUs", "share", "application", "faq", "disclosure", "privacyPolicy"
//productType:String can only = "checking", "savings"  -  optional param
function showPopup(destination, url, productType){
	
	//performs the "click"
	if( destination == "application" )
	{	if( productType == "checking" )
		{	var url = $j("#linkRC a").attr("href");
			window.location = url;
		}
		else if( productType == "savings" )
		{	var url = $j("#linkRS a").attr("href");
			window.location = url;
		}
	}
	else
	{	$j("#flashLink a").removeAttr("id").attr("href", url).trigger("click");
	}
}
