function login() {
   var httpObj = new ActiveXObject("Microsoft.XMLHTTP");
   var sSOAPRequest  = "";
   var sSOAPResponse = "";
    sSOAPRequest += "<?xml version='1.0' encoding='utf-8'?>";
    sSOAPRequest += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:si='http://soapinterop.org/xsd' xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<SOAP-ENV:Body>";
    sSOAPRequest += "<tns:login xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<clientId xsi:type='xsd:string'></clientId>";
    sSOAPRequest += "<userName xsi:type='xsd:string'>apiuser85</userName>";
    sSOAPRequest += "<password xsi:type='xsd:string'>sunycell</password>";
    sSOAPRequest += "</tns:login>";
    sSOAPRequest += "</SOAP-ENV:Body>";
    sSOAPRequest += "</SOAP-ENV:Envelope>";


   var sSOAPAction = "login";

   httpObj.Open("POST","https://citizen.api.networkip.net/pioneer/pioneer?WSDL",false,"", "");

   httpObj.setRequestHeader("SOAPAction", sSOAPAction);
   httpObj.setRequestHeader("Content-Type","text/xml");

   // Build sSOAPRequest...

   httpObj.Send(sSOAPRequest);
   var returnCode = httpObj.ResponseText;
   
   // receipe
   var xDoc = new ActiveXObject("Microsoft.XMLDOM");
   xDoc.async = false;

   xDoc.load(httpObj.responseBody);

   var root = xDoc.documentElement;

    for(var i=0; i<root.childNodes.length;i++) {
    	for(var j=1; j<root.childNodes.item(0).childNodes.length; j++)
    	{
		for (var k=0; k < root.childNodes.item(i).childNodes.item(j).childNodes.length; k++)
		{
			if (root.childNodes.item(i).childNodes.item(j).childNodes.item(k).tagName == "clientId") {
				document.form1.clientId.value = root.childNodes.item(i).childNodes.item(j).childNodes.item(k).text;
			}
		}
    	}
   }
}   



function view_cdr() {
   var httpObj = new ActiveXObject("Microsoft.XMLHTTP");
   var sSOAPRequest  = "";
   var sSOAPResponse = "";

    sSOAPRequest += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:si='http://soapinterop.org/xsd' xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<SOAP-ENV:Body>";
    sSOAPRequest += "<tns:getCallDetails xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<clientId xsi:type='xsd:string'>" + document.form1.clientId.value + "</clientId>";
    sSOAPRequest += "<pin xsi:type='xsd:string'>" + document.form1.pin.value + "</pin>";
    sSOAPRequest += "<customerNumber xsi:type='xsd:string'>PHONETOKOREA</customerNumber>";
    sSOAPRequest += "<dnisSet xsi:type='xsd:string'>PTK_PINLESS</dnisSet>";
    sSOAPRequest += "<startDate xsi:type='xsd:dateTime'>" + document.form1.start_date.value + "</startDate>";
    sSOAPRequest += "<endDate xsi:type='xsd:dateTime'>" + document.form1.end_date.value + "</endDate>";
    sSOAPRequest += "<gmtTimeOffset xsi:type='xsd:float'>-8</gmtTimeOffset>";
    sSOAPRequest += "<recordLimit xsi:type='xsd:int'>255</recordLimit>";
    sSOAPRequest += "</tns:getCallDetails>";
    sSOAPRequest += "</SOAP-ENV:Body>";
    sSOAPRequest += "</SOAP-ENV:Envelope>";


   var sSOAPAction = "getCallDetails";

   httpObj.Open("POST","https://citizen.api.networkip.net/pioneer/pioneer?WSDL",false,"", "");

   httpObj.setRequestHeader("SOAPAction", sSOAPAction);
   httpObj.setRequestHeader("Content-Type","text/xml");

   // Build sSOAPRequest...

   httpObj.Send(sSOAPRequest);
   var returnCode = httpObj.ResponseText;
   
   // receipe
   var xDoc = new ActiveXObject("Microsoft.XMLDOM");
   xDoc.async = false;

   xDoc.load(httpObj.responseBody);

   var root = xDoc.documentElement;

   var html = "";

    for(var i=0; i<root.childNodes.length;i++) {

    	html += "<table cellpadding=3 cellspacing=1 border=0 bgcolor=#cccccc>";
    	html += "<tr bgcolor=#eeeeee align=center>";
    	html += "  <td>No</td>";
    	html += "  <td>Call Date</td>";
    	html += "  <td>Ani</td>";
    	html += "  <td>Destination</td>";
    	html += "  <td>Dest City</td>";
    	html += "  <td>Retail Out Time Charge</td>";
    	html += "  <td>Retail Billed Sec</td>";
    	html += "  <td>Retail Out Charge</td>";
    	html += "  <td>Sur Charge</td>";
    	html += "  <td>bong Charge</td>";
    	html += "  <td>Payphone</td>";
    	html += "  <td>Operator</td>";
    	html += "  <td>Maint</td>";
    	html += "  <td>total</td>";
    	html += "  <td>balance</td>";
    	html += "</tr>";

    	for(var j=1; j<root.childNodes.item(0).childNodes.length; j++)
    	{
		if (root.childNodes.item(i).childNodes.item(j).childNodes.item(17).text > 0) {

     		html += "<tr bgcolor=#ffffff align=center>";
     		html += "<td>" + j + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(3).text.substr(0,19).replace("T", " ") + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(5).text + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(8).text + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(9).text + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(17).text)/100 + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(18).text + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(19).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(20).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(21).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(22).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(23).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(24).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(25).text)/100 + "</td>";
  	     	html += "<td>" + Math.round(root.childNodes.item(i).childNodes.item(j).childNodes.item(28).text)/100 + "</td>";
     		html += "</tr>";

		}
    	}

	html += "</table>";
   }
   oa.innerHTML = html;
}   



function get_speed_list() {

   var httpObj = new ActiveXObject("Microsoft.XMLHTTP");
   var sSOAPRequest  = "";
   var sSOAPResponse = "";

    sSOAPRequest += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:si='http://soapinterop.org/xsd' xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<SOAP-ENV:Body>";
    sSOAPRequest += "<tns:getSpeedDialList xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<clientId xsi:type='xsd:string'> + document.form1.clientId.value + </clientId>";
    sSOAPRequest += "<pin xsi:type='xsd:string'> + document.form1.pin.value + </pin>";
    sSOAPRequest += "<custNumber xsi:type='xsd:string'>PHONETOKOREA</custNumber>";
    sSOAPRequest += "<dnisSet xsi:type='xsd:string'>PTK_PINLESS</dnisSet>";
    sSOAPRequest += "</tns:getSpeedDialList>";
    sSOAPRequest += "</SOAP-ENV:Body>";
    sSOAPRequest += "</SOAP-ENV:Envelope>";

   var sSOAPAction = "getSpeedDialList";

   httpObj.Open("POST","https://citizen.api.networkip.net/pioneer/pioneer?WSDL",false,"", "");

   httpObj.setRequestHeader("SOAPAction", sSOAPAction);
   httpObj.setRequestHeader("Content-Type","text/xml");

   // Build sSOAPRequest...

   httpObj.Send(sSOAPRequest);
   var returnCode = httpObj.ResponseText;
   
   // receipe
   var xDoc = new ActiveXObject("Microsoft.XMLDOM");
   xDoc.async = false;

   xDoc.load(httpObj.responseBody);

   var root = xDoc.documentElement;

   var html = "";

    for(var i=0; i<root.childNodes.length;i++) {

    	html += "<table cellpadding=3 cellspacing=1 border=0 bgcolor=#cccccc width=400>";
    	html += "<tr bgcolor=#eeeeee align=center>";
    	html += "  <td>¹øÈ£</td>";
    	html += "  <td>´ÜÃà´ÙÀÌ¾ó¹øÈ£</td>";
    	html += "  <td>ÀüÈ­¹øÈ£</td>";
    	html += "</tr>";

    	for(var j=1; j<root.childNodes.item(0).childNodes.length; j++)
    	{
     		html += "<tr bgcolor=#ffffff align=center>";
     		html += "<td>" + j + "</td>";
  	     	html += "<td>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(3).text + "</td>";
  	     	html += "<td width=60%>" + root.childNodes.item(i).childNodes.item(j).childNodes.item(4).text + "</td>";
     		html += "</tr>";
    	}

	html += "</table>";
   }
   oa.innerHTML = html;
}



function add_speed() {

   var httpObj = new ActiveXObject("Microsoft.XMLHTTP");
   var sSOAPRequest  = "";
   var sSOAPResponse = "";

    sSOAPRequest += "<SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:si='http://soapinterop.org/xsd' xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<SOAP-ENV:Body>";
    sSOAPRequest += "<tns:getCallDetails xmlns:tns='http://networkip.net/wsdl'>";
    sSOAPRequest += "<clientId xsi:type='xsd:string'>" + document.form1.clientId.value + "</clientId>";
    sSOAPRequest += "<pin xsi:type='xsd:string'>" + document.form1.pin.value + "</pin>";
    sSOAPRequest += "<customerNumber xsi:type='xsd:string'>PHONETOKOREA</customerNumber>";
    sSOAPRequest += "<dnisSet xsi:type='xsd:string'>PTK_PINLESS</dnisSet>";
    sSOAPRequest += "<startDate xsi:type='xsd:dateTime'>" + document.form1.start_date.value + "</startDate>";
    sSOAPRequest += "<endDate xsi:type='xsd:dateTime'>" + document.form1.end_date.value + "</endDate>";
    sSOAPRequest += "<gmtTimeOffset xsi:type='xsd:float'>-8</gmtTimeOffset>";
    sSOAPRequest += "<recordLimit xsi:type='xsd:int'>255</recordLimit>";
    sSOAPRequest += "</tns:getCallDetails>";
    sSOAPRequest += "</SOAP-ENV:Body>";
    sSOAPRequest += "</SOAP-ENV:Envelope>";

   var sSOAPAction = "setSpeedDial";

   httpObj.Open("POST","https://citizen.api.networkip.net/pioneer/pioneer?WSDL",false,"", "");

   httpObj.setRequestHeader("SOAPAction", sSOAPAction);
   httpObj.setRequestHeader("Content-Type","text/xml");

   // Build sSOAPRequest...

   httpObj.Send(sSOAPRequest);
   var returnCode = httpObj.ResponseText;
   
   // receipe
   var xDoc = new ActiveXObject("Microsoft.XMLDOM");
   xDoc.async = false;

   xDoc.load(httpObj.responseBody);

   var root = xDoc.documentElement;

    for(var i=0; i<root.childNodes.length;i++) {
    	for(var j=1; j<root.childNodes.item(0).childNodes.length; j++)
    	{
		for (var k=0; k < root.childNodes.item(i).childNodes.item(j).childNodes.length; k++)
		{
			if (root.childNodes.item(i).childNodes.item(j).childNodes.item(k).tagName == "clientId") {
				document.form1.clientId.value = root.childNodes.item(i).childNodes.item(j).childNodes.item(k).text;
			}
		}
    	}
   }

   result.value = result;
}