﻿function VerifyOdjavaEnovice(obj)
{
		if(!check_email(obj.Email.value))
		{
			alert("Napačen E-mail naslov.");
			obj.Email.focus(); 
			// if the browser is Netscape 6 or IE
			if(document.all || document.getElementByID)
			{
			// change the color of text field
			obj.Email.style.background = "yellow";
			}
		// make sure the form is not submitted
		return false;
		}
		return true;	
}
function VerifyEnovice(obj)
{
	//if(obj.PriimekIme.value.length < 1)
	//{
	//	alert("V polje ste vnesli manj kot en znak.");
	//	obj.PriimekIme.focus(); // put the prompt in the name field 
	//	// if the browser is Netscape 6 or IE
	//	if(document.all || document.getElementByID)
	//	{
	//	// change the color of text field
	//	obj.PriimekIme.style.background = "yellow";
	//	}
	//	return false;
	//}
	if(!check_email(obj.Email.value))
	{
		alert("Napačen E-mail naslov.");
		obj.Email.focus(); 
		// if the browser is Netscape 6 or IE
		if(document.all || document.getElementByID)
		{
		// change the color of text field
			obj.Email.style.background = "yellow";
		}
		// make sure the form is not submitted
	return false;
	}
// check the second email address
//	if(!check_email(obj.another_email.value))
//	{
//		alert("Napačen E-mail naslov.");
//		obj.another_email.focus(); 
//		if(document.all || document.getElementByID)
//		{
//		obj.another_email.style.background = "yellow";
//		}
//	return false;
//	}
}
//dve funckciji za kar dobro validacijo vnešenega maila ! 
function check_email(e) 
{
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0)
		{ 
			return (false);
		}	
	} 
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) 
		{
			return (-1);		
		} 
	}
}
function Preveri_frmKontakt(obj)
{
if(document.all || document.getElementByID)
{
	obj.document.getElementById("txtnapaka").style.visibility="hidden";
}
	var Napaka;
	if(obj.txtIme.value.length < 3)
	{
		Napaka="* V polje Ime ste vnesli manj kot tri znake.";
		
		// if the browser is Netscape 6 or IE
		if(document.all || document.getElementByID)
		{
			obj.txtnapaka.value=Napaka;
			obj.document.getElementById("txtnapaka").style.visibility="visible";
			obj.txtIme.focus();
		}
		else
		{
			alert("V polje Ime ste vnesli manj kot tri znake.");
			obj.txtIme.focus();
		}
		return false;
	}
	if(obj.txtPriimek.value.length < 3)
	{
		Napaka="* V polje Priimek ste vnesli manj kot tri znake.";
		// if the browser is Netscape 6 or IE
		if(document.all || document.getElementByID)
		{
			obj.txtnapaka.value=Napaka;
			obj.document.getElementById("txtnapaka").style.visibility="visible"
			obj.txtPriimek.focus();
		}
		else
		{
			alert("V polje Priimek ste vnesli manj kot tri znake.");
			obj.txtPriimek.focus();
		}
		return false;
	}

	if(!check_email(obj.txtEmail.value))
	{
		Napaka="* Email ni pravilno oblikovan.";
		// if the browser is Netscape 6 or IE
		if(document.all || document.getElementByID)
		{
			obj.txtnapaka.value=Napaka;
			obj.document.getElementById("txtnapaka").style.visibility="visible";
			obj.txtEmail.focus();
		}
		else
		{
			alert("Napačen E-mail naslov.");
			obj.txtEmail.focus();
		}
		// make sure the form is not submitted
	return false;
	}
}

function ClearForm(obj)
{
	document.frmKontakt.reset()
}