/* author: Leonardo Corradi */
/* This script is alfa and don't work correctly at now */
/* It is intended for use on the alternative modeling website only */
/* You may copy this script if you want, but do it at your own risk */
/* 
 * If you copy this script entirely or in part, give-me feedback and
 * respect the inside copyright notes.
*/
/* **********************************************************************
/* For the cookies code only: */

/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 *************************************************************************
 */
/* The original cookies code was modified to adapt to my own needs... */
/* Te cookies code and my highlight code works perfectly, only the inter-windows
 * parameters fails because of some undetermined problem...
*/
/* Generated by AceHTML Freeware http://freeware.acehtml.com */
/* Creation date: 26/2/2004 */

/* lembrar que eu estarei chamando os códigos a partir de cabecalho.
 * se parar de funcionar, pode ser isto, mas no deve ter efeito.
*/



<!--
var endereco="";
var status = 0;
var cor =null;

 /*Objetivo é retibuir o valor armazenado no cookie pela página
fornecida em name.*/
 
function verificaCookie (name) {
    var dcookie = document.cookie; // instanciando...
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin < clen) { // cbegin e clen são o inicio e o tamanho total do cookie.
        var vbegin = cbegin + cname.length;
                if (dcookie.substring(cbegin, vbegin) == cname) { 
                var vend = dcookie.indexOf (";", vbegin); //vbegin é o início da substring a ser obtida, dentro do array.
                        if (vend == -1) vend = clen; // vend = fim da variavel, enquanto clen é lenght ou tamanho do Cookie
                return unescape(dcookie.substring(vbegin, vend));
                }
        cbegin = dcookie.indexOf(" ", cbegin) + 1;
                if (cbegin == 0) break;
        }
return "0";
}

/*Objetivo é atribuir o valor retribuído pela função verificaCookie
 (glossario) à variavel status on/off.*/

function checagem () {
	status = parseInt(verificaCookie ("glossario"),10);
}

/*Objetivo é abrir uma nova janela de nome glossario contendo a página
frames.html e usando id mais .html como arquivo aberto no iframe.*/

function abrirGlossario(identificador) {
	
	if (typeof(glossario) == "undefined"){
		if (status==1){
			endereco="../glossl/"+identificador+".html";
			glossario=window.open('glossario/frames.html','gloss','toolbar=0','location=0','directories=0','status=0','menubar=0','resizable=1','scrollbars=1','width=500,height=600'); // glossario é um window handler que controla a nova janela.
  			glossario.resizeTo(550,600); //por algum bug ou algo assim, o método window.open não consegue dar o tamanho certo às janelas, sendo necessário usar ainda window.resizeTo(width,height)...
			//glossario._glossario.location=endereco;
			//glossario.frames['_glossario'].open(endereco,'_glossario','scrollbars=yes','resizable=no','width=471,height=435'); //frames['nome' ou número] é filho de window, e herda suas propriedades e métodos, além de incluir novos. Assim, pode-se mandar que eles utilizem diretamente o método open(url,nome,[características]) quando uma característica vem entre parênteses, ela é opcional...
			identificador=null;
		}else{
			return null;
		}
	}else{
		glossario.close();
		if (status==1){
			endereco="../glossl/"+identificador+".html";
			glossario=window.open('glossario/frames.html','gloss','toolbar=0','location=0','directories=0','status=0','menubar=0','resizable=1','scrollbars=1','width=500,height=600'); // glossario é um window handler que controla a nova janela.
  			glossario.resizeTo(550,600); //por algum bug ou algo assim, o método window.open não consegue dar o tamanho certo às janelas, sendo necessário usar ainda window.resizeTo(width,height)...
			//glossario._glossario.location=endereco;
			//glossario.frames['_glossario'].open(endereco,'_glossario','scrollbars=yes','resizable=no','width=471,height=435'); //frames['nome' ou número] é filho de window, e herda suas propriedades e métodos, além de incluir novos. Assim, pode-se mandar que eles utilizem diretamente o método open(url,nome,[características]) quando uma característica vem entre parênteses, ela é opcional...
			identificador=null;
		}else{
			return null;
		}
	}
}

/*objetivo é destacar texto através de mudança de cor, com o evento
onmouseover.*/

function destacar(id) {
	if (status==1){
		cor = id.style.color;
		id.style.color="red"; // ver comentário abaixo...
	}else{
		return null;
	}
}

/*Objetivo é voltar o texto ao normal, após retirar o cursor de cima
do texto...*/

function normalizar(id){
	if (status==1){
		id.style.color = cor; // identificador no lugar de id, ja que id pode ser trocado diretamente pela string que ele contem. ex: tags.a1.color representa tags.id.color para id sendo a1...
	}else{
		return null;
	}
}

//Objetivo é criar um cookie, se inexistente, que armazene o código 0 ou 1 em value, amrazenando a informação ligado ou desligado para próximo acesso...

function criaCookie (name, value, expires) {
	if (!expires) expires = new Date(); //cria uma instancia expires do mesmo tipo data
	document.cookie = name + "=" + escape (value) +   "; expires=" + expires.toGMTString() +  "; path=/";  // document.cookie recebe os valores do cookie, sendo value em hexadecimal
} 

//Objetivo é atribuir o valor 1 ao status, se ele era zero, ou zero, se ele era diferente de zero... Um liga/desliga!

function criaStatus () {
	if (status==0) {
		var expdate = new Date ();
		expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * 31));
		criaCookie ("glossario", "1", expdate);
		status = 1;
		alert ("Glossary is on!\n\nInstructions: Scrow the mouse over the marked text and see if it gets red\nIf true, click the text to get their significance...\n\nThe glossary will open in a new window...\n\nClick on the glossary link again to disable this feature!");
	} else {
		criaCookie ("glossario", "0", expdate);
		if (typeof(glossario) != "undefined"){	
			glossario.close();
			status= 0;
			alert ("Glossary is off!");
		}else{
			status= 0;
			alert ("Glossary is off!");
		}
	}
}
	
function closewindow(){
	if (typeof(glossario) != "undefined"){	
		glossario.close();
		status= 0;
	}else{
		status= 0;
	}
}
	
	
// -->
