// Java Document
var DHTML = (document.getElementById || document.all || document.layers);

function point_it(event,imagetype){
	pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("pointer_div").offsetLeft-document.getElementById("c-block").offsetLeft-2;
	pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("pointer_div").offsetTop-document.getElementById("c-body").offsetTop;
	document.getElementById("cross").style.visibility = "visible" ;
	if ( document.all ) pos_x = pos_x - 1;
	callImageServer(imagetype,pos_x,pos_y);
}

function SetImage(theOutput,offsetX)
{
	X = document.getElementById("pointer_div").offsetLeft+document.getElementById("c-block").offsetLeft+offsetX;
	Y = document.getElementById("pointer_div").offsetTop+document.getElementById("c-body").offsetTop+20;
	if ( offsetX > 0 ) overlib(theOutput, WIDTH, 176, FIXX, X, FIXY, Y, NOCLOSE);
}

var ImgFrameObj; // our IFrame object
function callImageServer(theImage,imgX,imgY) {
  if (!document.createElement) {return true};
  var IFrameDoc;
  var URL = './templates/image_data.php?i=' + theImage + '&ix=' + imgX + '&iy=' + imgY;
  if (!ImgFrameObj && document.createElement) {
   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      ImgFrameObj = document.body.appendChild(tempIFrame);
      
      if (document.frames) {
        ImgFrameObj = document.frames['RSIFrame'];
      }
    } catch(exception) {
      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      ImgFrameObj = new Object();
      ImgFrameObj.document = new Object();
      ImgFrameObj.document.location = new Object();
      ImgFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      ImgFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
    }
  }
  
  if (navigator.userAgent.indexOf('Gecko') !=-1 && !ImgFrameObj.contentDocument) {
    setTimeout('callImageServer()',10);
    return false;
  }
  
  if (ImgFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = ImgFrameObj.contentDocument; 
  } else if (ImgFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = ImgFrameObj.contentWindow.document;
  } else if (ImgFrameObj.document) {
    // For IE5
    IFrameDoc = ImgFrameObj.document;
  } else {
    return true;
  }
  
  IFrameDoc.location.replace(URL);
  return false;
}
