function mailinglist() {

	var url ='/manager/templates/default/ajax-handler.php';
	var pars = Form.serialize('mailinglist');
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onComplete: showResponseMailinglist} );
}

function showResponseMailinglist (originalRequest) {
	var newData = originalRequest.responseText;
	$('mailinglist').style.display = 'none';
	$('mailinglist-subscribe').innerHTML = newData;
	
}

function mostra(parte){
	$(parte).style.display = "block";
}

function esconde(parte){
	$(parte).style.display = "none";
}

function innerSelect(id,html){
	var sel = document.getElementById(id);
	html = '(TAG SELECT)'+html+'<(TAG /SELECT)';
	var temp = document.createElement('div');
	temp.innerHTML = html;
	sel.innerHTML = '';
	var options = temp.getElementsByTagName('option');
	while (options.length){
		sel.appendChild(options[i]);
	}
}

function select_innerHTML(objeto,innerHTML){
/******
* select_innerHTML - corrige o bug do InnerHTML em selects no IE
* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228
* Versão: 1.0 - 06/04/2006
* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
* @objeto(tipo HTMLobject): o select a ser alterado
* @innerHTML(tipo string): o novo valor do innerHTML
*******/
    objeto.innerHTML = ""
    var selTemp = document.createElement("micoxselect")
    var opt;
    selTemp.id="micoxselect1"
    document.body.appendChild(selTemp)
    selTemp = document.getElementById("micoxselect1")
    selTemp.style.display="none"
    if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto
        innerHTML = "<option>" + innerHTML + "</option>"
    }
    innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span")
    selTemp.innerHTML = innerHTML
      
    
    for(var i=0;i<selTemp.childNodes.length;i++){
  var spantemp = selTemp.childNodes[i];
  
        if(spantemp.tagName){     
            opt = document.createElement("OPTION")
    
   if(document.all){ //IE
    objeto.add(opt)
   }else{
    objeto.appendChild(opt)
   }       
    
   //getting attributes
   for(var j=0; j<spantemp.attributes.length ; j++){
    var attrName = spantemp.attributes[j].nodeName;
    var attrVal = spantemp.attributes[j].nodeValue;
    if(attrVal){
     try{
      opt.setAttribute(attrName,attrVal);
      opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));
     }catch(e){}
    }
   }
   //getting styles
   if(spantemp.style){
    for(var y in spantemp.style){
     try{opt.style[y] = spantemp.style[y];}catch(e){}
    }
   }
   //value and text
   opt.value = spantemp.getAttribute("value")
   opt.text = spantemp.innerHTML
   //IE
   opt.selected = spantemp.getAttribute('selected');
   opt.className = spantemp.className;
  } 
 }    
 document.body.removeChild(selTemp)
 selTemp = null
}

function constroi_unidades(){
	var combustivel = $F('combustivel');
//	alert(combustivel);
	var url ='/manager/templates/default/ajax-handler.php';
	
	var pars = 'accao=simulador_unidades&combustivel='+combustivel;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onComplete: showResponseConstroiUnidades} );
	
}

function showResponseConstroiUnidades (originalRequest){
	
	var newData = originalRequest.responseText;
	$('select-unidades').innerHTML = newData;
//	var container = $('select-unidades');
//	innerSelect(container,newData);
//	select_innerHTML(container,newData);

//var newdiv = document.createElement("span");
//newdiv.innerHTML = newData;
//var container = document.getElementById("select-unidades");
//container.appendChild(newdiv);

	//$('select-unidades').appendChild = newData;
}
