window.onload = function() {
	var xmlhttp = new XMLHttpRequest();
	xmlhttp.open("POST", "http://www.webservicex.net/country.asmx/GetCountries",true);
	xmlhttp.onreadystatechange=function() {
	 if (xmlhttp.readyState === 4) {
		 document.getElementById("ws_data").innerHTML = xmlhttp.responseText;
	 }
	};
	xmlhttp.setRequestHeader("SOAPAction", "http://www.webservicex.net/country.asmx/GetCountries");
	xmlhttp.setRequestHeader("Content-Type", "text/json");
	var soap = '<?xml version="1.0" encoding="utf-8"?>' +
	 '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
	                'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
	                'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' + 
	   '<soap:Body> ' +
	     '<GetCountries xmlns="http://www.webserviceX.NET/"> ' +
	     '</GetCountries> ' +
	   '</soap:Body> ' +
	 '</soap:Envelope>';
	xmlhttp.send(soap);
	
	 // add eventListener for tizenhwkey
    document.addEventListener('tizenhwkey', function(e) {
        if (e.keyName === "back") {
            try {
                tizen.application.getCurrentApplication().exit();
            } catch (ignore) {}
        }
    });	
};