/*
	E-afacere Javascript Functions
*/
<!--
window.onload = function onLoad()
{ 
	//document.login.username.focus();
	window.status = 'Web Design, Pagini web, 3D, Flash, Multimedia, Promovare Web, Motoare de cautare, Bannere, Campanii online.';
}
//-->


//check mail function
function basicMailCheck(string){
	var err_mail=0, illegalPos=-1;
	var email = string;
	//define illegal chars:
	var illegalChars = new Array(18);
	illegalChars[0] = ',';
	illegalChars[1] = '!';
	illegalChars[2] = '#';
	illegalChars[3] = '$';
	illegalChars[4] = '^';
	illegalChars[5] = '*';
	illegalChars[6] = '+';
	illegalChars[7] = '=';
	illegalChars[8] = ')';
	illegalChars[9] = '(';
	illegalChars[10] = '<';
	illegalChars[11] = '>';
	illegalChars[12] = '{';
	illegalChars[13] = '}';
	illegalChars[14] = ']';
	illegalChars[15] = '[';
	illegalChars[16] = '^';
	illegalChars[17] = '|';
	//STEP 1: check for illegalChars
	for(i=0;i<illegalChars.length;i++){
		illegalPos = email.indexOf(illegalChars[i])*1;
		if(illegalPos>-1){
			//alert(illegalChars[i]);
			return 1;
		}
	}
	//STEP 2: check for e-mail correct structure
	var posAt = (email.indexOf('@')*1);
	var posDot = (email.indexOf('.', posAt)*1);
	var strLength = email.length*1;
	
	if(posAt<2 || posDot<posAt || (strLength<(posDot+3) || strLength>(posDot+4)))
		err_mail=1;
	//end check
	return err_mail;
}

function check()
{
	if (document.form_act.name.value=='')
		alert('Completati numele dumneavoastra!')			
	else if (document.form_act.tel.value=='')
		alert('Completati telefonul!');
	else if (document.form_act.email.value=='')
		alert('Completati email-ul!');	
	else if (document.form_act.message.value=='')
		alert('Completati mesajul!');				
	else if (confirm('Sunteti sigur?')) {					
		document.form_act.submit();
		}
}
		
function check1()
{
	if (document.form_act.nume.value=='')
		alert('Completati numele dumneavoastra!')			
	else if (document.form_act.cv.value=='')
		alert('Uploadati CV-ul dumneavoastra!');				
	else if (confirm('Sunteti sigur?')) {					
		document.form_act.submit();
		}
}

function show()
{
	document.getElementById("linkdiv").style.display = "";
}
function close()
{
	document.getElementById("linkdiv").style.display = "none";
	
}
function validateForm()
{
	document.getElementById("validator1").style.display = "none";
	document.getElementById("validator2").style.display = "none";
	document.getElementById("validator4").style.display = "none";
	document.getElementById("validator5").style.display = "none";
	document.getElementById("emvalidator").style.display = "none";
	
	var link = document.getElementById("link").value;
	var fname = document.getElementById("fname").value;
	var tel = document.getElementById("tel").value;
	var email = document.getElementById("email").value;
	
	if( link!="" && fname!="" && tel != "" && email !="")
	{
		apos   = email.indexOf("@")
		dotpos = email.lastIndexOf(".")
		if (apos>=1 && dotpos-apos>=2)
		{
			document.signlink.submit();
		}
		else{
			document.getElementById("emvalidator").style.display = "block";
		}
	}
	else
	{
		document.getElementById("validator1").style.display = "block";
		document.getElementById("validator2").style.display = "block";
		document.getElementById("validator4").style.display = "block";
		document.getElementById("validator5").style.display = "block";
	}

}

