function validate(oForm) {
	if (oForm.city.value == '') {
		document.branchDetails.city.value = document.branchDetails.branchDropDown.options[0].value;	
	}	

	return true;	
}


function sendBack() {
	document.branchDetails.submit();
	
}

/*CBG Offshore Start Javascript for onmouseover */

// global variables
var isMozilla;
var objDiv = null;
var originalDivHTML = "";
var DivID = "";
var over = false;
var varVisible = false;


//
// dinamically add a div to 
// dim all the page
//
function buildDimmerDiv()
{
	var windowHeight ="100" //window.screen.height - 159;
	var windowWidth = "100" //window.screen.width;
    document.write('<div id="dimmer" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;font-style: normal;background-color: #ffffff;position: absolute;z-index: 100001;visibility: hidden;border-style: solid;border-color: #999999;border-width: 1px;"></div>');
   
}

function displayFloatingDiv(divId)
{
	var cursorX;
	var cursorY;
	cursorX = event.clientX;
	cursorY = event.clientY;
	
	DivID = divId;	
	var srtHtml;	
	strHtml = '<table id="tblSubMenu" border=0 bgcolor="#ffffff"  onmouseout="hiddenFloatingDiv();" >'
	strHtml = strHtml + '<tr id="trCD">'
	strHtml = strHtml + '<td id="cd" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" class="Nav"><span class="bullet">·</span> '
	strHtml = strHtml + '<a href="page.asp?pSection=OnlineCD" style="color:Black">CD</a></td></tr>'
	strHtml = strHtml + '<tr id="trMM">'
	strHtml = strHtml + '<td id="mm" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" style="font: 7pt Verdana"><span class="bullet">·</span> '
	strHtml = strHtml + '<a href="page.asp?pSection=OnlineMM" style="color:Black">Money Market</a></td></tr>'
	strHtml = strHtml + '</table>'
	document.getElementById('dimmer').style.position = "absolute";
	document.getElementById('dimmer').style.visibility = "visible";
	document.getElementById('dimmer').style.display = "inline";
	document.getElementById('dimmer').innerHTML = strHtml;
	document.getElementById('dimmer').style.left=54;
	document.getElementById('dimmer').style.top=272;
	
	varVisible = true;
	
}

//For Branch Start

function displayFloatingDivBranch(divId)
{
	var cursorX;
	var cursorY;
	cursorX = event.clientX;
	cursorY = event.clientY;
	
	DivID = divId;	
	var srtHtml;	
	strHtml = '<table id="tblSubMenu" border=0 bgcolor="#ffffff"  onmouseout="hiddenFloatingDivBranch();" >'
	strHtml = strHtml + '<tr id="trCD">'
	strHtml = strHtml + '<td id="cd" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" class="Nav"><span class="bullet">·</span> '
	strHtml = strHtml + '<a href="page.asp?pSection=pdCD" style="color:Black">CD</a></td></tr>'
	strHtml = strHtml + '<tr id="trMM">'
	strHtml = strHtml + '<td id="mm" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" style="font: 7pt Verdana"><span class="bullet">·</span> '
	strHtml = strHtml + '<a href="page.asp?pSection=pdMM" style="color:Black">Money Market</a></td></tr>'
	strHtml = strHtml + '<tr id="trCK"><td id="CK" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" class="Nav"><span class="bullet">·</span>'
	strHtml = strHtml + '<a href="page.asp?pSection=pdCk" style="color:Black">Checking</a></td></tr>'
	strHtml = strHtml + '<tr id="trSV"><td id="SV" onmouseover="ChangeColor(this.id,true);" onmouseout="ChangeColor(this.id,false);" class="Nav"><span class="bullet">·</span>'
	strHtml = strHtml + '<a href="page.asp?pSection=pdSv" style="color:Black">Savings</a></td></tr>'
	strHtml = strHtml + '</table>'
	document.getElementById('dimmer').style.position = "absolute";
	document.getElementById('dimmer').style.visibility = "visible";
	document.getElementById('dimmer').style.display = "inline";
	document.getElementById('dimmer').innerHTML = strHtml;
	document.getElementById('dimmer').style.left=59;
	document.getElementById('dimmer').style.top=254;
	
	varVisible = true;
	
}
//End

function ChangeColor(objId,IsOver)
{
	if(IsOver)
	{
		//document.getElementById(objId).style.backgroundColor="#ffffff";
		document.getElementById(objId).style.backgroundColor="#B2D1E6";
		//document.getElementById(objId).style.fontSize="12px";
	}
	else
	{
		//document.getElementById(objId).style.backgroundColor="#E2ECEE";
		document.getElementById(objId).style.backgroundColor="#ffffff";
		//document.getElementById(objId).style.fontSize="11px";
	}
}

function hiddenFloatingDiv() 
{   
   var cursorX;
   var cursorY;
   cursorX = event.clientX;
   cursorY = event.clientY;
	
	if (varVisible)
	{	
		if(cursorX < 57 || cursorX > 140 || cursorY < 267 || cursorY > 305 )
		{	
			document.getElementById('dimmer').style.visibility = "hidden";		
			varVisible = false;
		}
		
	}
}

//For Branch Start
function hiddenFloatingDivBranch() 
{   
   var cursorX;
   var cursorY;
   cursorX = event.clientX;
   cursorY = event.clientY;
	
	if (varVisible)
	{	
		if(cursorX < 60 || cursorX > 140 || cursorY < 248 || cursorY > 322 )
		{	
			document.getElementById('dimmer').style.visibility = "hidden";		
			varVisible = false;
		}
		
	}
}
//End

function hideFloatingDivOnMove() 
{ 
   var cursorX;
   var cursorY;
   cursorX = event.clientX;
   cursorY = event.clientY;
	
	if (varVisible)
	{	
		if(cursorX < 26 || cursorX > 90 || cursorY < 255 || cursorY > 287)
		{	
			document.getElementById('dimmer').style.visibility = "hidden";
			varVisible = false;		
		}

	}
}

//For Branch Start
function hideFloatingDivOnMoveBranch() 
{ 
   var cursorX;
   var cursorY;
   cursorX = event.clientX;
   cursorY = event.clientY;
	
	if (varVisible)
	{	
		if(cursorX < 26 || cursorX > 130 || cursorY < 248 || cursorY > 287)
		{
			document.getElementById('dimmer').style.visibility = "hidden";
			varVisible = false;		
		}

	}
}
//End

function MouseDown(e) 
{
    if (over)
    {
        if (isMozilla) {
            objDiv = document.getElementById(DivID);
            X = e.layerX;
            Y = e.layerY;
            return false;
        }
        else {
            objDiv = document.getElementById(DivID);
            objDiv = objDiv.style;
            X = event.offsetX;
            Y = event.offsetY;           
        }
    }
}

/*function MouseDown(e) 
{
   var cursorX;
   var cursorY;
   cursorX = event.clientX;
   cursorY = event.clientY;

    if (varVisible)
	{	
	
		if(cursorX < 26 || cursorX > 90 || cursorY < 297 || cursorY > 330)
		{	
			document.getElementById('dimmer').style.visibility = "hidden";
			varVisible = false;		
		}

	}
}*/

function MouseMove(e) 
{
	X = event.offsetX;
    Y = event.offsetY;
    
    if (objDiv) {
        if (isMozilla) {
            objDiv.style.top = (e.pageY-Y) + 'px';
            objDiv.style.left = (e.pageX-X) + 'px';
            return false;
        }
        else 
        {
              objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
              objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
              return false;
        }
        	
    }
}

function MouseUp() 
{
    objDiv = null;
}

function init()
{
    // check browser
    isMozilla = (document.all) ? 0 : 1;


    if (isMozilla) 
    {
        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
    }

    document.onmousedown = MouseDown;
    document.onmousemove = MouseMove;
    document.onmouseup = MouseUp;
	DivID = 'dimmer';	
      
	buildDimmerDiv();
	objDiv = document.getElementById('dimmer');
}

// call init
init();

/*CBG Offshore End Javascript for onmouseover */

function displayBranch(iID, sCity){
	//alert(iID + ' ' + sCity);
	document.branchDetails.city.value = sCity;
	document.branchDetails.branch.value = iID;
	document.branchDetails.submit();
			
}


function setFromDrop() {
	document.branchDetails.city.value = document.branchDetails.branchDropDown.value;		
	document.branchDetails.branch.value = "";		
}


var goFlash = false;

Flash = function(version)
{
    this.requiredVersion = version || 6;
};


Flash.hasVersion = function(requiredVersion)
{
    var hasVersion = false;
    if (navigator.plugins.length > 0 && navigator.plugins["Shockwave Flash"]) { // NS/Mozilla
        var description = navigator.plugins["Shockwave Flash"].description;
        var version = description.match(/\d{1,2}/);
        hasVersion = (version >= requiredVersion);
    }
    else if (window.ActiveXObject && window.execScript && navigator.userAgent.indexOf('Mac') == -1) { // Win IE
        Flash.hasActiveX = false;
        window.execScript("On error resume next: Flash.hasActiveX = IsObject(CreateObject('ShockwaveFlash.ShockwaveFlash." + requiredVersion + "'))", "VBScript");
        hasVersion = Flash.hasActiveX;
        delete Flash.hasActiveX;
    }
    return hasVersion;
};


Flash.prototype.getRequiredVersion = function()
{
    return this.requiredVersion;
};

Flash.prototype.setRequiredVersion = function(v)
{
    this.requiredVersion = v;
};


Flash.prototype.checkObject = function()
{
    if(Flash.hasVersion(this.getRequiredVersion())) {
			goFlash = true;
	 } 
};