// JavaScript Document

if (top.frames.length!=0)
top.location=self.document.location;
self.moveTo(0,0);
self.resizeTo((screen.availWidth),(screen.availHeight));

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/
function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 30 + "px";
  }
}

function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
     }
}
//----------------------------------------------------------------

function apri(url, name, width, height) { 
if (document.all) { 
var x = window.screenLeft; 
var y = window.screenTop; 
var w = window.document.body.offsetWidth; 
var h = window.document.body.offsetHeight; 
} 
else { 
var x = window.screenX; 
var y = window.screenY; 
var w = window.outerWidth; 
var h = window.outerHeight; 
} 
var cntx = x + Math.round((w - width) / 2); 
var cnty = y + Math.round((h - height) / 2); 
window.open (url, name, 'left=' + cntx + ',top=' + cnty + ',width=' + 
width + ',height=' + height + ',resizable=0, toolbar=0, scrollbars=0, locationbar=0, status=no, menu=false'); 
} 

function apri_scroll(url, name, width, height) { 
if (document.all) { 
var x = window.screenLeft; 
var y = window.screenTop; 
var w = window.document.body.offsetWidth; 
var h = window.document.body.offsetHeight; 
} 
else { 
var x = window.screenX; 
var y = window.screenY; 
var w = window.outerWidth; 
var h = window.outerHeight; 
} 
var cntx = x + Math.round((w - width) / 2); 
var cnty = y + Math.round((h - height) / 2); 
window.open (url, name, 'left=' + cntx + ',top=' + cnty + ',width=' + 
width + ',height=' + height + ',resizable=0, toolbar=0, scrollbars=1, locationbar=0, status=no, menu=false'); 
} 

//----------------------------
//Funzioni Java-Flash
// F. Permadi May 2000
//----------------------------
function getFlashMovieObject(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);
  }
}

function StopFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.StopPlay();
}

function PlayFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.Play();
	//embed.nativeProperty.anotherNativeMethod();
}

function RewindFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.Rewind();
}

function NextFrameFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	// 4 is the index of the property for _currentFrame
	var currentFrame=flashMovie.TGetProperty("/", 4);
	var nextFrame=parseInt(currentFrame);
	if (nextFrame>=10)
		nextFrame=0;
	flashMovie.GotoFrame(nextFrame);		
}


function ZoominFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.Zoom(90);
}

function ZoomoutFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.Zoom(110);
}


function SendDataToFlashMovie(vars)
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.SetVariable("/:num", vars);
}

function SendDataToFlashMovie_2(vars)
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	flashMovie.SetVariable("/:num", vars);
	flashMovie.SetVariable("/:selected", "3");
	flashMovie.SetVariable("/:da_ricette", "si");
}

function ReceiveDataFromFlashMovie()
{
	var flashMovie=getFlashMovieObject("myFlashMovie");
	var message=flashMovie.GetVariable("/:message");
	document.controller.Data.value=message;
}



