// JavaScript Document

function displaynone(id2){
	var content = document.getElementById(id2);
	content.innerHTML='';
	content.style.background='';
	location.reload(true);
}


function NuevoAjax(){
        var xmlhttp=false;
        try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
                try{
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(E){
                        xmlhttp = false;
                }
        }

        if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}

function Cargar(url,id){
        var contenido;
        contenido = document.getElementById(id);
        //creamos el objeto XMLHttpRequest
        ajax=NuevoAjax(); 
        //peticionamos los datos, le damos la url enviada desde el link
        ajax.open("GET", url,true); 
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                        //modificamos el estilo de la div, mostrando una imagen de fondo
						contenido.innerHTML = '.'; 
						contenido.style.background = "url('25.gif') no-repeat center"; 
						}else if(ajax.readyState==4){
                        if(ajax.status==200){
                                //mostramos los datos dentro de la div
                                contenido.innerHTML = ajax.responseText; 
								contenido.style.background = "";  
								//setTimeout("displaynone('result')",2000);
                        }else if(ajax.status==404){
                                contenido.innerHTML = "Page no found!";
                        }else{
                                //mostramos el posible error
                                contenido.innerHTML = "Error:".ajax.status; 
                        }
                }
        }
        ajax.send(null);
}

function confirm_delete (url,id){
	var answer = confirm("really want to permanently remove this?");
	if (answer){
		Cargar(url,id);
	}
		
}