$(document).ready(function(){
		initCheckLogin();
});

function initCheckLogin(currentPage){
	
	$.ajax({
		 type: "POST",
		 dataType: ($.browser.msie) ? "text" : "xml", // Reconocemos el browser.
		 cache: false,
	     url: "../conicet/checklogin/",
		 timeout: 120000,
		 success: checkLoginResponse, 
		 error: errorCheckLogin
		 });
}

function errorCheckLogin (XMLHttpRequest, textStatus, errorThrown) {

}

function checkLoginResponse (data, textStatus){
		
		var xml;
    	if(typeof data == "string"){
			xml = new ActiveXObject("Microsoft.XMLDOM");
			xml.async = false;
			xml.loadXML(data);
   		} else {
      		xml = data;
    	}

					
		if($("usuario email",xml).text()!= null && $("usuario email",xml).text()!=""){
			$("#logOut").css('display','block');
			$("#login").css('display','none');		
			$("#listarArchivos").css('display','block');			
		}else{
			$("#logOut").css('display','none');	
			$("#login").css('display','block');
			$("#listarArchivos").css('display','none');		
		}
				
}

function initLogout(){
			
	$.ajax({
		 type: "POST",
		 dataType: ($.browser.msie) ? "text" : "xml", // Reconocemos el browser.
		 cache: false,
	     url: "../conicet/logout/",
		 timeout: 120000,
		 success: logoutResponse, 
		 error: errorLogout
		 });
}

function errorLogout (XMLHttpRequest, textStatus, errorThrown) {
}

function logoutResponse (data, textStatus){		
	
	window.location.href='index.html';
}






