/***********************************
 * Name: toolsSlide.js
 * Type: javascript
 * Author: dbryson@magnifigroup.com
 * Purpose: Code which allows menu to be hidden and shown 
 ***********************************/

/* This variable is to denote whether the menu will be sliding up or down*/
var a=1;
var Id=0;
/* Denotes the position of the flash interface on the webpage*/
var ypos=0;
var mtsLoad = 0;
var soundLoad = 0;

var count = 0;
var cam = 0;
var translate = new Array();
var rotate = new Array();
var orb = new Array();
var interval = false;
var x = null;
/***********************************
 * Function: moveMenuStart(var name)
 * Purpose: function will be called by interface, and will 
 * 			pass var 'a' to moveMenu() in so that menu can 
 *			be moved down or up
 ***********************************/
function moveMenuStart(name){
	if (a==1){a=-1;}
	
	else{a=1;}

	if(!Id){moveMenu(name);}
}

/***********************************
 * Function: moveMenu(var ID)
 * Purpose: function moves interface up or down 15 pixels at a time
 ***********************************/
function moveMenu(ID){	
	if(ypos>4){ypos=0;}
	ypos=ypos+15*a;
	
	if(document.all){ //IE
		document.all[ID].style.bottom=ypos;	
	}
	
	if(document.layers){//NN4
		document.layers[ID].bottom=ypos;
	}
	
	if(!document.all && document.getElementById){//MO
		document.getElementById(ID).style.bottom=ypos+"px";
	}
	
	if (ypos<=-106 || ypos>=0){
		window.clearTimeout(Id);Id=0;//document.body.style.overflow='hidden';i=0;
	}
	
	else{		
		var m= "moveMenu('"+ID+"');";	
		Id = window.setTimeout(m,100);//Sets a delay for executing a function	
	}
}

/***********************************
 * Function: get_cam_Info()
 * Purpose: function finds and outputs the position of object on webpage
 ***********************************/
function get_cam_Info() { 
	var test =  vmp.GetProperty('MTSScene', 'tra_', 'mts_pnt3d');
	var test1 = vmp.GetProperty('MTSScene', 'orbd', 'mts_pnt3d');
	var test2 = vmp.GetProperty('MTSScene', 'rot_', 'mts_pnt3d');
	
	translate[count] = test;
	orb[count] = test1;
	rotate[count] = test2;
	
	alert("tra = " + translate[count] + "\n" + "rot = " + rotate[count] + "\n" + "orbd = " + orb[count]);
	
	count++;
	cam = count - 1;
}

function camera_Angle(choice){
	if(choice == 1) {
		if(cam != 0){cam--;}
		else{cam = count - 1;}
	}
	else{
		if(cam != (count-1)) {cam++;}
		else{cam=0;}
	}
	
	if(translate[cam] == null) {alert('No Camera Angles Saved');}
	else {
		vmp.SetProperty('MTSCamera','tra_',translate[cam],'mts_real');
		vmp.SetProperty('MTSCamera','rot_',rotate[cam],'mts_real');
		vmp.SetProperty('MTSCamera','orbd',orb[cam],'mts_real');
	}
}

function trans(){
	var tra = "[" + translate[cam] + "]";
	window.clipboardData.setData('Text', tra);
	alert("Translate = " + tra);
}

function rota(){
	var rot = "[" + rotate[cam] + "]";
	window.clipboardData.setData('Text', rot);
	alert("Rotate = " + rot);
}

function orb_d(){
	var orbdistance = "[" + orb[cam] + "]";
	window.clipboardData.setData('Text', orbdistance);
	alert("Orb = " + orbdistance);
}
/***********************************
 * Function: getVersion(var value)
 * Purpose: function alerts user to which version this is
 ***********************************/
function getVersion(value)
{
	if(value == 1)
	{alert('V1 – This is version one for your review.  Please send all changes to Geoff Guillory at Magnifi within 3 days of receipt.');}

	else if(value == 2)
	{alert('V2 – This is version two for your review.  Please send all FINAL changes to Geoff Guillory at Magnifi within 3 days of receipt.  This will be your last chance to make changes within the terms of your contract.');}

	else if(value == 3)
	{alert('V3 – This is a final version  -- changes from this point forward will incur change orders.');}
}

function showControl(){
	setTimeout('document.controls.GotoFrame(2)',0000);
}

function play(step)
{
	if(!document.all && document.getElementById){
		window.document["controls"].SetVariable("_root.whichStep", step);
	}
	else {
		document.controls.SetVariable("_root.whichStep", step);
	}
}

function MTSDone(){
	mtsLoad = 1;
	if(mtsLoad + soundLoad == 2){
		vmp.PostEvent("stopCount",0);	
	}
}

function loadDone(){
	soundLoad = 1;
	if(mtsLoad + soundLoad == 2){
		vmp.PostEvent("stopCount",0);	
	}
}