
function OnLoading(){
 if(document.frmLogin.userGo.value != ""){
	document.frmLogin.passGo.focus();
		}
	//set document.frmLogin.userGo.value="";
	//set document.frmLogin.passGo.value="";
	document.frmLogin.passGo.onkeydown = OnKeyDown;
}

//********************
function userFocus(frm, fld) {
  if(document.getElementById(frm) && document.getElementById(fld)){
     document.getElementById(fld).focus();
     document.getElementById(fld).select();
        }
return true;
}
//********************
function OnKeyDown()
{
	e = window.event;
	if (e.keyCode == 13){
		e.cancel = true;
		document.frmLogin.submit();
	}	
}
//********************
function GoFindObj(n, d) {
  var p,i,x;
  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) 
  {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    }
  if(!(x=d[n])&&d.all) x=d.all[n];
  	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=GoFindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}
//********************
function swpImg() {
  var i,j=0,x,a=swpImg.arguments; 
  document.sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
   if ((x=GoFindObj(a[i]))!=null)
	{document.sr[j++]=x; 
		if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function RswpImg() {
  var i,x,a=document.sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImg() {
  var d=document;
  if(d.images){
   if(!d.Imp) d.Imp=new Array();
   var i,j=d.Imp.length,a=preloadImg.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.Imp[j]=new Image; d.Imp[j++].src=a[i];}}
}

function chk_fld(fld,fldName) {
if(document.getElementById(fld).value==""){
	alert("Completeaza " + fldName + "!");
	document.getElementById(fld).focus();
	document.getElementById(fld).select();
	return false;
	}
document.forms(0).submit();
return true;
}

function check_me(fld_txt, fld_bifa) {
if(document.getElementById(fld_bifa).checked){
document.getElementById(fld_txt).focus();
document.getElementById(fld_txt).value="";
document.getElementById(fld_txt).style.backgroundColor="#CCCCCC";
document.getElementById(fld_txt).disabled=true;
}
else {
document.getElementById(fld_txt).disabled=false;
document.getElementById(fld_txt).focus();
document.getElementById(fld_txt).style.backgroundColor="#FFFFFF";
document.getElementById(fld_txt).select();
	}
}

// ---------------------------------------





function submitReg() {

// validare Nume Prenume
var myName=document.forms[0].numele

	if(myName.value==""){
		alert("Completeaza " + myName.name.toUpperCase());
		myName.focus();
		myName.select();
		return false;
		}
//validare telefon
	var myTel = document.forms[0].telefonul
	if(myTel.value==""){
		alert("Completeaza " + myTel.name.toUpperCase());
		myTel.focus();
		myTel.select();
		return false;
		}

var stripped = myTel.value.replace(/[\(\)\.\-\ ]/g, '');
	
if (isNaN(parseInt(stripped))) {
   alert("TELEFONUL trebuie sa contina doar cifre.");
   return false; 
}

if (!(stripped.length == 10)) {
	alert("TELEFONUL este gresit! Verificati prefixul.\n");
	return false;  
}

//validare e-mail
	var myEmail=document.forms[0].email
	if(myEmail.value==""){
		alert("Completeaza " + myEmail.name.toUpperCase());
		myEmail.focus();
		myEmail.select();
		return false;
		}

	var emailFilter=/^.+@.+\..{2,3}$/;
if (!(emailFilter.test(myEmail.value))) { 
       alert("E-mail incorect!\n");
       myEmail.focus();
	   myEmail.select();
	   return false; 
	}	
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
if (myEmail.value.match(illegalChars)) {
   alert("E-mailul contine caractere interzise!\n");
   return false; 
	}

	
	//if(document.forms[0].repw.value.localeCompare(document.forms[0].pw.value)!==0){
		//alert("Parola nu este la fel!");
		//document.forms[0].repw.focus();
		//document.forms[0].repw.select();
		//return false;
		//}
		
		if (!document.forms[0].agree.checked) {
		
		alert("Bifati casuta daca sunteti de acord");
		return false; 
		}
return true;
document.forms[0].submit

}


