/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
var movieName = "gallery";

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 getLayerWidthHeight()
{
	var fl;
	//alert(movieName);
	fl=getFlashMovieObject(movieName);
	if(fl)
	{
		//showscroll();
		/*alert("layer Width"+document.getElementById("iframecontent").offsetWidth);
		alert("doc clientWidth"+document.body.clientWidth);
		alert("doc offsetWidth"+document.body.offsetWidth);
		alert("doc scrollWidth"+document.body.scrollWidth);
		alert("layer Height"+document.getElementById("iframecontent").offsetHeight);
		alert("element Height"+document.documentElement.scrollHeight);
		alert("doc clientHeight"+document.body.clientHeight);
		alert("doc offsetHeight"+document.body.offsetHeight);
		alert("doc scrollHeight"+document.body.scrollHeight);
		document.getElementById("iframecontent").style.overflowX="hidden";
		document.getElementById("iframecontent").style.overflowY="hidden";*/
		if(document.getElementById("iframecontent").offsetWidth==document.body.clientWidth)
		document.getElementById("iframecontent").style.width=document.getElementById("iframecontent").offsetWidth-17;
		//alert("layer Width"+document.getElementById("iframecontent").offsetWidth);
		
	fl.SetVariable("/:stageWidth", document.getElementById("iframecontent").offsetWidth); 
	fl.SetVariable("/:stageHeight", document.getElementById("iframecontent").offsetHeight);
	//alert(fl.GetVariable("/:stageWidth"));
	
	//fl.setVariable
	fl.Play() ;//GotoFrame(2)resize
	//showscroll();
	}
}


function showscroll(){
var cw, iw, ow;
//clientWidth
if (document.documentElement&&document.documentElement.clientWidth)
cw=document.documentElement.clientWidth;
if (document.body&&document.body.clientWidth)
cw=document.body.clientWidth;
// firefox, mozilla, netscape
if (window.innerWidth){
iw=window.innerWidth;
if (iw!=cw){
alert('Vertical Scrollbar Does Exist');
}else{
alert('Vertical Scrollbar Does NOT Exist');
}
}else{
// IE
// offsetWidth
if (document.documentElement&&document.documentElement.offsetWidth)
ow=document.documentElement.offsetWidth;
if (document.body&&document.body.offsetWidth)
ow=document.body.offsetWidth;
if (ow!=cw){
alert('Vertical Scrollbar Does Exist');
}else{
alert('Vertical Scrollbar Does NOT Exist');
}
}
}


function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
	alert(document.getElementById(divid).style.offsetWidth);
}
function setFlashHeight(divid, newH){
	//alert(newH);
	document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
	alert(newW);
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	//alert("name");
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}