/*
http://isohunt.com Interface Javascript
by Gary Fung - email: gary{REPLACE_WITH_THE_AT_SIGN}isohunt.com

Feel free to use / mod this to your heart's content,
but keep these lines to acknowledge where this code originated.
Comments, mods or additions you'd like add to this script can be posted here:
http://isohunt.com/forum/viewforum.php?f=1

Tip popup functions adapted from AWStats: http://awstats.sourceforge.net/
*/
var smooth_timer;
function go2(selID, link) {
  var selOBJ = (document.getElementById) ? document.getElementById(selID) : eval("document.all['" + selID + "']");
  window.location=link + selOBJ.options[selOBJ.selectedIndex].value;
}
function toclip(string) { window.clipboardData.setData('Text', string); }
function ShowTip(fArg) {
  var tooltipOBJ = (document.getElementById) ? document.getElementById('ih' + fArg) : eval("document.all['ih" + fArg + "']");
  if (tooltipOBJ != null) {
    var tooltipLft = (document.body.offsetWidth?document.body.offsetWidth:document.body.style.pixelWidth) - (tooltipOBJ.offsetWidth?tooltipOBJ.offsetWidth:(tooltipOBJ.style.pixelWidth?tooltipOBJ.style.pixelWidth:$TOOLTIPWIDTH)) - 5;
    var tooltipTop = 10;
    if (navigator.appName == 'Netscape') {
      if (parseFloat(navigator.appVersion) >= 5) tooltipTop = (document.body.scrollTop>=0?document.body.scrollTop+10:event.clientY+10);
      tooltipOBJ.style.left = tooltipLft; tooltipOBJ.style.top = tooltipTop;
    }
    else {
      tooltipLft -= 30;
      tooltipTop = (document.body.scrollTop?document.body.scrollTop:document.body.offsetTop) + event.clientY - (tooltipOBJ.scrollHeight?tooltipOBJ.scrollHeight:tooltipOBJ.style.pixelHeight) - 30;
      if (tooltipTop < (document.body.scrollTop?document.body.scrollTop:document.body.offsetTop) + 10) {
        if (event.clientX > tooltipLft) tooltipTop = (document.body.scrollTop?document.body.scrollTop:document.body.offsetTop) + event.clientY + 30;
        else tooltipTop = (document.body.scrollTop?document.body.scrollTop:document.body.offsetTop) + 10;
      } 
      tooltipOBJ.style.pixelLeft = tooltipLft; tooltipOBJ.style.pixelTop = tooltipTop;
    }
    tooltipOBJ.style.visibility = "visible";
  }
}
function HideTip(fArg) {
  var tooltipOBJ = (document.getElementById) ? document.getElementById('ih' + fArg) : eval("document.all['ih" + fArg + "']");
  if (tooltipOBJ != null) tooltipOBJ.style.visibility = "hidden";
}
function smoothHeight(id, curH, targetH, stepH, mode) {
  diff = targetH - curH;
  if (diff != 0) {
    newH = (diff > 0) ? curH + stepH : curH - stepH;
    ((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px";
    if (smooth_timer) window.clearTimeout(smooth_timer);
    smooth_timer = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 16 );
  }
  else if (mode != "o") ((document.getElementById) ? document.getElementById(mode) : eval("document.all['" + mode + "']")).style.display="none";
}
function rowOver(i, nColor) {
  if (!nColor) nColor = "";
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  if (nameObj != null) nameObj.style.background=nColor;
}
function rowOut(i, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  if (trObj == null || trObj.style.display=="none") nameObj.style.background=nColor;
}
function servOC(i, href, nColor,alturaDesplegable,indice) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : eval("document.all['ihif" + i + "']");
  var enlaceObj = (document.getElementById) ? document.getElementById('enlace' + i) : eval("document.all['enlace" + i + "']");
  if (trObj != null) {
    if (trObj.style.display=="none") {
      ifObj.style.height = "0px";
      trObj.style.display="";
      nameObj.style.background="d92900";
	  enlaceObj.style.color = "white";
	  enlaceObj.style.fontSize = "15px";
	  enlaceObj.style.fontWeight = "bold";
      if (!ifObj.src) ifObj.src = href;
      smoothHeight('ihif' + i, 0, alturaDesplegable, indice, 'o');
    }
    else {
      nameObj.style.background="black";
      smoothHeight('ihif' + i, alturaDesplegable, 0, indice, 'ihtr' + i);
    }
  }
}
function desplegarMenu(i, href, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : eval("document.all['ihif" + i + "']");
  if (trObj != null) {
    if (trObj.style.display=="none") {
      ifObj.style.height = "0px";
      trObj.style.display="";
      nameObj.style.background="";
      if (!ifObj.src) ifObj.src = href;
      smoothHeight('ihif' + i, 0, 115, 23, 'o');
    }
    else {
      nameObj.style.background=nColor;
      smoothHeight('ihif' + i, 115, 0, 23, 'ihtr' + i);
    }
  }
}
function ocultarTodos(){
	var trObj1 = (document.getElementById) ? document.getElementById("ihtr100") : eval("document.all['ihtr100']");
	var trObj2 = (document.getElementById) ? document.getElementById("ihtr200") : eval("document.all['ihtr200']");
	var trObj3 = (document.getElementById) ? document.getElementById("ihtr300") : eval("document.all['ihtr300']");
	var trObj4 = (document.getElementById) ? document.getElementById("ihtr400") : eval("document.all['ihtr400']");
	var trObj5 = (document.getElementById) ? document.getElementById("ihtr500") : eval("document.all['ihtr500']");
	var trObj6 = (document.getElementById) ? document.getElementById("ihtr600") : eval("document.all['ihtr600']");
	
	var titulo1= (document.getElementById) ? document.getElementById("name100") : eval("document.all['name100']");
	var titulo2= (document.getElementById) ? document.getElementById("name200") : eval("document.all['name200']");
	var titulo3= (document.getElementById) ? document.getElementById("name300") : eval("document.all['name300']");
	var titulo4= (document.getElementById) ? document.getElementById("name400") : eval("document.all['name400']");
	var titulo5= (document.getElementById) ? document.getElementById("name500") : eval("document.all['name500']");
	var titulo6= (document.getElementById) ? document.getElementById("name600") : eval("document.all['name600']");
	
	var enlace1= (document.getElementById) ? document.getElementById("enlace100") : eval("document.all['enlace100']");
	var enlace2= (document.getElementById) ? document.getElementById("enlace200") : eval("document.all['enlace200']");
	var enlace3= (document.getElementById) ? document.getElementById("enlace300") : eval("document.all['enlace300']");
	var enlace4= (document.getElementById) ? document.getElementById("enlace400") : eval("document.all['enlace400']");
	var enlace5= (document.getElementById) ? document.getElementById("enlace500") : eval("document.all['enlace500']");
	var enlace6= (document.getElementById) ? document.getElementById("enlace600") : eval("document.all['enlace600']");


	var colorFondo = "#cccccc";
	var colorTexto = "#555555";

	titulo1.style.background=colorFondo; enlace1.style.color=colorTexto; enlace1.style.fontSize = "13px"; enlace1.style.fontWeight = ""; 
	titulo2.style.background=colorFondo; enlace2.style.color=colorTexto; enlace2.style.fontSize = "13px"; enlace2.style.fontWeight = "";
	titulo3.style.background=colorFondo; enlace3.style.color=colorTexto; enlace3.style.fontSize = "13px"; enlace3.style.fontWeight = "";
	titulo4.style.background=colorFondo; enlace4.style.color=colorTexto; enlace4.style.fontSize = "13px"; enlace4.style.fontWeight = "";
	titulo5.style.background=colorFondo; enlace5.style.color=colorTexto; enlace5.style.fontSize = "13px"; enlace5.style.fontWeight = "";
	titulo6.style.background=colorFondo; enlace6.style.color=colorTexto; enlace6.style.fontSize = "13px"; enlace6.style.fontWeight = "";
	
	if (trObj1 != null) {
		if (trObj1.style.display=="") { trObj1.style.display="none";}
	  }
	 if (trObj2 != null) {
		if (trObj2.style.display=="") { trObj2.style.display="none"; }
	  }
	 if (trObj3 != null) {
		if (trObj3.style.display=="") { trObj3.style.display="none"; }
	  }
	 if (trObj4 != null) {
		if (trObj4.style.display=="") { trObj4.style.display="none"; }
	  }
	 if (trObj5 != null) {
		if (trObj5.style.display=="") { trObj5.style.display="none"; }
	  }
	 if (trObj6 != null) {
		if (trObj6.style.display=="") { trObj6.style.display="none"; }
	  }
}
function trOC(idHL, idOC, idArrow) {
  var trObj = (document.getElementById) ? document.getElementById(idOC) : eval("document.all['" + idOC + "']");
  var hlObj = (document.getElementById) ? document.getElementById(idHL) : eval("document.all['" + idHL + "']");
  var arrowObj = (document.getElementById) ? document.getElementById(idArrow) : eval("document.all['" + idArrow + "']");
  if (trObj != null && hlObj != null) {
    if (trObj.style.display=="none") {
      trObj.style.display="";
      hlObj.style.background="#003366";
      hlObj.style.color="";
      arrowObj.innerHTML="v";
    }
    else {
      trObj.style.display="none";
      hlObj.style.background="";
      hlObj.style.color="#000000";
      arrowObj.innerHTML="^";
    }
  }
}
function firstFocus()
{
   if (document.forms.length > 0)
   {
      var TForm = document.forms[0];
      for (i=0;i<TForm.length;i++)
      {
         if ((TForm.elements[i].type=="text")||
           (TForm.elements[i].type=="textarea")||
           (TForm.elements[i].type.toString().charAt(0)=="s"))
         {
            document.forms[0].elements[i].focus();
            break;
         }
      }
   }
}
function HighlightAll(theField) {
  var tempval=eval("document."+theField);
  tempval.focus();
  tempval.select();
  if (document.all) {
    therange=tempval.createTextRange();
    therange.execCommand("Copy");
    window.status="Contents highlighted and copied to clipboard!";
    setTimeout("window.status=''",5000);
  }
}
function NewWindow(mypage, myname, w, h, scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
  win = window.open(mypage, myname, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
startList = function() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover=function() {
          this.className+=" navOver";
        }
        node.onmouseout=function() {
          this.className=this.className.replace(" navOver", "");
        }
      }
    }
  }
}
function setImageDimensions(gotImage) {
  if(gotImage.width > 600) gotImage.width = 600;
}
function changeImageDimensions(gotImage, type) {
  if(gotImage.width > 600 && type == 'out') {
	  gotImage.width = 600;
    return;
  }
  if(type == 'over') gotImage.removeAttribute('width');
}

