var on = false; function dropdown(){ on = true; if(document.getElementById("dropdown").style.display == "none"); { var myAnim = new YAHOO.util.Anim('statesautocomplete', { height: { to: 300 } }, 1, YAHOO.util.Easing.easeOut); myAnim.animate(); document.getElementById("dropdown").style.display = "inline"; } } function startRollUp(){ on = false; setTimeout("rollUp()",500); } function rollUp(){ if(on == false) { var myAnim = new YAHOO.util.Anim('statesautocomplete', { height: { to: 0 }}, 1, YAHOO.util.Easing.easeIn); myAnim.animate(); setTimeout("hideDrop()",1000); } } function hideDrop(){ if(on == false) { document.getElementById("dropdown").style.display = "none"; } } var dataset = { 'a': [{"STATE" : "ANCHORAGE PLANTATION", "ABBR" : "Wadmalaw Island" , "URL" : "Anchorage_Plantation"},{"STATE" : "ASHLEYTOWNE REC & DEV", "ABBR" : "Charleston" , "URL" : "Ashleytowne_Rec_&_Dev"},{"STATE" : "ATRIUM VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Atrium_Villas"}],'b': [{"STATE" : "BRIAR'S CREEK POA", "ABBR" : "Johns Island" , "URL" : "Briar_s_Creek_POA"}],'c': [{"STATE" : "CHARLES TOWNE PLACE", "ABBR" : "Seabrook Island" , "URL" : "Charles_Towne_Place"}],'d': [{"STATE" : "DUNECREST VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Dunecrest_Villas"}],'f': [{"STATE" : "FOLLY OAKS OFFICES", "ABBR" : "Charleston" , "URL" : "Folly_Oaks_Offices"}],'g': [{"STATE" : "GOLF SHORE VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Golf_Shore_Villas"}],'h': [{"STATE" : "HARBOR OAKS", "ABBR" : "James Island" , "URL" : "Harbor_Oaks"},{"STATE" : "HIGHLANDS OF LEGEND OAKS", "ABBR" : "Summerville" , "URL" : "Highlands_of_Legend_Oaks"},{"STATE" : "HOMES OF HIDDEN OAKS", "ABBR" : "Seabrook Island" , "URL" : "Homes_of_Hidden_Oaks"}],'i': [{"STATE" : "ISLAND BLUFF", "ABBR" : "James Island" , "URL" : "Island_Bluff"},{"STATE" : "ISLAND CENTER EXECUTIVE", "ABBR" : "Johns Island" , "URL" : "Island_Center_Executive"}],'l': [{"STATE" : "LEGEND OAKS - THE CLUB", "ABBR" : "Summerville" , "URL" : "Legend_Oaks_-_The_Club"},{"STATE" : "LEGEND OAKS PLANTATION", "ABBR" : "Summerville" , "URL" : "Legend_Oaks_Plantation"}],'m': [{"STATE" : "MARSH POINTE HOMES", "ABBR" : "Seabrook Island" , "URL" : "Marsh_Pointe_Homes"},{"STATE" : "MARSH WINDS", "ABBR" : "Folly Beach" , "URL" : "Marsh_Winds"},{"STATE" : "MEPKIN PLACE", "ABBR" : "Charleston" , "URL" : "Mepkin_Place"}],'n': [{"STATE" : "NORTH BEACH HOMES", "ABBR" : "Seabrook Island" , "URL" : "North_Beach_Homes"}],'o': [{"STATE" : "OCEAN WINDS VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Ocean_Winds_Villas"}],'p': [{"STATE" : "PELICAN COVE", "ABBR" : "Charleston" , "URL" : "Pelican_Cove"},{"STATE" : "PEMBERTON", "ABBR" : "James Island" , "URL" : "Pemberton"},{"STATE" : "PLANTERS TRACE", "ABBR" : "Charleston" , "URL" : "Planters_Trace"},{"STATE" : "PROVIDENCE COMMON", "ABBR" : "Charleston" , "URL" : "Providence_Common"}],'s': [{"STATE" : "SEASIDE ESTATES", "ABBR" : "James Island" , "URL" : "Seaside_Estates"},{"STATE" : "SEASIDE PLANTATION", "ABBR" : "James Island" , "URL" : "Seaside_Plantation"},{"STATE" : "SHADOWMOSS PLANTATION", "ABBR" : "Charleston" , "URL" : "Shadowmoss_Plantation"},{"STATE" : "SHADOWWOOD VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Shadowwood_Villas"},{"STATE" : "SUMMER WIND COTTAGES", "ABBR" : "Seabrook Island" , "URL" : "Summer_Wind_Cottages"},{"STATE" : "SUMMERTREES", "ABBR" : "Johns Island" , "URL" : "Summertrees"},{"STATE" : "SUNBURST LAKES", "ABBR" : "Summerville" , "URL" : "Sunburst_Lakes"}],'t': [{"STATE" : "TREELOFT VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Treeloft_Villas"}],'v': [{"STATE" : "VILLAGE ON CENTRAL", "ABBR" : "Summerville" , "URL" : "Village_on_Central"},{"STATE" : "VILLAGES IN ST. JOHNS WOODS", "ABBR" : "Johns Island" , "URL" : "Villages_in_St__Johns_Woods"}],'w': [{"STATE" : "WEDGEWOOD VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Wedgewood_Villas"},{"STATE" : "WESCOTT PLANTATION", "ABBR" : "Summerville" , "URL" : "Wescott_Plantation"},{"STATE" : "WINNSBORO LAKES", "ABBR" : "Johns Island" , "URL" : "Winnsboro_Lakes"}] }; function getStates(sQuery) { aResults = []; if(sQuery && sQuery.length > 0) { var charKey = sQuery.substring(0,1).toLowerCase(); var oResponse = dataset[charKey]; if(oResponse) { for(var i = oResponse.length-1; i >= 0; i--) { var sKey = oResponse[i].STATE; var sKeyIndex = encodeURI(sKey.toLowerCase()).indexOf(sQuery.toLowerCase()); // Query found at the beginning of the key string for STARTSWITH // returns an array of arrays where STATE is index=0, ABBR is index=1 if(sKeyIndex === 0) { aResults.unshift([sKey, oResponse[i].URL]); } } return aResults; } } // Empty queries return all states else { for(var letter in dataset) { var oResponse = dataset[letter]; for(var i = 0; i <= oResponse.length-1; i++) { aResults.push([oResponse[i].STATE, oResponse[i].URL]); } } return aResults; } } YAHOO.example.ACJSFunction = new function(){ // Instantiate JS Function DataSource this.oACDS = new YAHOO.widget.DS_JSFunction(getStates); this.oACDS.maxCacheEntries = 0; // Instantiate AutoComplete this.oAutoComp = new YAHOO.widget.AutoComplete('statesinput','statescontainer', this.oACDS); this.oAutoComp.alwaysShowContainer = true; this.oAutoComp.minQueryLength = 0; this.oAutoComp.maxResultsDisplayed = 50; this.oAutoComp.formatResult = function(oResultItem, sQuery) { var sMarkup = "" + oResultItem[0] + ""; return (sMarkup); }; this.oAutoComp.setBody("
"); // Show custom message if no results found this.myOnDataReturn = function(sType, aArgs) { var oAutoComp = aArgs[0]; var sQuery = aArgs[1]; var aResults = aArgs[2]; if(aResults.length == 0) { oAutoComp.setBody("