
var notice = new Array();
notice[0] = '<strong>The item was added to your cart!</strong>';
notice[1] = '<strong>The item could not be added to your cart!</strong>';

var thename  = "shop_notice";
var theobj;
var thetext;
var winHeight;
var winPositionFromTop;
var winPositionFromLeft;
var winWidth;
var startH = 2;
var positionModifier = 6;
var openTimer;

function ietruebody()
{
    return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}

function setObj(indx, inwidth, inheight)
{
    var myWidth = 0, myHeight = 0;
    var scrollbarWidth = 30;
    thetext = notice[indx];
    theobj = document.getElementById ? document.getElementById(thename) : document.all.thename;
    winWidth = inwidth;
    winHeight = inheight;

    if(document.all)
    {
        winPositionFromTop = !window.opera ? ietruebody().clientHeight : document.body.clientHeight;
    }

    if(!document.all)
    {
        winPositionFromTop = window.innerHeight;
        scrollbarWidth += 15;
    }

    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;
    }

    theobj.style.left = (myWidth - winWidth - scrollbarWidth) + "px";
    theobj.style.width = winWidth + "px";
    theobj.style.height = startH + "px";

    if(document.all)
    {
        theobj.style.top = ietruebody().scrollTop + winPositionFromTop + "px";
    }

    if(!document.all)
    {
        theobj.style.top = window.pageYOffset+winPositionFromTop+"px";
    }

    var iHtml =
    '<table cellspacing="0" cellpadding="0" style="width:'+winWidth+'px;height:"'+winHeight+'px;border:0;">' +
    '   <tr>' +
    '       <td style="width:50%;height:10px;">&nbsp;</td>' +
    '       <td style="width:50%;height:10px;text-align:right;">' +
    '       <span style="color:black;font-size:11px;font-family: Verdana, sans-serif;"><a href="javascript:void(0)" onclick="clearTimeout(openTimer);hideIt()"><img src="../images/common/btn-cancel.gif" width="13" height="13" border="0" alt="close window" title="close window" /></a></span>' +
    '       </td>' +
    '   </tr>'+
    '   <tr>' +
    '       <td colspan="2" width="100%" valign="top">' +
    '       <span class="plainText">'+thetext+'</span>' +
    '       </td>' +
    '   </tr>'+
    '</table>';

    theobj.innerHTML = iHtml;

    viewIt();
}

function viewIt()
{
    if(startH <= winHeight)
    {
        theobj.style.visibility = "visible";

        if(document.all)
        {
            theobj.style.top = ((ietruebody().scrollTop + winPositionFromTop) - startH - positionModifier) + "px";
        }

        if(!document.all)
        {
            theobj.style.top = ((window.pageYOffset + winPositionFromTop) - startH - positionModifier) + "px";
        }

        theobj.style.height = startH + "px";
        startH += 2;
        openTimer = setTimeout("viewIt()",10);
    }
    else
    {
        clearTimeout(openTimer);
        openTimer = setTimeout("autoStopIt()",8000);
    }
}

function hideIt()
{
    if(startH > 0)
    {
        if(document.all)
        {
            theobj.style.top = ((ietruebody().scrollTop + winPositionFromTop) - startH - positionModifier) + "px";
        }

        if(!document.all)
        {
            theobj.style.top = ((window.pageYOffset + winPositionFromTop) - startH - positionModifier) + "px";
        }

        theobj.style.height = startH + "px";
        startH -= 2;
        openTimer = setTimeout("hideIt()",10);
    }
    else
    {
        stopIt();
    }
}

function stopIt()
{
    clearTimeout(openTimer);
    theobj.innerHTML = "";
    theobj.style.visibility = "hidden";
    startH = 2;
}

function autoStopIt()
{
    clearTimeout(openTimer);
    hideIt();
}