//load whiteboard

if (AC_FL_RunContent == 0) {
	alert("This page requires AC_RunActiveContent.js.");
} else {
	AC_FL_RunContent(
	'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
	'width', '100%',
	'height', '100%',
	'src', 'whiteboard',
	'quality', 'high',
	'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
	'align', 'middle',
	'play', 'true',
	'loop', 'true',
	'scale', 'showall',
	'wmode', 'window',
	'devicefont', 'false',
	'id', 'whiteboard',
	'bgcolor', '#ffffff',
	'name', 'whiteboard',
	'menu', 'true',
	'flashvars', 'identifier=stad|node_',
	'allowFullScreen', 'false',
	'allowScriptAccess','sameDomain',
	'movie', 'whiteboard',
	'salign', ''
	); //end AC code
}

//undertween
function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}
var LastItem ="";
var winW = 630;
var winH = 460;
var vUnderHeight = 298;
var open = false;

function openpop(vItem) {
	animatediv(vItem, "opennew");
}

function closepop(vItem) {
	if(getFlashMovie("whiteboard").popClose());
//	animatediv(vItem, "opennew");
}
 
function animatediv(vItem, vDirection) {
	getScreen();

	var topdiv = document.getElementById("topdiv");
	var whitediv = document.getElementById("whitediv");
	var contentdiv = document.getElementById(vItem);

	if(LastItem != "" && vDirection == "opennew" && open == true) {
		contentdiv = document.getElementById(LastItem);
		vDirection = "close";
	}

	if(vDirection == "close") {
		tweenTA = new Tween(new Object(),'xyz',Tween.backEaseIn,(winH - vUnderHeight),winH,1);
		open = false;
	}
	else {
		if(vItem == "strip") {
			vUnderHeight = 400;
		}
		else if(vItem == "contact") {
			vUnderHeight = 337;//285;
		}
		else {
			vUnderHeight = 350; //298;
		}
		tweenTA = new Tween(new Object(),'xyz',Tween.backEaseOut,winH,(winH - vUnderHeight),1);
		open = true;
	}

	contentdiv.style.display = "block";

	tweenTA.onMotionChanged = function(event){
		//testdiv.style.display = "block";
		contentdiv.style.height = Math.round(winH - event.target._pos) + "px";
		topdiv.style.height = Math.round(event.target._pos) + "px";
	};

	tweenTA.start();

	if(vDirection == "close" && vItem != LastItem) tweenTA.onMotionFinished = function() {
		contentdiv.style.display = "none";
		document.getElementById("strip").style.display = "none";
		document.getElementById("contact").style.display = "none";
		document.getElementById("cases").style.display = "none";
		document.getElementById("about").style.display = "none";
		contentdiv.style.height = "0px";
		topdiv.style.height = winH;
		animatediv(vItem, "open");
	}
	else if(vDirection == "close" && vItem == LastItem) tweenTA.onMotionFinished = function() {
		document.getElementById("strip").style.display = "none";
		document.getElementById("contact").style.display = "none";
		document.getElementById("cases").style.display = "none";
		document.getElementById("about").style.display = "none";
		contentdiv.style.height = "0px";
		topdiv.style.height = winH;
		
	}

	LastItem = vItem;
	

}

function resize() {
	if(LastItem != "" ) {
		getScreen();
		var topdiv = document.getElementById("topdiv");
		topdiv.style.height =  (winH - vUnderHeight) + "px";
	}
}

function getScreen() {
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
//			winH = document.body.offsetHeight -10;
			winH = document.body.offsetHeight -5;
		}
	}
}