// Modified by Johnny

var RS_IFrameObj; // our IFrame object
var RS_Initialized = false;

function InitRS() {

  if (!RS_IFrameObj && document.createElement) {
    // create the IFrame and assign a reference to the
    // object to our global variable RS_IFrameObj.
    // this will only happen the first time 
    // callToServer() is called
   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      RS_IFrameObj = document.body.appendChild(tempIFrame);
      
      if (document.frames) {
        // this is for IE5 Mac, because it will only
        // allow access to the document object
        // of the IFrame if we access it through
        // the document.frames array
        RS_IFrameObj = document.frames['RSIFrame'];
      }
	  RS_Initialized = true;
    } catch(exception) {
      // This is for IE5 PC, which does not allow dynamic creation
      // and manipulation of an iframe object. Instead, we'll fake
      // it up by creating our own objects.
      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      RS_IFrameObj = new Object();
      RS_IFrameObj.document = new Object();
      RS_IFrameObj.document.location = new Object();
      RS_IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      RS_IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
	  RS_Initialized = true;
    }

    if (navigator.userAgent.indexOf('Gecko') !=-1 && !RS_IFrameObj.contentDocument) {
      // we have to give NS6 a fraction of a second
      // to recognize the new IFrame
      setTimeout('InitRS();',50);
      return false;
    }
  }
  
}

function CallToServer(URL) {

  var IFrameDoc;
  
  if (!RS_Initialized) {
    InitRS();
  }
  
  if (RS_Initialized) {
    if (!document.createElement) {
      return true
    };

    if (RS_IFrameObj && document.createElement) {  
	  if (RS_IFrameObj.contentDocument) {
  	    // For NS6
	    IFrameDoc = RS_IFrameObj.contentDocument; 
	  } else if (RS_IFrameObj.contentWindow) {
	    // For IE5.5 and IE6
	    IFrameDoc = RS_IFrameObj.contentWindow.document;
	  } else if (RS_IFrameObj.document) {
	    // For IE5
	    IFrameDoc = RS_IFrameObj.document;
	  } else {
	    return true;
	  }  
	  IFrameDoc.location.replace(URL);
	  return false;
    } else {
	  alert('Invalid callToServer() IFrameObj = ' + RS_IFrameObj);
	  return(true);
    }	
  }
}

