function descargar()
{
    if (evaldrop())
        window.open($('#audiodrop').val(),$('#audiodrop').val());
}

function evaldrop()
{
	if ($('#audiodrop').val()!='0')
        {
            if ($('#audioerror').css('display')!='none')
                $('#audioerror').slideUp();

            return true;
        }
        else
        {
            if ($('#audioerror').css('display')=='none')
                $('#audioerror').slideDown();

            return false;
        }
}

function cargarrepro(sd)
{
    if ($('#audiodrop').val()!='0')
    {
        var sreprowrap = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="0" height="0" id="repro" align="">';
        sreprowrap += ' <param name=movie value="' + sd + '/player/niftyplayer.swf?file=' + $('#audiodrop').val() + '">';
        sreprowrap += ' <param name=quality value=high>';
        sreprowrap += ' <param name=bgcolor value=#FFFFFF>';
        sreprowrap += ' <embed src="' + sd + '/player/niftyplayer.swf?file=' + $('#audiodrop').val() + '" quality=high bgcolor=#FFFFFF width="0" height="0" name="repro" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
        sreprowrap += ' </embed>';
        sreprowrap += '</object>';
        $('#reprowrap').html(sreprowrap);
        //$('#botonreproducir').attr('src',sd + '/images/pausar.gif');
        //evaldrop();
    }
}

function reproducir(sd)
{

    if (evaldrop())
    {
	if ($('#botonreproducir').attr('src')==sd + '/images/reproducir.gif')
	{
            niftyplayer('repro').play();
            $('#botonreproducir').attr('src',sd + '/images/pausar.gif');
	}
	else
	{
            niftyplayer('repro').pause();
            $('#botonreproducir').attr('src',sd + '/images/reproducir.gif');
	}
    }

}

function veragenda(id)
{
    $('#agenda' + id).slideToggle();
}

function cargarboxdrop(n)
{
    if ($('#drop' + n).val()!='0' && $('#drop' + n).val()!='')
    {
        $('#img' + n).attr('src',$('#drop' + n).val());
        $('#link' + n).click();
    }
}

$(document).ready(function() {
    $.superbox();

    $('.agenda').click(function()
    {
        $('#pop').attr('href',fotos[$(this).attr('id')][(Math.ceil(Math.random()*fotos[$(this).attr('id')].length))-1].src);
        $('#pop').click();
        return false;
    });

    jQuery.jQueryRandom = 0;
    jQuery.extend(jQuery.expr[":"],
    {
        random: function(a, i, m, r) {
        if (i == 0) {
            jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
        };
        return i == jQuery.jQueryRandom;
    }
});
});
