Util = {
        tooltip :function(from){
            var tooltipId = from+"ToolTip";
            var parnt = $("#"+from).parent();
            var marginLeft = parnt.width();
            var text = $("#"+from).attr("alt");
            var ht ='<div id="'+tooltipId+'" style="position: absolute;border: 1px solid #f00;width: 100%;margin:0px 0 0 '+marginLeft+'px;z-index:9001;background-color: #ccc;padding: .2em;display: none;">'+text+'</div>';
           parnt.css({"position": "relative"});
           parnt.prepend(ht);
            $("#"+from).hover(function(){
                $('embed, object, select').css({'visibility' : 'hidden'});
                $("#"+tooltipId).show();
            }, function(){
                $('embed, object, select').css({'visibility' : 'visible'});
            $("#"+tooltipId).hide();
            });
        },
       opacarCapa : function(){
       // $('embed, object, select').css({'visibility' : 'hidden'});
        $('body').append('<div id="Opacar" style="position: absolute;top: 0%;left: 0%;width: 100%;height: 500px;background-color: black;z-index:999;-moz-opacity: 0.9;opacity:.90;filter: alpha(opacity=90);/*display:none*/"></div>');
        var arrPageSizes = Util.getPageSize();
            $('#Opacar').css({width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();
        },
        aclararCapa :function(){

            $('#Opacar').fadeOut(function() {$('#Opacar').remove();});
            // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
           // $('embed, object, select').css({'visibility' : 'visible'});
        },

        /**
         * array indice 0 = widht , 1 = height  para pagina
         *  indice 2 = widht , 4 = hieght para ventana ;
         */
        getPageSize : function() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth;
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}
			// for small pages with total height less then height of the viewport
			var pageHeight,pageWidth;
                        if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else {
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){
				pageWidth = xScroll;
			} else {
				pageWidth = windowWidth;
			}
			var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		},
       getPageScroll :function()  {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;
			}
			var arrayPageScroll = new Array(xScroll,yScroll);
			return arrayPageScroll;
		},
                
                
       laHora : function(){
           var meses = new Array("Enero", "Febrero", "Marzo","Abril",
            "Mayo","Junio","Julio","Agosto","Setiembre","Octubre","Noviembre","Diciembre");
            var dias = new Array("Domingo","Lunes","Martes","Miércoles",
            "Jueves","Viernes","Sábado");
            var D = new Date();
            var hora = D.getHours();
            var amp = (hora<12)?"am":"pm";
            hora = (hora>12)?hora%12:hora;
            var minutos = D.getMinutes();
            minutos = (minutos<10)?"0"+minutos:minutos;
            var segundos = D.getSeconds();
            segundos = (segundos<10)?"0"+segundos:segundos;
            var mes = meses[D.getMonth()];
            var dia = dias[D.getDay()];
            var fecha = D.getDate();
            var anio = D.getFullYear();
            var horita = hora+":"+minutos+":"+segundos+" "+amp+" &nbsp;&nbsp;"+dia+" "+fecha+ " de "+mes+" del "+anio;
            $("#laHora").html(horita);
            setTimeout("Util.laHora()", 1000);
       }
}

function socialPopUp(url){
   var winwin = window.open(url, "winwin", "location=0,status=1,scrollbars=1,  width=700,height=400,top="+(($(window).height()/2)-200)+",left="+(($(window).width()/2)-350)+"");
    return false ;
}


function loadMusic(){
    var x = $("#musica-wrapper")
    $.ajax({
           async:true,
           type: "GET",
           dataType: "html",
           url:"http://localhost/refactor001/musica/ajax/musica-recomendada",
           success:function(datos){
            x.html(datos);
            },
           timeout:10000,
           error:function (){
               x.html('-.-');
            }});
        
}


