
var anOption=d.createElement('option');anOption.value='';function RefineSelection(firstSelectId,secondSelectId){this.firstSelect=d.getElementById(firstSelectId);this.firstSelect.selectedIndex=0;this.secondSelect=d.getElementById(secondSelectId);dojo.connect(this.firstSelect,'onchange',this,this.getOptions);}
RefineSelection.prototype.getOptions=function(){var params=[];params['s']=this.firstSelect.value;this.currentRequest=dojo.xhrGet({url:"/visitor/familyPetGuide/breedGroupList.do",mimetype:"text/json",content:params,handleAs:"json",load:dojo.hitch(this,this.createAndAddOptions),error:dojo.hitch(this,this.showError)})}
RefineSelection.prototype.createAndAddOptions=function(response,ioArgs){this.optionsArray=[];var newOption=anOption.cloneNode(false);newOption.innerHTML='-- Any --';this.optionsArray.push(newOption);for(var i=0;i<response.length;i++){var newOption=anOption.cloneNode(false);newOption.value=response[i]['value'];newOption.innerHTML=response[i]['label'];this.optionsArray.push(newOption);}
this.secondSelect.innerHTML='';for(var i=0;i<this.optionsArray.length;i++){this.secondSelect.appendChild(this.optionsArray[i]);}}
RefineSelection.prototype.showError=function(response,ioArgs){alert('connection'+response+'please try again');}
var rs=new RefineSelection('topSel','subSel');