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"}],'c': [{"STATE" : "CAIN CROSSING", "ABBR" : "Charleston" , "URL" : "Cain_Crossing"},{"STATE" : "CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Carolina_Bay"},{"STATE" : "CHARLES TOWNE PLACE", "ABBR" : "Seabrook Island" , "URL" : "Charles_Towne_Place"},{"STATE" : "CYPRESS AT CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Cypress_at_Carolina_Bay"}],'d': [{"STATE" : "DUNECREST VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Dunecrest_Villas"}],'e': [{"STATE" : "EGRET'S POINTE", "ABBR" : "James Island" , "URL" : "Egret_s_Pointe"},{"STATE" : "ESSEX AT CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Essex_at_Carolina_Bay"}],'g': [{"STATE" : "GOLF SHORE VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Golf_Shore_Villas"}],'h': [{"STATE" : "HARBOR OAKS", "ABBR" : "James Island" , "URL" : "Harbor_Oaks"},{"STATE" : "HOMES OF HIDDEN OAKS", "ABBR" : "Seabrook Island" , "URL" : "Homes_of_Hidden_Oaks"}],'i': [{"STATE" : "ISLAND BLUFF", "ABBR" : "James Island" , "URL" : "Island_Bluff"}],'l': [{"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" : "PROVIDENCE COMMON", "ABBR" : "Charleston" , "URL" : "Providence_Common"}],'r': [{"STATE" : "RICE FIELD AT CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Rice_Field_at_Carolina_Bay"}],'s': [{"STATE" : "SALT GRASS AT CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Salt_Grass_at_Carolina_Bay"},{"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" : "SHELTER COVE VILLAS", "ABBR" : "Seabrook Island" , "URL" : "Shelter_Cove_Villas"},{"STATE" : "SPINNAKER BEACHHOUSES", "ABBR" : "Seabrook Island" , "URL" : "Spinnaker_Beachhouses"},{"STATE" : "SULLIVAN TOWNHOMES AT ESSEX", "ABBR" : "Charleston" , "URL" : "Sullivan_Townhomes_at_Essex"},{"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" : "THE BEND AT RIVER ROAD", "ABBR" : "Johns Island" , "URL" : "The_Bend_at_River_Road"},{"STATE" : "TIDEWATER AT CAROLINA BAY", "ABBR" : "Charleston" , "URL" : "Tidewater_at_Carolina_Bay"},{"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" : "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("