
function sendRequest( url, callback, method, data ){
	req = createXMLHTTP();
	if( !req ){
		return;
	}
	req.onreadystatechange = function(){
		getResponse( req, callback );
	}
	if(method.toUpperCase() == 'GET' && data.length > 0){
		url += '?'+ data;
		data = '';
	}
	req.open( method, url, true );
	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	req.send( data );
}

function createXMLHTTP(){

  if( window.XMLHttpRequest ){
    return new XMLHttpRequest();
  }
  else if( window.ActiveXObject ){
    try {
      return new ActiveXObject("MSXML2.XMLHTTP");
    }
    catch (e) {
      try {
        return new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e2) {
        return null;
      }
    }
  }
  return null
}

function getResponse( req, callback ){

  if( req.readyState == 4 ){

    if( req.responseText ){
      callback(req);
    }
  }
}

function stopRequest(){
	req.abort();
}

function addListener(elem, eventType, func, cap) {

    if(elem.addEventListener) {

        elem.addEventListener(eventType, func, cap);

    } else if(elem.attachEvent) {

        elem.attachEvent('on' + eventType, func);

    } else {
        alert('ご利用のブラウザはサポートされていません。');
        return false;
    }
}

function removeListener(elem, eventType, func, cap) {
    if(elem.removeEventListener) {
        elem.removeEventListener(eventType, func, cap);
    } else if(elem.detachEvent) {
        elem.detachEvent('on' + eventType, func);
    }
}

function jsgt_Indicator(src){

  this.div        = setIndicatorDIV(src);
  this.indi_append = indi_append;
  this.indi_start  = indi_start;
  this.indi_stop   = indi_stop;
  this.img = new Image();
  this.img.src = src;

  function setIndicatorDIV(src){
    id = "_indicator"+(new Date()).getTime();
    this.div = document.createElement("DIV") ;
    this.div.style.position = "relative";
    this.div.style.top      = "0px";
    this.div.style.left     = "0px";
    this.div.style.width    = "0px";
    this.div.style.height   = "0px";
    this.div.style.margin  = '0px' ;
    this.div.style.padding = '0px' ;

    return this.div
  }

  function indi_append(id){
    if(typeof document.getElementById(id) != 'object')return;
    document.getElementById(id).appendChild(this.div);
  }

  function indi_start(){
    this.div.style.height ="12px";
    this.div.style.width ="auto";
    this.div.innerHTML  = '<img src="'+this.img.src+'">' ;
  }


  function indi_stop(){
    this.div.style.width ="0px";
    this.div.style.height ="0px";
    this.div.innerHTML  = '' ;
  }
  return this
}

