	var time_zindex = '';
	var optioninit;
	var myWidth = 0, myHeight = 0;
	var time = '';
	var show = '';
	var selecionado = '';
	var ie4 = false;
	if(document.all){ ie4 = true; }
	var valorajax;
	var rediract_o;
	var redirect_link;
	var developer;
	var q;
	var valores;
	var vect;
	document.onkeydown = KeyCheck; 
	document.onkeyup = KeyMod;
	var ctrlKey = false;
	var altKey = false;
	var shftKey = false;
	var scrollbar;
	//var elm = getElmById("myID"); 
function handleEvent(aEvent) { 
	var myEvent = aEvent ? aEvent : window.event; 
} 
function onemltLoad(emlt) {
	var element = getElmById(emlt);
	element.addEventListener("click", handleEvent, false); 
} 

function getElmById(aID){ 
	return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
} 

function imgloader(imgs) {
	var i = 0;
    imageObj = new Image();
    for (var i = 0; i < arguments.length; i++){
		if(arguments[i] != '' && arguments[0] != undefined) {
			imageObj[i] = document.createElement('img');
			imageObj[i].setAttribute('src',arguments[i]);
		};
    };
}
function KeyMod(e){
	var KeyID = (window.event) ? event.keyCode : e.keyCode;
	switch(KeyID) {
		case 17: ctrlKey = false; break;
		case 18: altKey = false; break; 
		case 16: shftKey = false; break; 
	}
}
function redirectto(url) {
	window.location = url;
}
function KeyCheck(e){
	var KeyID = (window.event) ? event.keyCode : e.keyCode;
	switch(KeyID)
	{
		case 17: ctrlKey = true; break; 
		case 18: altKey = true; break;
		case 16: shftKey = true; break;
		case 27: {content('mensagemh');show_auto_hide('s_message', 'hidden');}break;
		case 36: if(ctrlKey){ ajax('sim&col=op&t=auto&r=lista'); } break;
		case 116: if(ctrlKey && shftKey) { window.location = "/"; } break;
		case 118: if(ctrlKey && shftKey) { window.location = "/?q="+valorajax; } break;
		case 119: if(ctrlKey && shftKey) { msgrep(0, "<span style=\"font-size:6px;\">/?q="+valorajax+"</span>"); } break;
		/*<br><a onClick=\"redirectto(\"/?q=\""+valorajax+")\">go</a> <a onClick=\"copyToClipboard(\"/?q=\""+valorajax+")\">copy</a>*/
		case 120: if(ctrlKey && shftKey) {
			if(developer != 'rjorge') {
				developer = 'rjorge';
				show_hide('debuger', 'visible');
				msgrep(1000, 'activada a visualização do debug.');
			} else {
				developer = '';
				show_hide('debuger', 'hidden');
				msgrep(1000, 'desactivada a visualização do debug.');
			}
			break;
		}
		case 33: if(get_class('prev') == 'lstprev') ajax(q+'&t='+valores['t']+'&col='+valores['col']+'&r='+valores['r']+'&pag='+(parseInt(getContent('pag'))-1));break;
		case 34: if(get_class('next') == 'lstnext') ajax(q+'&t='+valores['t']+'&col='+valores['col']+'&r='+valores['r']+'&pag='+(parseInt(getContent('pag'))+1));break;
	}
}
function msgrep(time, msg) {
	setContent('s_message', msg);
	show_hide('sombra', 'visible');
	show_auto_hide('s_message', 'visible');
	if(time != 0 && time != '') time = setTimeout("show_auto_hide('s_message', 'hidden')", time);
	else setContent('s_message', msg+'<br><a onclick="show_auto_hide(\'s_message\', \'hidden\')" >fechar</a>');
}
n="busca";
function redirect(valor) {
	rediract_o = true;
	redirect_link = valor;
}
function show_auto_hide(id, op) {
	show_hide(id, op);
	if(op == 'hidden') time = '';
	if(id == 's_message' && op == 'hidden') show_hide('sombra', 'hidden');
}
function show_hide(id, op) {
	if(op == 'change') {
		op2 = document.getElementById(id).style.visibility;
		if(op2 == 'hidden') op = 'visible';
		else if(op2 == 'visible') op = 'hidden';
	} else if(op == 'show') op = 'visible';
	else if(op == 'hide') op = 'hidden';
	if (id == 'mensagem') document.getElementById(id).style.visibility=op;
	if (id == 'mesgcont') document.getElementById(id).style.visibility=op;
	document.getElementById(id).style.visibility=op;
}
function min_max(id, op) {
	var d = getElmById(id);  
	if(op == 'change' || op == '') {
		op2 = d.style.display;
		if(op2 == 'none') op = 'block';
		else if(op2 == 'block') op = 'none';
	} else if(op == 'max') op = 'block';
	else if(op == 'min') op = 'none';
	if (id == 'mensagem') d.style.display=op;
	if (id == 'mesgcont') d.style.display=op;
	d.style.display=op;
}
function confirmSubmit(url, msg) {
	var agree=confirm(msg);
	if (agree)
		window.location = url;
}
//function alert(str){ msgrep(1000, str); }	
function rhtmlspecialchars(str) {
	if (typeof(str) == "string") {
		str = str.replace(/&gt;/ig, ">");
		str = str.replace(/&lt;/ig, "<");
		str = str.replace(/&#039;/g, "'");
		str = str.replace(/&quot;/ig, '"');
		str = str.replace(/&amp;/ig, '&'); /* must do &amp; last */
	}
	return str;
}
function htmlspecialchars(str) {
	if (typeof(str) == "string") {
		str = str.replace(/&/g, "&amp;"); /* must do &amp; first */
		str = str.replace(/"/g, "&quot;");
		str = str.replace(/'/g, "&#039;");
		str = str.replace(/</g, "&lt;");
		str = str.replace(/>/g, "&gt;");
	}
	return str;
}
function htmlentities( s ){
	var div = document.createElement('div');
	var text = document.createTextNode(s);
	div.appendChild(text);
	return div.innerHTML;
}
function html_entity_decode(str) {
	var  tarea=document.createElement('textarea');
	tarea.innerHTML = str;
	return tarea.value;
	tarea.parentNode.removeChild(tarea);
}
function copyToClipboard(tocopy) {
	var  holdtext=document.createElement('textarea');
	holdtext.innerText = tocopy;
	Copied = holdtext.createTextRange();
	Copied.execCommand("Copy");
}
function setContent(name, value){
	var d = getElmById(name);   
	d.innerHTML = value;    
} 
function getContent(name){
	var d = getElmById(name);  
	return d.innerHTML;
}  
function getvalue(name){
	var d = getElmById(name);  
	return d.value;
}
function setColor(name, value){
	var d = getElmById(name);  
	d.style.color = value;  
}
function getColor(name){
	var d = getElmById(name);  
	return d.style.color;
}
function getimg(name){
	var d = getElmById(name);  
	return d.src;
}
function set_img(name, value){
	var d = getElmById(name);  
	d.style.background.image = 'url('+value+');';
}
function setimg(name, value){
	var d = getElmById(name);  
	d.src = value;
}
function set_class(name, value){
	var d = getElmById(name);  
	d.className = value;
}
function get_class(name){
	var d = getElmById(name);  
	return d.className;
}
function set_margin(name, pos, value) {
	var d = getElmById(name);  
	if(pos == 'top') d.style.top = value+'px';
	if(pos == 'left') d.style.left = value+'px';
}
function set_margins(name, t, l) {
	var d = getElmById(name);  
	d.style.top = t+'px';
	d.style.left = l+'px';
}
function set_size(name, op, value) {
	var d = getElmById(name);  
	if(op == 'height') d.style.height = value+'px';
	if(op == 'width') d.style.width = value+'px';
}
function set_sizes(name, w, h) {
	var d = getElmById(name);  
	d.style.height = h+'px';
	d.style.width = w+'px';
}
function get_margin(name, pos) {
	var d = getElmById(name);  
	if(pos == 'top') return d.style.top;
	if(pos == 'left') return d.style.left;
}
function get_size(name, op) {
	var d = getElmById(name);  
	if(op == 'height') return d.style.height;
	if(op == 'width') return d.style.width;
}
function set_zindex(name, op) {
	var d = getElmById(name);  
	d.style.zIndex = op;
}
function rset_zindex(name, op) {
	var d = getElmById(name);  
	d.style.zIndex = op;
	time_zindex = '';
}
function get_zindex(name) {
	var d = getElmById(name);  
	return d.style.zIndex;
}
function reset_zindex(t) {
	time_zindex = setTimeout("rset_zindex('content', 8)", t);
}

function eval_this(this_value, possivel, objt, objt2) {
	var rep = false;
	var i=0;
	var possiveis = possivel.split("#");
	for(i=0; i < possiveis.length; i++) {
		if(possiveis[i] == this_value) rep = true;
	}
	if(rep == true) {
		min_max(objt, 'block');
		min_max(objt2, 'none');
	} else {
		min_max(objt, 'none');
		min_max(objt2, 'block');
	}
}
function open_win(url, winW, winH) {
	//alert(url+winW+winH);
	var winX = (screen.availWidth - winW) / 2;
	var winY = (screen.availHeight - winH) / 2;
	var features = 'left='+winX+',top='+winY+',height='+winH+',' +
	'width='+winW+',status=no,' +
	'toolbar=no,menubar=no,location=no';
	window.open(url, null, features);
	//return false;
}
function valorSubmit(msg, def) {
	var valor=prompt(msg,def);
	if (valor)
		return valor;
}
function make_link() {
	var url=prompt('indique o url para o link','http://');
	if (url) var name=prompt('indique o nome para o link','');
	if (url && name) return '<a href="'+url+'" target="_blank" >'+name+'</a>';
}
function make_email_link() {
	var url=prompt('indique o email','nome@domino.com');
	if (url) var name=prompt('indique o nome para o email','');
	if (url && name) return '<a href="mailto:'+url+'" target="_blank" >'+name+'</a>';
}
function getDt(){
	var dt=new Date(); 
	var hrs=dt.getHours();
	var min=dt.getMinutes(); 
	var sec=dt.getSeconds(); 
	var Tm=" "+((hrs<10)?"0":"") +hrs+":"; 
	Tm+=((min<10)?"0":"")+min+":";
	Tm+=((sec<10)?"0":"")+sec+" "; 
	self.status = Tm; 
	return true;
	seTimeout("getDt()",1000); 
} 
