/*
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)) - 30;
    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 {
      tooltipTop = (document.body.scrollTop>=0?document.body.scrollTop+10:event.clientY+10);
      if ((event.clientX > tooltipLft) && (event.clientY < (tooltipOBJ.scrollHeight?tooltipOBJ.scrollHeight:tooltipOBJ.style.pixelHeight) + 10)) tooltipTop = (document.body.scrollTop?document.body.scrollTop:document.body.offsetTop) + event.clientY + 20;
      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 + "')", 20 );
  }
  else if (mode != "o") ((document.getElementById) ? document.getElementById(mode) : eval("document.all['" + mode + "']")).style.display="none";
}
function rowOver(i, nColor) {
  var p ='v';
  if (!nColor && p=='v') nColor = "#ECECD9";
  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 rowOutdif(i, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('prodtr'+ i) : eval("document.all['prodtr'"+ i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  if (trObj == null || trObj.style.display=="none")  trObj.style.background=nColor;
}

function servOC(i, c , href, nColor, h) 
{
  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 + "']");
  //alert(h);
  if(h == null) { h=128; }
  //if(h == 78) { h=document.height; }
 	
  if (trObj != null) {
  	 
  	//abre
    if (trObj.style.display=="none"){
		trObj.style.display="";
		nameObj.style.background="#ECECD9";
		  //if (!ifObj.src)
	      idcol = c;
	      ifObj.src = href;
	      smoothHeight('ihif' + i, 0, h * 5, h, 'o');
    }
	//fecha
    else {
		  switch(c != idcol)
		  {
		  	case(true):
		  	
		  		trObj.style.display="";
	      		nameObj.style.background="#ECECD9";
	      		ifObj.src = href;
	      		smoothHeight('ihif' + i, 0, h * 5, h, 'o');
	      		idcol = c;
		  	break;
		  	case(false):
		  		
		  		nameObj.style.background=nColor;
	      		smoothHeight('ihif' + i, h * 5, 0, h, 'ihtr' + i);
		  	break;

		  }
    }
  }
}

clics = new Array(200);
idcol="";
function servOC_New(table, i, c, href, nColor, h) {
	
	if(c == null){
		named = i;
	}else{
		named = i + '-' + c;
	}
	var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
	var nameObj = (document.getElementById) ? document.getElementById(named) : eval("document.all['" + named + "']");
	var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : eval("document.all['ihif" + i + "']");
	if(h == null) { h=42; }
	//h=228;
	if (trObj != null) {
		
		//abre
		if (trObj.style.display=="none" || c != idcol){
			if(!clics[i]){
				clics[i] = nameObj;
			}else{
				clics[i].style.background="";
				clics[i] = nameObj;
			}
			trObj.style.display="";
			nameObj.style.background="#9FC0EC";
			idcol = c;
			ifObj.src = href;
			smoothHeight('ihif' + i, 0, h * 5, h, 'o');
		} else {
			nameObj.style.background="";
   	  		smoothHeight('ihif' + i, h * 5, 0, h, 'ihtr' + i);
		}
	}
}

function rowOver_New(i, nColor){
	var p ='v';
	//#9FC0EC azul sistema
	if (!nColor && p=='v') nColor = "#ECECD9";
	var nameObj = (document.getElementById) ? document.getElementById(i) : eval("document.all['" + i + "']");
	if (nameObj != null) nameObj.style.background=nColor;
}

function rowOut_New(i, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById(i) : eval("document.all['" + i + "']");
  if (trObj == null || trObj.style.display=="none") nameObj.style.background=nColor;
}
var clr = new Array(400);
function rowOut_Newckc(i, nColor) 
{
  
  if (clr[i]==1)
  {
  	nColor="#FAFAFA";
  	clr[i]=0;
  
  }
  else
  {
  	clr[i]=1;
  }
  
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById(i) : eval("document.all['" + i + "']");
  if (trObj == null || trObj.style.display=="none") nameObj.style.background=nColor;
  
}



function cheatOver(num, xx, yy, color) {
/*
	if (!document.getElementById) return;
  var col =  color;
  var td = document.getElementById(num + '-' + xx + '-' + yy);
  td.style.backgroundColor = col;
  //td.style.fontWeight = 'bold';
  var td = document.getElementById(num + '-' + '0' + '-' + yy);
  td.style.backgroundColor = col;
  var td = document.getElementById(num + '-' + xx + '-' + '0');
  td.style.backgroundColor = col;
*/
}
function cheatOut(num, xx, yy, color) {
/*
  if (!document.getElementById) return;
  var td = document.getElementById(num + '-' + xx + '-' + yy);
  td.style.backgroundColor = '';
  //td.style.fontWeight = 'normal';
  var td = document.getElementById(num + '-' + '0' + '-' + yy);
  td.style.backgroundColor = '';
  var td = document.getElementById(num + '-' + xx + '-' + '0');
  td.style.backgroundColor = '';
*/
}




function servCup(i, c , href,  h, frameA, frameB) {
  var trObj = (document.getElementById) ? document.getElementById(frameA + i) : eval("document.all['" + frameA + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById(frameB + i) : eval("document.all['" + frameB + i + "']");
  if (trObj != null) {
  	
  	//abre
    if (trObj.style.display=="none") {
		trObj.style.display="";
		idcol = c;
		
		smoothHeight(frameB + i, 0, h * 5, h, 'o');
			ifObj.src = href;
		return true;
	}
	//fecha
    else {
		switch(c != idcol){
		  	case(true):
		  		trObj.style.display="";
	      		ifObj.src = href;
	      		smoothHeight(frameB + i, 0, h * 5, h, 'o');
	      		idcol = c;
		  	break;
		  	case(false):
	      		smoothHeight(frameB + i, h * 5, 0, h, frameA + i);
		  	break;

		  }
		
    }
  }
}

function servGF(i, c , href) {
  var trObj = (document.getElementById) ? document.getElementById('igtr' + i) : eval("document.all['igtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) : eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById('igif' + i) : eval("document.all['igif" + i + "']");
   
  if (trObj != null) {
  	//abre
    if (trObj.style.display=="none") {
		trObj.style.display="";
		idcol = c;
		smoothHeight('igif' + i, 0, 537, 179, 'o');
		if (!ifObj.src){
			ifObj.src = href;
		}
		return true;
	}
	//fecha
    else {
		smoothHeight('igif' + i, 537, 0, 179, 'igtr' + i);
		return false;
    }
  }
}



function servOCROWFix(){

}
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="#EDF6F9";
      arrowObj.innerHTML="v";
    }
    else {
      trObj.style.display="none";
      hlObj.style.background="#ECECD9";
      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(); }
}
;
