
var xmlReq = null;
var arrsubesp= new Array();

arrsubesp[1]="<option value='0'>Seleccione su especialidad...</option>"+
			"<option value='1'>Administrativo General</option>"+
			"<option value='2'>Contrataci&oacute;n Administrativa</option>"+
			"<option value='3'>Deporte</option>"+
			"<option value='4'>Extranjer&iacute;a</option>"+
			"<option value='5'>Medio Ambiente</option>"+
			"<option value='6'>Sanitario y Farmac&eacute;utico</option>"+
			"<option value='7'>Telecomunicaciones</option>"+
			"<option value='8'>Transportes, Mar&iacute;timo, Aeron&aacute;utico</option>"+
			"<option value='9'>Tr&aacute;fico</option>"+
			"<option value='10'>Urbanismo</option>";

arrsubesp[2]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="1">Arrendamientos</option>'+
			'<option value="2">Civil_General</option>'+
			'<option value="3">Familia</option>'+
			'<option value="4">Hipotecario</option>'+
			'<option value="5">Inmobiliario</option>'+
			'<option value="6">Propiedad Horizontal</option>'+ 
			'<option value="7">Registral - Notarial</option>'+
			'<option value="8">Sucesiones y Donaciones</option>';

arrsubesp[3]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="1">Arbitraje Internacional y Europeo</option>'+
			'<option value="2">Europeo Financiero y Tributario</option>'+
			'<option value="3">Europeo General</option>'+
			'<option value="4">Internacional General</option>'+
			'<option value="5">Internacional Mar&iacute;timo y A&eacute;reo</option>'+
			'<option value="6">Internacional Penal</option>'+
			'<option value="7">Internacional Privado</option>'+
			'<option value="8">Internacional P&uacute;blico</option>';

arrsubesp[4]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="1">Laboral</option>';

arrsubesp[5]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="0">Bancario y Burs&aacute;til</option>'+
			'<option value="0">Competencia</option>'+
			'<option value="0">Concursal</option>'+
			'<option value="0">Mercantil General</option>'+
			'<option value="0">Propiedad Intelectual e Industrial</option>'+
			'<option value="0">Protección de datos</option>'+
			'<option value="0">Seguros</option>'+
			'<option value="0">Societario</option>'+
			'<option value="0">Transportes, Mar&iacute;timo, Aeronáutico</option>';
			
arrsubesp[6]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="1">Penal</option>';

arrsubesp[7]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="0">Arbitraje y Mediación</option>'+
			'<option value="0">Medicina Legal y Forense</option>'+
			'<option value="0">Proceso Civil</option>'+
			'<option value="0">Proceso Contencioso Administrativo</option>'+
			'<option value="0">Proceso Laboral</option>'+
			'<option value="0">Proceso Militar</option>'+
			'<option value="0">Proceso Penal</option>';

arrsubesp[8]='<option value="0">Seleccione su especialidad...</option>'+
			'<option value="1">Tributario</option>';

function sub(f) { 
var tablaOK='<table width="413" height="226" border="0" cellpadding="0" cellspacing="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#00304E">     <tr>      <td width="498">&nbsp;</td>    </tr>    <tr>      <td width="498"><div align="center" style="font-size:20px;">MUCHAS GRACIAS</div></td>    </tr>    <tr>      <td width="498"><div align="center"><strong>Sus datos han sido enviados,</strong></div></td>    </tr>    <tr>      <td width="498"><div align="center"><strong> en breve nos pondremos en contacto con Ud.</strong></div></td>    </tr>    <tr>      <td width="498">&nbsp;</td>    </tr> </table>';

   var file = 'proc.php' ;
   var celdaForm=document.getElementById('celdaForm').innerHTML;//firefox no captura los valores de formulario en innerHTML
   var nombre=document.getElementById('nombre').value;
   var apellidos=document.getElementById('apellidos').value;
   var email=document.getElementById('email').value;
   var telefono=document.getElementById('telefono').value;
   var movil=document.getElementById('movil').value;
   var asunto=document.getElementById('asunto').value;
   var celdaEnviar=document.getElementById('celdaEnviar').innerHTML;
   var str='nombre='+nombre+'&apellidos='+apellidos+'&email='+email+'&telefono='+telefono+'&movil='+movil+'&asunto='+asunto;
   document.getElementById('celdaForm').innerHTML="<img src='economist/loader.gif'/>";
   //document.getElementById('celdaEnviar').innerHTML='';
   xmlReq = getXML(file,str); 
   if (xmlReq.responseText=="OK") {
   document.getElementById("celdaForm").innerHTML=tablaOK;
   }
   else  {
	   document.getElementById('celdaForm').innerHTML=celdaForm;
	   document.getElementById('nombre').value=nombre;
	   document.getElementById('apellidos').value=apellidos;
	   document.getElementById('email').value=email;
	   document.getElementById('telefono').value=telefono;
	   document.getElementById('movil').value=movil;
	   document.getElementById('asunto').value=asunto;
	   //document.getElementById('celdaEnviar').innerHTML=celdaEnviar;

	var alerta='Se han detectado las siguientes incidencias:\r\n';
	alerta=alerta+xmlReq.responseText;
   	alert(alerta); }

} 

function getXML(file,str) 
{ 
   var doc = null 
   var ua = navigator.userAgent.toLowerCase();
   if (!window.ActiveXObject)
     doc = new XMLHttpRequest();
   else if (ua.indexOf('msie 5') == -1)
     doc = new ActiveXObject("Msxml2.XMLHTTP");
   else
     doc = new ActiveXObject("Microsoft.XMLHTTP");
	var url=file+"?"+str;
   doc.open( "GET", url, false ); 
   doc.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
   doc.send("dummy string for firefox");
   return doc; 

}
function getFormValues(fobj,valFunc) 
{ 
   var str =''; 
   var valueArr = null; 
   var val =''; 
   var cmd =''; 
   for(var i = 0;i < fobj.elements.length;i++) 
   { 
       switch(fobj.elements[i].type) 
       { 
           case "text": 
                str += fobj.elements[i].name + 
                 '=' + escape(fobj.elements[i].value) + "&"; 
                 break; 
           case "hidden": 
                str += fobj.elements[i].name + 
                 '=' + escape(fobj.elements[i].value) + "&"; 
                 break; 
           case "select-one": 
                str += fobj.elements[i].name + 
                '=' + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&"; 
                break; 
       } 
   } 

   str = str.substr(0,(str.length - 1)); 

   return str; 

}


function fillSubesps(){
		if (document.getElementById('area').selectedIndex==0){
			document.getElementById('especialidad').selectedIndex=0;
			document.getElementById('especialidad').disabled=true;
			document.getElementById('cod_area').value=0;
			document.getElementById('cod_especialidad').value=0;
		}
		else {
		document.getElementById('especialidad').disabled=false;
		document.getElementById('especialidad').innerHTML=arrsubesp[document.getElementById('area').selectedIndex];
		document.getElementById('cod_area').value=document.getElementById('area').selectedIndex;
		document.getElementById('cod_especialidad').value=document.getElementById('especialidad').selectedIndex;
		}
}