function number_format(a, b, c, d) {
	a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
	var e = a + '';
	var f = e.split('.');
	if (!f[0]) {
		f[0] = '0';
	}
	if (!f[1]) {
		f[1] = '';
	}
	if (f[1].length < b) {
		var g = f[1];
		for (var i=f[1].length + 1; i <= b; i++) {
			g += '0';
		}
		f[1] = g;
	}
	if(d != '' && f[0].length > 3) {
		var h = f[0];
		f[0] = '';
		for(var j = 3; j < h.length; j+=3) {
			var i = h.slice(h.length - j, h.length - j + 3);
			f[0] = d + i +  f[0] + '';
		}
		j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
		f[0] = j + f[0];
	}
	c = (b <= 0) ? '' : c;
	return f[0] + c + f[1];
}

function esta_elemento_en_array(elemento, array) {
	for (var i=0;i<array.length;i++) {
		if (array[i]==elemento) return true;
	}
	return false;
}

function deshabilitar_enter(e) {
	var key = (window.event) ? event.keyCode : e.keyCode;
	if (key==13) {
		return false;
	}
	return true;
}

function encadenar_select(lista) {
	cadena='';
	for (i=0;i<lista.length;i++) {
		cadena+=',' + lista.options[i].value;
	}
	if (cadena!='') cadena=cadena.substr(1);
	return cadena;
}


function startList() {
	if (document.all&&document.getElementById) {
		cssdropdownRoot = document.getElementById("cssdropdown");
		for (x=0; x<cssdropdownRoot.childNodes.length; x++) {
			node = cssdropdownRoot.childNodes[x];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
					if (this.className.indexOf('m1')!=-1 || this.className.indexOf('m2')!=-1) {
						showHideCombos('hidden');
					}
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
					if (this.className.indexOf('m1')!=-1 || this.className.indexOf('m2')!=-1) {
						showHideCombos('visible');
					}
				}
			}
		}
	}
}

if (window.attachEvent)
	window.attachEvent("onload", startList)
else
	window.onload=startList;

function showHideCombos(accion) {
	if (navigator.appVersion.indexOf('MSIE 6.0')==-1) return;
	var f=document.getElementById('buscador');
	if (!f) return;
	var select=f.getElementsByTagName('select');
	for (var i=0;i<select.length;i++) {
		select[i].style.visibility=accion;
	}
}