function setaction(th, boton) {
setaction2(th, boton)
setaction4(th)
}

function setaction2(th, boton) {
var frm = th;
//var wtit = frm['WTIT-C'].value;
var wtit = document.forms['form1'].t.value
while (frm.firstChild) { frm.removeChild(frm.firstChild); }
if(boton === 'E') {
 addInput(frm, 'CMD', 'VERLST', 'hidden');
 addInput(frm, 'BASE', 'ISBN', 'hidden');
 addInput(frm, 'DOCS', '1-15', 'hidden');
 addInput(frm, 'CONF', 'AEISPA.cnf', 'hidden');
 addInput(frm, 'OPDEF', 'AND', 'hidden');
 addInput(frm, 'SEPARADOR', '', 'hidden');
 addInput(frm, 'WDIS-C', 'DISPONIBLE or AGOTADO', 'hidden'); //creo que no es indispensable
 addInput(frm, 'WGEN-C', '', 'hidden');                      //creo que no es indispensable
 addInput(frm, 'WISB-C', '', 'hidden');                      //creo que no es indispensable
 addInput(frm, 'WAUT-C', '', 'hidden');                      //creo que no es indispensable
 addInput(frm, 'WTIT-C', wtit, 'text');
 frm.action = 'http://www.mcu.es/cgi-brs/BasesHTML/isbn/BRSCGI';
 frm.submit()
}
else if(boton === 'N') {
 addInput(frm, 'params.orderByFormId', '1', 'hidden');
 addInput(frm, 'language', 'es', 'hidden');
 addInput(frm, 'prev_layout', 'busquedaisbn', 'hidden');
 addInput(frm, 'layout', 'busquedaisbn', 'hidden');
 addInput(frm, 'params.liConceptosExt[0].texto', wtit, 'hidden');
 frm.action = 'http://www.mcu.es/webISBN/tituloSimpleDispatch.do';
 frm.submit()
}
else if(boton === 'M') {
 addInput(frm, 'txtTitulo', '', 'hidden');
 addInput(frm, 'txtAutor', '', 'hidden');
 addInput(frm, 'nombrePagina', 'Temas', 'hidden');
 addInput(frm, 'cod_pais_header', 'VE', 'hidden');
 addInput(frm, 'buscarPor', 'titulo', 'hidden');
 addInput(frm, 'txtBusqueda', wtit, 'hidden');
 frm.action = 'http://www.muchoslibros.com/paginaBusqueda.do';
 frm.submit()
 while (frm.firstChild) { frm.removeChild(frm.firstChild); }
 addInput(frm, 'type', '1', 'hidden');
 addInput(frm, 'layout', '28', 'hidden');
 addInput(frm, 'start', '0', 'hidden');
 addInput(frm, 'keyword', wtit, 'hidden');
 frm.action = 'http://www.tecniciencia.com/layout.jsp';
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'F') {
 addInput(frm, 'fque', wtit, 'hidden');
 addInput(frm, 'fdonde', 'titulo', 'hidden');
 frm.action = 'http://www.libreriasdelfondo.com/LF_Catalogo.asp';
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'B') {
 frm.action = 'http://www.google.com/products';
 addInput(frm, 'q', wtit, 'hidden');
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'G') {
 addInput(frm, 'source', 'ig', 'hidden');
 addInput(frm, 'hl', 'en', 'hidden');
 frm.action = 'http://www.google.com/search';
 addInput(frm, 'q', wtit, 'hidden');
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'V') {
 frm.action = 'http://www.alibris.com/booksearch';
 addInput(frm, 'title', wtit, 'hidden');
 frm.submit()
 while (frm.firstChild) { frm.removeChild(frm.firstChild); }
 addInput(frm, 'sts', 't', 'hidden');
 frm.action = 'http://www.abebooks.com/servlet/SearchResults';
 addInput(frm, 'tn', wtit, 'hidden');
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'S') {
 addInput(frm, 'new_used', '*', 'hidden');
 addInput(frm, 'destination', 've', 'hidden');
 addInput(frm, 'currency', 'VEB', 'hidden');
 addInput(frm, 'binding', '*', 'hidden');
 addInput(frm, 'mode', 'advanced', 'hidden');
 addInput(frm, 'st', 'sr', 'hidden');
 addInput(frm, 'ac', 'qr', 'hidden');
 frm.action = 'http://www.bookfinder.com/search/?submit=Begin+search';
 addInput(frm, 'title', wtit, 'hidden');
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
else if(boton === 'A') {
 frm.action = 'http://www.amazon.com/s/ref=nb_ss_b?url=search-alias%3Dstripbooks';
 addInput(frm, 'field-keywords', wtit, 'hidden');
 frm.submit()
 addInput(frm, 'WTIT-C', wtit, 'text');
}
}

function addInput(formElement, fieldName, fieldValue, fieldType) {
var inp = document.createElement('input');
inp.setAttributeNode(createHtmlAttribute('type', fieldType));
inp.setAttributeNode(createHtmlAttribute('name', fieldName));
inp.setAttributeNode(createHtmlAttribute('value', fieldValue));
if(fieldName === 'WTIT-C') inp.setAttributeNode(createHtmlAttribute('size', 1));
if(fieldName === 'WTIT-C') inp.setAttributeNode(createHtmlAttribute('style', 'display:none'));
if(fieldName === 'S1') inp.setAttributeNode(createHtmlAttribute('onClick', 'boton=this.value'));
if(fieldName === 'S2') inp.setAttributeNode(createHtmlAttribute('onClick', 'boton=this.value'));
if(fieldName === 'S3') inp.setAttributeNode(createHtmlAttribute('onClick', 'boton=this.value'));
formElement.appendChild(inp);
return
}

function createHtmlAttribute(name, value) {
var attribute = document.createAttribute(name)
attribute.nodeValue = value
return attribute
}

function setaction4(th) {
var frm = th;
myselect = document.createElement('select');
myselect.style.width='100px';
myselect.setAttributeNode(createHtmlAttribute('onchange', 'setaction(this.form, options[selectedIndex].value)'));
theOption=document.createElement('option');
theText=document.createTextNode('Buscador');
theOption.appendChild(theText);
myselect.appendChild(theOption);
creaoption(myselect, 'Ministerio Español', 'E')
creaoption(myselect, 'MuchosLibros y TecniCiencia', 'M')
creaoption(myselect, 'Fondo de Cultura', 'F')
creaoption(myselect, 'Google products', 'B')
creaoption(myselect, 'Google', 'G')
creaoption(myselect, 'Abebooks y Alibris', 'V')
creaoption(myselect, 'BookFinder', 'S')
creaoption(myselect, 'Amazon', 'A')
frm.appendChild(myselect);
}

function creaoption(selectelem, nombre, letra) {
theOption=document.createElement('option');
theOption.appendChild(document.createTextNode(nombre));
theOption.setAttribute('value',letra);
selectelem.appendChild(theOption);
}
