﻿var xmlHttp;
    var ddivid;
    var ddivid1;
  function createXMLHttpRequest() {
     if (window.ActiveXObject) {
              xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
     } 
     else if (window.XMLHttpRequest) {
              xmlHttp = new XMLHttpRequest();
    }
  } 
		//實作AJAX
    function startRequest(divid,name) {                
            ddivid=divid;
             //var divleft=document.getElementById(divid).offsetLeft;
             //var cid=document.getElementById("hidcid").value;  +"&divleft="+divleft
             var url = "img_Ajax.aspx?divid="+divid+"&name="+encodeURI(name);
             createXMLHttpRequest();
             xmlHttp.onreadystatechange = handleStateChange;
             xmlHttp.open("GET",url, true);
             xmlHttp.send(null);
   }
   function handleStateChange() {
          
             if(xmlHttp.readyState == 4) {
                  if(xmlHttp.status == 200) {                  
                      document.getElementById(ddivid).innerHTML = xmlHttp.responseText;
                      
                      //change(ddivid1,ddivid);
                  }
              }
             
   }
   
  function change(div1,div2){
  document.getElementById(div2).style.top=document.getElementById(div1).offsetTop+30;
  document.getElementById(div2).style.left=document.getElementById(div1).offsetLeft+30;
  document.getElementById(div2).style.zIndex=10000;
  document.getElementById(div2).style.position="absolute";
} 