// global request and XML document objects
var req;

// retrieve XML document (reusable generic function);
// parameter is URL string (relative or complete) to
// an .xml file whose Content-Type is a valid XML
// type, such as text/xml; XML source must be from
// same domain as HTML file
function degkont(deger) {	
xdeger = false
if ((typeof deger != 'undefined') && (deger != '') && (deger != null)) xdeger = true;
return xdeger
}

function loadXMLDoc(url) {	
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, false);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        //isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}
// handle onreadystatechange event of req object
function processReqChange(){
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		//alert(req.status)		
		if (req.status == 200) {		
			//alert(req.responseText.substring(req.responseText.indexOf('<div>')))			
			// ...processing statements go here...
			response  = req.responseXML.documentElement;

			method =
				response.getElementsByTagName('method')[0].firstChild.data;
			
			//result = response.getElementsByTagName('result')[0].firstChild.data;
			var start = req.responseText.indexOf('<result>') + 8
			var stop = req.responseText.indexOf('</result>')
			result = req.responseText.substring(start,stop);
			eval(method + '(\'\', result)');
		} else {
         try {
         qw = window.open('','_blank');
         qw.document.write(http_request.responseText)
         } catch(exd) { alert("There was a problem retrieving the XML data:\n" + req.statusText);}

		}
	}
}		

function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
function noselectX() { 
var xrt = false;
if (event.srcElement.tagName == 'INPUT') xrt = true;
return xrt;
}
//document.onselectstart = noselectX; // for all others
//document.oncontextmenu = nocontextmenu; // for IE5+
//document.onmousedown = norightclick; // for all others

function do_xml(parameter) {
  pp = location.href.split('/');
  pp1 =location.href.replace(pp[pp.length-1],'');
      makeRequest(pp1 + '', parameter);
                           }
aaaq = '';                           
 function makeRequest(url, parameters) {
      aaaq = parameters;
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
     
 if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      if (parameters.indexOf('10.6.121.92') > -1) 
            { pathj = parameters } else { pathj = url + parameters } 

      http_request.onreadystatechange = alertContents;
      http_request.open('GET', pathj, true);
      http_request.setRequestHeader("Content-Type", "text/xml");
 //     http_request.setRequestHeader("charset", "windows-1254");
      http_request.send();
   }
 function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
     var xmldoc = http_request.responseText;//  
     var xmlobject=new ActiveXObject("Microsoft.XMLDOM");
              xmlobject.async="false";
              yazix = http_request.responseText;
              if (yazix.indexOf('|') > -1)  { 
              yazix = '<?xml version="1.0" encoding="iSO-8859-9"?>\
              <root>\
                 <item>\
                    <ComboName>adsl_no</ComboName>\
                    <ComboValue>' + yazix.replace('|','</ComboValue>\
                    <ComboText>') + '\
                    </ComboText>\
                 </item>\
              </root>'
               }
              xmlobject.loadXML(yazix);
              root=xmlobject.documentElement;  
    obj_nameT = '';
//    try {
    if (root!=null)  {
    for (var iNode = 0; iNode < root.childNodes.length; iNode++) {
               var node = root.childNodes.item(iNode);
        for (i = 0; i < node.childNodes.length; i++) {
                   
         var sibl = node.childNodes.item(i);
         if (sibl.nodeName == 'ComboName') obj_name = sibl.firstChild.nodeValue
         if (sibl.nodeName == 'ComboValue') valuex = (sibl.firstChild == null)?'':sibl.firstChild.nodeValue;
         if (sibl.nodeName == 'ComboText')  Textx = (sibl.firstChild == null)?'':sibl.firstChild.nodeValue;
         if (sibl.nodeName == 'ComboStart') obj_nameT = sibl.firstChild.nodeValue
   xx = document.getElementById(obj_name);
   xy = document.getElementById('H'+obj_name);
   xz = document.getElementById(obj_nameT);

       xyvar = degkont(xy);
       xxvar = degkont(xx);
       xzvar = degkont(xz);
 if (xzvar) {
       if (xz.tagName == 'SELECT') { 
 var optgroups = xz.childNodes;
 for(ioptSel = optgroups.length - 1 ; ioptSel >= 0 ; ioptSel--)
        {xz.removeChild(optgroups[ioptSel]);}
         obj_nameT = ''      
               }   
               }
                
 if (sibl.nodeName == 'ComboText') {
//------------------------------------------------                  
  if (xxvar) {
        switch(xx.tagName)       
  { case 'SELECT' :
       oOption = document.createElement('OPTION');
       oOption.text = Textx; 
       oOption.value = valuex;
       xx.add(oOption); 
       break;

  case 'INPUT' : xx.value = Textx;break;
  default : xx.innerHTML = Textx;
                  } // Switch End
             } // xxvar End                   
//------------------------------------------------                  
       if (xyvar) {
              switch(xy.tagName)       
                { 
  case 'INPUT' : xy.value = Textx;break;
  default : xy.innerHTML = Textx;
                  } // Switch End
             } // xyvar End                   

//------------------------------------------------                  
                    } // ComboText if End
              } // For i End 
          } // For iNode End 
          }  // root element null
  //   } catch(e) {} 
    } else { // if (http_request.status == 200)  End 
    if (aaaq.indexOf('pstnNo') > -1) {msqtext = 'ADSL Bilgisi Al&#305;namad&#305;'} 
         else {msqtext = 'There was a problem with the request.' + http_request.statusText}
               alert(msqtext);
    }
         } // if (http_request.readyState == 4)  End 
      } // Function End 