		
			function getMakeOptions() 
			{
				// Add a script element with the src set to the Google Base query for vehicle
				// makes. The JSON output is specified by including the alt=json-in-script
				// argument. The callback function is also specified as a URI argument.
				// This is equivalent to adding a script tag that looks like this:
				// <script type="text/javascript" src="http://www.google/com/base/feed/attributes/.." /> 

				var attributesElement = document.createElement("script");
				attributesElement.setAttribute("id", "attributes");
				attributesElement.setAttribute("src", 
				  "http://www.google.com/base/feeds/attributes/-/vehicles?max-values=30" + 
				  "&alt=json-in-script&callback=showMakeOptions");
				attributesElement.setAttribute("type", "text/javascript");
				document.documentElement.firstChild.appendChild(attributesElement);
			}
			function getModels()
			{
				// Add a script element with the src set to the Google Base query for vehicle  
				// models.  The JSON output is specified by including the alt=json-in-script 
				// argument. The callback function is also specified as a URI argument.
				// This is equivalent to adding a script tag that looks like this:
				// <script type="text/javascript" src="http://www.google/com/base/feed/attributes/.." /> 
				//alert('i am in getmodels');
				makeOptions = document.getElementById("make_options");
				make = makeOptions.options[makeOptions.selectedIndex].text;

				var attributesElement = document.createElement("script");
				attributesElement.setAttribute("id", "attributes");
				attributesElement.setAttribute("src", 
				  ['http://www.google.com/base/feeds/attributes/-/vehicles?max-values=40',
				   '&bq=[make:', make, ']&alt=json-in-script&callback=showModelOptions'].join(''));
				attributesElement.setAttribute("type", "text/javascript");

				document.documentElement.firstChild.appendChild(attributesElement);
			}
			function showMakeOptions(json) 
			{
			  // transform the JSON results into a drop down menu
			  var select = document.getElementById("make_options"); 
			  select.disabled = false;  // enable the dropdown
			  select.onchange = getModels;
			  select.options[select.selectedIndex].disabled = true; // disable the 'Loading...' option
			  select.options[select.selectedIndex].text = "Select Make";

			  for (var i = 0; i < json.feed.entry.length; ++i) 
			  {
				var entry = json.feed.entry[i];
				
				// find the make entry
				if (entry.title.$t == "make(text)") {
				  makeList = entry.gm$attribute.gm$value;
				  for (var j = 0; j < makeList.length; ++j) {
					var option = document.createElement("option");
					make = makeList[j].$t;
					option.appendChild(document.createTextNode(make));
					select.appendChild(option);
				  }
				  break;
				}
			  }
			  
			  document.getElementById("make_div").appendChild(select);
			}
			function showModelOptions(json) 
			{
			  //Create or reset the options in the drop down box
			  var select = document.getElementById("model_options");
			  select.disabled = false;
			  select.options[0].disabled = false;
				/*Remove disable 'Model' Option */
				//select.options[0].remove;
				// select.remove(select.options[0]);
			  // Use 1 instead of 0 so we don't delete the first option
			  while (select.length > 1) {
				 select.remove(1);
			  }
			  
			  // Find the 'model' entry
			  for (var i = 0; i < json.feed.entry.length; ++i) {
				var entry = json.feed.entry[i];

				if (entry.title.$t == "model(text)") {

				  // Create an <option> element for each model
				  makeList = entry.gm$attribute.gm$value;
				  for (var j = 0; j < makeList.length; ++j) {
					var option = document.createElement("option");
					make = makeList[j].$t;
					/*Add value to option */
					option.value=make;
					/*make first char capital*/
					var firstLetter = make.substr(0, 1);
					make=firstLetter.toUpperCase() + make.substr(1);
					option.appendChild(document.createTextNode(make));
					select.appendChild(option);
				  }
						
				  // Don't process any more entries 
				  break;
				}
			  }
			}
