// JavaScript Document
var searchString = document.location.search;
var iFrameUrl ='' ;
var street = '' ;
var city = '' ;
var state = '' ;
var zipcode = '' ;
var addressline= '' ;

// strip off the leading '?'
searchString = searchString.substring(1);

var nvPairs = searchString.split("&");

for (i = 0; i < nvPairs.length; i++)
{
     var nvPair = nvPairs[i].split("=");
     var name = nvPair[0];
     var value = nvPair[1];
	 
	 if (nvPair[0] == "street")
	 {
		street = nvPair[1] ;	 
	 }
	 if (nvPair[0] == "city")
	 {
		city = nvPair[1] ;	 
	 }
	 if (nvPair[0] == "state")
	 {
		state = nvPair[1] ;	 
	 }
	 if (nvPair[0] == "zipcode")
	 {
		zipcode = nvPair[1] ;	 
	 }	 
	 if (nvPair[0] == "ATM")
	 {
		iFrameUrl = iFrameUrl + '&ATMSF=1' ;	 
	 }
	 if (nvPair[0] == "ATMSF")
	 {
		iFrameUrl = iFrameUrl + '&ATMSF=1' ;	 
	 }
	 if (nvPair[0] == "ATMDP")
	 {
		iFrameUrl = iFrameUrl + '&ATMDP=1' ;	 
	 }
	 if (nvPair[0] == "FCSATM")
	 {
		iFrameUrl = iFrameUrl + '&FCSATM=1' ;	 
	 }
	 if (nvPair[0] == "FCS")
	 {
		iFrameUrl = iFrameUrl + '&FCS=1' ;	 
	 }
	 if (nvPair[0] == "ESC")
	 {
		iFrameUrl = iFrameUrl + '&ESC=1' ;	 
	 }
	 if (nvPair[0] == "FSCESC")
	 {
		iFrameUrl = iFrameUrl + '&FSCESC=1' ;	 
	 }
	 if (nvPair[0] == "BRANCH")
	 {
		iFrameUrl = iFrameUrl + '&FCS=1' ;	 
	 }
}
if (street.length > 0)
 {
    addressline = street ;
 }	 
 if (city.length > 0)
 {
    if (addressline.length > 0)
    {
        addressline = addressline + "," + city ;
    }
    else
    {
        addressline = city ;
    }
 }
 if (state.length > 0)
 {
    if (addressline.length > 0)
    {
        addressline = addressline + "," + state ;
    }
    else
    {
        addressline = state ;
    }
 }
 if (zipcode.length > 0)
 {
    if (addressline.length > 0)
    {
        addressline = addressline + "," + zipcode ;
    }
    else
    {
        addressline = zipcode ;
    }
 }
 
if (addressline.length > 0) 
{
	iFrameUrl = 'addTXT=' + addressline.replace(' ','+') + iFrameUrl ;
}

if (iFrameUrl.length > 0)
{
	document.write('<iframe id="atmlocator" src="http://locatorsearch.cuswirl.com/index.aspx?' + iFrameUrl + '" height="585" width="1000" name="atmlocator" frameborder="0" allowtransparency="true" scrolling="no">Your browser doesn\'t support iframes</iframe>');
}
else
{
	document.write('<iframe id="atmlocator" src="http://locatorsearch.cuswirl.com/index.aspx" height="585" width="1000" name="atmlocator" frameborder="0" allowtransparency="true" scrolling="no">Your browser doesn\'t support iframes</iframe>');
}


