// JavaScript Document MENUS

startList = function() 
{
	if (document.all&&document.getElementById) 
	{
		navRoot = document.getElementById("nav");
		if (navRoot != null && navRoot.childNodes != null)
		{
			for (var i = 0; i < navRoot.childNodes.length; i++) 
			{
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") 
				{
					node.onmouseover=function() 
					{
						this.className+=" over";
					}
					node.onmouseout=function() 
					{
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
}
window.onload=startList;

//////////////

function StringBuffer() {
	this.length = 0;
	
	this._cache = null;
	this._data = [];
	this._joiner = (arguments.length == 1) ? arguments[0] : "";
	
	if (arguments.length > 0) {
		for (var i = 0; i < arguments.length; i++) {
			this.append(arguments[i]);
		}
	}
}

var _p = StringBuffer.prototype;

_p.append = function (s) {
	this.length += String(s).length;
	this._data[this._data.length] = String(s);
}

_p.clear = function () {
	this._cache = null;
	
	for (var i = 0; i < this._data.length; i++) {
		this._data[i] = null;
	}
	
	this._data = [];
}

_p.toString = function () {
	if (this._cache != null) {
		return this._cache;
	}
	
	return (this._cache = this._data.join(this._joiner));
}

function $(s) {
	return document.getElementById(s);
}

function LimpaResposta() {
	$('resposta').innerHTML = "";
}

function DropDown(path) {	
	LimpaResposta();		
	xajax_ExibeConteudoDropDown(path);
}

function limpaDropDown() {
	var qtd_dados = $('selection').options.length;
	var i;
	for ( i = 0; i < qtd_dados; i++ ) {
		$('selection').remove(i);
	}
	$('selection').options[0] = new Option("Primeiro selecione um Estado!","");
}

function ExibeDropDown(path) {	
	//alert($('crmunicipio').value);	
	//alert(path);	
	limpaDropDown();	
	xajax_BuscaCidades($('crmunicipio').value,path);
	return true;
}