$(document).ready(function() {
	$("#mainmenu ul li ul").css("z-index","5000");
	$("#mainmenu ul li").hoverIntent(
	  function () {
	    $(this).addClass("over");
	    if($.browser.msie)
		$(this).find('ul').show();
		else
	    $(this).find('ul').slideDown("fast");
	  },
	  function () {
	    $(this).removeClass("over");
	    if($.browser.msie)
		$(this).find('ul').hide();
		else
	    $(this).find('ul').slideUp("fast");
	  }
	);
	
	
	$(".logos").hover(
	  function () {
	  	$(".logos").before('<img class="largelogos" src="http://www.altanafcu.org/template/images/logos_large.gif"/>');
	  	$(".largelogos").css({"border":"5px solid white","position":"absolute","margin-top":"-15em"});
	  },
	  function () {
	  	$(".largelogos").remove();
	  }
	);
	
});


$(document).ready(function() {
	if( $("#query").length ) {
	$("#query").val('SEARCH').css({"color":"silver"});
	$("#query").focus(function () {
	if( $(this).val()=='SEARCH' )
		$(this).val('').css({"color":"#333333"});
	});
	$("#query").blur(function () {
		if( $(this).val()=="" )
		$(this).val('SEARCH').css({"color":"silver"});
	});
	}
});


function clear(){
	document.signon.userid.value = "";
	document.signon.imageword.value = "";
}

var emailmsg = "You may contact Altana Federal Credit Union via email for general, non-urgent communications \
with us. As regular email is not secure, we caution against using email for transmitting any sensitive \
personal information. As your identity cannot be confirmed, we cannot act on any instructions received \
via regular email.";


function link_alert(NewPage)
{
	input_box=confirm("The web site you have selected is an external site not operated by Altana Federal Credit Union. This link is provided for convenience and informational purposes only. Altana Federal Credit Union has no responsibility for the content of this web site and does not attest to the accuracy or propriety of any information located there.");
	if (input_box==true)
	{ 
		// Output when OK is clicked
  		window.open(NewPage);
	}
}
	
function email_alert(NewPage)
{
	input_box=confirm( emailmsg );
	if (input_box==true)
	{ 
		// Output when OK is clicked
  		location.href=NewPage;
	}
}	


function popUp(url) {
	window.open(url,"popWin",'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=610,height=600');
}
	
/// PRINT FUNCTION

function printit() {

	input_box=confirm("Are you ready to print your application?");
	if (input_box==true)
	{ 
		window.print();
		window.close();
	} else {
		window.close();
	}
}




//////////////////////////////////////////////////////////////////////// EMAIL VALIDATION

function emailcheck(email) {
	var at="@"
	var dot="."
	var lat=email.indexOf(at)
	var lstr=email.length
	var ldot=email.indexOf(dot)
	if (email.indexOf(at)==-1){
	   alert("Invalid Email Address")
	   return false;
	}
	if (email.indexOf(at)==-1 || email.indexOf(at)==0 || email.indexOf(at)==lstr){
	   alert("Invalid Email Address")
	   return false;
	}
	if (email.indexOf(dot)==-1 || email.indexOf(dot)==0 || email.indexOf(dot)==lstr){
	    alert("Invalid Email Address")
	    return false;
	}
	if (email.indexOf(at,(lat+1))!=-1){
	   alert("Invalid Email Address")
	   return false;
	}
	if (email.substring(lat-1,lat)==dot || email.substring(lat+1,lat+2)==dot){
	   alert("Invalid Email Address")
	   return false;
	}
	if (email.indexOf(dot,(lat+2))==-1){
	   alert("Invalid Email Address")
	   return false;
	}
	if ((email.indexOf(" ")!=-1) || (email.indexOf("!")!=-1) || (email.indexOf("#")!=-1) || (email.indexOf(",")!=-1) || (email.indexOf("$")!=-1) || (email.indexOf("%")!=-1) || (email.indexOf("\"")!=-1)){
	   alert("Invalid Email Address")
	   return false;
	}
	return true;
}
