﻿/* INIT */
$(document).ready(onReadyDocument);

/* EVENTOS */
function onReadyDocument() 
{
    $('div.noticias > div.central > div.thumbs > div').click(function() {onMouseMoveNoticia(this);} );
    onMouseMoveNoticia($('div.noticias > div.central > div.thumbs > div:first-child')[0]);
	 $('div.noticias > div.central > div.thumbs > div').mouseover(function(){
		$(this).css('background','url(../Images/fon_thumb_over.gif) no-repeat');	
		$(this).css('cursor','hand');
								})
	$('div.noticias > div.central > div.thumbs > div').mouseout(function(){
		$(this).css('background','url(../Images/fon_thumb.gif) no-repeat');	
		$(this).css('cursor','default');
								})
	
}

function onMouseMoveNoticia(divNoticia) 
{
    var imgFoto = $($(divNoticia).children()[0]);
    var divOculto = $($(divNoticia).children()[2])[0];
    var lblTitulo = $($(divOculto).children()[0]);
    var lblCuerpo = $($(divOculto).children()[1]);
    var lblFecha = $($(divOculto).children()[2]);
    var lblTieneFoto = $($(divOculto).children()[3]);
    var lblTieneLista = $($(divOculto).children()[4]);
    var lblTienePersonal = $($(divOculto).children()[5]);
    var lblTemplate = $($(divOculto).children()[6]);
    
    var lnkFotos = $($('div.links > a')[0]);
    var lnkPromocion = $($('div.links > a')[1]);
    var lnkPersonal = $($('div.links > a')[2]);
    
    $('div.noticia > div.titulo > div.central > span.Fecha').text(lblFecha.text());
    $('div.noticia > div.titulo > div.central > span.Titulo').text(lblTitulo.text());
    $('div.noticias > div.central > div.imagen > img').attr('src', imgFoto.attr('src'));
    $('div.noticias > div.cuer > span.cuerpo').text(lblCuerpo.text());
	
    if (lblTieneFoto.text() == 0) {
        lnkFotos.hide();
    }
    else 
	{
        lnkFotos.attr('href', 'fotos_lista.aspx?cod=' + lblTieneFoto.text());
        lnkFotos.show();
    }
	
    if (lblTieneLista.text() == 0) 
	{
        lnkPromocion.hide();
    }
    else 
	{
        lnkPromocion.attr('href', 'promocion_lista_per.aspx?cod=' + lblTieneLista.text());
        lnkPromocion.show();
    }
    if (lblTienePersonal.text() == 0) {
        lnkPersonal.hide();
    }
    else {
        if (lblTemplate.text() == 1)
		{
            lnkPersonal.attr('href', 'personal_disco.aspx?cod=' + lblTienePersonal.text());
        }
        else 
		{
            lnkPersonal.attr('href', 'personal_resto.aspx?cod=' + lblTienePersonal.text());
        }
        lnkPersonal.show();
    }
}


