DynAPI.setLibraryPath('/scripts/lib/')
DynAPI.include('dynapi.api.*');
DynAPI.include('dynapi.event.*');
DynAPI.include('dynapi.gui.*');

function hideLayers()
{
	if (DynAPI.document.children.length > 0 )
	{
		var index = DynAPI.document.children.length-1;
		DynAPI.document.children[index].setVisible(false);
	}
}


function showContent(content)
{
	if (DynAPI.loaded && DynAPI.document.children.length > 0)
	{
        var index = DynAPI.document.children.length-1;
		var p = DynAPI.document.children[index];
        if(window.screen.availHeight)
        {
            var wHeight = window.screen.availHeight;
            var wWidth = window.screen.availWidth;
        }
        else if(window.innerHeight)
        {
            var wHeight = window.innerHeight;
            var wWidth = window.innerWidth;
        }
		p.setURL(content+'&wHeight='+wHeight+'&wWidth='+wWidth);
		p.setVisible(true);
	}
}


DynAPI.onLoad = function() 
{
	var x = DynAPI.document.getWidth();
	var y = DynAPI.document.getHeight();
	var posX = x/2 - 250;
	var posY = y/2 - 200;

	lp = new LoadPanel();
	lp.moveTo(posX, posY);
	lp.setAutoResizeWidth(true);
	lp.setAutoResizeHeight(true);
	lp.setZIndex(300);


	myListener = new EventListener(lp);
	myListener.onload = function(e) 
	{
		var target = e.getTarget();
		var sx = DynAPI.document.getWidth();
		var sy = DynAPI.document.getHeight();
		var yscroll = (document.all) ? document.body.scrollTop : window.pageYOffset;
		var posX = 0.5 * ((sx + 20) - target.getWidth());
		//var posY = yscroll + 0.5 * (sy - target.getHeight());
        var posY = document.body.scrollTop + 10;
		target.moveTo(posX, posY);
	}
	lp.addEventListener(myListener);
	
	DynAPI.document.addChild(lp);
	DragEvent.enableDragEvents(lp);
	lp.setVisible(false);
}
