// JScript File
ddaccordion.init(
{
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
}
)


function togglefinddealer(show)
{
    ds = document.getElementById('dealers2');
    if (show==1)
    {
        ds.style.display = "block";
    }
    else
    {
        ds.style.display = "none";
    }
}

/*
function dealerFieldChanged(ctl)
{
	switch(ctl.id){
	case ctlZip.id:
		if(ctl.value!='Enter Zip Code'){
		ddlProvince.selectedIndex = 0;
		ddlCountry.selectedIndex = 0;
		}
		break;
	case ddlProvince.id:
		ctlZip.value="Enter Zip Code";
		ddlCountry.selectedIndex = 0;
		break;
	case ddlCountry.id:
		ctlZip.value="Enter Zip Code";
		ddlProvince.selectedIndex = 0;
		break;
	}
	
	ctl.form.action = ((ctl.form.action.indexOf("?")!=-1)?ctl.form.action.substr(0,ctl.form.action.indexOf("?")):ctl.form.action);
}
*/

function dealerFieldChanged(ctlid)
{
    var ctl = document.getElementById('ctl00_cphHeader_' + ctlid);
    var ddlProduct = document.getElementById('ctl00_cphHeader_ddlProduct');
    var ddlProvince = document.getElementById('ctl00_cphHeader_ddlProvince');
    var ddlCountry = document.getElementById('ctl00_cphHeader_ddlCountry');
    var txtZip = document.getElementById('ctl00_cphHeader_txtZip');
    var btnSearch = document.getElementById('ctl00_cphHeader_btnSearch');
    var pnlSearch = document.getElementById('ctl00_cphHeader_pnlSearch');
	
	switch(ctl.id)
	{
	    case "ctl00_cphHeader_txtZip":
		    if(txtZip.value!='Enter Zip Code')
		    {
		        ddlProvince.selectedIndex = 0;
		        ddlCountry.selectedIndex = 0;
		    }
		    break;
	    case "ctl00_cphHeader_ddlProvince":
		    txtZip.value="Enter Zip Code";
		    ddlCountry.selectedIndex = 0;
		    break;
	    case "ctl00_cphHeader_ddlCountry":
		    txtZip.value="Enter Zip Code";
		    ddlProvince.selectedIndex = 0;
		    break;
	}
	
	
    if(ddlProduct.selectedIndex > 0 && (ddlProvince.selectedIndex > 0 || 
        ddlCountry.selectedIndex > 0 || txtZip.value !='Enter Zip Code'))
    {
        btnSearch.disabled = '';
        pnlSearch.style.display = 'none';
    }
    else
    {
        btnSearch.disabled = 'disabled';    
        pnlSearch.style.display = 'block';
    }
    
	ctl.form.action = ((ctl.form.action.indexOf("?")!=-1)?ctl.form.action.substr(0,ctl.form.action.indexOf("?")):ctl.form.action);

}
