
//globals
var browserWidth	= window.screen.width
var global			= window.document


//function to get offset top of an element. Used to place popup windows
function getTotalOffSetTop(e) 
{ 
    var i = 0; 
    while (e.tagName != 'BODY') 
            {                       
            i = i + e.offsetTop;                     
            e = e.offsetParent; 
            }                                               
    return i;       
}


//function to accomodate large popups
function getTop(e,popHeight)
{
	fromTop = getTotalOffSetTop(e)
	if((fromTop - (popHeight/2)) > 0 ){return (fromTop-(popHeight/2));}
	else{return 20;}
}


//function to open new window
function popIframe(url,fromTop,popHeight,popWidth)
{
	//set position
	document.getElementById('popContainer').style.top = fromTop;
	document.getElementById('popContainer').style.left = ((browserWidth/2)-(popWidth/2));
	//set size
	document.getElementById('popContainer').height = popHeight;
	document.getElementById('popContainer').width = popWidth;
	//set source and visibility
	document.getElementById('popContainer').src = "admin/inner_popup_iframe.asp?"  + url;
	document.getElementById('popContainer').style.visibility = "visible";
}


//function to close the popUp iframe
function closeIframe()
{
	document.getElementById('popContainer').style.visibility = "hidden";
	document.getElementById('popContainer').src = "";
	window.location.href = window.location.href
}


//function for iframe popup to call back and resize itself
function resizeIframe(fromTop,popHeight,popWidth)
{
	//set position
	document.getElementById('popContainer').style.top = fromTop
	document.getElementById('popContainer').style.left = ((browserWidth/2)-(popWidth/2));
	//set size
	document.getElementById('popContainer').height = popHeight;
	document.getElementById('popContainer').width = popWidth;
}

function popWindow(file,width,height,scroll,sizable)
	{window.open(file,'x','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scroll + ',resizable=' + sizable + ',width=' + width + ',height=' + height + ',left=10,top=10');}

function popRadio()
	{popWindow("player.asp",230,290,'no','no')}

