var IsNetscape1 = (navigator.appName.indexOf("Netscape") != -1);
var px1 = document.layers ? "" : "px";


function getAnElement1(id)
{
	return document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
}
//pricing control center variables
var thePBB;
var PCCtop1;
var PCCstop1;
var PccLocation1 = 0;
var VMessages1;
var RMessages1;
var Vclosebox1;
var Vtextbox1;

window.onresize = xPositionDivPbb;

function setPBBStart(startY)
{
 	
	thePBB=getAnElement1("divPBB");
	PCCtop1=getAnElement1("topBarR"); 
	if (VMessages1)
		InitializeVMessageHeight();
	if (RMessages1)
		InitializeRMessageHeight();
		
	if (thePBB)
	{
	    PCCstop1 = getAnElement1("bottomBarR").offsetTop - thePBB.offsetHeight - 30;
        if (startY) 
            thePBB.y = startY;
	    else 
            thePBB.y = 0;
	    
	    xPositionDivPbb(thePBB);
	    //setPBB();
	}
}

function xPositionDivPbb(pccDiv)
    {
        var startX1 = 790;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
  startX1 = (winW/2)+279;	
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
  startX1 = (winW/2)+289;	
 }
}


        if ( ! (pccDiv) )
            pccDiv = getAnElement1("divPBB");
        if (pccDiv)
        {
            var mOffset = getMastheadOffset1();
            if ( mOffset > 0 )
            {
                startX1 = startX1 -11 + mOffset;
            }
            pccDiv.style.left = startX1 + 'px';
            pccDiv.x = startX1;
        }
    }


    function getLeftOffset(obj) {
        var x = obj.offsetLeft
        while (obj = obj.offsetParent) x += obj.offsetLeft
        return x
    }
   
   function getMastheadOffset1 ()
   {
        var table = document.getElementById("masthead");
        if ( table == null )
        {
            return 0;
        }
        return getLeftOffset ( table );
   } 



	
function setPBB()
{
	var pY = (IsNetscape1 ? window.pageYOffset : (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 15;
	if (PccLocation1 == pY)
	{
		if(thePBB.y > PCCstop1)thePBB.y = PCCstop1;
		else
		{
			var dY = (pY > PCCtop1.offsetTop) ? pY : PCCtop1.offsetTop;
			thePBB.y += (dY - thePBB.y);
			thePBB.style.top=thePBB.y + px1;
			if (VMessages1)
			{
				if (VMessages1.y)
					VMessages1.style.top = thePBB.y + VMessages1.y +  px1;				
				else 
					VMessages1.style.top = thePBB.y + px1;
			}
			if (RMessages1)
			{
				if (RMessages1.y)
					RMessages1.style.top = thePBB.y + RMessages1.y +  px1;				
				else 
					RMessages1.style.top = thePBB.y + px1;
			}
		}
	}
	
	PccLocation1 = pY;
	
	setTimeout("setPBB()", 250);
}
