﻿var swf = "roomBuilder";
var flash;
var intro;

var jsReady = false;
var SWFReady = false;

var flashVersion = null;
var flashVisible = false;


function initFlash()
{
    var swf = "roomBuilder";
    
    // set 'flash' to point to correct object
	if( navigator.appName.indexOf("Netscape") != -1 )
	{
        // for some raeson FF seems to prefer this??!
        flash = window.document[swf];
	}
    else
    {
        flash = document.getElementById(swf)
    }
    
    jsReady=true;
}

function isReady() {
    return jsReady;
}

function setSWFIsReady() {
    SWFReady = true;
}    
		    
function UpdateFlash() {
    if(SWFReady) {
        flash.updateFlash();
    } else {
        var t = setTimeout("UpdateFlash()", 100);
    }
}

function SendFlashData() {
    if (SWFReady)
    {
        flash.updateRoomData();
    }
    else {
        // It is ok...
    }
} 

function AddWallItem( itemId, type, width ) {
    // HOX: changed for new drawing..
    if( SWFReady )
        flash.addWallItem( itemId, type, width, 1, 1 );
}

function AddInnerWall(width, height, depth, direction) {
    if( SWFReady )
        flash.addWall( width, height, depth, direction );
}

function ZoomIn() {
    if( SWFReady )
        flash.zoomIn();
}

function ZoomOut() {
    if( SWFReady )
        flash.zoomOut();
}

function ZoomToFit() {
    if( SWFReady )
        flash.centerCamera();
}

function RemoveRoomElement() {
    if( SWFReady )
        flash.deleteItems();
}

function UpdateWebservDone()
{
    SendMessage( 'refreshDesign' );
}