
var CityCombo ;
var CountyCombo ;
var txtZipCode ;
Ext.onReady(function()
{
   Ext.QuickTips.init();
  
	CityCombo = new Genesis.ComboBox({
		store: DistinctCityDS,
		displayField:'NAME',
		valueField: 'ID',
		typeAhead: true,
		mode: 'local',
		triggerAction: 'all',
		hideTrigger	:false,
		listWidth:150,
		selectOnFocus:true,
		autocomplete:'off',
		applyTo: 'together_LeftSearchMenu1_txtCity',
		  listeners:{select:{fn:function(combo, value) {

			CountyCombo.setValue('');
			txtZipCode.setValue('');
	}}}

	});

	CountyCombo = new Genesis.ComboBox({
		store: CountyDS,
		displayField:'NAME',
		valueField: 'ID',
		typeAhead: true,
		mode: 'local',
		triggerAction: 'all',
		hideTrigger	:false,
		listWidth:150,
		selectOnFocus:true,
		autocomplete:'off',
		applyTo: 'together_LeftSearchMenu1_txtCounty',
		listeners:{select:{fn:function(combo, value) {

			CityCombo.setValue('');
			txtZipCode.setValue('');
		}},
		blur:{fn:function(){
			//document.getElementById('together_LeftSearchMenu1_imgSearch').focus();
		}}
	}
	});
	//CountyCombo.setEditable(false);
	txtZipCode = new Genesis.NumTextBox({		
		applyTo: 'together_LeftSearchMenu1_txtZipcode',
		listeners:{change:{fn:function(txt, value,newvalue) {

			CountyCombo.setValue('');
			CityCombo.setValue('');
	}}}
	});

	

});
function GoSearch()
{
  	var city=document.getElementById('together_LeftSearchMenu1_txtCity').value;
  	var county=document.getElementById('together_LeftSearchMenu1_txtCounty').value;
  	var zip=document.getElementById('together_LeftSearchMenu1_txtZipcode').value;
	window.location='SearchProviderResult.aspx?city='+city +'&county='+ county +'&zip='+zip;
	
}

//var SelectCounty=function(record, index)
//{
//    if(this.fireEvent('beforeselect', this, record, index) !== false){
//            this.setValue(record.data[this.valueField || this.displayField]);
//            this.collapse();
//            this.fireEvent('select', this, record, index);
//    }
//    clearOthers('CO');
//    return true;
//}

//var SelectCity=function(record, index)
//{
//    if(this.fireEvent('beforeselect', this, record, index) !== false){
//            this.setValue(record.data[this.valueField || this.displayField]);
//            this.collapse();
//            this.fireEvent('select', this, record, index);
//    }
//    clearOthers('CI');
//    return true;
//}

//    


function ValidateHomePage()
{
    var city,county,zip;
    city=trim(document.getElementById('together_LeftSearchMenu1_txtCity').value);
    county=trim(document.getElementById('together_LeftSearchMenu1_txtCounty').value);
    zip=trim(document.getElementById('together_LeftSearchMenu1_txtZipcode').value);
    var dvError=document.getElementById('dvError');
    dvError.innerHTML='';
    if(city=='' && county=='' && zip=='')
    {
        //ShowError('Please provide value of City or County or Zip Code');
        dvError.innerHTML='Please provide the value of City or County or Zip Code';
        document.getElementById('together_LeftSearchMenu1_txtZipcode').focus();
        return false;
    }
    else if(zip.length<5 && zip.length>0 )
    {
		//ShowError('Invalid Zip Code format. Please provide the Zip Code in 5 digit format.');
		dvError.innerHTML='Invalid Zip Code format. Please provide the Zip Code in 5 digit format.';
		document.getElementById('together_LeftSearchMenu1_txtZipcode').focus();
		return false;
    }
    
    return true;
}
function RunVideo()
{
	if(document.getElementById('together_Header1_hdnLanguage').value='es-es')
		openVideo('mp_spn_video1.htm');
	else
		openVideo('mp_eng_video1.htm');

}