function obtiene_comunas(id_region){
	new Request({
		url:'/lib/comunas.php',
		onSuccess: function(responseText){
			$('comunas').set('html', responseText);
		}
	}).send('region=' + id_region);
}

function postular(id){
	new Request({
		url:'/lib/postular.php',
		method:'post',
		data:'id=' + id,
		onSuccess: function(responseText){
			if(responseText == "OK"){
				Sexy.info("<h1>Postular</h1><br><p>Postulacion realizada</p>");
				$('pos_' + id).set('html', 'Postulaci&oacute;n hecha el ');
			}else{
				Sexy.alert("<h1>Postular</h1><br><p>Error al realizar la postulacion</p>");
			}
		}
	}).send();
}
function elimina_experiencia(numero){
	$$('.exp_' + numero).destroy();
}
function agregar_experiencia(){
	var numero = $('last').get('value').toInt();
	var e = $('empresa_0').clone();
	var c = $('contacto_0').clone();
	var l = $('laboral_0').clone();
	var li = $('linea_0').clone();
	numero++;
	e.className = 'exp_' + numero;
	c.className = 'exp_' + numero;
	li.className = 'exp_' + numero;
	l.className = 'exp_' + numero;
	e.setStyle('display', 'table-row');
	l.setStyle('display', 'table-row');
	c.setStyle('display', 'table-row');
	li.setStyle('display', 'table-row');
	e.getElements('input').set('value', '').set('name', 'empresa[' + numero + ']');
	e.getElements('img').set('onclick', 'elimina_experiencia(' + numero + ')');
	c.getElements('input').set('value', '').set('name', 'contacto[' + numero + ']');
	l.getElements('textarea').set('value', '').set('name', 'laboral[' + numero + ']');
	$('trabajos').appendChild(e);
	$('trabajos').appendChild(c);
	$('trabajos').appendChild(l);
	$('trabajos').appendChild(li);
	$('last').set('value', numero);
}
