var sbyp = 100;   
(document.getElementById) ? dom = true : dom = false;

var aibr=false;

function hidesb() {
    if (dom) {
        document.getElementById("sbox").style.visibility='hidden';
    }
    if (document.layers) {
        document.layers["sbox"].visibility='hide';
    } 
}

function showsb() {
    if (aibr) {
        if (dom) {
            document.getElementById("sbox").style.visibility='visible';
        }
        if (document.layers) {
            document.layers["sbox"].visibility='show';
        }
        placesb();
    }
}

function placesb() {
    dowide();
    if (dom && !document.all) {
        document.getElementById("sbox").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-sbyp));
        document.getElementById("sbox").style.left = winW-610;
    }
    if (document.layers) {
        document.layers["sbox"].top = window.pageYOffset + (window.innerHeight - (window.innerHeight-sbyp));
        document.layers["sbox"].left = winW-610;
    }
    if (document.all) {
        document.all["sbox"].style.top = document.body.scrollTop + (document.body.clientHeight - (document.body.clientHeight-sbyp));
        document.all["sbox"].style.left = winW-610;
    }
    window.setTimeout("placesb()", 10); 
}

function buildsb() {
    var content = '<table border="0" cellspacing="0" cellpadding="0" width="250"><tr id="sbho"><td><a href="javascript:;" onclick="hidesb()"><img src="/searchb.gif" width="250" height="29" alt="Search Box. Click To Hide" border="0"></a></td></tr>';
    content = content + '<tr id="sbhp" valign="top"><td class="blc"><form method="get" action="searchresults.php"><input type="text" name="search" size="24"><input type="submit" name="submit" value="search"><br><br><small>Enter a product number, or text to search for and press the search button.</small></td></tr></table>';

    var x=document.getElementById('sbcont');

    var f=document.createElement('div');
    f.id='sbox';
    f.innerHTML = content;
    f.zIndex=5;
    x.appendChild(f);
    aibr=true;
}

var winW = 760, winH = 460;

function dowide() {
    winW = 760;
    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }
        if (navigator.appName.indexOf("Microsoft")!=-1) {
            winW = document.body.offsetWidth;
            winH = document.body.offsetHeight;
        }
    }
    if (winW>760) {
        var off=winW-760;
        off = Math.ceil(off / 2);
        winW = winW - off;
    }
}