/* Funciones para flash */
function insertar_flash(nombre, w, h, variables, bgcolor)
{
    
       document.write(" <object style='z-index:0' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='" + w + "' height='" + h + "' id='" + nombre + "' align='middle' VIEWASTEXT>");
       document.write(" <param name='allowScriptAccess' value='sameDomain' />");
       document.write("<param name='movie' value='flash/" + nombre + ".swf" + variables + "' />");
       document.write("<param name='quality' value='high' />");
       document.write("<embed src='flash/" + nombre + ".swf" + variables + "' quality='high' bgcolor='" + bgcolor + "' width='" + w + "' height='" + h + "' name='" + nombre + "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
       document.write("</object>");
}
function flash_transparente(cual, width, height, variables)
{
       document.write("<object style='z-index:0' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='" + width + "' height='" + height + "' id='" + cual + "' align='middle' VIEWASTEXT>");
       document.write("<param name='allowScriptAccess' value='sameDomain' />");
       document.write("<param name='movie' value='../flash/" + cual + ".swf" + variables + "' />");
       document.write("<param name='quality' value='high' />");
       document.write("<param name='wmode' value='transparent'>");
       document.write("<embed wmode='transparent'  src='../flash/" + cual + ".swf" + variables + "' quality='high' width='" + width + "' height='" + height + "' name='" + cual + "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
       document.write("</object>");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/* Obtener QueryString */
function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}

/* Pre cargar imagenes */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function precargar()
{
	MM_preloadImages(''
					 );
}

function mostrar_menu(cual)
{
	menuAnimado(cual,"OPEN");
}
function esconder_menu(cual)
{
	menuAnimado(cual,"CLOSE");
}

/*MENU CON CLASE*/

var currM1;
function menu1(tipo, cual)
{
	if (cual != currM1)
	{
	document.getElementById('m1_' + cual).className='td-menu1' + tipo;
	}
}
function setMenu1(cual)
{
	if (document.getElementById('m1_' + cual))
	{
		document.getElementById('m1_' + cual).className='td-menu1_on';
		document.getElementById('m1_a' + cual).className='link-menu1_on';
		currM1 = cual;
	}
}

var currSM1;
function submenu1(tipo, cual)
{
	if (cual != currSM1)
	{
	document.getElementById('sm1_' + cual).className='td-submenu1' + tipo;
	}
}
function setSubMenu1(cual)
{
	if (document.getElementById('sm1_' + cual))
	{
		document.getElementById('sm1_' + cual).className='td-submenu1_on';
		document.getElementById('sm1_a' + cual).className='link-menu1_on';
		currSM1 = cual;
	}
}


/*MENU CON IMAGENES*/

function cambiarOver(cual)
{
	if (curr != cual)
	{
	document.getElementById("i_" + cual).src = "../img/m1_" + cual + "_on.png";
	}
}
function cambiarOut(cual)
{
	if (curr != cual)
	{
	document.getElementById("i_" + cual).src = "../img/m1_" + cual + ".png";
	}
}
var cualImg;
function imgOver(cual)
{
	if (cualImg != cual)
	{
	document.getElementById("marco_" + cual).style.display = "";
	}
}
function imgOut(cual)
{
	if (cualImg != cual)
	{
	document.getElementById("marco_" + cual).style.display = "none";
	}
}
function openImage(cual)
{
	if (document.getElementById("img_" + cualImg))
	{
	document.getElementById("img_" + cualImg).style.display = "none";
	document.getElementById("marco_" + cualImg).style.display = "none";
	}
	cualImg = cual;
	document.getElementById("img_" + cualImg).style.display = "";
	document.getElementById("marco_" + cualImg).style.display = "";
	
}
function prevImg()
{
	cual=parseInt(cualImg)-1;
	if (cual == 0)
		cual = document.getElementById("cant").value;
	openImage(cual);
}
function nextImg()
{
	cual=parseInt(cualImg)+1;
	var cant = parseInt(document.getElementById("cant").value);
	if (cual > cant)
		cual = 1;
	openImage(cual);
}
