﻿
function initCalc(amt, ir, term) {
    document.aspnetForm.amt.value = amt;
    document.aspnetForm.ir.value = ir;
    document.aspnetForm.term.value = term;
    calcpayment();
}
function initMap(inAddress, canvas) {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(0, 0);
    var myOptions = { zoom: 10, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }
    map = new google.maps.Map(canvas, myOptions);
    codeAddress(inAddress, map);
}
function initSatelliteMap(inAddress, canvas) {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(0, 0);
    var myOptions = { zoom: 18, center: latlng, mapTypeId: google.maps.MapTypeId.SATELLITE }
    satmap = new google.maps.Map(canvas, myOptions);
    codeAddress(inAddress, satmap);
}


function codeAddress(inAddress, map) {

    var address = inAddress; //document.getElementById("address").value;
    if (geocoder) {
        geocoder.geocode({ 'address': address }, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });
            } else {
                alert("Geocode was not successful for the following reason: " + status);
            }
        });
    }
}
function modalWin(url) {

    if (window.showModalDialog) {
        window.showModalDialog(url, "name", "dialogWidth:660px;dialogHeight:650px");
    }
    else {
        window.open(formName, 'name', 'height=650,width=660,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
}

function openDetails(url) {
    window.location.href = url;

}
function highlight(tableRow, active) {
    if (active) {
        tableRow.originalstyle = tableRow.style.backgroundColor;
        tableRow.originalBackgroundImage = tableRow.style.backgroundImage;
        tableRow.style.backgroundColor = '#dae7ef';
        tableRow.style.backgroundImage = 'none';
    }
    else {
        tableRow.style.backgroundColor = tableRow.originalstyle;
    }
}  
