function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function controlloTuttiDati(){

	testo = "";
	controllo = 0;
	
	//nome
	
	if(document.formDati.nome.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = "Introduceti nume";
	controllo = 1;
	}
	
	//cognome
	
	if(document.formDati.cognome.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti prenume";
	controllo = 1;
	}
	
	//data giorno
	
	var sel = document.getElementById('giorno');
	
	var i=0;
	for (i = sel.length - 1; i>=0; i--) {
    	if (sel.options[i].selected) {
			 if(sel.options[i].value==0){ 
			 	if(testo != ""){
					testo = testo+"\n";
				}
	
				testo = testo+"Selectati zi de data dvs. de na?tere";
				controllo = 1;
			 
			 }
		}
	}
	
	
	//data mese
	
	var sel = document.getElementById('mese');
	
	var i=0;
	for (i = sel.length - 1; i>=0; i--) {
    	if (sel.options[i].selected) {
			 if(sel.options[i].value==0){ 
			 	if(testo != ""){
					testo = testo+"\n";
				}
	
				testo = testo+"Selectati lun? de la data dvs. de na?tere";
				controllo = 1;
			 
			 }
		}
	}
	
	
	//data anno
	
	var sel = document.getElementById('anno');
	
	var i=0;
	for (i = sel.length - 1; i>=0; i--) {
    	if (sel.options[i].selected) {
			 if(sel.options[i].value==0){ 
			 	if(testo != ""){
					testo = testo+"\n";
				}
	
				testo = testo+"Selectati anul de data dvs. de na?tere";
				controllo = 1;
			 
			 }
		}
	}
	
	
	
	
	
	//Indirizzo
	
	if(document.formDati.indirizzo.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti adresa";
	controllo = 1;
	}
	
	
	//settore
	
	var sel = document.getElementById('settore');
	
	var i=0;
	for (i = sel.length - 1; i>=0; i--) {
    	if (sel.options[i].selected) {
			 if(sel.options[i].value==0){ 
			 	if(testo != ""){
					testo = testo+"\n";
				}
	
				testo = testo+"Selectati zona de profesia ta";
				controllo = 1;
			 
			 }
		}
	}
	//telefono
	
	if(document.formDati.telefono.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti telefon";
	controllo = 1;
	}
	
	//telefono numerico
	if(!IsNumeric(document.formDati.telefono.value)){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Telfon Campul accepta doar valori numerice!";
	controllo = 1;
	}
	
		
	//cellulare
	
	if(document.formDati.cellulare.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti telefon mobile";
	controllo = 1;
	}
	
	//cellulare numerico
	if(!IsNumeric(document.formDati.cellulare.value)){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Telfon Mobile Campul accepta doar valori numerice!";
	controllo = 1;
	}

	// e-mail	
	if(document.formDati.mail.value == ""){

        if(testo != ""){
                testo = testo+"\n";
        }

        testo = testo+"Introduceti E-mail";
        controllo = 1;
        }

	// controllo validita mail
	if(document.formDati.mail.value != ""){
		 var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
		if(!emailPattern.test(document.formDati.mail.value)){ 

        		if(testo != ""){
                		testo = testo+"\n";
        		}

        	testo = testo+"E-mail Incorect!";
        	controllo = 1;
        	}
	}


	//nazionalita
	
	if(document.formDati.nazionalita.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti cetatenie";
	controllo = 1;
	}
	
	//domicilio
	
	if(document.formDati.domicilio.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti site";
	controllo = 1;
	}
	
	//professione
	
	if(document.formDati.professione.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Introduceti profesie";
	controllo = 1;
	}
	
	//allegatocv1
	
	if(document.formDati.allegatocv1.value == ""){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Allega almeno un CV";
	controllo = 1;
	}
	
	//Controllo estenzione curriculum1	
	
	stringa = document.formDati.allegatocv1.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".doc")==(stringa.length-4) || stringa.lastIndexOf(".docx")==(stringa.length-5) || stringa.lastIndexOf(".pdf")==(stringa.length-4)){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Curriculum 1 nu este corect, introduceti doc, docx o pdf.";
		controllo = 1;
	}

	//fine controllo estenzione curriculum1	
	
	//Controllo estenzione curriculum2	
	
	stringa = document.formDati.allegatocv2.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".doc")==(stringa.length-4) || stringa.lastIndexOf(".docx")==(stringa.length-5) || stringa.lastIndexOf(".pdf")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Curriculum 2 nu este corect, introduceti doc, docx o pdf.";
		controllo = 1;
	}
	
	//fine controllo estenzione curriculum2 
	
	//Controllo estenzione curriculum3 	
	
	stringa = document.formDati.allegatocv3.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".doc")==(stringa.length-4) || stringa.lastIndexOf(".docx")==(stringa.length-5) || stringa.lastIndexOf(".pdf")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Curriculum 3 nu este corect, introduceti doc, docx o pdf.";
		controllo = 1;
	}
	
	//fine controllo estenzione curriculum3 
	
	//Controllo estenzione curriculum4 	
	
	//stringa = document.formDati.allegatocv4.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".doc")==(stringa.length-4) || stringa.lastIndexOf(".docx")==(stringa.length-5) || stringa.lastIndexOf(".pdf")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"formato del Curriculum 4 non corretto, inserire un doc, docx o pdf.";
		controllo = 1;
	}
	
	//fine controllo estenzione curriculum4	
	
	//Controllo estenzione curriculum5 	
	
	//stringa = document.formDati.allegatocv5.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".doc")==(stringa.length-4) || stringa.lastIndexOf(".docx")==(stringa.length-5) || stringa.lastIndexOf(".pdf")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formato del Curriculum 5 non corretto, inserire un doc, docx o pdf.";
		controllo = 1;
	}
	
	//fine controllo estenzione curriculum5 
	
	//Controllo estenzione foto1 	
	
	stringa = document.formDati.allegatofoto1.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".jpeg")==(stringa.length-5) || stringa.lastIndexOf(".jpg")==(stringa.length-4) || stringa.lastIndexOf(".JPG")==(stringa.length-4) || stringa.lastIndexOf(".gif")==(stringa.length-4) || stringa.lastIndexOf(".png")==(stringa.length-4) || stringa == ""){
	
	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Poza 1 nu este corect, introduceti jpeg, jpg, JPG, gif, png.";
		controllo = 1;
	}
	
	//fine controllo estenzione foto1 
	
	//Controllo estenzione foto2 	
	
	//stringa = document.formDati.allegatofoto2.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".jpeg")==(stringa.length-5) || stringa.lastIndexOf(".jpg")==(stringa.length-4) || stringa.lastIndexOf(".JPG")==(stringa.length-4) || stringa.lastIndexOf(".gif")==(stringa.length-4) || stringa.lastIndexOf(".png")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Poza 2 nu este corect, introduceti   jpeg, jpg, JPG, gif, png.";
		controllo = 1;
	}
	
	//fine controllo estenzione foto2 
	
	
		//Controllo estenzione video1 	
	
	stringa = document.formDati.allegatovideo.value;
	//stringaTagliata = stringa.substring(stringa.length-6);
	//stringa = stringaTagliata.substring(stringaTagliata.indexOf(".")+1);
	
	if(stringa.lastIndexOf(".avi")==(stringa.length-4) || stringa.lastIndexOf(".wmv")==(stringa.length-4) || stringa.lastIndexOf(".3gp")==(stringa.length-4) || stringa == ""){

	}else{
		if(testo != ""){
			testo = testo+"\n";
		}
		
		testo = testo+"Formatul de Video nu este corect, introduceti avi, wmv, 3gp.";
		controllo = 1;
	}
	
	//fine controllo estenzione video1 
	
	
	
	//trattamentodati
	
	if(document.formDati.trattamentodati.checked == false){
	
	if(testo != ""){
		testo = testo+"\n";
	}
	
	testo = testo+"Tu nu au acceptat Termeni de confidentialitate";
	controllo = 1;
	}
	
	if(controllo == 0){
	document.formDati.submit();
	}else{
	alert(testo);
	}

}

function loadcategoria(){

var valselez=0;

var elSel = document.getElementById('settore');
var elSel2 = document.getElementById('categoria');
var i=0;
var a=0
	for (i = elSel.length - 1; i>=0; i--) {
    	if (elSel.options[i].selected) { valselez=elSel.options[i].value; }
	}
	for (a=elSel2.length - 1; a>=0; a--) {
		elSel2.remove(a);
	}
	
	if(valselez==1){
		settoretocategoria('Structuristi',1);
		settoretocategoria('Mecanici',2);
		settoretocategoria('Avionics',3);
		settoretocategoria('Line',4);
		settoretocategoria('Maintenance',5);
		settoretocategoria('Base Maintenance',6);
	}
	else if(valselez==2){
		settoretocategoria('Agricultura',7);
	}
	else if(valselez==3){
		settoretocategoria('Arhitectura',8);
		settoretocategoria('Design',9);
	}
	else if(valselez==4){
		settoretocategoria('Mass Media',10);
		settoretocategoria('Educatie',11);
	}
	/*else if(valselez==5){
		settoretocategoria('Retail',12);
		settoretocategoria('Corporate',13);
		
	}*/
	else if(valselez==6){
		settoretocategoria('Call Center',14);
		}
	else if(valselez==7){
		settoretocategoria('Structuri',15);
		settoretocategoria('Instalatii',16);
		settoretocategoria('Amenajari',17);
		settoretocategoria('Intretinere',18);
		
	}
	else if(valselez==8){
		settoretocategoria('Audit',19);
		settoretocategoria('Expert Contabil',20);
		settoretocategoria('Economist',21);
		settoretocategoria('Retail',12);
		settoretocategoria('Corporate',13);
		
	}
	else if(valselez==9){
		settoretocategoria('Responsabil',22);
		settoretocategoria('Consultant',23);
	}
	else if(valselez==10){
		settoretocategoria('Intretinere',24);
		settoretocategoria('Productie',25);
		settoretocategoria('Punere in functiune',26);
	}
	else if(valselez==11){
		settoretocategoria('Productie',27);
		settoretocategoria('Executie',28);
		settoretocategoria('Infrastructura',29);
		settoretocategoria('Proiectare',30);
		settoretocategoria('Cost Controller',31);
		
	}
	else if(valselez==12){
		settoretocategoria('Hardware',32);
		settoretocategoria('Software',33);
		settoretocategoria('E- Media',34);
		settoretocategoria('Customer Support',35);

	}
	else if(valselez==13){
		settoretocategoria('Avocati',36);
		settoretocategoria('Juristi',37);
		settoretocategoria('Notari',38);

	}
	else if(valselez==14){
		settoretocategoria('Marinari',39);
		settoretocategoria('Motoristi',40);
		settoretocategoria('Electricieni Maritimi',41);
		settoretocategoria('Frigotehnisti Maritimi',42);
		settoretocategoria('Santiere Navale',43);
		}
	else if(valselez==15){
		settoretocategoria('Responsabil',44);
		settoretocategoria('Planner',45);
		settoretocategoria('Controlul Calitatii',46);
		settoretocategoria('Tehnician',47);
		settoretocategoria('Calificat',48);
		settoretocategoria('Operator',49);
		settoretocategoria('Necalificat',50);
	
		}
	else if(valselez==16){
		settoretocategoria('Comercial',51);
		settoretocategoria('Economic',52);
		settoretocategoria('Marketing',53);
		settoretocategoria('Achizitii',54);
		settoretocategoria('Administrativ',55);
	}
	else if(valselez==17){
		settoretocategoria('Laborant',56);
		settoretocategoria('Asistent',57);
		settoretocategoria('Infirmier',58);
		settoretocategoria('Farmacie',59);
	}
	else if(valselez==18){
		settoretocategoria('Reprezentant Comercial',60);
		settoretocategoria('Vanzator',61);
		settoretocategoria('Lucrator Comercial',62);
	}
	else if(valselez==19){
		settoretocategoria('Assistant Manager',63);
		settoretocategoria('Personal Administrativ',64);
		settoretocategoria('Public Relations',65);
	}
	else if(valselez==20){
		settoretocategoria('Imobiliare',66);
		settoretocategoria('Asigurari',67);
		settoretocategoria('Consultanta',68);
		settoretocategoria('Estetica',69);
	}
	else if(valselez==21){
		settoretocategoria('Distributie',70);
		settoretocategoria('Depozitare',71);
		settoretocategoria('Import - Export',72);
	}
	else if(valselez==22){
		settoretocategoria('Hotel Staff',73);
		settoretocategoria('Catering',74);
		settoretocategoria('Camerista',75);
		settoretocategoria('Ghid Turistic',76);
		settoretocategoria('Bucatar',77);
		settoretocategoria('Ospatar',78);
	}
	else if(valselez==23){
		settoretocategoria('Agent Paza',79);
	}
	else if(valselez==24){
		settoretocategoria('Studii Superioare',80);
		settoretocategoria('Liceu/Profesionala',81);
	}

	else if(valselez==0){
		
		settoretocategoria('',0);
	}

}


function settoretocategoria(text, value){
	
  var elOptNew = document.createElement('option');
  elOptNew.text = text;
  elOptNew.value = value;
  var elSel = document.getElementById('categoria');

  try {
    elSel.add(elOptNew, null); // standards compliant;
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }	
}


