// JavaScript Document - javascript.js

// GERAL -------------------------------------------------------
//Âncora & título (Juntos devido alteração do título quando acionado a âncora, por isso, forçado acerto do título)
function moveWindow (){window.location.hash="topo"; document.title = "TATTOO ILHA - ESTÚDIO DE TATUAGEM";}
//Título
function loadtitle (){document.title = "TATTOO ILHA - ESTÚDIO DE TATUAGEM";}
//Parte comum para todas as funções de carregar html dentro das DIVs
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}
//FIM GERAL ---------------------------------------------------------

//INFORMACÕES & TATUAGEM & PIERCING -----------------------------------------------------
//Carregar paginas HTML na DIV id="cc_c_in"
function conect() {
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('cc_c_in').innerHTML = http.responseText;
    }
  }
  http.send(null);
  }
function info_carpe() {  http.open("GET", "informacoes/info_carpe.html", true); conect();}
function info_medicos() {  http.open("GET", "informacoes/info_medicos.html", true); conect();}
function info_sangue() {  http.open("GET", "informacoes/info_sangue.html", true); conect();}
function info_estagio() {  http.open("GET", "informacoes/info_estagio.html", true); conect();}
function info_gravidez() {  http.open("GET", "informacoes/info_gravidez.html", true); conect();}
function info_hepatite() {  http.open("GET", "informacoes/info_hepatite.html", true); conect();}
function info_remover() {  http.open("GET", "informacoes/info_remover.html", true); conect();}
function info_trabalho() {  http.open("GET", "informacoes/info_trabalho.html", true); conect();}
function tatuagem_historia() {  http.open("GET", "tatuagem/tatuagem_historia.html", true); conect();}
function tatuagem_henna() {  http.open("GET", "tatuagem/tatuagem_henna.html", true); conect();}
function tatuagem_cuidados() {  http.open("GET", "tatuagem/tatuagem_cuidados.html", true); conect();}
function piercing_historia() {  http.open("GET", "piercing/piercing_historia.html", true); conect();}
function piercing_cuidados() {  http.open("GET", "piercing/piercing_cuidados.html", true); conect();}
//FIM NOTÍCIAS & TATUAGEM & PIERCING ---------------------------------------------------------------------------------------

//NOTÍCIAS -------------------------------------------------------
//Obter variável a partir de link
function getUrlVars()
   {
	   var vars = [], hash;
	   var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	   for(var i = 0; i < hashes.length; i++)
	   {
		   hash = hashes[i].split('=');
		   vars.push(hash[0]);
		   vars[hash[0]] = hash[1];
		}
	return vars;
	} 
var informacoes = getUrlVars()["informacoeslink"];
//A partir da variavel capturada (link na página index) abrir notícia correspondente
function load(){
if (informacoes == "info_carpe") { info_carpe();
} else if (informacoes == "info_sangue") {	info_sangue();
} else if (informacoes == "info_medicos") { info_medicos();
} else { info_estagio();
}
}
//FIM NOTÍCIAS ---------------------------------------------------------------

//PRODUTOS ------------------------------------------------------------
//Para permutar imagens dos produtos. O link deve ficar assim: onclick="javascript:exibir_camisa('cp023');. O cp023 é o código = nome da imagem.
//function exibir_lata(codigo) {
	//Identificação da imagem maior permutável
	//var imagem = document.getElementById("id_lata");
	//A partir do código informado no link carrega a imagem correspondente
	//var lata = codigo
	//switch(lata) {
	//	case codigo: imagem.src =("imagem/produtos/lata/"+codigo+".jpg"); break;
//	}
//}
//Carregar paginas HTML das galerias na DIV cc_c_in2
function conect_produto() {
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('cc_c_in2').innerHTML = http.responseText;
    }
  }
  http.send(null);
  }
function produtos_alargadores_t1() {  http.open("GET", "produtos/produtos_alargadores_t1.html", true); conect_produto();}
function produtos_alargadores_t2() {  http.open("GET", "produtos/produtos_alargadores_t2.html", true); conect_produto();}
function produtos_cd() {  http.open("GET", "produtos/produtos_cd.html", true); conect_produto();}
function produtos_camisas() {  http.open("GET", "produtos/produtos_camisas.html", true); conect_produto();}
function produtos_cintos() {  http.open("GET", "produtos/produtos_cintos.html", true); conect_produto();}
function produtos_caixas() {  http.open("GET", "produtos/produtos_caixas.html", true); conect_produto();}
function produtos_pg_argola() {  http.open("GET", "produtos/produtos_pg_argola.html", true); conect_produto();}
function produtos_pg_bananabell() {  http.open("GET", "produtos/produtos_pg_bananabell.html", true); conect_produto();}
function produtos_pg_barbell() {  http.open("GET", "produtos/produtos_pg_barbell.html", true); conect_produto();}
function produtos_pg_captive() {  http.open("GET", "produtos/produtos_pg_captive.html", true); conect_produto();}
function produtos_pg_ferradura() {  http.open("GET", "produtos/produtos_pg_ferradura.html", true); conect_produto();}
function produtos_pg_labret() {  http.open("GET", "produtos/produtos_pg_labret.html", true); conect_produto();}
function produtos_pg_megabell() {  http.open("GET", "produtos/produtos_pg_megabell.html", true); conect_produto();}
function produtos_pg_microbell() {  http.open("GET", "produtos/produtos_pg_microbell.html", true); conect_produto();}
function produtos_pg_nostril() {  http.open("GET", "produtos/produtos_pg_nostril.html", true); conect_produto();}
function produtos_pg_twist() {  http.open("GET", "produtos/produtos_pg_twist.html", true); conect_produto();}
//Mostrar e ocultar DIVs no submenu dos produtos (Piercing e Alargadores)(Lembrar que o link deve ter ex: onclick="piercing_sub(1)"; e as DIVs devem ser identificadas id="piercing_sub1")
function piercings_sub(el) {
var objTexto = document.getElementById("piercings_sub"+el);
var piercings_abrir = document.getElementById("piercings_sub1");
var piercings_fechar = document.getElementById("piercings_sub2");
piercings_abrir.style.display = "none";
piercings_fechar.style.display = "none";
objTexto.style.display = "block";
}
function alargadores_sub(el) {
var objTexto = document.getElementById("alargadores_sub"+el);
var alargadores_abrir = document.getElementById("alargadores_sub1");
var alargadores_fechar = document.getElementById("alargadores_sub2");
alargadores_abrir.style.display = "none";
alargadores_fechar.style.display = "none";
objTexto.style.display = "block";
}
//FIM PRODUTOS ----------------------------------------------------------------------

//CONTATO -----------------------------------
// Linha para capturar a variável (contatolink). O restante do cádigo está em Notícias, pois não precisa repetir.
var contato = getUrlVars()["contatolink"];

function contatotarget(){
var myFrame = document.getElementById('contato_forms');
if (contato == "cadastro") { myFrame.src = "contato/contato_cadastro.html";
} else if (contato == "livro") { myFrame.src = "contato/contato_livro.asp";
} else if (contato == "indique") { myFrame.src = "contato/contato_indique.html";
} else if (contato == "pedido") { myFrame.src = "contato/contato_produtos.html";
} else { myFrame.src = "contato/contato_mensagem.html";
}
}
//Iframe com altura altomática
function tamanho_iframe() {
document.getElementById("contato_forms").height = contato_forms.document.getElementById("div_contato_forms").scrollHeight + 10; //40: Margem Superior e Inferior, somadas
}
//Abrir mapa em outra página com dimensões fixas
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// Carregar página mapa_local.html dentro da div mapa_local nas páginas dos formulários de contato
function conect_contato() {
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('mapa_localizacao').innerHTML = http.responseText;
    }
  }
  http.send(null);
  }
function mapa_localizacao() {  http.open("GET", "contato/mapa_localizacao.html", true); conect_contato();}
//FIM CONTATO ---------------------------------


