﻿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 SelectPicture() {
    var randomnumber = Math.floor(Math.random() * 9) // 4 will give you a number between 0 and 3
    var mypicturearray = new Array();
    mypicturearray[0] = "Crystals-120x120.png";
    mypicturearray[1] = "WomanRock-120x120.jpg";
    mypicturearray[2] = "WomanSea-120x120.jpg";
    mypicturearray[3] = "WomanWoods-120x120.jpg";
    mypicturearray[4] = "Distant-Healing-120x120.jpg";
    mypicturearray[5] = "WomanBirds-120x120.jpg";
    mypicturearray[6] = "Journal-120x120.jpg";
    mypicturearray[7] = "Massage-120x120.jpg";
    mypicturearray[8] = "Sunset-120x120.jpg";
    document.write("<td><img class=\"noborder\" alt=\"Detoxity\" src=\"Images/" + mypicturearray[randomnumber] + "\"/></td>");
}   

function expandpoem(thistag, tag) {
    styleObj = document.getElementById(thistag).style;
    if (styleObj.display == 'none') {
        styleObj.display = '';
        tag.innerHTML = "Click Here To Hide The Poem";
    }
    else {
        styleObj.display = 'none';
        tag.innerHTML = "Click Here To See The Poem";
    }
}
function GetReferredPage() {
    document.write(document.referrer);
}
function GetReferredPageText() {
    document.write("<input type=\"hidden\" name=\"refurl\" value=\"" + document.referrer + "\" />");
}
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 ShowSearchBox()
{
    document.write("<form method=\"get\" action=\"http://www.google.com/search\">");
    document.write("<div class=\"SearchBox\" >");
    document.write("    <table border=\"0\" cellpadding=\"0\">");
    document.write("        <tr><td>");
    document.write("	<input type=\"text\"   name=\"q\" size=\"25\" maxlength=\"255\" value=\"\" />");
    document.write("	<input type=\"submit\" value=\"Web Search\" />");
    document.write("		</td></tr>");
    document.write("        <tr><td align=\"left\">");
    document.write("		<input type=\"radio\"  name=\"sitesearch\" value=\"www.detoxity.co.uk\" checked=\"checked\" /> Detoxity <br />");
    document.write("	    <input type=\"radio\"  name=\"sitesearch\" value=\"\" /> Web ");
    document.write("	    </td></tr>");
    document.write("    </table>");
    document.write("</div></form>");
}
function ShowFacebook() 
{
    document.write("<script type=\"text/javascript\">");
    document.write("function fbs_click() { u = location.href; t = document.title; window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false; }");
    document.write("</script>");
    document.write("<a href=\"http://www.facebook.com/share.php?u=<url>\" onclick=\"return fbs_click()\" target=\"_blank\" class=\"fb_share_link\">Share on Facebook</a>");
}
function ShowTwitter() 
{
document.write("<script type=\"text/javascript\" src=\"http://ajax.twitthis.com/chuug.twitthis.scripts/twitthis.js\"></script>");
document.write("<a href=\"javascript:;\" onclick=\"TwitThis.pop();\"><img src=\"Images/twitter.png\" alt=\"TwitThis\" style=\"border:none;\" />Twit This</a>");
}
function VerticalMenu()
{
    //document.write(location.href); // location.href is full url.
    //document.write("<td><a href=\"Thai-Massage.html\" ><img class=\"noborder\" alt=\"Thai Massage\" src=\"Images/Banner1.gif\" /></a></td>");
    document.write("<td class=\"rightcoltext\">");
    document.write("<ul  id=\"vmenu\"><!-- Start of Vertical Menu -->");
    document.write("<li><a href=\"javascript:bookmarksite('Detoxity','http://www.detoxity.co.uk/');\" target=\"_self\">Add To Favourites</a></li>");
    document.write("<li><a href=\"http://www.addthis.com/bookmark.php\" target=\"_blank\">Bookmark and Share</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/JoinDiscussion.html\">Join Discussion Group</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/WordPress/\">Visit Blog</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/Recommend.html\">Tell a Friend</a></li>");
    document.write("</ul>");
    document.write("<table><tr><td height=\"5px\" width=\"200px\" bgcolor=\"#390481\"></td></tr></table>");
    document.write("<p class=\"Heading1\">How Well Are You?</p>");
    document.write("<p>Discover how you can dramatically improve your health and banish the symptoms of illness in only 90 days!");
    document.write("Order a simple hair test that can identify the real underlying cause(s) of your health problems.</p>");
    document.write("<a rel=\"external\" href=\"http://www.bionetics.co.uk\"><img class=\"ICtr\" src=\"Images/Bionetics187X33.jpg\" alt=\"Bionetics\" /></a>");
    document.write("<!-- Start of Facebook --><script type=\"text/javascript\">    ShowFacebook();</script><br /><!-- End of Facebook -->");
    document.write("<!-- Start of Twit This --><script type=\"text/javascript\">    ShowTwitter();</script><!-- End of Twit This -->");
    document.write("<div class=\"SubscribeBox\" >	");
    document.write(" <img src=\"http://groups.google.com/groups/img/3nb/groups_bar.gif\" height=\"26\" width=\"132\" alt=\"Google Groups\" />");
    document.write(" <p>See what others are saying<br />about Detoxity</p>Click <a href=\"http://groups.google.com/group/detoxity?hl=en\">Here</a> to visit the Forum or <br />");
    document.write(" <b>Subscribe to Detoxity</b>");
    document.write(" <form style=\"margin-top:0px\"  action=\"http://groups.google.com/group/detoxity/boxsubscribe\">");
    document.write("  <input type=\"hidden\" name=\"hl\" value=\"en\" />");
    document.write("  Email: <input type=\"text\" name=\"email\" />");
    document.write("  <input type=\"submit\" name=\"sub\" value=\"Subscribe\" />");
    document.write("  </form>");
    document.write("</div><br />");
    document.write("<script type=\"text/javascript\">    ShowSearchBox();</script><br />");
    document.write("</td> <!--  End of Right Column -->");
}
function RightColumn() {
    document.write("<ul  id=\"vmenu\"><!-- Start of Vertical Menu -->");
    document.write("<li><a href=\"javascript:bookmarksite('Detoxity','http://www.detoxity.co.uk/');\" target=\"_self\">Add To Favourites</a></li>");
    document.write("<li><a href=\"http://www.addthis.com/bookmark.php\" target=\"_blank\">Bookmark and Share</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/JoinDiscussion.html\">Join Discussion Group</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/WordPress/\">Visit Blog</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/Recommend.html\">Tell a Friend</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/Recommended-Products.html\">Recommended Products</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/Store\">Visit Online Shop</a></li>");
    document.write("<li><a href=\"http://www.detoxity.co.uk/Search-Detoxity.html\">Search Detoxity Site</a></li>");
    document.write("</ul>");
    document.write("<table><tr><td height=\"5px\" width=\"200px\" bgcolor=\"#390481\"></td></tr></table>");
    document.write("<p class=\"Heading1\">How Well Are You?</p>");
    document.write("<p>Discover how you can dramatically improve your health and banish the symptoms of illness in only 90 days!");
    document.write("Order a simple hair test that can identify the real underlying cause(s) of your health problems.</p>");
    document.write("<a rel=\"external\" href=\"http://www.bionetics.co.uk\"><img class=\"ICtr\" src=\"Images/Bionetics187X33.jpg\" alt=\"Bionetics\" /></a>");
    document.write("<!-- Start of Facebook --><script type=\"text/javascript\">    ShowFacebook();</script><br /><!-- End of Facebook -->");
    document.write("<!-- Start of Twit This --><script type=\"text/javascript\">    ShowTwitter();</script><!-- End of Twit This -->");

        
}
function PageFooter()
{ 
document.write("<table class=\"MainFooter\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.write("<tr>");
document.write("<td class=\"FooterLeft\">");
document.write("</td>");
document.write("<td class=\"FooterCenter\">");
document.write("</td>");
document.write("<td class=\"FooterRight\">");
document.write("</td>");
document.write("</tr></table>");
}
// 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;
}
// Run the externallinks script when the page loads
window.onload = externalLinks;
