/*
## Copyright (C) 2008 Wender Fernandes <wender@navesa.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
##
## Author(s): Wender Fernandes <wender@navesa.com.br>
*/


// Funï¿½ï¿½o responsï¿½vel de conectar a uma pï¿½gina externa e retornar os resultados, no nosso caso a busca_item.php
var field = "";
var msg = "";
/**
 * funcao para carrgamento com ajax
 * @param url
 * @param campo
 * @param mensagem
 * @return string
 */
function ajax(url,campo,mensagem){
	field = campo;
	msg = mensagem;
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest){
    req = new XMLHttpRequest();
    req.onreadystatechange = processReqChange;
    req.open("GET",url,true);
    req.send(null);
    }
    // Procura por uma versï¿½o ActiveX (IE)
    else if (window.ActiveXObject){
    req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req){
        req.onreadystatechange = processReqChange;
        req.open("GET",url,true);
        req.send();
        }
    }
}

function processReqChange(){
    document.getElementById(field).innerHTML = "<img border='0' src='img/load.gif'> "+msg;
    // apenas quando o estado for "completado"
    if (req.readyState == 4){
    // apenas se o servidor retornar "OK"
        if (req.status ==200){
        // procura pela div id="pagina" e insere o conteudo
        // retornado nela, como texto HTML
        document.getElementById(field).innerHTML = req.responseText;
        }
        else{
        	document.getElementById(field).innerHTML = "<br><br><p><img border='0' src='imagens/mini_logo.png'><br>Dados indisponiveis no momento</p>";
        }
    }
}

function addEvento(acessorio,id)
{
	window.open('agendaVirtualGYN/admin.php','janela01','status=no,scrollbars=yes,menubar=no,resizable=no,width=640,height=480,left=200,top=10');
}

function delEvento(id)
{
	window.open('agendaVirtualGYN/deletagenda.php','janela01','status=no,scrollbars=yes,menubar=no,resizable=no,width=640,height=480,left=200,top=10');
}
