﻿//#########################################################//
// Tao.Ajax
//#########################################################//
function openAjax() { 
var Ajax; 
try {Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros. 
}catch(ee) { 
try {Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS 
}catch(e) { 
try {Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS 
}catch(e) {Ajax = false; 
} 
} 
} 
return Ajax; 
} 
function CallAjax(div,file) {
document.getElementById(div).innerText = "";
if(document.getElementById) { // Para os browsers complacentes com o DOM W3C. 
var exibeResultado = document.getElementById(div); // div que exibirá o resultado. 
var Ajax = openAjax(); // Inicia o Ajax. 
Ajax.open("GET", file, true); // fazendo a requisição 
Ajax.onreadystatechange = function() 
{ 
if(Ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando... 
exibeResultado.innerHTML = "<div align='center'><img src='./Layout/Loading.gif'><h6>carregando...</h6></div>"; 
} 
if(Ajax.readyState == 4) { // Quando estiver tudo pronto. 
if(Ajax.status == 200) { 
var resultado = Ajax.responseText; // Coloca o retornado pelo Ajax nessa variável 
resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4) 
resultado = unescape(resultado); // Resolve o problema dos acentos 
exibeResultado.innerHTML = resultado; 
// document.getElementById("A").innerHTML = ""; //"<img src='Layout/Visto.gif'>";
} else { 
exibeResultado.innerHTML = "Erro ao porcessar página.";
} 
} 
} 
Ajax.send(null); // submete 
} 
} 
//#########################################################//
// Tao.Ajax.Functions
//#########################################################//
function LoadTexto(id) {
CallAjax("Texto","ContentTexto.aspx?id=" + id);
}
function LoadEquipe() {
CallAjax("Texto","ContentEquipe.aspx");
}
function LoadCursos(id) {
CallAjax("Texto","ContentCursos.aspx?id=" + id);
}
function LoadArtigos(id) {
CallAjax("Texto","ContentArtigos.aspx?id=" + id + "&#top");
}
function LoadNoticias(id) {
CallAjax("Texto","ContentNoticias.aspx?id=" + id + "&#top");
}

function GetPhoto(foto) {
CallAjax("DivPhoto","ContentPhoto.aspx?foto=" + foto);
}

function GetPage(div, page) {
CallAjax(div,page);
}

//#########################################################//
// Tao.Scripts.Functions
//#########################################################//
function x(id){
document.getElementById(id).style.background = "#FEFAE0";
}
function y(id){
document.getElementById(id).style.background = "white";
if(id %2 == 0){
document.getElementById(id).style.background = "#F4F8FB";
}
}
function y2(id){
document.getElementById(id).innerHTML = "<img src='./Layout/Visto.gif'>";
}
function StatusBar() {
window.status = ":::::: Dr. Aranha ::::::";
}

function OpenWindowMapa()
{
alert("Atenção: O mapa será aberto em uma nova janela!");
window.open('PageLocalizacaoGoogle.aspx','Localizacao','fullscreen=yes');
}
window.focus();


function SendEmailIndique()
{
var nome = document.getElementById("nome").value;
var de = document.getElementById("de").value;
var para = document.getElementById("para").value;
var mensagem = "";
var page = "ContentIndique.aspx?nome="+ nome + "&de=" + de + "&para=" + para;


if(para == "")
{
mensagem = "Digite o email do amigo(a) !";
}
if(de == "")
{
mensagem = "Digite seu email !";
}

if(nome == "")
{
mensagem = "Digite seu nome !";
}
if(mensagem == "")
{
GetPage('Texto',page);
}
else
{
alert(mensagem);
}

}

function carregaFlash(caminho,largura,altura)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">');
document.write('<param name="movie" value="'+caminho+'">');
document.write('<param name="quality" value="high">');
document.write('<param name="wmode" value="transparent">');
document.write('<param name="menu" value="false">');
document.write('<embed src="'+caminho+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed>');
document.write('</object>');
}