		
		function checkRecibir(form){
				var rempty = false;
				for (r=0;r<form.suscription.length;r++) {
					if(form.suscription[r].checked){
						rempty = true;
						break;
					}
				}
				if(rempty){
					if(form.suscription[r].value == 1){
						return checkRecibirOfertas(form);	
					}										
				}
				return true;								
		}

		function checkRecibirOfertas(form){
		
				//validar Categoria
				/*var temp2 = form.Categoria.value;	
				if (temp2 == 0 || !temp2) { 
					alert("Debes Escoger una Categoria.");
					form.Categoria.focus();
					return false;
				}*/

				//validar Provincia
				/*var temp2 = form.iProvincia.value;	
				if (temp2 == 1 || !temp2) { 
					alert("Debes Escoger una Provincia.");
					form.iProvincia.focus();
					return false;
				}*/

				return true;	
		}

		function confirmUpdateCaduca(){
				return(confirm('Quiere actualizar la fecha que caduca la oferta a 2 meses mas ?'));
		}


		function verifyEmail(form){
				//validar email 
				var temp2 = form.email_actual.value;		
				if ((temp2 == "") || (temp2.length > 0 && (temp2.indexOf("@",0) == - 1 || temp2.indexOf(".",0) == - 1))) { 
					alert("Debes introducir tu direccion de email actual.");
					form.email_actual.focus();
					return false;
				}

				//validar email 
				var temp2 = form.email_nuevo.value;		
				if ((temp2 == "") || (temp2.length > 0 && (temp2.indexOf("@",0) == - 1 || temp2.indexOf(".",0) == - 1))) { 
					alert("Debes introducir una direccion de email nuevo valida.");
					form.email_nuevo.focus();
					return false;
				}

				return true;
		}


		function valideContactForm(form){
		
				//validar id_sugerencia
				var temp2 = form.id_sugerencia.value;	
				if (temp2 == 0 || !temp2) { 
					alert("Debes Escoger tu Sugerencia.");
					form.id_sugerencia.focus();
					return false;
				}
				
				//validar Nombre
				var temp2 = form.Nombre.value;	
				if (temp2 == "" || !temp2) { 
					alert("Debes introducir tu Nombre.");
					form.Nombre.focus();
					return false;
				}	

				//validar email 
				var temp2 = form.EMail.value;		
				if ((temp2 == "") || (temp2.length > 0 && (temp2.indexOf("@",0) == - 1 || temp2.indexOf(".",0) == - 1))) { 
					alert("Debes introducir una direccion de email valida.");
					form.EMail.focus();
					return false;
				}
					
				//validar Telefono
				/*
				var temp2 = form.Telefono.value;	
				if (temp2 == "" || !temp2) { 
					alert("Debes introducir tu Telefono.");
					form.Telefono.focus();
					return false;
				}	
				*/

				//validar Sugerencia
				var temp2 = form.Sugerencia.value;	
				if (temp2 == "" || !temp2) { 
					alert("Debes introducir tu Sugerencia.");
					form.Sugerencia.focus();
					return false;
				}	

				return true;	
		}


			function valideMejorarForm(form){

				//validar Nombre
				var temp2 = form.Nombre.value;	
				if (temp2 == "" || !temp2) { 
					alert("Debes introducir tu Nombre.");
					form.Nombre.focus();
					return false;
				}	

				//validar email 
				var temp2 = form.EMail.value;		
				if ((temp2 == "") || (temp2.length > 0 && (temp2.indexOf("@",0) == - 1 || temp2.indexOf(".",0) == - 1))) { 
					alert("Debes introducir una direccion de email valida.");
					form.EMail.focus();
					return false;
				}
				
				//validar Sugerencia
				var temp2 = form.Sugerencia.value;	
				if (temp2 == "" || !temp2) { 
					alert("Debes introducir tu Sugerencia.");
					form.Sugerencia.focus();
					return false;
				}	

				return true;	
		}

		function verifyFileSize(form){
			var oas = new ActiveXObject("Scripting.FileSystemObject");
			var e = oas.getFile(form.curriculum.value);
			var f = e.size;
			return f;
		}

		function verifyExtCV(form){
			// curriculum
			if(form.curriculum.value != ""){
				var tmp = form.curriculum.value.split(".");
				var extAllowed = "docx,doc,pdf";
				var tmp2 = extAllowed.split(",");

				for(var k = 0; k < tmp2.length; k++){
					if((tmp2[k] == tmp[1].toLowerCase())){
						return true;
					}
				}
				alert("La extension del curriculum es invalida.");
				return false;	
			}else{
				return true;
			}
		}

		
		function verifyExtFoto(form){
			// foto
			if(form.foto.value != ""){
				var tmp = form.foto.value.split(".");
				var extAllowed = "jpeg,jpg,gif,bmp,png";
				var tmp2 = extAllowed.split(",");

				for(var k = 0; k < tmp2.length; k++){
					if(tmp2[k] == tmp[tmp.length - 1].toLowerCase()){
						return true;
					}
				}
				
				alert("La extension de la foto es invalida.");
				return false;			
			}else{
				return true;
			}
		}
		
		function checkFileExt(form){
			//return (verifyExtCV(form) && verifyExtFoto(form));
			//comentado hasta volver a permitir upload de archivos para el CV
			return (verifyExtFoto(form) && checkFileName(form));
		}


		var isNetscape = 0;
		var isMicrosoft = 0;


		function checkFileName(form){			
				
				   
				//Determine if this is a Netscape or Microsoft browser
				if(navigator.appName.indexOf("Netscape") != -1)
				  	isNetscape = 1;
				if(navigator.appName.indexOf("Microsoft") != -1)
			 		 isMicrosoft = 1;

			var checkOK = ":¡!-+()_#$%&()=.'¿°" + "0123456789 " + "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú";
			if(form.foto.value != ""){

				var posDotExt = form.foto.value.lastIndexOf(".");				
				var checkStr = form.foto.value.substring(0, posDotExt);
				
				if(isMicrosoft){
					tmp = checkStr.split("\\");
					checkStr = tmp[tmp.length-1];
				}

				var allValid = true;
				
				for (i = 0; i < checkStr.length; i++) {
					ch = checkStr.charAt(i);
					for (j = 0; j < checkOK.length; j++)
						if (ch == checkOK.charAt(j))
							break;
					if (j == checkOK.length) {
						allValid = false;
						break;
					}
				}
				if (!allValid) {
					alert("El nombre de archivo de la foto posee caracteres invalidos. (" + ch +")");
					form.foto.focus();
					return false;
				}

			}

			return true; 
		} 

		function changePas() {
			if (isFormChanged()) 
				return confirm("No has guardado los datos introducidos. &iquest;Quieres salir de este paso?");
			return true;
		}
		
		function checkSus(){
				if(!document.getElementById("acepto").checked){
					alert("Debes aceptar las condiciones.");
					return false;
				}else return true;
		}
		
			function updateDaysSelect(day, month, year)
			{
				var aMonths = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
				if(isLeapYear(year.value))
					aMonths[1] = 29;
			
				var iDaySelected = parseInt(day.value);
				var iMonthSelected = parseInt(month.value);
			
				if(iMonthSelected)
				{
					while(day.length)
						day.remove(0);
			
					var tmp = document.createElement('option');
			
					tmp.value = '';
					tmp.text = '---';
			
					try
					{
						day.add(tmp, null);
					}
					catch(e)
					{
						day.add(tmp);
					}
			
					for(var i = 1; i <= aMonths[iMonthSelected - 1]; i++)
					{
						tmp = document.createElement('option');
			
						tmp.value = i;
						tmp.text = i;
			
						try
						{
							day.add(tmp, null);
						}
						catch(e)
						{
							day.add(tmp);
						}
					}
			
					if(iDaySelected && iDaySelected <= aMonths[iMonthSelected - 1])
						day.value = iDaySelected;
					else
						day.value = '';
			
				}
			}
			
			function isLeapYear(year)
			{
				year = parseInt(year);
			
				if(year % 4 == 0)
				{
					if(year % 100 != 0)
						return true;
					else
					{
						if(year % 400 == 0)
							return true;
						else
							return false;
					}
				}
			
				return false;
			}
			
			function CreateElement(obj, code)
			{
				var d = document.getElementById(obj);
				d.innerHTML = code;
			}
			  
			function refresh(){ 
				location.reload(true)
			}  
			
			function URLEnc(txt){
				var nocodificar = "0123456789"+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"abcdefghijklmnopqrstuvwxyz" +"-_.!~*'()";
				var HEX = "0123456789ABCDEF";
				var textoAcodificar = txt;
				//var textoAcodificar = document.Form1.encode.value;
				var codificado = "";
				for (var i = 0; i < textoAcodificar.length; i++ ) {
					var ch = textoAcodificar.charAt(i);
				    if (ch == " ") {
					    codificado += "+";
					} else if (nocodificar.indexOf(ch) != -1) {
					    codificado += ch;
					} else {
					    var charCode = ch.charCodeAt(0);
						if (charCode > 255) {
						    alert( "Caracter Unicode '"+ch+"' no puede ser codificado utilizando la codificación URL estandar.\n" +
							          "(sólo soporta caracteres de 8-bit.)\n" +
									  "Será sustituido por un símbolo de suma (+)." );
							codificado += "+";
						} else {
							codificado += "%";
							codificado += HEX.charAt((charCode >> 4) & 0xF);
							codificado += HEX.charAt(charCode & 0xF);
						}
					}
				}
				//document.Form1.encode.value = codificado;
			   	//return false;
				return codificado;
			};
			
			function URLDec(txt){
			   var HEXCHARS = "0123456789ABCDEFabcdef"; 
			   //var codificado = document.Form1.decode.value;
			   var codificado = txt;
			   var textoAcodificar = "";
			   var i = 0;
			   while (i < codificado.length) {
			       var ch = codificado.charAt(i);
				   if (ch == "+") {
				       textoAcodificar += " ";
					   i++;
				   } else if (ch == "%") {
						if (i < (codificado.length-2) 
								&& HEXCHARS.indexOf(codificado.charAt(i+1)) != -1 
								&& HEXCHARS.indexOf(codificado.charAt(i+2)) != -1 ) {
							textoAcodificar += unescape( codificado.substr(i,3) );
							i += 3;
						} else {
							alert( 'Bad escape combination near ...' + codificado.substr(i) );
							textoAcodificar += "%[ERROR]";
							i++;
						}
					} else {
					   textoAcodificar += ch;
					   i++;
					}
				} 
			   //document.Form1.encode.value = textoAcodificar;
			   //return false;
			   return textoAcodificar;
			};

			function setEditorValue( instanceName, txt ){
				document.getElementById(instanceName).value = txt;
			}
