function getOffset(element)
{
	valueT = 0;
	valueL = 0;
	do
	{
		valueT += element.offsetTop  || 0;
		valueL += element.offsetLeft || 0;
		element = element.offsetParent;
	} while (element);
};

function getElementPosition(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

//Used to support rollover images
function rollImg(btnID, img) 
{
    if(document.images) 
    {
        
        var btn = document.getElementById(btnID);
        if(btn)
            btn.src = img;
    }
}

//Used to catch the enter key in a textbox and click a button
function catchEnterKey(txtID, btnID)
{
    var txt = document.getElementById(txtID);
    var btn = document.getElementById(btnID);
    
    if(event.keyCode == 13 && txt && btn)
    { 
        btn.click(); 
        event.handled='true';
    }
}

//Used to open up new windows for descriptions
function newWin(contentURL, windowName)
{
    var inWindow = window.open(contentURL, windowName, 'scrollbars=yes,toolbar=no,location=yes,resizable=yes,width=640,height=480');
	inWindow.focus();
}

function disableItem(itemID)
{
    var item = document.getElementById(itemID);
    alert(item);
    if(item)
        item.disabled = true;
}

function centerWin(url, windowName, width, height)
{
    var bw, bh, bl, bt;
    
    if (document.all)
    {
        alert('document.all');
        bw = document.body.clientWidth;
        bh = document.body.clientHeight;
        bl = window.screenLeft;
        bt = window.screenTop;
    }
    else if (document.layers)
    {
        bw = window.outerWidth;
        bh = window.outerHeight;
        bl = window.screenX;
        bt = window.screenY;
    }

    var leftPos = Math.floor((bw-width)/2) + bl;
    var topPos = Math.floor((bh-height)/2) + bt;
    
    <!-- window.open(url, windowName, 'height=' + height + ', width=' + width + ', top=' + topPos + ', left=' + leftPos + 'resizable=no, toolbar=no, menubar=no, titlebar=no, alwaysraised=yes, dependent=yes'); -->
    
    alert(bw + ' ' + bh + ' ' + bl + ' ' + bt + ' ' + leftPos + ' ' + topPos);
}

try
{
    checkForFrame();
}
catch(e)
{
}

function checkForFrame()
{
    try
    {
        if (top.location != location)
        {
            top.location.href = document.location.href ;
        }
    }
    catch(ex){}
}