/* window.onresize=resize;
function resize(){
self.location.href=self.location.href;
} */

if(window.event + "" == "undefined") event = null;
// FOR HM_MENU BELOW
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;
//FOR HM_MENU ABOVE
//FOR COOLMENU BELOW
function showMenu(){return false};
function mout(){return false};
function dummyObject() {this.mout=mout};
oM = new dummyObject();
// FOR COOLMENU ABOVE

var uri = document.location.href;
var newUri = false;

if (window.secure) {
	/* make sure we're at https: */
	if(/^http\:/.test(uri)){	
		uri = uri.replace(/^http/,'https');	
		newUri = true;
	}
} else {
	/* make sure we're NOT at https: */
	if(/^https\:/.test(uri)){	
		uri = uri.replace(/^https/,'http');
		newUri = true;
	}
}
	
/* make sure the 'www' is there */
/*if(!/^(http\:|https\:)\/\/www\./.test(uri)){
	uri = uri.replace(/^https:\/\//,'https://www.');
	newUri = true;
}*/
/*var domain = { name:"yampavalleybank", tld:"com" };
var domExp = new RegExp(domain.name+"\."+domain.tld);
if(!domExp.test(uri)){
    uri = uri.replace(/^(http\:|https\:)\/\/(www\.)?(\w*\.)+(org|com|net)/,'$1://$2'+domain.name+'.'+domain.tld);
    newUri = true;
}*/
//if (newUri) alert(uri);
if (newUri) document.location.replace(uri);



// CALL TO CORRECT DIRECTORY BELOW - if you are on homepage you need <script> var homepage = "yes";</script> to make codework properly
var imgdir = "../images/";
var sitedir = "";
var securedir = "";
var homedir = "../";
if(window.homepage)
{
imgdir="images/";
sitedir="site/";
securedir="site/";
homedir="";
}
else if(window.absolutepage)
{
imgdir="http://www.yampavalleybank.com/images/"
sitedir="http://www.yampavalleybank.com/site/"
securedir="http://www.yampavalleybank.com/site/"
homedir="http://www.yampavalleybank.com/"
}
else if(window.securepage)
{
imgdir="https://www.yampavalleybank.com/images/"
sitedir="http://www.yampavalleybank.com/site/"
securedir="https://www.yampavalleybank.com/site/"
homedir="http://www.yampavalleybank.com/"
}
// CALL TO CORRECT DIRECTORY ABOVE


// ROLLOVER CODE BELOW
function makeNavImage(name,width,height){
this.name_on="nav-" + name +"-on.gif";
this.name_off="nav-" + name +"-off.gif";
this.width=width;
this.height=height;
this.newimage_on = new Image(width,height);
this.newimage_on.src = imgdir + this.name_on;
this.newimage_off = new Image(width,height);
this.newimage_off.src = imgdir + this.name_off;
}

var navitems = new Array();
navitems["about"] = new makeNavImage("about",104,19);
navitems["contact"] = new makeNavImage("contact",112,19);
navitems["help"] = new makeNavImage("help",70,19);
navitems["home"] = new makeNavImage("home",76,19);
navitems["logincash"] = new makeNavImage("logincash",207,22);
navitems["loginlogin"] = new makeNavImage("loginlogin",51,18);
navitems["loginback"] = new makeNavImage("loginback",207,26);
navitems["mortgage"] = new makeNavImage("mortgage",104,19);
navitems["prods"] = new makeNavImage("prods",167,19);




function img_act(imgName){
document[imgName].src = navitems[imgName].newimage_on.src;
}

function img_inact(imgName){
oM.mout();
window.status = "";
document[imgName].src = navitems[imgName].newimage_off.src;
}
// ROLLOVER CODE ABOVE

// OTHER FUNCTIONS BELOW
function openWin(url,name,width,height,options){
var n = name;
var w = width;
var h = height;
var o = options;
n = (n==null)?"_blank":n;
w = (isNaN(w) || w==null)?700:w;
h = (isNaN(h) || h==null)?600:h;
o = (o==null)?"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1":(o.indexOf(",")!=0)?","+o:o;

var posX = Math.ceil((parseInt(screen.width) - w) / 2);
var posY = Math.ceil((parseInt(screen.height) - h) / 2);
aWindow = window.open(url,n,"width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY + o);
}

function open_apps(nameofapp){
	self.location.href = "https://www.yampavalleybank.com/Forms/OnlineForm.cgi?form=" + nameofapp+"&onweb=true";
}

function openIB(type){
	if(type == "demo"){
		self.location.href = "https://www.yampavalleybank.com/home.html?demo=true";
	}
	else if(type == "reg"){
		self.location.href = "https://www.yampavalleybank.com/onlineserv/HB/dimlDisplayer.cgi?DIML_FILE=STDWelcome.diml";
	}
	else{
		self.location.href = "https://www.yampavalleybank.com/home.html";
	}	
}
function openCM(){
	self.location.href = "https://www.yampavalleybank.com/onlineserv/CM";
}
function showWarning(url){
	//content creation
	var content = new Array();
        var index = 0;
	content[index++] = '<h1>Third Party Site Disclaimer</h1><br>By accessing the noted link you will be leaving Yampa Valley Bank\'s website and entering a website hosted by another party. Yampa Valley Bank has not approved this as a reliable partner site.  Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of Yampa Valley Bank\'s website. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different than those of Yampa Valley Bank\'s.';
	content[index++] = '<br><br><br>';
	content[index++] = '<div align="center"><a href="'+url+'">Continue</a>&nbsp;&nbsp;<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.visibility = \'hidden\'">Decline</a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.visibility = "visible";
    scrollTo(0,0);
}
document.write('<div id="ex_dis" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #000000; text-align: center; position:absolute; border: 2px solid #6C1136; padding: 15px; visibility: hidden; z-index: 300; width:350px;  top:200px; left:350px; FILTER: progid:DXImageTransform.Microsoft.dropShadow( Color=AC302C,offX=7,offY=8,positive=true); "></div>');

function showMessage(url){
	//content creation
	var content = new Array();
        var index = 0;
	content[index++] = '<h1>Coming Soon!!!</h1><br>The content for the information is still being developed.  Check back often to check on our progess.';
	content[index++] = '<br><br><br>';
	content[index++] = '<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.visibility = \'hidden\'">Close</a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.visibility = "visible";
    scrollTo(0,0);
}
document.write('<div id="ex_dis" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #000000; text-align: center; position:absolute; border: 2px solid #6C1136; padding: 15px; visibility: hidden; z-index: 300; width:350px;  top:200px; left:350px; FILTER: progid:DXImageTransform.Microsoft.dropShadow( Color=AC302C,offX=7,offY=8,positive=true); "></div>');

