var ofm_loaded = false;
var ofm_interval = 0;
var ofm_layer = '';
var ofm_crd = new Array();

var so = new SWFObject("orbit_flash/OrbitFlashMap_modern.swf", "ofm", "640", "480", "8", "#F0F8FC");
so.addParam("scale", "noscale");
so.addParam("wmode", "transparent");
so.addVariable("SKIP_FIRST_VIEW", "true");
so.addVariable("LOAD_JS_GATEWAY", "true");
so.useExpressInstall('orbit_flash/expressinstall.swf');
//timeout
function checkOfmTimeOut()
{
    if (document.ofm.getClientState() == 'timeout') location.href = 'showcase.php';
}
this.publicInterfaceLoaded = function() {
    var ofm = document.getElementById("ofm");
	ofm.setKeepAlive(800); // session timeout default is 900 seconds
	ofm_loaded = true;
}

function orbitStatus(layer)
{
    ofm_layer = layer;
    if (arguments.length > 1) ofm_crd = arguments[1];
    ofm_interval = setInterval('orbitLoaded()', 100);
}

function orbitLoaded()
{
	if (ofm_loaded) {
		setInterval('checkOfmTimeOut()', 60000);
		clearInterval(ofm_interval);
        document.ofm.setVisibleLayers([ofm_layer]);
		//alert(ofm_crd['minX']);
        if (ofm_crd['minX']){
			//alert('ofm_crd: '+ofm_crd);
			document.ofm.zoomToBoundingBox(ofm_crd);
		}
        else document.ofm.zoomToExtent(-5000);
    }
}

