﻿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 rollover will change the image name (id) to the new image (imgfile)
function rollover(imgname, imgfile) 
{
if (document.images)  // Check if Browser displays images
    {
    document.getElementById(imgname).src=imgfile
    }
  return;
}

function WriteMenuEntry(url,title,target)
{ document.write("<li><a href=\"" + url + "\" target=\"_" + target + "\">" + title + "</a></li>"); }
function WriteSiteLinks(url, title)
{ document.write("<a class=\"InternalLinks\" href=\"" + url + "\">" + title + "</a>&nbsp;"); }
function WriteExternalLinks(url, title)
{ document.write("<a rel=\"external\" href=\"" + url + "\">" + title + "</a>&nbsp;"); }

// Function to Boookmark page.
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
function reset() {
    document.tellafriend.name.value = "";
    document.tellafriend.email.value = "";
    document.tellafriend.fmail1.value = "";
    document.tellafriend.fmail2.value = "";
    document.tellafriend.fmail3.value = "";
}
function validate() {
    if (document.tellafriend.fmail1.value.length == 0) {
        alert("Oops! you'll need to enter a friend's email address");
        return false;
    }
    if (document.tellafriend.email.value.length == 0) {
        alert("Oops! you forget to enter your email address");
        return false;
    }
    if (document.tellafriend.name.value.length == 0) {
        alert("Oops! you forgot to enter your name");
        return false;
    }
    document.tellafriend.submit()
    return true;
}
function expandlinks(thistag, tag) {
    styleObj = document.getElementById(thistag).style;
    if (styleObj.display == 'none') {
        styleObj.display = '';
        tag.innerHTML = "Click Here To Hide The Links";
    }
    else {
        styleObj.display = 'none';
        tag.innerHTML = "Click Here To See The Links";
    }
}
// Run the externallinks script when the page loads
window.onload = externalLinks;
