
function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

function loadtable(url, id) {
  var xmlhttp = null;
  if (window.XMLHttpRequest) {// Firefox, Opera, IE7
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {// IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (xmlhttp != null) {
    xmlhttp.onreadystatechange = function() { ontableloaded(xmlhttp, id); };
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);
  }
  else {
    // browser does not support XMLHTTP
  }
}

function ontableloaded(xmlhttp, id) {
  if (xmlhttp.readyState == 4) {
    if (xmlhttp.status == 200) {
      document.getElementById(id).innerHTML = xmlhttp.responseText;
      fixlinks();
    }
    else {
      document.getElementById(id).innerHTML = "";
    }
  }
}

function fixlinks() {
  var host = window.location.hostname;
  host = host.replace(/^www\./i, '').replace(/[^a-z0-9]+/ig,'_');
  for (var i = 0; i < document.links.length; i++) {
    document.links[i].href = document.links[i].href.replace('SAID', host);
  }
}

document.write('<div id="ct-zdt27k"></div>');
loadtable('comp-table/blue/xanax.html', 'ct-zdt27k');

loadjscssfile('comp-table/blue/style.css', 'css');