var prefix = "";

function openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

function hover(obj) {
    if (obj.className=='tab_01') obj.className = 'tab_01a';
    else if (obj.className=='tab_01a') obj.className = 'tab_01';
    else if (obj.className=='tab_02') obj.className = 'tab_02a';
    else obj.className = 'tab_02';
}

function redirect(url) {
    document.location.href = prefix + url;
    return false;
}

function setPrefix(val) {
    prefix = val;
}

function writeHeader(showTitle, showPhone, title, headerStyle) {
    var phn = "(800)&nbsp;541-6612";
    var hdr;
    hdr =  "<table width='100%' border='0' cellpadding='0' cellspacing='0'>";
    hdr += "  <tr>";
    hdr += "    <td width='100%' align='right' style='padding:2px 2px 0 0;'>";
    hdr += "      <table width='350px' border='0' cellpadding='0' cellspacing='0'>";
    hdr += "        <tr>";
    hdr += "          <td width='20%' class='tab_01' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here to go to the main Index' nowrap='nowrap'><a href='javascript();' onclick='return redirect(\"index.html\");' style='text-decoration:none;'>Home</a></td>";
    hdr += "          <td width='40%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on the Adult Ortho-T Appliance' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"adult_ortho_t.html\");' style='text-decoration:none;'>Adult Ortho-T Appliance</a></td>";
    hdr += "          <td width='20%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on Perfit Bumpers' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"perfit_bumpers.html\");' style='text-decoration:none;'>Perfit Bumpers</a></td>";
    hdr += "          <td width='20%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on Softee Technique' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"softee.html\");' style='text-decoration:none;'>Softee Technique</a></td>";
    hdr += "        </tr>";
    hdr += "      </table>";
    hdr += "    </td>";
    hdr += "  </tr>";
    hdr += "  <tr>";
    hdr += "    <td><img src='" + prefix + "images/logo2.jpg' alt='Ortho-Tain, Inc.'></td>";
    hdr += "  </tr>";
    hdr += "  <tr>";
    hdr += "    <td width='100%' style='padding:0 2px;'>";
    hdr += "      <table width='100%' border='0' cellpadding='0' cellspacing='0'>";
    hdr += "        <tr>";
    hdr += "          <td width='12.375%' class='tab_01' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on Nite-Guide®' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"nite.html\");' style='text-decoration:none;'>Nite-Guide®</a></td>";
    hdr += "          <td width='13.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on Occlus-o-Guide®' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"occlus.html\");' style='text-decoration:none;'>Occlus-o-Guide®</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on the Interim G Retainer' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"interim.html\");' style='text-decoration:none;'>Interim 'G'</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on the Ortho-Tain Positioner®' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"position.html\");' style='text-decoration:none;'>OT Positioner®</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on our Products' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"prodguid.html\");' style='text-decoration:none;'>Products</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for Consumer Information' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"consumer.html\");' style='text-decoration:none;'>Consumer Info</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here to request information to be sent to you' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"request.html\");' style='text-decoration:none;'>Request Info</a></td>";
    hdr += "          <td width='12.375%' class='tab_02' onmouseover='hover(this);' onmouseout='hover(this);' title='Click here for information on Future Events' nowrap='nowrap'><a href='javascript()' onclick='return redirect(\"future.html\");' style='text-decoration:none;'>Future Events</a></td>";
    hdr += "        </tr>";
    hdr += "      </table>";
    hdr += "    </td>";
    hdr += "  </tr>";
    if (showPhone && title.value!="") {
        hdr += "  <tr><td>&nbsp;</td></tr>";
        hdr += "  <tr>";
        hdr += "    <td width='100%' style='text-align:left;'>";
        hdr += "      <table width='100%' border='0' cellpadding='0' cellspacing='0'>";
        hdr += "        <tr>";
        if (headerStyle && headerStyle.length > 0) {
            hdr += "          <td class='header_02' style='" + headerStyle + "'>" + title + "</td>";
        } else {
            hdr += "          <td class='header_02'>" + title + "</td>";
        }
        if (showPhone) {
            hdr += "          <td class='phone' nowrap='nowrap'>" + phn + "</td>";
        }
        hdr += "        </tr>";
        hdr += "      </table>";
        hdr += "    </td>";
        hdr += "  </tr>";
    } else if (showTitle && title.value!="") {
        hdr += "  <tr><td>&nbsp;</td></tr>";
        hdr += "  <tr>";
        if (headerStyle && headerStyle.length > 0) {
            hdr += "          <td class='header_02' style='" + headerStyle + "'>" + title + "</td>";
        } else {
            hdr += "          <td class='header_02'>" + title + "</td>";
        }
        hdr += "  </tr>";
    }
    hdr += "  <tr>";
    hdr += "    <td align='center'><br /><img width='400px' height='2px' src='" + prefix + "images/ruled.jpg'><br /><br /></td>";
    hdr += "  </tr>";
    hdr += "</table>";
    document.write(hdr);
}

function writeFooter() {
    var ftr;
    ftr =  "<table width='100%' border='0' cellpadding='0' cellspacing='0'>";
    ftr += "  <tr>";
    ftr += "    <td align='center'><br /><img width='400px' height='2px' src='" + prefix + "images/ruled.jpg'><br /><br /></td>";
    ftr += "  </tr>";
    ftr += "  <tr>";
    ftr += "    <td align='center'>";
    ftr += "      <ol class='list_none'>";
    ftr += "        <li class='list_none'>[ <a href='javascript()' onclick='return redirect(\"nite.html\");' title='Click to read about the Nite-Guide...'>Nite-Guide&reg;</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"occlus.html\");' title='Click read about the Occlus-o-Guide...'>Occlus-o-Guide&reg;</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"interim.html\");' title='Click read about the Interim G Retainer...'>Interim&#39;G&#39; Retainer&reg;</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"position.html\");' title='Click to read about the Ortho-Tain Positioner...'>Ortho-Tain Positioner&reg;</a></li>";
    ftr += "      </ol> ]<br />";
    ftr += "      <ol class='list_none'>";
    ftr += "        <li class='list_none'>[ <a href='javascript()' onclick='return redirect(\"prodguid.html\");' title='Click to see our product guide...'>Product Guide</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"adult_ortho_t.html\");'>Adult Ortho-T&reg; Appliance</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"perfit_bumpers.html\");'>Perfit&reg; Bumpers</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"softee.html\");'>Softee&#153; Technique</a></li>";
    ftr += "      </ol> ]<br />";
    ftr += "      <ol class='list_none'>";
    ftr += "        <li class='list_none'>[ <a href='javascript()' onclick='return redirect(\"habit_corrector.htm\");'>Habit-Corrector</a> |</li>";
    ftr += "        <li class='list_none'>[ <a href='javascript()' onclick='return redirect(\"hawley_form_retainer.htm\");'>Hawley-Form Retainer</a> |</li>";
    ftr += "        <li class='list_none'>[ <a href='javascript()' onclick='return redirect(\"consumer.html\");' title='Click to see our consumer information...'>Consumer</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"request.html\");' title='Click request information from Ortho-Tain, Inc...'>Request Info</a> |</li>";
    ftr += "        <li class='list_none'> <a href='javascript()' onclick='return redirect(\"future.html\");' title='Click to see our future event schedule...'>Future Events</a></li>";
    ftr += "      </ol> ]<br /><br />";
    ftr += "    </td>";
    ftr += "  </tr>";
    ftr += "  <tr>";
    ftr += "    <td class='copyright'>&copy; 1997-2009 by Ortho-Tain, Inc. All Rights Reserved.</td>";
    ftr += "  </tr>";
    ftr += "</table>";
    document.write(ftr);
}

function setCookie(name, value, expires, path, domain, secure) {
    document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var pre = name + "=";
    var begin = dc.indexOf("; " + pre);
    if (begin == -1) {
        begin = dc.indexOf(pre);
        if (begin != 0) return null;
    } else {  begin += 2; }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) { end = dc.length; }
    return unescape(dc.substring(begin + pre.length, end));
}

function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
