// JavaScript Document

// Moved to include from page content
function Clickheretoprint()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("print_content").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title><%= var_title %></title>');
   docprint.document.write('<link href="/styles5.css" rel="stylesheet" type="text/css" />'); 
   docprint.document.write('</head><body onLoad="self.print()"><center>');     
   docprint.document.write(content_vlue);          
   docprint.document.write('</center></body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}



// End page content code

function varitext(text) {
	text=document
	print(text)
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function notice() {
	// Shows the leaving GNCU web site page. If text or graphics change you may need to adjust window size
	window.open("notice.html","","height=400,width=250,scrollbars=no,menubar=no,toolbar=no")
}

function gotoURL(strURL) {
	// Pass in the value of a select menu (i.e. document.Rates.ratesmenu.value) go to the URL
	//document.write(strURL)				// To see the value passed in - for testing
	document.location.href=strURL;			// According to the Forums this does not work in Firefox - seems fine to me...
	// FIREFOX issues
		// ??? Use the document.location.replace() function because it does not use the document.location.href correctly
		// Use the document.Rates.submit() function because the abbrivated version Rates.submit() does not work
	//document.location.replace(strURL);
}

// Select the Rate Options Function
var selectedOptionValue = null;
var selectedOptionText = null;

function changed(what) {
    selectedOptionValue = what.options[what.selectedIndex].value;
    selectedOptionText = what.options[what.selectedIndex].text;
	document.location.href=selectedOptionValue;
}

function Header_Write() {
	var sHTML;
	var sNUM;
	var sMAX;
	// Set the Maximun numbers of picture here... This changes as images are added/deleted, then add/remove IF statements
	sMAX = 6;
	// Random gives me a number between 0 and 1 multiple by MAX number of pictures - gives numbers between 0 and MAX
	// Round gives me the whole numbers 
	sNUM = Math.round(Math.random() * sMAX);
	if (sNUM == 0 || sNUM == sMAX ) {	// Image for 0 or MAX - both show .5 of time, added = 1. Weighted as values below.
	sHTML = "<img src=\"./assets/nav_person/Harold_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	if (sNUM == 1) {
	sHTML = "<img src=\"./assets/nav_person/Michael_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	if (sNUM == 2) {
	sHTML = "<img src=\"./assets/nav_person/Sheryl_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	if (sNUM == 3) {
	sHTML = "<img src=\"./assets/nav_person/Earleen_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	if (sNUM == 4) {
	sHTML = "<img src=\"./assets/nav_person/Silva_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	if (sNUM == 5) {
	sHTML = "<img src=\"./assets/nav_person/Alan_190x103.gif\" width=\"190\" height=\"103\" alt=\"\" border=\"0\">";
	}
	document.write(sHTML);
}

function Select_Pic_Top() {
	var sNUM0;
	var sMAX;
	var sPic0;
	var sPath = "assets/home/";
	// Set the Maximun numbers of picture here... (Example if there are 3 picture the maximun would be 2 since counting starts at 0 zero)
	
	sMAX = 4;
	sPicHREF = new Array("ebranch.html","ATMs.html","HomeEquity.html","ShareDraftChecking.html","Rates-IRA.html");
	sPicImage = new Array("lg-transfer-banner.gif","atm.gif","heloc-lg-banner.gif","90921.checking.WG.Floating.gif","IRAnew.gif");

	// Random gives me a number between 0 and 1 multiple by MAX number of pictures - gives numbers between 0 and MAX
	// Round gives me the whole numbers 
	sNUM0 = Math.round(Math.random() * sMAX);

	sPic0 = "<a href=" + sPicHREF[sNUM0] + "><img src=" + sPath + sPicImage[sNUM0] + " name=\"Img0\" width=\"510\" height=\"224\" border=\"0\"></a>";

	document.getElementById('Pic0').innerHTML = sPic0;
}

function Select_Pic_Bottom() {
	var sNUM1, sNUM2, sNUM3;
	var sMAX;
	var sPic1, sPic2, sPic3;
	var sPath = "assets/home/";
	// Set the Maximun numbers of picture here... (Example if there are 3 picture the maximun would be 2 since counting starts at 0 zero)
	
	//do not drown xMAX to 1....script error!
	
	//THOMAS COMMENT OUT ARRAY//
	//	sMAX = 2;
	//sPicHREF = new //Array("https://gncu.org/Ballot2007.asp","https://gncu.org/Ballot2007.asp","https://gncu.org/Ballot2007.asp");
//	sPicImage = new Array("boardvote.jpg","boardvote.jpg","boardvote.jpg");
	//sPicImageRO = new Array("boardvote-over.jpg","boardvote-over.jpg","boardvote-over.jpg");
	
	
	//sMAX = 2;
	//sPicHREF = new Array("DontBorrow.html","DontBorrow.html","DontBorrow.html");
	//sPicImage = new Array("dontborrow.jpg","dontborrow.jpg","dontborrow.jpg");
	//sPicImageRO = new Array("dontborrow.jpg","dontborrow.jpg","dontborrow.jpg");
	
	
	// Random gives me a number between 0 and 1 multiple by MAX number of pictures - gives numbers between 0 and MAX
	// Round gives me the whole numbers 
	sNUM1 = Math.round(Math.random() * sMAX);
	sNUM2 = Math.round(Math.random() * sMAX);
	sNUM3 = Math.round(Math.random() * sMAX);
	while (sNUM2 == sNUM1) {
		sNUM2 = Math.round(Math.random() * sMAX);
	}
	while (sNUM3 == sNUM1 | sNUM3 == sNUM2) {
		sNUM3 = Math.round(Math.random() * sMAX);
	}
	sPic1 = "<a href=" + sPicHREF[sNUM1] + " onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Img1','','../global/" + sPath + sPicImageRO[sNUM1] + "',1)\"><img src=" + sPath + sPicImage[sNUM1] + " name=\"Img1\" width=\"155\" height=\"105\" border=\"0\"></a>";
//	sPic2 = "<a href=" + sPicHREF[sNUM2] + " onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Img2','','" + sPath + sPicImageRO[sNUM2] + "',1)\"><img src=" + sPath + sPicImage[sNUM2] + " name=\"Img2\" width=\"155\" height=\"105\" border=\"0\"></a>";
//	sPic3 = "<a href=" + sPicHREF[sNUM3] + " onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Img3','','" + sPath + sPicImageRO[sNUM3] + "',1)\"><img src=" + sPath + sPicImage[sNUM3] + " name=\"Img3\" width=\"155\" height=\"105\" border=\"0\"></a>";
//	document.write(sPic1)
	document.getElementById('Pic1').innerHTML = sPic1;
//	document.getElementById('Pic2').innerHTML = sPic2;
//	document.getElementById('Pic3').innerHTML = sPic3;
}

function subDate() {
	var d=new Date()
	var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
//	document.write(weekday[d.getDay()] + " ");
	document.write(monthname[d.getMonth()] + ". ");
	document.write(d.getDate() + ", ");
	document.write(d.getFullYear());
}

function safemail(name, domain, display) {
	displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
	document.write('<a href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');
}

function showimage() {
	if (!document.images)
	return
	document.images.pictures.src=document.branches.picture.options[document.branches.picture.selectedIndex].value
}

function Submit_Enter(myfield,e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	   {
	   myfield.form.submit();
	   return false;
	   }
	else
	   return true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

function ShowPopup(hoveritem)
{
hp = document.getElementById("hoverpopup");

// Set position of hover-over popup
hp.style.top = hoveritem.offsetTop + 875;
hp.style.left = hoveritem.offsetLeft + 202;

// Set popup to visible
hp.style.visibility = "Visible";
}

function HidePopup()
{
hp = document.getElementById("hoverpopup");
hp.style.visibility = "Hidden";
}

function ShowPop(hoveritem)
{
hp = document.getElementById("hoverpop");

// Set position of hover-over popup
hp.style.top = hoveritem.offsetTop + 805;
hp.style.left = hoveritem.offsetLeft + 312;

// Set popup to visible
hp.style.visibility = "Visible";
}

function HidePop()
{
hp = document.getElementById("hoverpop");
hp.style.visibility = "Hidden";
}
// End -->
