// JavaScript Document
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];}
}


function changeNail(tbl, prod){

        var prod = document.getElementById(prod);

        if(prod.style.display=="block"){
                prod.style.display = "none";
				if(tbl.className=="btn_cursos_concepto"){
					tbl.className="btn_cursos_concepto";
					}else{
						tbl.className="image_back";
					}
                

        }else{
                prod.style.display = "block";
				if(tbl.className=="btn_cursos_concepto"){
					tbl.className="btn_cursos_concepto";
				}else{
					 tbl.className="image_back";
					}
               

        }
}
function CloseOpens()
{
        regexp = /^cat_[0-9]+/;
        abiertas = new Array();
        tables = document.getElementsByTagName('table');
        for (i=0; i < tables.length; i++) {
                tabla = tables.item(i);
                if (regexp.test(tabla.id)) {
                        if (tabla.style.display != 'none') {
                                                                var a = tabla.id.split('_');
                                                                var prod = a[1];
                                                            var nail1 = document.getElementById("nail_"+prod);
                                                                var img1 = document.getElementById("imgSub_"+prod);
                                                                var tbl1 = document.getElementById("td_"+prod);
                                tabla.style.display='none';
                                                                tbl1.className="";
                                        var imgPath='/Cla/images/Optimizadas/menu/arrow_red.gif';
                                        nail1.className="color_menu_nail_gray";
                                        img1.src=imgPath;
                        }
                }
        }

}


function openSub(tbl, prod){
        var nail = document.getElementById("nail_"+prod);
        var marco = document.getElementById("cat_"+prod);
        var img = document.getElementById("imgSub_"+prod);

                CloseOpens();

        if(marco!=null){
                if(marco.style.display=="block"){
                        marco.style.display = "none";
                        tbl.className="image_back";
                        var imgPath='/Cla/images/Optimizadas/menu/arrow_red.gif';
                        marco.style.display = "none";
                        nail.className="color_menu_nail_gray";
                        img.src=imgPath;
                }else{
                        marco.style.display = "block";
                        tbl.className="image_back";
                        var imgPath='/Cla/images/Optimizadas/menu/arrow_red_down.gif';
                        img.src=imgPath;
                        nail.className="color_menu_nail_red";
                }
        }
}

function cambiarImagen(id, imgSrc){
	 
  document.getElementById(id).background = imgSrc;
  
}
function changeCursor(id){
	document.getElementById(id).style.cursor = "pointer";
}

function MostrarDetalle(id){
  document.getElementById(id).style.display = 'block';
  
}
function OcultarDetalle(id){	 
  document.getElementById(id).style.display = 'none'; 
}
/*function cambiarImagen(id1, id2, imgSrc1, imgSrc2){
	 
  document.getElementById(id1).background = imgSrc1;
  document.getElementById(id2).background = imgSrc2;
  
}*/

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";
	if (docHt) iframeEl.style.height = docHt + "px";
  }
}

function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    window.frames[iframeName].location = url;   
    return false;
  }
  else return true;
}

function goSetHeight() {//adecuo la altura segun contenido
  if (parent == window) return;
  else parent.setIframeHeight('ifrm');
}

function MM_callJS(jsStr) { //v2.0 cerrar la ventana
  return eval(jsStr)
}

var popUpWin=0;
function popUpWindow(URLStr, left, top)// funcion para abrir el popUp
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes, left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


//-->
