﻿function clickButton(e, buttonid) {
    var bt = document.getElementById(buttonid);
    if (typeof bt == 'object') {
        if (navigator.appName.indexOf("Netscape") > (-1)) {
            if (e.keyCode == 13) {

                if (bt.type == 'submit') {
                    showpleasewait();
                    bt.click();
                }
                else {
                    showpleasewait();
                    eval(bt.href);
                }
                return false;
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer") > (-1)) {
            if (event.keyCode == 13) {

                if (bt.type == 'submit') {
                    showpleasewait();
                    bt.click();
                }
                else {
                    showpleasewait();
                    eval(bt.href);
                }
                return false;
            }
        }
    }
}
function clickButtonv2(e, buttonid) {
    var bt = document.getElementById(buttonid);
    if (typeof bt == 'object') {
        if (navigator.appName.indexOf("Netscape") > (-1)) {
            if (e.keyCode == 13) {

                if (bt.type == 'submit') {
                    bt.click();
                }
                else {
                    eval(bt.href);
                }
                return false;
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer") > (-1)) {
            if (event.keyCode == 13) {

                if (bt.type == 'submit') {
                    bt.click();
                }
                else {
                    eval(bt.href);
                }
                return false;
            }
        }
    }
}

function showpleasewait() {
    showdeadcenterdiv(200, 100, 'pleasewaitScreen')
    //document.getElementById('pleasewaitScreen').style.display = 'inline'
}
function showdeadcenterdiv(Xwidth, Yheight, divid) {
    // First, determine how much the visitor has scrolled 

    var scrolledX, scrolledY;
    if (self.pageYoffset) {
        scrolledX = self.pageXoffset;
        scrolledY = self.pageYoffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrolledX = document.documentElement.scrollLeft;
        scrolledY = document.documentElement.scrollTop;
    } else if (document.body) {
        scrolledX = document.body.scrollLeft;
        scrolledY = document.body.scrollTop;
    }

    // Next, determine the coordinates of the center of browser's window 

    var centerX, centerY;
    if (self.innerHeight) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        centerX = document.documentElement.clientWidth;
        centerY = document.documentElement.clientHeight;
    } else if (document.body) {
        centerX = document.body.clientWidth;
        centerY = document.body.clientHeight;
    }

    // Xwidth is the width of the div, Yheight is the height of the 
    // div passed as arguments to the function: 
    var leftoffset = scrolledX + (centerX - Xwidth) / 2;
    var topoffset = scrolledY + (centerY - Yheight) / 2;

    //get the scroll postionn to use as our offset for our absolute position
    var scroll_pos = document.body.scrollTop;
    if (scroll_pos == 0) {
        if (window.pageYOffset)
            scroll_pos = window.pageYOffset;
        else
            scroll_pos = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
    }

    //get the full document width\height
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }

    var blur = document.getElementById('blur2');
    //set our blur layer to take over the entire width\height of the browser
    blur.style.width = parseInt(myWidth) + 'px';
    blur.style.height = parseInt(myHeight) + 'px';
    blur.style.display = 'block';
    
    // The initial width and height of the div can be set in the
    // style sheet with display:none; divid is passed as an argument to // the function
    var o = document.getElementById(divid);
    var r = o.style;
    r.position = 'absolute';
    r.top = topoffset + 'px';
    r.left = leftoffset + 'px';
    r.display = "block";
}

function doClear(theText) {
    if (theText.value == "Keyword or SKU" || theText.value == "Enter Keyword")  {
        theText.value = ""
    }
}

//***********************************************************************************
var browserType;
if (document.layers) { browserType = "nn4" }
if (document.all) { browserType = "ie" }
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
    browserType = "gecko"
}
function hidelogin() {
    if (browserType == "gecko")
        document.poppedLayer = eval('document.getElementById("ctl00_loginPanel")');
    else if (browserType == "ie")
        document.poppedLayer = eval('document.getElementById("ctl00_loginPanel")');
    else
        document.poppedLayer = eval('document.layers["ctl00_loginPanel"]');
    document.poppedLayer.style.visibility = "hidden";
}
function showlogin() {
    if (browserType == "gecko")
        document.poppedLayer = eval('document.getElementById("ctl00_loginPanel")');
    else if (browserType == "ie")
        document.poppedLayer = eval('document.getElementById("ctl00_loginPanel")');
    else
        document.poppedLayer = eval('document.layers["ctl00_loginPanel"]');
    document.poppedLayer.style.visibility = "visible";
}
function forcePostBack() {
    __doPostBack("", "");

}
//Trying to speed up omniture tagging
//$.get('/images/spacer.gif?iid=1111', function() { return false });







