// ------------------------------------------------- 
// Crafty Syntax Live Help - Dynamic IFrame Creator 
//    version: 2.9.8 
//       date: jan, 17, 2005 
// programmer: Kent (design4effect) 
// ------------------------------------------------- 
//   This script should be generated after we know the installation path 
//     of CSLH and the name of the department's doLiveHelp HTML file. 
//   Note: CHANGES ARE REQUIRED 
//     1> change all '/LiveChat1/' to application path 
//     2> change all 'doLiveHelp1.htm' to appropriate department's doLiveHelp HTML file 
// ------------------------------------------------- 
// Locates an object 
function cslhFindObj(oName) { 
  if( document.frames && document.frames[oName] ) return document.frames[oName]; 
  if( document[oName] ) { return document[oName]; } 
  if( document.getElementById && document.getElementById(oName) ) { return document.getElementById(oName); } 
  if( document.all && document.all[oName] ) { return document.all[oName]; } 
  return null; 
} 
// Returns the document object contained within a dynamically allocated IFRAME 
// Not required but here incase needed later 
function cslhIFrameDoc(oIFrame) { 
  if( oIFrame.contentWindow )   return oIFrame.contentWindow.document; // IE5.5+ 
  if( oIFrame.contentDocument ) return oIFrame.contentDocument;        // NS6 
  if( oIFrame.document )        return oIFrame.document;               // IE5 
  return null; 
} 
// Validates system compliance and if capable, starts-up CSLH 
function cslhEnable() { 
  // Look for placeholder image for location of LiveHelp 
  var oi = cslhFindObj("cslhIMG"); 
  if( oi==null ) { 
    // If not found, check for IFRAME. If present CSLH is already loaded. If not, the placeholder image is missing 
    if( cslhFindObj("cpCSLH")==null ) 
      alert( "Sorry no Live Help placeholder image found\n - no Live Help available" ); 
    return; // In either case, we won't load it again 
  } 
  // Ensure encapsulating DIV has also been defined 
  var oED = cslhFindObj('divCSLH'); 
  if( oED==null ) { 
    alert( "No <div id='divCSLH'> surrounding placeholder image\n - Refer to installation instructions" ); 
    return; 
  } 
  // Check support 
  if( !document.createElement && typeof(oED.innerHTML)!="string" ) { 
    oi.alt = "Sorry, browser incapable of running Live Help in a dynamic IFRAME."; 
    return; 
  } 
  // If we get to here, it's okay to run it 
  oi.alt = "One moment please, loading LiveHelp."; 
  // Creates frame and sets contents 
  cslhCreateIFrame(); 
  // We'll be live momentarily 
} 
// Create IFRAME and load CSLH into it 
function cslhCreateIFrame() { 
  if( cslhFindObj('cpCSLH')==null ) { 
    var oDiv = cslhFindObj('divCSLH');  // DIV containing placeholder image 
    try { 
      // If no IFRAME yet, create one now 
      var tmpIF = document.createElement("iframe"); 
      tmpIF.setAttribute("width","150"); 
      tmpIF.setAttribute("height","75"); 
      tmpIF.setAttribute("id","cpCSLH"); 
      tmpIF.setAttribute("name","cpCSLH"); 
      tmpIF.setAttribute("frameBorder","0"); 
      tmpIF.setAttribute("hspace","0"); 
      tmpIF.setAttribute("vspace","0"); 
      tmpIF.setAttribute("marginheight","0"); 
      tmpIF.setAttribute("marginwidth","0"); 
      tmpIF.setAttribute("scrolling","no"); 
      // CSS styles 
      tmpIF.style.width='150px'; 
      tmpIF.style.height='75px'; 
      tmpIF.style.backgroundColor='#333333'; 
      tmpIF.style.margin='0px'; 
      tmpIF.style.padding='0px'; 
      tmpIF.style.border='0px'; 
      // Replace the image with an IFAME 
      tmpIF.setAttribute("src","http://www.greatadventure.ca/livehelp/doLiveHelp1.htm"); 
      oDiv.innerHTML = ''; 
      oDiv.appendChild(tmpIF); 
    } catch(e) { 
      // If createElement() failed, maybe innerHTML works 
      if( typeof(oDiv.innerHTML)=="string" ) { 
        oDiv.innerHTML = '<iframe id="cpCSLH" src="http://www.greatadventure.ca/livehelp/doLiveHelp1.htm" width=150 height=75 frameborder=0 hspace=0 vspace=0 marginheight=0 marginwidth=0 scrolling="no" style="width: 150px; height: 75px; backgroundColor: #333333; margin: 0px; padding: 0px; border: 0px;"><\/iframe>'; 
  } } } 
} 
// --------------------------------------------------------------- 
// Your BODY tag must be adjusted to add the cslhOnLoad() handler 
// <BODY... onLoad="[existing_handler_if_any]; cslhOnLoad();">    
// --------------------------------------------------------------- 
// Pause before loading incase visitor is just passing through 
function cslhOnLoad() { 
  setTimeout("cslhEnable()",1000); 
} 

// ------------------- That's All Folks! -------------------------