function cargar_get_reload(url,id){
        var contenido, preloader;
        id = document.getElementById(id);
        var ajax=nuevo_ajax(); 
        ajax.open("GET", url,true); 
		
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                }else if(ajax.readyState==4){
								document.title ="Portal Oficial del Gobierno de Formosa  ||  El Portal de Nuestra Gente";	
                        if(ajax.status==200){
								document.title ="Portal Oficial del Gobierno de Formosa  ||  El Portal de Nuestra Gente";	
                                id.innerHTML = ajax.responseText; 
								
                        }else if(ajax.status==404){
                              id.innerHTML = "La página no existe";
                        }else{
                                id.innerHTML = "Error:"+ajax.status; 
                        }
                }
        }
        ajax.send(null);
}

var nav4 = window.Event ? true : false;
function acceptNum(evt)
{
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57));
}

function acceptFloat(evt,val)
{	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
var is_float=val.indexOf('.');
//alert(key);
return (key <= 13 || (key >= 48 && key <= 57) || (key == 46 && is_float==-1));
}

function favoritos(){
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) 
		{
		var url="http://www.formosa.gob.ar/";
		var titulo="Portal oficial del Gobierno de la Provincia de Formosa";
		window.external.AddFavorite(url,titulo);
	}
	else {
		 if(navigator.appName == "Netscape")
		 alert ("Por Favor, presione Crtl+D para agregar formosa.gob.ar a sus Favoritos");
	 }
};

function printcontent()
{
var a = window. open('','','scrollbars=yes,width=500,height=500');

	a.document.open("text/html");
	a.document.write('<html><head><link rel="stylesheet" href="/css/print.css" media="screen"/></head><body>');
	a.document.write(document.getElementById('content').innerHTML);
	a.document.write('</body></html>');
	a.document.close();
	a.print();
}


function monitor() {
	cargar_get_reload('modulos/videos/php/ver_ciudad_vivo.php','content');
	//alert('hola');
};

function start_refresh() 
{
	cargar_get_reload('modulos/videos/php/ver_ciudad_vivo.php','content');
  	setInterval("monitor()", 100000); //10 segundos
}
/*

function start_refresh() 
{
   if(!intval=="")
   {
		   cargar_get_reload('modulos/videos/php/ver_ciudad_vivo.php','content');
		   intval=setInterval("monitor()", 10000); //100 segundos
   }
}

function stop_refresh() 
{
		   clearInterval(intval);
		   intval="";
}

*/
function print_special(div)
	 {
		docPrint=window.open("","formosa.gob.ar","");
		docPrint.document.open();
		docPrint.document.write('<html><head><title>Portal Oficial del Gobierno de la Provincia de Formosa ||  El Portal de Nuestra Gente</title>');
		docPrint.document.write('<link href="css/print.css" rel="stylesheet" type="text/css">');
		docPrint.document.write('</head><body onLoad="self.print()">');
		docPrint.document.write(document.getElementById(div).innerHTML); 
		docPrint.document.write('<br><br><p><strong>www.formosa.gob.ar</strong></p>');
		docPrint.document.write('</body></html>');
		docPrint.document.close(); 
		docPrint.focus();
}

function validar_login()
{
		sysport06_mail = document.getElementById("email").value;
		sysport06_contrasena = document.getElementById("password").value;

		if (sysport06_mail=="Correo Electrónico" || sysport06_contrasena=="password")
		{
			$('#msg_login').html("<p>Ingresa tu Correo Electrónico y Contraseña</p>");
			$('#msg_login').removeClass().addClass("msg msg-warn").fadeIn("slow");
			setTimeout(function(){ $("#msg_login").fadeOut(1000);}, 3000);
		}
		else
		{
			$.post("miportal_v1/login/php/valida.php", { sysport06_mail: sysport06_mail, sysport06_contrasena: sysport06_contrasena }, function(result){
		   
				var respuesta_mostrar=result.replace(/(^\s*)|(\s*$)/g,"");
				var respuesta=respuesta_mostrar.substring(0,5);
				if (respuesta=='Error')
				{
					$('#msg_login').html("<p>El Correo Electrónico ingresado y/o la contraseña son inválidos.</p>");
					$('#msg_login').removeClass().addClass("msg msg-error").fadeIn("slow");
					setTimeout(function(){ $("#msg_login").fadeOut(1000);}, 3000);
				}
				else
				{
					//window.open('./index.php','_self');
					window.location.reload();
				}
			});
		}
}

function logout()
{
	$.post("miportal_v1/login/php/logout.php", function(data){
			window.location.reload();
	 });
}

(function($){
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val("");
			});
			$(this).blur(function(){
				if ($(this).val() == "") $(this).val(default_value);
			});
		});
	};
})(jQuery);

