
var nBannersOnPage = 7;

var glb_Banners = new Array(
"olsh_bigcat.jpg|249|",
"olsh_bird1.jpg|247|",
"olsh_catmb.jpg|130|",
"olsh_bird2.jpg|247|",
"olsh_cat1.jpg|140|",
"olsh_bird3.jpg|249|",
"olsh_catsky.jpg|182|",
"olsh_ebonysunset.jpg|249|",
"olsh_mykitty.jpg|253|",
"olsh_owl.jpg|129|",
"olsh_swans.jpg|248|",
"olsh_puppy.jpg|130|",
"olsh_owl4.jpg|248|",
"olsh_sweetdream.jpg|280|",
"olsh_owl3.jpg|140|",
"olsh_owl2.jpg|130|"
);


function GetBannerIndex(nb)
{
    if ( nb < glb_Banners.length ) return nb;
    return parseInt(nb - glb_Banners.length);
}

function GetRandomBanner()
{
    var nBanner = parseInt(glb_Banners.length * Math.random());
    return nBanner;
}

function GetBannerImage(n)
{
    var nIndex = GetBannerIndex(n);
    var arr = glb_Banners[nIndex].split("|");
    spath = base + "images/" + arr[0]; 
    return spath;
}

function GetBannerWidth(n)
{
    var nIndex = GetBannerIndex(n);
    var arr = glb_Banners[nIndex].split("|");
    return parseInt(arr[1]);
}

function GetBannerComment(n)
{
    var arr = glb_Banners[GetBannerIndex(n)].split("|");
    return arr[2];
}

function InsertTopGallery()
{
    var nStart = GetRandomBanner();

    nWidth = oDiv.clientWidth;
    nCurWidth = 0;

    document.write("<table cellpadding=0 cellspacing=0 width='100%'>");
    document.write("<tr>");

    while ( nCurWidth < nWidth )
    {
        document.write("<td align=left width='1%' style='padding:0; border:0px solid blue;'>");
        document.write("<img border=0 src='");
        document.write(GetBannerImage(nStart));
        document.write("'>");
        document.write("</td>");

        nCurWidth += GetBannerWidth(nStart);
        nStart++;

        document.write("<td style='padding:0;' width='90%'>&nbsp;");
        document.write("</td>");

    }

    document.write("</tr>");
    document.write("</table>");

}

function insertCopyright()
{
    document.write("<p>");
    document.write("<table class='PageFooter' width='100%'>");
    document.write("<tr><td align='left'>&copy;Copyright 2006, Pet On Demand Studio.</td></tr>");
    document.write("</table>");
}

function insertTopNavigation(banner)
{
    if ( banner )
    {
    var nImg = GetRandomBanner();

    document.write("<table style='background-color:#E6E6C8;' background=#FFFFFF height='90px' width='100%' cellpadding='0' cellspacing='0'>");
    document.write("<tr>");
    document.write("<td valign=top align='left' style='padding-left:50px; background-color:#FFFFFF;'><img border=0 src='" + base + "images/egend.small.jpg'></td>");
    document.write("<td valign=top align='left' style='padding-top:20px; padding-right:10px; background-color:#FFFFFF;'><img border=0 src='" + base + "images/egend-software.jpg'></td>");
    document.write("<td class=BlueBg width='80%' valign=top align='right' style='padding-right:2;padding-top:5; background-color:#FFFFFF;'>");
    document.write("<a target='_blank' href='" + GetBannerWeb(nImg) + "'><img border='0' src='" + GetBannerImg(nImg) + "' alt='Visit a Web Site of Our Partner'></a>");
    document.write("</td>");
    document.write("</tr>");
    document.write("</table>");
    }

    document.write("<br>");
}


function insertBottomNavigation()
{
document.write("<table height='22px' width='100%' cellpadding='0' cellspacing='0'");
document.write("<tr>");
document.write("<td width='50%'>&nbsp;</td>");
document.write("<td>&nbsp;</td>");
document.write("<td valign='center'><a target='_self' href='" + base + "index.html'>[Home]</a></td>");
document.write("<td>&nbsp;</td>");
document.write("<td valign='center'><a target='_self' href='" + base + "sizeandprice.htm'>[Prices]</a></td>");
document.write("<td>&nbsp;</td>");
document.write("<td valign='center'><a target='_self' href='" + base + "contact.htm'>[Contact]</a></td>");
document.write("<td>&nbsp;</td>");
document.write("<td valign='center'><a target='_self' href='" + base + "legal.htm'>[Legal]</a></td>");
document.write("<td>&nbsp;</td>");
document.write("<td width='50%'>&nbsp;</td>");
document.write("</tr>");
document.write("</table>");
document.write("<br>&nbsp;");
}

function ShowBanner()
{
    index = GetRundomBanner();
    //alert(index);

    banner = glb_Banners[index].split("|");

    window.document.all.BannerPicture.src = base + "banners/" + banner[0];
    window.document.all.BannerURL.href = banner[1];
}

function ErrorMsg(strerr)
{
    document.write("<table cellcpasing=0 cellpadding=5>");
    document.write("<tr>");
    document.write("<td width='1%'>");
    document.write("<img src='");
    document.write(base + "images/stop.jpg'>");
    document.write("</td>");
    document.write("<td width='100%'>");
    document.write(strerr);
    document.write("</td>");
    document.write("</tr>");
    document.write("</table>");
}

function Navigate(strClue)
{
    switch (strClue)
    {
        case "Home"    : window.location.href = "index.html"; break;
        case "Prices"  : window.location.href = "sizeandprice.htm";  break;
        case "Gallery" : window.location.href = "gallery.htm";  break;
        case "Order"   : window.location.href = "order.htm";  break;
        case "Contact" : window.location.href = "contact.htm";  break;
        case "About"   : window.location.href = "about.htm";  break;
    }
}

function InsertSideMenu()
{
    document.write("<table width=200 cellcpasing=0 cellpadding=5 width='100%'>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('Home')\">");
    document.write("Home");
    document.write("</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('Prices')\">");
    document.write("Sizes and Prices");
    document.write("</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('Gallery')\">");
    document.write("Gallery");
    document.write("</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('Order')\">");
    document.write("Place an Order");
    document.write("</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('Contact')\">");
    document.write("Contact Us");
    document.write("</td>");
    document.write("</tr>");

    document.write("<tr>");
    document.write("<td class=SideMenuItem onclick=\"Navigate('About')\">");
    document.write("About &copy; Pet On Demand");
    document.write("</td>");
    document.write("</tr>");

    document.write("</table>");
}

