﻿/*
PURPOSE:
	[1] Provides dynamic replacement of text without page reload	

CREATION DATE:
	October 2, 2009

REVISION HISTORY:
	

STATUS OF THIS DOCUMENT:
	This is a operational document.

DEPENDANCIES:
	Must provide a page for failure

MAINTAINER:
	Mike Van Alstine
	m v a # v a m m g r o u p . c o m

LEGAL NOTICE:
	Distribution of this document is limited.
	Copyright (C) The VAMM Group 2009. All Rights Reserved.
*/

function clientSideInclude(id, url) 
{
  var req = false;
  
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) 
  {
        try 
        {
          req = new XMLHttpRequest();
        } 
        
        catch (e) 
        {
          req = false;
        }
  } 
  else if (window.ActiveXObject) 
  {
        // For Internet Explorer on Windows
        try 
        {
          req = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        
        catch (e) 
        {
          try 
          {
            req = new ActiveXObject("Microsoft.XMLHTTP");
          } 
          catch (e) 
          {
            req = false;
          }
        }
  }
  
  var element = document.getElementById(id);
 
  if (req) 
  {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    if(req.responseText == "") element.innerHTML = "";
    else element.innerHTML = req.responseText;
  } 
  else 
  {
    
    element.innerHTML = "AJAX Error";
  }
}



