// JavaScript Document
var timeID;
var refreshRate = 20000; // 20 seconds
var rnd = Math.random();
var isFirefox;
var isIE;
var AjaxServerPageName;
AjaxServerPageName = "sContenido.asp";

function getAjax()
{
	var XmlHttp;
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	return XmlHttp;
}

function sniffBrowserType() {
	isFirefox = ( navigator.appName == "Netscape" );
	isIE = (navigator.appName == "Microsoft Internet Explorer" ); 
}


// Start the update timer
function setTimers()
{
	timeID = window.setTimeout( "actualizarT()", refreshRate );
}

// Start to update and reset the update timer
function actualizarT()
{
	//window.clearTimeout( timeID );
	//getContenido('HOME.HTML');
    //setTimers();
}

function getContenido(Destino, fotomenu, carpetamenu, NumCont)
{
	  rnd++;
	  showLoadScreen();
	  //url = AjaxServerPageName+'?id_subasta=<%=id_subasta%>&aut=ova&comando=ListaOfertas&session='+ rnd +'&lm1='+lm1+'&lm2='+lm2;
	  var url = 'Contenidos/'+Destino+'?&aut=ova&c=MuestraContenido&session='+ rnd ;
	  req = getAjax();
	  req.onreadystatechange = function(){
	  
		  if( req.readyState == 4 && req.status == 200 ) {
		  
			  obj = getElement( "CPrincipal" );
			  obj.innerHTML = req.responseText;
		  }
	  
	  }
	  req.open( 'GET', url, true );
	  req.send( null );
	  getFotoMenu1(fotomenu);
	  getBannerTop1(carpetamenu);
	  document.form1.ContenidoActual.value = NumCont;
}

function getColumnaSub()
{
	  rnd++;
	  var url = 'server1.asp?c=ColumaSubastas&aut=ova&session='+ rnd ;
	  reqC = getAjax();
	  reqC.onreadystatechange = function(){
	  
		  if( reqC.readyState == 4 && reqC.status == 200 ) {
		  
			  obj = getElement( "ColumnaSubastas1" );
			  obj.innerHTML = reqC.responseText;
		  }
	  
	  }
	  reqC.open( 'GET', url, true );
	  reqC.send( null );
}

function getFotoMenu1(fotomenu)
{
	//var cFotoMenu1 = "<img src='Contenidos/FotoMenu/"+fotomenu+"' width='249' height='214' border='0'>";
	var cFotoMenu1 = "<img src='r.aspx?command=resize&width=200&height=172&src=Contenidos/FotoMenu/"+fotomenu+"' border='0'>";
	tmpFotoMenu1 = getElement( "FotoMenu1" );
	tmpFotoMenu1.innerHTML = cFotoMenu1;
}
function getBannerTop1(carpetamenu)
{
	var cBannerTop1 = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='963' height='63' title='Hilco Acetec - Portal'><param name='movie' value='BannerTop.swf?var1="+carpetamenu+"'><param name='quality' value='high'><param name='wmode' value='opaque'><embed src='BannerTop.swf?var1="+carpetamenu+"' quality='high' wmode='opaque' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='963' height='63'></embed>";
	tmpBannerTop1 = getElement( "BannerTop1" );
	tmpBannerTop1.innerHTML = cBannerTop1;
}


function getElement( id ) 
{
	if( isIE ) {
		return document.all[ id ];
	}
	else {
		return document.getElementById( id );
	}
}

function showLoadScreen()
{
	var loading = "<div style=\"text-align:center;color:red;\"><h5>Cargando datos...</h5><img src='img/spacer.gif' width='500' height='1' /></div>";

	tmpListaOfertas = getElement( "CPrincipal" );
	tmpListaOfertas.innerHTML = loading;
}

function setFocus(ControlName)
{
	var control = document.getElementById(ControlName);
	if( control != null )
	{
		control.focus();
	}
}
function SelectIdioma(idioma){
	document.location = 'default.asp?secc='+document.form1.ContenidoActual.value+'&idioma='+idioma;
	}

function ClikMenu(elementoActual){
	var DivBoton;
	DivBoton = getElement( "MenuBt001" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt002" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt003" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt004" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt005" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt006" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt007" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt008" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt009" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt010" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt011" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt012" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( "MenuBt013" );	DivBoton.className='ElementoMenu';
	DivBoton = getElement( elementoActual );   	DivBoton.className='ElementoMenuActivado';
   }
