/*-== taringamp3.com - ImBaTy WebMaster */
var userAgent = navigator.userAgent.toLowerCase();
jQuery.browser = {
    version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
    chrome: /chrome/.test( userAgent ),
    safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
    opera: /opera/.test( userAgent ),
    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
    mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};



function play(urlFile, urlCancion){
    var browserx = ($.browser.msie || $.browser.chrome) ? 'ie' : '';
    var htmlLoading = '<div class="loading"><img src="Img/loading.gif" alt="Cargando..." /></div>';
	
    $('#player').html(htmlLoading);
    $.get('player.php',{
        'ver':urlFile,
        'browser':browserx,
        'cancion':urlCancion
    },
    function(data){
        $('#player').html(data);
    }
    );
	
    return false;
}

function Seleccionar(a,b){
    $('#'+a).show();
    $('#'+b).hide();
}


function youtube(id_tube){
    $('#load_play').html( '<iframe width="560" height="349" src="http://www.youtube.com/embed/'+id_tube+'?autoplay=1" frameborder="0" allowfullscreen></iframe><br/><br/>');
}

function aparecer(e){
    x++;
    if(x < 101){
        document.getElementById(e).style.opacity = (x/100);
        document.getElementById(e).style.filter = 'alpha(opacity=' + x + ')';
        (x >= 10) ? document.getElementById(e).style.display = 'block' : '';
        Tiempo = setTimeout("aparecer('"+e+"')",10); 
    } else {
        clearTimeout(Tiempo);
    }
}

var x = 100;
function desaparecer(e){
    x = x-1;
    if(x <= 100 && x > 0){
        document.getElementById(e).style.opacity = x/100;
        document.getElementById(e).style.filter = 'alpha(opacity=' + x+ ')';
        Tiempo = setTimeout("desaparecer('"+e+"')",10);
        (x <= 5) ? document.getElementById(e).style.display = 'none' : '';
    } else {
        clearTimeout(Tiempo);
    }
}

function efecto_aparece(i){ 
    x = 10;
    setTimeout("aparecer('"+i+"')",1);
}

function efecto_desaparce(i){ 
    x = 95;
    
    
    setTimeout("desaparecer('"+i+"')",1);
}

function Process(variable,value,archivo) {
    //document.getElementById('cargando').style.display='block';
    $('#'+variable).html('<center><br /><br /><b>Espere un momento cargando contenido...</b><br /><br /></center>');
    MiAjax=objetoAjax();
    var url = "./" + archivo + ".php?" + value;
    MiAjax.open("GET", url, true);
    MiAjax.onreadystatechange = function() {
        if (MiAjax.readyState == 4) {
            if (MiAjax.status == 200) {
                var Respuesta = MiAjax.responseText;
                $('#'+variable).html(Respuesta);
                efecto_aparece(variable);
            //document.getElementById('cargando').style.display='none';
            }
        }
    }
    MiAjax.send(null);
}


function SelectAll(id){
    document.getElementById(id).focus();
    document.getElementById(id).select();
}
function popup(url,ancho,alto) {
    var posicion_x; 
    var posicion_y; 
    posicion_x=(screen.width/2)-(ancho/2); 
    posicion_y=(screen.height/2)-(alto/2); 
    window.open(url, "formpopup", "width="+ancho+",height="+alto+",menubar=0,toolbar=0,directories=0,scrollbars=no,resizable=no,left="+posicion_x+",top="+posicion_y+"");
}
function target_popup(form) {
    //window.open('', 'formpopup', 'width=' + ( screen.width - 300 ) +',height=' + ( screen.height - 200 ) +',resizeable,scrollbars');
    
    popup('', '800','450');
    //window.open('', 'formpopup', 'width=450,height=450,resizeable,scrollbars');
    
    form.target = 'formpopup';
}

