﻿// functions common to most pages
var localDebug = false;
var indexFile = false;
var menuName = "Home";
if ((document.referrer)
    && (document.referrer.indexOf("http") == 0)) {
    //document.write("document.referrer: " + document.referrer + "<br/>");
    if (document.referrer.indexOf("://") >= 0) {
        if (document.referrer.indexOf("index.html") >= 0) indexFile = true;
        refDomain = document.referrer.substring(document.referrer.indexOf("://") + 3, document.referrer.length);
        refDomain = refDomain.substring(0, refDomain.indexOf("/"));
        refPort = "80";
        if (refDomain.indexOf(":") >= 0) {
            refPort = refDomain.substring(refDomain.indexOf(":") + 1, refDomain.length);
            refDomain = refDomain.substring(0, refDomain.indexOf(":"));
        }
        //document.write("referrer.domain: " + refDomain + "<br/>");
        //document.write("referrer.port: " + refPort + "<br/>");
        if (refDomain == "localhost")
            localDebug = true;
    }
}

function popup(URL, picw, pich) {
  window.open(URL,'popup','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+picw+',height='+pich+',left=5,top=5,screenX=5,screenY=5');
}

function docOnLoad() {
    return;
}

function putHeadTags(pageSubject, keywordType) {
    if (pageSubject == null && keywordType == null)
        return;
    menuName = keywordType;
    if (keywordType == null) menuName = "";
    document.write("<meta name=\"Description\" content=\"Absolute Genius - " + pageSubject + "\"/>");
    document.write("<meta name=\"robots\" content=\"noindex,follow\"/>");
    if (keywordType == "software") {
        document.title = "Absolute Genius " + pageSubject + " - Custom programming, computer and web systems design and support.";
        document.write("<meta name=\"keywords\" content=\"Absolute Genius, absolutegenius, Palm, Palm Computing, Palm Computing Platform, PalmIII, PalmV, PalmVII, SPT1500, SPT1700, SPT1740, programming, databasing, database programming, C/C++, Visual C, Visual C++, C++, Visual Basic, , Visual C#, POP, POS, point of purchase, point of sale, inventory, shipping, reveiving, data acquisition, security, interface, interfaces, custom interface, custom  interfaces\"/>");
    }
    else if (keywordType == "hardware") {
        document.title = "Absolute Genius " + pageSubject + " - Custom electronics prototypes, industrial and embedded control.";
        document.write("<meta name=\"keywords\" content=\"Absolute Genius, absolutegenius, prototype, prototypes, prototyping, engineer, engineering, custom electronics, electronic, electronics, industrial, industrial control, industrial, Industrial Automation, embedded, embedded control, embedded systems, control, telephony, telephone, telephones, JUMPtec PC/104, PC/104, PIC16Cxx, PIC16CXX, PIC18Fxx, PIC18FXX, PIC16C84, PIC16C74, 68HC11, 68HC05, programming, databasing, database programming, C/C++, Visual C, Visual C++, C++, Visual Basic, Visual C#, RS232, movie  props, film props, advertizing props, merchandising props, data acquisition, data aquisition, interface, interfaces, custom interface, custom  interfaces\"/>");
    }
    else {
        document.title = "Absolute Genius " + pageSubject + " - Custom programming, electronics prototypes, industrial and embedded control, computer and web systems design and support.";
        document.write("<meta name=\"keywords\" content=\"Absolute Genius, absolutegenius, prototype, prototypes, prototyping, engineer, engineering, custom electronics, electronic, electronics, industrial, industrial control, industrial, Industrial Automation, embedded, embedded control, embedded systems, control, telephony, telephone, telephones, JUMPtec PC/104, PC/104, Palm, Palm Computing, Palm Computing Platform, PalmIII, PalmV, PalmVII, SPT1500, SPT1700, SPT1740, PIC16Cxx, PIC16CXX, PIC18Fxx, PIC18FXX, PIC16C84, PIC16C74, 68HC11, 68HC05, programming, databasing, database programming, C/C++, Visual C, Visual C++, C++, Visual Basic, Visual C#, RS232, movie  props, film props, advertizing props, merchandising props, POP, POS, point of purchase, point of sale, inventory, shipping, reveiving, data acquisition, data aquisition, interface, interfaces, custom interface, custom  interfaces\"/>");
    }
}

function putHeader(indexPath, noLogo) {
    indexFile = indexPath;
    document.write("<!-- Title and Header images  -->");
    document.write("<div id=\"AGpageTitle\">	Absolute Genius </div>");
    document.write("<div id=\"AGpageTagline\"> " + menuName + " </div>");
    document.write("<div id=\"bgrepeat\"></div>");
    document.write("<div id=\"head\"></div>");
    document.write("<div id=\"titl\"></div>");
    document.write("<div id=\"top_menu\"></div>");
    if (noLogo != true) {
        document.write("<a href=\"" + (indexPath ? "home/contact.html" : "contact.html") + "\">");
        document.write("<img id=\"AG_GEN_ID_6\" alt=\"AbsoluteGenius\" style=\"position: absolute; left: 353px; top: 196px\" src=\"" + (indexPath ? "images/ag_bounce.gif" : "../images/ag_bounce.gif") + "\" />");
        document.write("</a>");
    }
    document.write("<!-- / Title and Header images  -->");
}

function putMenu(indexPath) {

    document.write("<!--  Side Border and Menu -->");
    document.write("<div id=\"AGuserMenuPosition\" style=\"overflow: visible; position: absolute; top: 231px; left: 19px;\">");
    document.write("    <div style=\"position: static;\" id=\"AGuserMenu\">");
    document.write("        <div class=\"AGuserButton0\" title=\"Home    \"><a style=\"text-decoration: none;\" href=\"" + (indexPath ? "index.html" : "../index.html") + "\">Home</a></div>");
	document.write("        <div class=\"AGuserButton0\" title=\"Software\"><a style=\"text-decoration: none;\" href=\"" + (indexPath ? "home/software.html" : "software.html") + "\">  Software </a></div>");
	document.write("        <div class=\"AGuserButton0\" title=\"Hardware\"><a style=\"text-decoration: none;\" href=\"" + (indexPath ? "home/hardware.html" : "hardware.html") + "\">  Hardware </a></div>");
	document.write("        <div class=\"AGuserButton0\" title=\"Contact \"><a style=\"text-decoration: none;\" href=\"" + (indexPath ? "home/contact.html" : "contact.html") + "\">   Contact  </a></div>");
	if (localDebug == true)
	document.write("        <div class=\"AGuserButton0\" title=\"Test Page\"><a style=\"text-decoration: none;\" href=\"" + (indexPath ? "home/_homepage.html" : "_homepage.html") + "\">Test Page</a></div>");
    document.write("        <div class=\"AGuserButton\" title=\"\"><a style=\"text-decoration: none;\" href=\"#\">&nbsp</a></div>");
    document.write("        <div class=\"AGuserButton0\" title=\" < Back \"><a style=\"text-decoration: none;\" href=\"javascript:goHistory(-1," + (indexPath ? "true" : "false") + ");\">  < Back  </a></div>");
    document.write("        <div class=\"AGuserButton0\" title=\" Forward > \"><a style=\"text-decoration: none;\" href=\"javascript:goHistory(1," + (indexPath ? "true" : "false") + ");\">  Forward >  </a></div>");
    document.write("    </div>");
    document.write("</div>");
    document.write("<!-- / Side Border and Menu -->");
}

function putFooter(indexPath) {
    document.write("<div class=\"AGpageFooter\" id=\"AG_FOOTER\" align=\"left\"><hr>");
    document.write("<table align=\"center\" width=\"100%\">");
    document.write("<tr align=\"center\" width=\"100%\">");
    document.write("<td align=\"center\" width=\"30%\"><a href=\"javascript:goHistory(-1," + (indexPath ? "true" : "false") + ");\"><img src=\"" + (indexPath ? "images/rewind_blue.gif" : "../images/rewind_blue.gif") + "\" border=\"0\" width=\"32\" height=\"32\" alt=\"Back\" title=\"Back\"><br>Back</a></td>");
    document.write("<td align=\"center\" width=\"30%\"><a href=\"javascript:goHistory(0," + (indexPath ? "true" : "false") + ");\"><img src=\"" + (indexPath ? "images/home.gif" : "../images/home.gif") + "\" border=\"0\" width=\"32\" height=\"32\" alt=\"Home\" title=\"Home\"><br>Home</a></td>");
    document.write("<td align=\"center\" width=\"30%\"><a href=\"javascript:goHistory(1," + (indexPath ? "true" : "false") + ");\"><img src=\"" + (indexPath ? "../images/fastforward_blue.gif" : "../images/fastforward_blue.gif") + "\" border=\"0\" width=\"32\" height=\"32\" alt=\"Forward\" title=\"Forward\"><br>Forward</a></td>");
    document.write("</tr>");
    document.write("</table>");
    document.write("</div>");
    document.write("<p>&nbsp</p>");
    lastMod = document.lastModified;
    copyYear = lastMod.substr(20, 4);
    document.write("<font size=\"1\"><p align=\"center\">Copyright &copy; " + copyYear + " Sean O\'Leary & Absolute Genius - Last modified " + lastMod + "</p></font>");
    //document.write("<font size=\"1\"<p>This Web site utilizes cookies in order to provide a better experience. We do not collect personal information without your knowledge and permission, nor to resell or distribute any site visitor data, including information that may be collected as a natural by-product of your visit. If you have any questions about our policy, please click <a href=\"cookie.html\">here</a>.</p></font>");
}

function goHistory(inHistory, indexPath) {
    if ((inHistory < 0) && (parent.history.length)) parent.history.back();
    else if ((inHistory > 0) && (parent.history.length)) parent.history.forward();
    else if (typeof (document.location) == "object") window.location.replace((indexPath ? "index.html" : "../index.html"));
    else window.location.href = (indexPath ? "index.html" : "../index.html");
}
