$(document).ready( function() {
		etd();
   $(".hover_gris") .hover( 
     function() { $(this).addClass('fondo_gris') }, 
     function() { $(this).removeClass('fondo_gris'); }
	 );
	 
		$(function() {
				$("#dialog").dialog({
					bgiframe: true,
					autoOpen: false,
					height: 540,
					modal: true
				});
			});
 /*    
var menu_top_btn_sel = "home";
var menu_left_btn_sel = "";
var menu_right_btn_sel = "";*/


$().ready(function(){
	var btn_sel = "#btn_"+menu_top_btn_sel;
	if (btn_sel != "#btn_no_sel") {
		var new_src = $(btn_sel).attr("src").match(/[^\.]+/) + "_over.gif";
		$(btn_sel).attr("src", new_src);
	}
		
	$("#menu_top ul li a img")
        .mouseover(function() {
			var btn_id = "#" + $(this).attr("id");
			
			if (btn_sel != btn_id){
				var src = $(this).attr("src").match(/[^\.]+/);
	            src = src + "_over.gif";
	   	        $(this).attr("src", src);
			}
        })
        .mouseout(function() {
			var btn_id = "#" + $(this).attr("id");
			if (btn_sel != btn_id){
	            var src = $(this).attr("src").replace("_over", "");
		        $(this).attr("src", src);
			}
        });
	
	var link_mleft_sel = "#link_"+menu_left_btn_sel;
	$(link_mleft_sel).addClass("selected");
	var link_mright_sel = "#link_"+menu_right_btn_sel;
	$(link_mright_sel).addClass("selected");
	
	$("#menu_right form a img")
        .mouseover(function() {
			var btn_id = "#" + $(this).attr("id");
			var src = $(this).attr("src").match(/[^\.]+/);
			src = src + "_over.gif";
			$(this).attr("src", src);
        })
        .mouseout(function() {
			var btn_id = "#" + $(this).attr("id");
			if (btn_sel != btn_id){
	            var src = $(this).attr("src").replace("_over", "");
		        $(this).attr("src", src);
			}
        });	
	//intercalar el color de fondo de las filas
	//$("dl dd ul li:odd").css("background-color", "#F0F0F0");
	
	//$("#hoy dl").hide();

	$("#hoy h1").toggle(function(){
		$(this).addClass("abierto");
		}, function () {
		$(this).removeClass("abierto");
	});
	
	$("#lista_1").click(function(){
		$("#hoy dl.lista_1").slideToggle("slow,");
	});
	$("#lista_2").click(function(){
		$("#hoy dl.lista_2").slideToggle("slow,");
	});
	$("#lista_3").click(function(){
		$("#hoy dl.lista_3").slideToggle("slow,");
	});
	$("#lista_4").click(function(){
		$("#hoy dl.lista_4").slideToggle("slow,");
	});
	
	$("#lista_2_1").click(function(){
		$("#hoy dd.lista_2_1").slideToggle("slow,");
	});
	$("#lista_2_2").click(function(){
		$("#hoy dd.lista_2_2").slideToggle("slow,");
	});
	$("#lista_2_3").click(function(){
		$("#hoy dd.lista_2_3").slideToggle("slow,");
	});
	$("#lista_2_4").click(function(){
		$("#hoy dd.lista_2_4").slideToggle("slow,");
	});
});
});


$(document).ready( function() {
	$("#presentacion dl dd").hide();

	$("#presentacion dl dt").toggle(function(){
		$(this).addClass("abierto");
		$(this).next("#presentacion dl dd").addClass("abierto");
		}, function () {
		$(this).removeClass("abierto");
		$(this).next("#presentacion dl dd").removeClass("abierto");
	});
	
	$("#presentacion dl dt").click(function(){
		$(this).next("#presentacion dl dd").slideToggle("slow,");
	});
});	

//----------------------------------------------------------------------------//
// changeInputType
//----------------------------------------------------------------------------//
function changeInputType(oldObject) {
	viejo = document.getElementById(oldObject);
	viejo.value='';
  var newObject = document.createElement('input');
  newObject.type = 'password';
	newObject.onkeyup = function (e){ if (e.keyCode == 13) { $("#login_form").submit(); }};
  if(viejo.size) newObject.size = viejo.size;
  if(viejo.value) newObject.value = viejo.value;
  if(viejo.name) newObject.name = viejo.name;
  if(viejo.id) newObject.id = viejo.id;
  if(viejo.className) newObject.className = viejo.className;
  viejo.parentNode.replaceChild(newObject,viejo);
  newObject.focus();
  return newObject;
}	

//----------------------------------------------------------------------------//
// cierra el dialog
//----------------------------------------------------------------------------//

function cerrar_dialog(){

  $("#dialog").dialog("close");
}
//----------------------------------------------------------------------------//
// redirecciona
//----------------------------------------------------------------------------//
function ir(url){

  window.location=url;
}

//----------------------------------------------------------------------------//
// recargar
//----------------------------------------------------------------------------//
function recargar(){

	window.location.reload();
}
//----------------------------------------------------------------------------//
function getWinY() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	}
	/*
if ( !!(window.attachEvent && !window.opera) ) {
// IE
var window_width = $('body').offsetWidth;
var window_height = getWinY();

} else {
var window_width = window.innerWidth;
var window_height = window.innerHeight;
}	
	
	*/
	return myHeight;
}

function etd(){
	
 var a = document.location;
 var locat = encodeURIComponent(document.location);
 var param = '&resolucion='+screen.width+"x"+ screen.height+"&loc="+locat;

	$.ajax({
        type: "POST",
        url: "recursos/ajax/funciones_ajax_no_user.php",
        data: "x=default&ax=fun_id&mo=estadisticasModel&a=add"+param,
        success: function(datos){
					//alert(datos);
        }
      })
	
}

/**/

