// default.js

function init() { externalLinks(); obscure(); }

// routine to set target attribute of external links
// external links defined by the rel attribute:  <a rel="external" ...
function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
  }
}
function swapTxt(t) {
  for (i = 0; i < 3; i++) {
    el = document.getElementById("txt" + (i));
    el.style.visibility = "hidden";
  }
  el = document.getElementById(t);
  el.style.visibility = "visible";
}

function obscure() {
  var theLinks = document.links;
  for (var i = 0; i < theLinks.length; i++) {
    if (theLinks[i].className == "obscure") {
      var text = "";
      var address = theLinks[i].href.split("|");
      var mailAddress = address[1] + "@" + address[2];
      address[3] ? text = address[3].replace(/%20/g, " ") : text = mailAddress;
      theLinks[i].href = "mailto:" + mailAddress;
      theLinks[i].childNodes.length ? theLinks[i].firstChild.data = text 
        : theLinks[i].appendChild(document.createTextNode(text));
    }
  }
}

function writeHeader(msg) {
	document.write(
	'    <h1 id="shadaux">Shadaux<br /><i>world wide web solutions</i></h1>\n' +
	'    <div class="topBar00">\n' +
  '    <img class="tb01" src="grfx/logo_52x50.gif" width="52" height="50" alt="" />\n' +
  '    <img class="tb02" src="grfx/nam_165x38.gif" width="165" height="38" alt="" />\n' +
  '    <img class="tb03" src="grfx/leg_177x10.gif" width="177" height="10" alt="" />\n' +
  msg +
	'\n' +
  '    <div class="topBar01">\n' +
  '      <p class="menu00"><a class="menu02" href="index.html">home</a></p>\n' +
  '      <p class="menu01">\n' +
  '        <a class="menu02" href="portfolio.html">portfolio</a> |\n' +
  '        <a class="menu02" href="company.html">company</a> |\n' +
  '        <a class="menu02" href="contact.html">contact us</a> |\n' +
  '        <a class="menu02" href="access.html">client access</a>\n' +
  '      </p>\n' +
  '    </div>\n' +
  '  </div>\n'
	);
	document.close();
}

function writeFooter() {
	document.write(
  '  <div id="footer">\n' +
  '    <p class="copyr">&copy; 2003 by Shadaux</p>\n' +
	'\n' +
  '    <p class="menu03">\n' +
  '      <a class="menu02" href="index.html">home</a> |\n' +
  '      <a class="menu02" href="portfolio.html">portfolio</a> |\n' +
  '      <a class="menu02" href="company.html">company</a> |\n' +
  '      <a class="menu02" href="contact.html">contact us</a> |\n' +
  '      <a class="menu02" href="access.html">client access</a>\n' +
  '    </p>\n' +
	'\n' +
  '    <img class="estab" src="grfx/est_104x20.gif" width="104" height="20" \n' +
  '      alt="Established 1998" />\n' +
  '    <a class="w3c01" href="http://validator.w3.org/check/referer">Valid XHTML</a>\n' +
  //'    <a class="w3c02" href="http://jigsaw.w3.org/css-validator/">Valid CSS</a>\n' +
  '  </div>\n'
	);
	document.close();
}

function pop(page,w,h) {
	if (!w) w = 360;
	if (!h) h = 400;
  popWin=window.open(page,"popWin","resizable,scrollbars,left=100,screenX=100,top=20,screenY=20,width=" + w + ",height=" + h);
  popWin.document.close()
}

function popImage(f, w, h) {
  var xPos = 200;
  xPos = (screen.width - w) / 2;
  var yPos = 10;
  popUp = window.open('','popUp','width=' + w + ',height=' + h + ',left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',resizable');
	popUp.document.write('<html><head><title></title><style type="text/css">body{margin:0;background:#fff}</style></head>'
		+ '<body><div><img src="' + f + '" width="' + w + '" height="' + h + '"></div></body></html>'
  );
  popUp.document.close();
}



