var combodropimage='' //path to "drop down" image
var combodropoffsetY=2 //offset of drop down menu vertically from default location (in px)
var combozindex=40

if (combodropimage!="")
	combodropimage='<img class="downimage" src="'+combodropimage+'" title="Select an option" />'

function dhtmlselect(selectid, selectname, selectvalue, selectwidth, optionwidth, prev, documento){
	var selectbox=document.getElementById(selectid)

	if (!documento) {
		document.write('<div id="dhtml_'+selectid+'" class="dhtmlselect">'+selectbox.title+" "+combodropimage+'<div id="mazinger_'+selectid+'" class="dropdown">')
	} else {
		var salida = '<div id="dhtml_'+selectid+'" class="dhtmlselect">'+selectbox.title+" "+combodropimage+'<div id="mazinger_'+selectid+'" class="dropdown">';	
	}
//	for (var i=selectbox.actual; i<selectbox.options.length && i<=(selectbox.actual+selectbox.items); i++)

	for (var i=0; i<selectbox.options.length; i++)
		//document.write('<a href="'+selectbox.options[i].value+'">'+selectbox.options[i].text+'</a>')
		if (!documento) {
			if (prev == '0')
				document.write('<a href="#" id="a_'+i+'" onclick="javascript:document.getElementById(\''+selectname+'\').value=\''+selectbox.options[i].text+'\';document.getElementById(\''+selectvalue+'\').value=\''+selectbox.options[i].value+'\';">'+selectbox.options[i].text+'</a>')			
			else
				document.write('<a href="#" id="a_'+i+'" onclick="javascript:document.getElementById(\''+selectname+'\').value=\''+selectbox.options[i].text+'\';document.getElementById(\''+selectvalue+'\').value=\''+selectbox.options[i].value+'\';prevision();asignar(document.getElementById(\''+selectid+'\').name,document.getElementById(\''+selectvalue+'\').value);">'+selectbox.options[i].text+'</a>')
		} else {
			salida += '<a href="#" id="a_'+i+'" onclick="javascript:document.getElementById(\''+selectname+'\').value=\''+selectbox.options[i].text+'\';document.getElementById(\''+selectvalue+'\').value=\''+selectbox.options[i].value+'\';prevision();asignar(document.getElementById(\''+selectid+'\').name,document.getElementById(\''+selectvalue+'\').value);">'+selectbox.options[i].text+'</a>'; 
		}
//		document.write('<div class="jarr" id="a_'+i+'" onclick="javascript:document.getElementById(\''+selectname+'\').value=\''+selectbox.options[i].text+'\';document.getElementById(\''+selectvalue+'\').value=\''+selectbox.options[i].value+'\';">'+selectbox.options[i].text+'</div>')
//	document.write('<div onmouseover="javascript:document.getElementById(\''+selectid+'\').actual = parseInt(document.getElementById(\''+selectid+'\').actual)+parseInt(document.getElementById(\''+selectid+'\').items); dhtmlselect2(\''+selectid+'\',\''+selectname+'\',\''+selectvalue+'\',\''+selectwidth+'\',\''+optionwidth+'\');">[Siguiente]</div>')
    if (!documento) {
		document.write('</div></div>')
	} else {
		salida += '</div></div>';
		document.getElementById('div_'+selectid).innerHTML = salida;	
	}
	
	selectbox.style.display="none"
	var dhtmlselectbox=document.getElementById('dhtml_'+selectid)
	dhtmlselectbox.style.zIndex=combozindex
	combozindex--
	if (typeof selectwidth!="undefined")
		dhtmlselectbox.style.width=selectwidth
	if (typeof optionwidth!="undefined")
		dhtmlselectbox.getElementsByTagName("div")[0].style.width=optionwidth
	dhtmlselectbox.getElementsByTagName("div")[0].style.top=dhtmlselectbox.offsetHeight-combodropoffsetY+"px"
	if (combodropimage!="")
		dhtmlselectbox.getElementsByTagName("img")[0].style.left=dhtmlselectbox.offsetWidth+3+"px"
	dhtmlselectbox.onmouseover=function(){
		this.getElementsByTagName("div")[0].style.display="block"
	}
	dhtmlselectbox.onmouseout=function(){
		this.getElementsByTagName("div")[0].style.display="none"
	}
	

}
/*
function dhtmlselect2(selectid, selectname, selectvalue, selectwidth, optionwidth) {
    var selectbox = document.getElementById(selectid)
    var selector = document.getElementById('mazinger_'+selectid);
    for (var i=selectbox.actual; i<selectbox.options.length && i<=(selectbox.actual+selectbox.items); i++) {
        var aux = document.getElementById('a_'+(i-15).toString());
        if (aux) {
        	aux.innerHTML = selectbox.options[i].text;
        	//aux.onclick = 'alert();document.getElementById(\''+selectname+'\').value=\''+selectbox.options[i].text+'\';document.getElementById(\''+selectvalue+'\').value=\''+selectbox.options[i].value+'\';'
        	//aux.onclick = function () { this.onclick; }
        }
	}

}
*/