var g_flashInstances = 1;

function setBlockHeight(blockName,h)
{

    document[blockName].height = h;
}
function setBlockSize(blockName,w,h)
{
 	document[blockName].width = w;
    document[blockName].height = h;
}

//COLA PRESENTACION DE MODALES
function flash_modal_queue(movie,flashvars)
{
	p_modals.push([movie,flashvars]);
	if(p_cmodal == null && 	modals_present) flash_modal_present();
}
flash_modal = flash_modal_queue;
function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}
function getHeight() 
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return myHeight;
}
function getScrollY()
{
    var scrollX,scrollY;
    if (document.all)
    {
       if (!document.documentElement.scrollLeft)
          scrollX = document.body.scrollLeft;
       else
          scrollX = document.documentElement.scrollLeft;
             
       if (!document.documentElement.scrollTop)
          scrollY = document.body.scrollTop;
       else
          scrollY = document.documentElement.scrollTop;
    }   
    else
    {
       scrollX = window.pageXOffset;
       scrollY = window.pageYOffset;
    }
    return scrollY;
}
function flash_modal_present()
{
	if(p_modals.length==0)
	{ 
		try{
			on_modals_end();
		}catch(e)
		{
		}
		return;
	}
	
	var newmodal = p_modals[0];
	
	var flaname = "flash_"+g_flashInstances; 
    g_flashInstances++;


    var fm = document.getElementById("flash_modal");
	fm.style["display"] = "block";
	fm.innerHTML = "<div style='position:absolute; left:0px; top: 0px; width: 100%; height: "+(getPageSizeWithScroll()[1])+"px; z-index: 10;' id='subflash_modal_"+g_flashInstances+"' ></div>";

	var fmsub = document.getElementById("subflash_modal_"+g_flashInstances);
	fmsub.innerHTML = flash_insert_id_trans("/comun/swf/modal_loader","100%","100%","&modal_ini="+getScrollY()+"&modal_win="+getHeight()+"&msg="+newmodal[0]+"&"+newmodal[1],flaname);
	
	p_cmodal = newmodal;
	
}
function flash_modal_end()
{
 	var fm = document.getElementById("flash_modal");
	fm.innerHTML = "";
	fm.style["display"] = "none";
	p_cmodal = null;
	p_modals.shift();
	flash_modal_present();
}
function modals_count()
{
	return p_modals.length;
}
	var modals_present=false;
var p_modals = Array();
var p_cmodal = null;

///////


function flash_insert(movie,width,height,flashvars)
{
	var flaname = "flash_"+g_flashInstances;
    g_flashInstances++;
	flash_insert_id(movie,width,height,flashvars,flaname);
}

function flash_insert_id(movie,width,height,flashvars,id)
{
    if (AC_FL_GenerateContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		return AC_FL_GenerateContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'menu', 'false',
			'scale', 'noScale',
			'wmode', 'opaque',
			'devicefont', 'false',
			'id', id,
			//'bgcolor', '#ffffff',
			'name', id,

			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
            'flashvars',escape("myHTMLname="+id+"&html_width="+width+"&html_height="+height+"&"+flashvars),
			'movie', movie,
			'salign', ''
			); //end AC code
	}
}
function flash_insert_id_noesc(movie,width,height,flashvars,id)
{
    if (AC_FL_GenerateContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		return AC_FL_GenerateContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noScale',
			'wmode', 'opaque',
			'devicefont', 'false',
			'id', id,
			//'bgcolor', '#ffffff',
			'name', id,
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
            'flashvars',"myHTMLname="+id+"&html_width="+width+"&html_height="+height+"&"+flashvars,
			'movie', movie,
			'salign', ''
			); //end AC code
	}
}
function flash_insert_id_trans(movie,width,height,flashvars,id)
{
    if (AC_FL_GenerateContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
	
		return AC_FL_GenerateContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noScale',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', id,
			//'bgcolor', '#ffffff',
			'name', id,
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
            'flashvars',"myHTMLname="+id+"&html_width="+width+"&html_height="+height+"&"+flashvars,
			'movie', movie,
			'salign', ''
			); //end AC code
			
			
	}
	
}
function flash_trans(movie,width,height,flashvars)
{
    var flaname = "flash_"+g_flashInstances;
    g_flashInstances++;
    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=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noScale',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', flaname,
			//'bgcolor', '#ffffff',
			//'name', flaname,
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
             'flashvars',"myHTMLname="+flaname+"&html_width="+width+"&html_height="+height+"&"+flashvars,
			'movie', movie,
			'salign', ''
			); //end AC code
	}
}
function flash(movie,width,height,flashvars)
{
    var flaname = "flash_"+g_flashInstances;
    g_flashInstances++;
    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=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noScale',
			'wmode', 'opaque',
			'devicefont', 'false',
			'id', flaname,
			//'bgcolor', '#ffffff',
			'name', flaname,
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
             'flashvars',"myHTMLname="+flaname+"&html_width="+width+"&html_height="+height+"&"+flashvars,
			'movie', movie,
			'salign', ''
			); //end AC code
	}
}
//tu te crees 
function flash_notrans(movie,width,height,flashvars)
{
    /*var flaname = "flash_"+g_flashInstances;
    g_flashInstances++;
    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=8,0,0,0',
			'width', width,
			'height', height,
			'src', movie,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'noScale',
			'wmode', 'window',
			'devicefont', 'false',
			//'id', flaname,
			//'bgcolor', '#ffffff',
			'name', flaname,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
           'flashvars',"myHTMLname="+flaname+"&html_width="+width+"&html_height="+height+"&"+flashvars,
			'movie', movie,
			'salign', ''
			); //end AC code
	}*/
	
	
		var flaname = "flash_"+g_flashInstances; 
	

    g_flashInstances++;
	document.write(		//"<div style='position:absolute; float:left:0px; top:0px; width: 100%; height: 100%;z-index: 10;' >"
						flash_insert_id(movie,width,height,flashvars,flaname)
						//+"</div>"
					);
	
}
