// JavaScript Document
var movieName = "website-design-flash-environment-flash";

function thisMovie(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    return document.getElementById(movieName);
  }else{
	return window.document[movieName];  
  }
}

var easeSpeed=2;
var bigWidth=955;
var smallWidth=415;
var resFlInt=false;
var flashBig=false;
var flashBigSet=false;
function sizeFlash(){
		//ensure we know where the script is at any point
		flashBig=true;
		flashBigSet=false;
		//define div frames
		var docID = getElementObject('flashDiv');
		
		
		//enlarge flash
		var reference=getPageCoords(getElementObject('refPoint'));
		var bigX=reference.x-266;
		
		var curWidth = docID.offsetWidth;
		var curHeight = docID.offsetHeight;
		var coordsD = getPageCoords(docID);		
		var curX = coordsD.x;
		var goToW=Math.round(curWidth+((bigWidth-curWidth)/easeSpeed));
		var goToH=Math.round(curHeight*(goToW/curWidth));
		var goToX=Math.round(curX+((bigX-curX)/easeSpeed));
		
		if(curWidth == goToW){
				var stopNow=true;
				//document.getElementById('flashLink').innerHTML='<a href="javascript:outFlash();">Click here to restore</a>';
				flashBigSet=true;
				enableWhiteClick();
		}
		
		if(docID.style){
			docID.style.width=goToW+"px";
			docID.style.height=goToH+"px";
			docID.style.left=goToX+"px";
			
			if(stopNow!==true){
				resFlInt=setTimeout('sizeFlash()',50);
				//alert('from: '+curTop+' to element top: '+goTo);
			}
		}
}
function enlargeFlash(){
	if(flashBig!==true){
		//ensure we know where the script is at any point
		flashBig=true;
		
		flashBigSet=false;
		//define div frames
		var docID2 = getElementObject('flashFeather');
		
		var docID3 = getElementObject('flashLink');
		//fade in white background
		opacity('whiteOver', 0, 70, 300);		
		//fade out feather
		//var linkOut=setTimeout("opacity('flashLink', 100, 0, 300);	",400);
		var myFxFlash = new Fx.Scroll(window).toElement('refPoint');
		var flashFeather=setTimeout("opacity('flashFeather', 100, 0, 500)",1100);
		resFlInt=setTimeout('sizeFlash()',1700);
		if(thisMovie("website-design-flash-environment-enter")){
		thisMovie("website-design-flash-environment-enter").SetVariable("/:fadeOutLink","true"); 
		}
		if(thisMovie("website-design-flash")){
		thisMovie("website-design-flash").SetVariable("/:fadeOutLink","true"); 
		}
	}
}

function outFlash(){
	if(flashBigSet!==false){
		if(thisMovie("website-design-flash")){
			thisMovie("website-design-flash").SetVariable("/:fadeInV","true"); 
		}
		var myFxFlash = new Fx.Scroll(window).toElement('top');
	}
	flashBigSet=false;
	var reference=getPageCoords(getElementObject('refPoint'));
	var smallX=reference.x;
	
	var docID = getElementObject('flashDiv');
	var docID2 = getElementObject('flashFeather');
	
	var docID3 = getElementObject('flashLink');
	docID3.style.zIndex = '505';
	
	var curWidth = docID.offsetWidth;
	var curHeight = docID.offsetHeight;
	
	var coordsD = getPageCoords(docID);		
	var curX = coordsD.x;
	
	var goToW=Math.round(curWidth+((smallWidth-curWidth)/easeSpeed));
	var goToH=Math.round(curHeight*(goToW/curWidth));
	var goToX=Math.round(curX+((smallX-curX)/easeSpeed));
	clearTimeout(resFlInt);
	
	if(curWidth == goToW){
			var stopNow=true;
			//document.getElementById('flashLink').innerHTML='<a href="javascript:enlargeFlash();">Click here to enlarge</a>';
			
			
			
			//docID2.style.left=goToX+"px";
			//docID2.style.width=goToW+"px";
			//docID2.style.height=goToH+"px";
			//fade in white background
			opacity("flashFeather", 0, 100, 500)
					
			//fade out feather
			var whiteIn=setTimeout("opacity('whiteOver', 70, 0, 500)",700);
			//var linkIn =setTimeout("opacity('flashLink', 0, 100, 500);	",1000); 
	}
	
	if(docID.style){
		docID.style.left=goToX+"px";
		docID.style.width=goToW+"px";
		docID.style.height=goToH+"px";
		
		if(stopNow!==true){
			resFlInt=setTimeout('outFlash()',50);
			
			//alert('from: '+curTop+' to element top: '+goTo);
		}else{
			//docID2.style.left=goToX+"px";
			//docID2.style.width=(goToW+5)+"px";
			//docID2.style.height=(goToH+5)+"px";
			
			setTimeout("setFBF()",2000);
			
			
		}
	}
}
function setFBF(){
	flashBig=false;	
	if(thisMovie("website-design-flash-environment-enter")){
		thisMovie("website-design-flash-environment-enter").SetVariable("/:fadeInV","true"); 
	}
}

