﻿/*formular*/
function isEmpty(e) {   
    return ((e == null) || (e.length == 0));
}
function isEmail(mail) {
    re = /^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,7}$/;
    return mail.search(re) == 0;
}


function checkNum(x)
 {
  
   var s_len=x.value.length ;
   var s_charcode = 0;
     for (var s_i=0;s_i<s_len;s_i++)
     {
      s_charcode = x.value.charCodeAt(s_i);
      if(!((s_charcode>=48 && s_charcode<=57)))
       {
	     if(x=="tk_ho"){
          alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο Τ.Κ.(κατοικίας) .");
		  x.value='';
          x.focus();
         return false;
		  }
		  if(x=="phone_ho"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο Τηλέφωνο(κατοικίας).");
		   x.value='';
          x.focus();
         return false;
		  }
		  if(x=="fax_ho"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο FAX(κατοικίας).");
		   x.value='';
          x.focus();
         return false;
		  }
		   if(x=="mobile"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο Κινητό.");
		   x.value='';
          x.focus();
         return false;
		  }
		  if(x=="tk_er"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο Τ.Κ.(εργασίας).");
		   x.value='';
          x.focus();
         return false;
		  }	  
		  if(x=="phone_er"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο Τηλέφωνο(εργασίας).");
		   x.value='';
          x.focus();
         return false;
		  }
		  if(x=="fax_er"){
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς στο πεδίο FAX(εργασίας).");
		   x.value='';
          x.focus();
         return false;
		   }
		   else{
		   alert("Παρακαλώ εισάγετε μόνο αριθμούς");
           return false; }
       }
     }
     return true;
 }





function checkForm(form) {



if (isEmpty(form.name.value)) {
	alert("Παρακαλώ εισάγετε το όνομα σας.");
	form.name.focus();
	return false;
	}
if (isEmpty(form.surname.value)) {
	alert("Παρακαλώ εισάγετε το επώνυμο σας.");
	form.surname.focus();
	return false;
	}
	
if (isEmpty(form.mobile.value)) {
	alert("Παρακαλώ εισάγετε το κινητό σας.");
	form.mobile.focus();
	return false;
	}

if (isEmpty(form.addr_er.value)) {
	alert("Παρακαλώ εισάγετε τη διεύθυνση εργασίας σας.");
	form.addr_er.focus();
	return false;
	}
	
if (isEmpty(form.phone_er.value)) {
	alert("Παρακαλώ εισάγετε το τηλέφωνο εργασίας σας.");
	form.phone_er.focus();
	return false;
	}

if (isEmpty(form.email_er.value)) {
	alert("Παρακαλώ εισάγετε το e-mail εργασίας σας.");
	form.email_er.focus();
	return false;
	}
else if (!isEmail(form.email_er.value)) {
	alert("Παρακαλώ ελέγξτε το e-mail εργασίας σας.");
	form.email_er.focus();
	return false;
	}
	
if (isEmpty(form.job.value)) {
	alert("Παρακαλώ εισάγετε το επάγγελμα σας.");
	form.job.focus();
	return false;
	}
	
if (isEmpty(form.eidikotita.value)) {
	alert("Παρακαλώ εισάγετε την ειδικότητα σας.");
	form.eidikotita.focus();
	return false;
	}
 
else return true;

} /* end function checkForm */


/*code for form */
var ids=new Array('test','gr');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
