
var modListingPos = 0;
var modListingPosMax = -500;
var modListingCount = 5;
var modListingHeight = 80;
var modListingsShow = 10;
var modListingScroll = modListingHeight * modListingsShow;
var modListScrollMethod = 'easy';

function modListingCountProc(fx_count) {
    modListingCount = fx_count;
    modListingPosMax = (modListingCount * modListingHeight * -1) + modListingScroll;
}

function modListingUp() {
    if (modListScrollMethod == 'easy') {
        var animateto = modListingPos - modListingScroll
        if (animateto.valueOf() < modListingPosMax.valueOf() ) {
            animateto = modListingPosMax.valueOf();
        }
        modListingPos = animateto;
        xpsCkSets('modListingPos307643', animateto)
        animateto = animateto.toString() + 'px';
        $('#modListings').animate({ marginTop: animateto }, 500);
        modListControls();
    }        
}

function modListingDown() {
    if (modListScrollMethod == 'easy') {
        var animateto = modListingPos + modListingScroll;
        if (animateto > 0) {
            animateto = 0; 
        }
        modListingPos = animateto;
        xpsCkSets('modListingPos307643', animateto)
        animateto = animateto.toString() + 'px';
        $('#modListings').animate({ marginTop: animateto }, 500);
        modListControls();
    }        
}

function modListingAll() {
    if (document.getElementById('modListingControlAll').innerHTML=='Show All Listings') { 
        document.getElementById('modListingControlAll').innerHTML='Show Easy Scroll';
        $('#modListings').css('margin-top', '0px');
        $('#modListingsOut').removeClass('sc_ezscroll');
        modListScrollMethod = 'all';
    } else {
        document.getElementById('modListingControlAll').innerHTML='Show All Listings';
        $('#modListings').css('margin-top', '0px');
        $('#modListingsOut').addClass('sc_ezscroll');
        modListScrollMethod = 'easy';
    }
    modListingPos=0;
    xpsCkSets('modListingPos307643', 0)
    modListControls();
}

function modListControls() {
    if (document.getElementById('modListingControlAll').innerHTML=='Show All Listings') {
        if (modListingPos==0) {
            $('#modListingControlPrev').fadeTo('slow', .33);    
            $('#modListingControlNext').css('visibility', 'visible');
            $('#modListingControlNext').fadeTo('slow', 1);
        } else if (modListingPos==modListingPosMax) {
            $('#modListingControlNext').fadeTo('slow', .33);
            $('#modListingControlPrev').css('visibility', 'visible');
            $('#modListingControlPrev').fadeTo('slow', 1);
        } else {
            $('#modListingControlPrev').css('visibility', 'visible');
            $('#modListingControlPrev').fadeTo('slow', 1);  
            $('#modListingControlNext').css('visibility', 'visible');     
            $('#modListingControlNext').fadeTo('slow', 1); 
        }
    } else {
        $('#modListingControlPrev').fadeTo('slow', .33);  
        $('#modListingControlNext').fadeTo('slow', .33);   
    }        
}

function loadLocationMap(fx_lat, fx_lon) {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("mapLocationMain"));
map.setCenter(new GLatLng(fx_lat, fx_lon), 14);
var point = new GLatLng(fx_lat, fx_lon);
map.addOverlay(new GMarker(point));
}
}

var baseIcon = new GIcon();
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);

function createMarker(point, index, fx_html) {
// Create a lettered icon for this point using our icon class
var letter = String.fromCharCode("A".charCodeAt(0) + index);
var letteredIcon = new GIcon(baseIcon);
letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

// Set up our GMarkerOptions object
markerOptions = { icon:letteredIcon };
var marker = new GMarker(point, markerOptions);

GEvent.addListener(marker, "click", function() {
//marker.openInfoWindowHtml("Marker <b>" + letter + "</b>");
marker.openInfoWindowHtml(fx_html);
});
return marker;
}


var map = null;
var geocoder = null;

function mapInitialize() {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map_canvas"));
	//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
	geocoder = new GClientGeocoder();
  }
}

function mapShowAddress(address, title) {
  if (geocoder) {
	geocoder.getLatLng(
	  address,
	  function(point) {
		if (!point) {
		  alert(address + " not found");
		} else {
		  map.setCenter(point, 15);
		  var marker = new GMarker(point);
		  map.addControl(new GSmallMapControl());
		  map.addControl(new GMapTypeControl());
		  map.addOverlay(marker);
		  //marker.openInfoWindowHtml(title);
		}
	  }
	);
  }
}

function branchByCity(fx_city) {
    if(fx_city=='any') {
        window.location='/office-locations.htm';
    } else {
        ajaxPostForm('/axiomfinancial/layout/office-locations/ajax_list.cxp?city=' + fx_city, 'modFormInfo','branchListShow');
        document.getElementById('branchListZip').value='';
    }        
}
function branchByZip(fx_zip) {
	if (fx_zip == "")
	{
		window.location='/office-locations.htm';
	}
    ajaxPostForm('/axiomfinancial/layout/office-locations/ajax_list.cxp?zip=' + fx_zip, 'modFormInfo','branchListShow');
    document.getElementById('branchListCity').selectedIndex=0;
}
    




xpsJSPage = 'ran';



