 function validation_register(forma)
 {

 if (trim(document.forma.user.value) == '')
	 {
	 alert('Va rugam introduceti nume utilizator !');
	 document.forma.user.focus();
	 return false;
	 }
  
 if (trim(document.forma.user.value).length < 4)
	 {
	 alert('Va rugam introduceti minimum 4 caractere pentru utilizator !');
	 document.forma.user.focus();
	 return false;
	 } 	

 if (document.forma.parola.value == '')
	 {
	 alert('Va rugam introduceti parola !');
	 document.forma.parola.focus();
	 return false;
	 }

 if (document.forma.parola.value.length < 4)
	 {
	 alert('Va rugam introduceti minimum 4 caractere pentru parola !');
	 document.forma.parola.focus();
	 return false;
	 }


 if (document.forma.parola.value != document.forma.repeta_parola.value)
    {
    alert('Parolele nu sunt identice !');
	return false;
    }

 if (!isEmail(forma.email.value))
   {
	 alert('Va rugam introduceti o adresa de email valida !');
	 document.forma.email.focus();
	 return false;
   }
 
 }

 function validation_modify_profile(forma)
 {

   if (!isEmail(forma.email.value))
   {
	alert('Va rugam introduceti o adresa de email valida !');
	 document.forma.email.focus();
	 return false;
   }

 }

 function validation_pass()
 {

  if (document.forma.parola.value == '')
	 {
	 alert('Va rugam introduceti parola !');
	 document.forma.parola.focus();
	 return false;
	 }

 if (document.forma.parola.value.length < 4)
	 {
	 alert('Va rugam introduceti minimum 4 caractere pentru parola !');
	 document.forma.parola.focus();
	 return false;
	 }


 if (document.forma.parola.value != document.forma.repeta_parola.value)
    {
    alert('Parolele nu sunt identice !');
	return false;
    }
 
 }

function openwindow_book(id)
{
var URL = 'book.php?id='+id;
var options = "toolbar=1,status=0,menubar=0,scrollbars=1," + "resizable=0,width=500,height=400, left=300,top=100";
//alert(URL);
window.open(URL, "", options);
}

function openwindow_user(id)
{
var URL = 'user.php?id='+id;
var options = "toolbar=1,status=0,menubar=0,scrollbars=1," + "resizable=0,width=300,height=200, left=600,top=100";
//alert(URL);
window.open(URL, "", options);
}

function openwindow_helpsearch()
{
var URL = 'help_search.html';
var options = "toolbar=1,status=0,menubar=0,scrollbars=1," + "resizable=0,width=400,height=500, left=600,top=100";
//alert(URL);
window.open(URL, "", options);
}

/***********************************************************************
Name: isEmail
Description: Checks if the string parameter is a valid e-mail address
************************************************************************/
function isEmail(str){
	str = trim(str)
	var re = /^(\w|[^_]\.|[\-]|[^\s@])+@[^_@\.](([^\s@\.]|[a-z]|\d|\-)+|([^_@\.]\.[^_@\.])*)+\.[a-z]{2,}$/i
	return re.test(str)
}

/**********************************************************************
Name: trim
Description: Removes leading and trailing spaces
**********************************************************************/
function trim(str) {
	return (str.replace(/^\s*|\s*$/gi,''))
} 

/***********************************************************************
Name: confirmDelete
Description:
************************************************************************/

function confirmDelete(confirm_message) {
	return window.confirm(confirm_message);
}


function openwindow_job(id)
{
var URL = 'job.php?id='+id;
var options = "toolbar=0,status=0,menubar=0,scrollbars=1," + "resizable=1,width=500,height=550, left=500, top=100";
//alert(URL);
window.open(URL, "", options);
}


function openwindow_terms()
{
var URL = 'terms.html';
var options = "toolbar=0,status=0,menubar=0,scrollbars=0," + "resizable=1,width=400,height=300, left=550,top=300";
//alert(URL);
window.open(URL, "", options);
}



