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);

