dojo.require("dojox.xml.parser");

    function getSPoints() {
		       
		var countrySelect = dojo.byId("country");
		//alert(countrySelect.options[countrySelect.selectedIndex].text);

        //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
        var xhrArgs = {
            url: "startpoints.jsp",
            handleAs: "xml",
			content: {
				cid: countrySelect.options[countrySelect.selectedIndex].value
				},
			load: function(data) {
				var targetSelect = dojo.byId("startpoint");
				//clear start points
				targetSelect.options.length = 0;
				//parse xml
				var docNode = data.documentElement;
				for (var i = 0; i < docNode.childNodes.length; i++) {
					var pointnode = docNode.childNodes[i];
					targetSelect.options[i] = new Option( dojox.xml.parser.textContent(pointnode.childNodes[1]),dojox.xml.parser.textContent(pointnode.childNodes[0]) );
				}
            },
            error: function(error) {
                alert("An unexpected error occurred: " + error);
            }
        }
		/*alert("1");
		 var xml = "<tnode><node>Some Text</node><node>Some Other Text</node></tnode>";
            var dom = dojox.xml.parser.parse(xml);
alert("2");*/

        //Call the asynchronous xhrGet
        var deferred = dojo.xhrGet(xhrArgs);
    }
	
	
	/*function buttonChange(val){
        dojo.byId("fbutton").disabled=false;
    
 }*/
	
	
function submitform () {
	var countrySelect=dojo.byId("country");	
	var countryurl="";
	
	if (countrySelect.selectedIndex<0) {
     alert("Please select country");
     return false;
	}

   	if (dojo.byId("startpoint").selectedIndex<0) {
                alert("Please select airport or port");
                return false;
    }
	else{

                switch (countrySelect.options[countrySelect.selectedIndex].value) {
					    case "Cyprus": countryurl = "http://www.cyprustaxireservations.com";document.getElementById("usercode1").value="txcy";document.getElementById("showhome").value=""; break;
                        case "France": countryurl = "http://www.francetaxireservations.com";document.getElementById("usercode1").value="txfr";document.getElementById("showhome").value=""; break;
						case "Greece": countryurl = "http://www.taxireservations.gr";document.getElementById("usercode1").value="txgr";document.getElementById("showhome").value=""; break;
                        case "Spain": countryurl = "http://www.spaintaxireservations.com";document.getElementById("usercode1").value="txsp";document.getElementById("showhome").value=""; break;
						case "Turkey": countryurl = "http://www.turkeytaxireservations.com";document.getElementById("usercode1").value="txtr";document.getElementById("showhome").value=""; break;
						case "UK": countryurl = "http://www.taxireservations.co.uk";document.getElementById("usercode1").value="txen";document.getElementById("showhome").value=""; break;
						default: countryurl = "http://www.bookyourtransfer.com";document.getElementById("usercode1").value="taxires4";document.getElementById("showhome").value="no"; break;
                }
				
			}
	document.form1.action =countryurl + "/DestPointSearchOp.action";

	
	document.form1.submit();
			}
	
	
