// JavaScript Document


//for flash to close window

function closeme () {
	
	window.open('','_parent','');window.close();
	
}
//these variables are used by the functions that allow the CULT3D to finish loading
var Cult3D;
var isLoaded = false;

//this is the function that is called when the Cult3D object is finished loading (it is referenced above
function finishedLoading(refObject){	
	if (typeof(Cult3D)=="object")
	{
		return;
	}
	
	Cult3D=new Cult3D_Object(refObject);
	if (Cult3D == null) {
		alert("not loaded");
	}

	if(Cult3D == null)
	{
		alert("Cult3D variable could not be initialized!");
	}
	else
	{
		isLoaded = true;
		//alert("Is Loaded");
		
	}		
}

//this function is another way of triggering events, could be used instead of cEvent (nme)
function triggerCommand(arg){
	if (isLoaded == true) {
		if (Cult3D != null) {
			if (!Cult3D.triggerEvent(arg)) {
			alert("Error trigger action");
		}
		}
		else {
			alert("Object not loaded");
		}
	} else {
		alert("Object not loaded");
	}
	Cult3D.setFocus();
}


//custom function for sending messages out to the flash player (swf IDed as "MyFlash")
function messageSent () {
//creates a variable for holding the message string
var msg;
//check to see if the Cult3D exists
if (Cult3D != null) {
//set the created msg variable to the last message sent by the cult3D object
msg=Cult3D.getLastMessage();
//alert box for tracing the messages, not needed for proper functioning
//alert("The message is " + msg);
//send the variable to flash. you really only need this conditioanl 
//statement if the cult3D was sending out certain messages that you would not want flash to receive.
window.document.myFlash.SetVariable ("myVar", msg);
} 
//if the cult3D isn't loaded properly, this will alert you
else{
		alert("Not initialized");
	}
}

//this function allows html to trigger events in cult 3D, could also use the triggerEvent function above...i have no idea how this function triggers events
function cEvent(nme) {
	if (Cult3D == null) {
		alert("Cult3d object not loaded, please use Internet Explorer.");
	} else {
		if (!Cult3D.triggerEvent(nme))
			alert("no such Event");
}
}
