//include in this file any custom code that you want your desktop to run 
//but not code that is specific to individual applications

var ib_desktop = {};
//default: tryfreq X trynum is 20 secs
ib_desktop.tryfreq = 20;
ib_desktop.trynum = 1000;
ib_desktop.bodyready = false;

ib_desktop.onStartUp = function()
{
	/******************************************************************************************/
	//at this point both the desktop initial DOM and the Ironbox framework should be available
	//so include in this section any custom code, including Ironbox calls, that need to run
	//immediately at start up, before the desktop_custom.js file arrives

	

	var tabmgr1 = new seaTabMgr();
	tabmgr1.onMakeTabs = function(tabset)
	{
		//tabset.tabbars[0].innerHTML = 'tabbar0';
		//tabset.tabbars[1].innerHTML = 'tabbar1';
		//tabset.tabbars[2].innerHTML = 'tabbar2';
			
		var minbak = (tabset.tabs[0].offsetWidth * tabset.tabs.length) + 2 * 100;	
		ironbox.bindEvent(window, 'resize', function(e)
		{			
			if (tabset.parentNode.offsetWidth <= minbak)
				tabset.style.width = minbak + 'px';
			else
				tabset.style.width = '100%';
		});	
			
			
	};
		
	var tabs1 = tabmgr1.makeTabs('tnav1', 'tabsheet', 'basic');




	//end of custom startup code
	/******************************************************************************************/
};

ib_desktop.onCouldNotStart = function()
{
	//give up trying to load desktop page after 20 secs -- (change time and how to respond if desired)
	alert('Error or delay loading website from server. Please refresh browser to try again.');
};

ib_desktop.testDomAvail = function()
{
	//this tests whether mydesktop.htm (or equivalent renamed file) has its DOM ready for access (returns true)
	//the 2nd test is to try to make this happen earlier than the window.onload event - it should work in most cases
	//(note: many types of dom-ready tests are possible, modify this if desired - 
	//but do not modify into a loop or setInterval, ironbox will do that automatically)

	return (ib_desktop.bodyready || Boolean(document && document.getElementById('dt_ref001')));
};



//***************************************
//Do Not Modify Code Below this Line

ib_desktop.onIronbox = function(){
ironbox.doNotUntil(ironbox.loadCustomDt, ib_desktop.testDomAvail, ib_desktop.tryfreq, ib_desktop.trynum, ib_desktop.onCouldNotStart);};
ib_desktop.onBeforeIbExt = function(){ironbox.loadExt();};
ib_desktop.dt_jsfiles = [
	["cgi/seaStar.exe?do=seatest&cgit=getfile&cgival=..\\seautils\\seaClasses\\ironbox_base.js", ib_desktop.onBeforeIbExt],
	["dtop/js/desktop_custom.js", null],
	["dtop/jdat/tabstyles.js", null],
	//["raphael", null],
	["seaTabs", "ib_desktop.onIronbox"]							
];
ib_desktop.loadIronbox = function(){
var be = function(x,y,z){if(x.addEventListener) x.addEventListener(y,z,false);
else if (x.attachEvent)	x.attachEvent('on' + y, z);};
var s = document.createElement('script'); s.type = 'text/javascript';
if (s.readyState){var c = false; be(s, 'readystatechange', function()
{if (!c && (/loaded|complete/.test(s.readyState)) )
{ib_desktop.dt_jsfiles[0][1](); c = true;}});} else be(s, 'load', ib_desktop.dt_jsfiles[0][1]);
s.src = ib_desktop.dt_jsfiles[0][0]; document.getElementsByTagName('head')[0].appendChild(s);}();

