// JavaScript Document

function ahah(url, target) {
  document.getElementById(target).innerHTML = '<img src="http://www.vizioshop.com/images/indicator.gif" />';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML="Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}


function get() {
      var text = document.getElementById("ajax_text").value ;
      var field = encodeURI( document.getElementById("ajax_field").value );
      var table = encodeURI( document.getElementById("ajax_table").value );
      var keyname = encodeURI( document.getElementById("ajax_keyname").value );
      var id = encodeURI( document.getElementById("ajax_id").value );
      var where = document.getElementById("ajax_where").value ;
      var action = document.getElementById("ajax_action").value ;

	  //alert(text); 
	  ahah('doahah.php?keyname='+ keyname +'&action='+ action +'&table='+ table +'&field='+ field +'&text='+ text + '&id='+ id,where);
   }
   
function changeorder() {
      var text =  encodeURI( document.getElementById("ajax_text").value );
      var id = encodeURI( document.getElementById("ajax_id").value );
      var where = document.getElementById("ajax_where").value ;

	  //alert(text); 
	  ahah('narucenoedit.php?change=1&id='+ id +'&text='+ text,where);
   }
   