﻿// Controls JavaScript

/*
#########################################################################################
## Global Section - All variables and/or constants                                     ##
#########################################################################################
*/

//Global Constants

//Global Variables

// Global Functions

/*
#############################
## LocateADealerLarge.ascx ##
#############################
*/

// enableLocateDealerGoButton
// checks to determine when to enable the go button on the locate a dealer control
// 
// @author	kgrove - 04/14/06
// @edit	-
// @param	p_sClientId - Prefix for the client id
// @return	none
function enableLocateDealerGoButton(p_sClientId) {    
    var oMake = document.getElementById(p_sClientId + "ddlMake");
    var oZipCode = document.getElementById(p_sClientId + "txtZip");
    var oDistance = document.getElementById(p_sClientId + "ddlDistance");
    var oButton  = document.getElementById(p_sClientId + "btnGo");
    
    if (parseInt(oMake.value) > 0 && oZipCode.value.length >= 5 && parseInt(oDistance.value) > 0) {
        oButton.disabled = false;
        oButton.src = m_sImageRoot + "gobutton_large.gif";
        oButton.style.cursor = "pointer";
    }
    else {
        oButton.disabled = true;
        oButton.src = m_sImageRoot + "gobutton_large_off.gif";
        oButton.style.cursor = "default";
    }
}

// enableUsedSearchGoButton
// checks to determine when to enable the go button on the Used Search Control
// 
// @author	Jroberts - 04/14/06 (taken from kgrove's code)
// @edit	-
// @param	p_sClientId - Prefix for the client id
// @return	none
function enableUsedSearchGoButton(p_sClientId) {    
    var oMake = document.getElementById(p_sClientId + "ddlMake");
    var oModel = document.getElementById(p_sClientId + "ddlMake");
    var oZipCode = document.getElementById(p_sClientId + "txtZip");
    var oButton  = document.getElementById(p_sClientId + "btnGo");
    
    if (parseInt(oMake.value) > 0 && oZipCode.value.length >= 5 && parseInt(oModel.value) > 0) {
        oButton.disabled = false;
        oButton.src = m_sImageRoot + "gobutton_large.gif";
        oButton.style.cursor = "pointer";
    }
    else {
        oButton.disabled = true;
        oButton.src = m_sImageRoot + "gobutton_large_off.gif";
        oButton.style.cursor = "default";
    }
}

/*
##########################
## DealerDirectory.ascx ##
##########################
*/

// enableDealerDirectoryGoButton
// determines when to enable the go button on the dealers directory control
// 
// @author	kgrove - 04/14/06
// @edit	-
// @param	p_sClientId - Prefix for the client id
// @return	none
function enableDealerDirectoryGoButton(p_sClientId) {
    var oMake = document.getElementById(p_sClientId + "dropMakes");
    var oZipCode = document.getElementById(p_sClientId + "txtZip");
    var oDistance = document.getElementById(p_sClientId + "dropDistance");
    var oButton = document.getElementById(p_sClientId + "ibtnGo");
    var oCategory = document.getElementById(p_sClientId + "ddlCategory");

    if (parseInt(oCategory.value) > 0 && parseInt(oMake.value) > 0 && oZipCode.value.length >= 5 && parseInt(oDistance.value) > 0) {
        oButton.disabled = false;
        oButton.src = m_sImageRoot + "gobutton_large.gif";
        oButton.style.cursor = "pointer";
    }
    else {
        oButton.disabled = true;
        oButton.src = m_sImageRoot + "gobutton_large_off.gif";
        oButton.style.cursor = "default";
    }
}
   
   
   

