// JavaScript Document
  function changeDivStyle (id, x, y, width, height, background)
  {
	  targetDiv = document.getElementById(id);
	   if(x != "no")targetDiv.style.left = x;
	   if(y != "no")targetDiv.style.top = y;		  	  
	  if(width != "no")targetDiv.style.width = width; 
	  if(height != "no")targetDiv.style.height = height;	
	  
	  if(id != "thecDrawing")return;	  
	   if(background != "undefined")
	   {      
		   targetDiv.style.backgroundImage = background;			   
		}
		if(background == "undefined")
	   {		  
		   targetDiv.style.backgroundImage = 'none';
		}
  }
  
  function divContent(id, inContent) 
{    
  document.getElementById(id).innerHTML = inContent;   
}

function getImgSize(imgSrc)
{   
  var newImg = new Image();
  newImg.src = imgSrc.replace('small', 'big');    
  var height = newImg.height;
  var width = newImg.width;
  return(newImg);
}

function changeImageSize (imgName,imgSrc, w, h)
{  
  
var pic = document.images[imgName];
pic.src = imgSrc;
pic.width = w;
pic.height = h;

}

function getBrowserSize()
{
var winObj = new Object();
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winObj.w = window.innerWidth;
  winObj.h = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winObj.w = document.body.offsetWidth;
  winObj.h = document.body.offsetHeight;
 }
}
return(winObj);
}

function getBrowserSizeForProducts()
{
var winObj = new Object();
if (parseInt(navigator.appVersion)>3) 
{
 if (navigator.appName=="Netscape")
 {
  winObj.w = window.innerWidth;
  winObj.h = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1)
 {
  winObj.w = document.body.offsetWidth;
  winObj.h = document.body.offsetHeight;
 }
}
getFlashMovie("productsMenuSwf_").sendBrowserSizeToAS(winObj);
}


function SendDataToFlashMovie()
{
   var flashMovie=getFlashMovieObject("myFlashMovie");
   flashMovie.SetVariable("/:message", 
   document.controller.Data.value);
}

function getFlashMovie(movieName)
{  
 return (swfobject.getObjectById(movieName));
}


function callToActionscript(flash, imgList)
{  
    
    if(document.getElementById('productsMain') == null)
	{		
	  getFlashMovie(flash).sendToActionscript("500", "600", imgList, getBrowserSize());
	  return null;
	}	
	
    var bgImg = document.getElementById('productsMain').getElementsByTagName('img')[0].src;	
	var newImg = getImgSize(bgImg);		
	getFlashMovie(flash).sendToActionscript(newImg.width, newImg.height, imgList, getBrowserSize());	
}
