function InLessOut()
  {
           inlessout=0;
		   d=document.form1.inD.selectedIndex;
		   m=document.form1.inM.selectedIndex;
		   y=document.form1.inY.selectedIndex;
		   od=document.form1.outD.selectedIndex;
		   om=document.form1.outM.selectedIndex;
		   oy=document.form1.outY.selectedIndex;
		   if ((oy>y) || ((om>m) && (oy>=y)) || ((od>d) && (om>=m) && (oy>=y))){
			inlessout=1;
		   }
		   document.form1.hinlessout.value=inlessout;
//		   alert(oy+' '+y+' '+om+' '+m+' '+od+' '+d+' '+inlessout);
   }   
   
function LeapY(year,hv) 
{
	leap=false;
	y=year.selectedIndex;
	g=year.options[y].text;
	if (g.substr(2,3)=='00') 
	{
		if (g%400==0)
		{
			leap=true;
		}
	}
	else
	{
		if (g%4==0)
		{
			leap=true;
		}
	}
	hv.value=leap;
}

function FalseDate(day,month,le,fd)
{
	fdate=0;
	d=day.selectedIndex;
	den1=day.options[d].text;
	m=month.selectedIndex;
	mes1=month.options[m].text;
	if ((den1=='31') && ((m==1) || (m==3) || (m==5) || (m==8) || (m==10)))
	{
		fdate=1;
	}
	if ((den1=='30') && (m==1))
	{
		fdate=1;
	}
	l=le.value;
//	alert('le.value='+le.value+' l='+l+' den1='+den1+' m='+m);
	if ((l=='false') && (den1=='29') && (m==1))
	{
		fdate=1;
	}
//	alert('fdate='+fdate);
	fd.value=fdate;
//	alert(fd.value);
}

//function TodayLessIn() {
//	today=new Date();
//	t=today.getDate()+'.'+(today.getMonth()+1)+'.'+today.getFullYear();
//	alert(t);
//}

function CheckEmail() {
	n=0; a=true; dot=true; dash=true; underscore=true; frbddn=false; t=0; pos=41; brt=0; tpos=0; fch=0; minl=0; tdom=0; tire=0; brtire=0; tirepos=0; brd=0; dpos=0; d=0;
	document.form1.he.value=0;
	l=document.form1.email.value.length;
	for (i=0; i<l; i++) { 
		if (!(((document.form1.email.value.charAt(i)>='a') && (document.form1.email.value.charAt(i)<='z')) || 
((document.form1.email.value.charAt(i)>='A') && (document.form1.email.value.charAt(i)<='Z')) ||
((document.form1.email.value.charAt(i)>='0') && (document.form1.email.value.charAt(i)<='9')) ||
(document.form1.email.value.charAt(i)=='@') || (document.form1.email.value.charAt(i)=='.') || (document.form1.email.value.charAt(i)=='-') || (document.form1.email.value.charAt(i)=='_'))) { //dopustimi simwoli: a-z;A-Z;0-9;@;.;-;_
			fch=1; break;
		}
		if (l<6) { //e-maila min 6 simwola
			minl=1; break;
		}
		if (document.form1.email.value.charAt(i)=='@') {
			n=n+1; pos=i;
		}
		if (document.form1.email.value.charAt(i)=='.') {
			brt=brt+1; tpos=i;
			
			if ((document.form1.email.value.charAt(i-1)=='-')||(document.form1.email.value.charAt(i-1)=='_')||(document.form1.email.value.charAt(i+1)=='-')||(document.form1.email.value.charAt(i+1)=='_')) {
				frbddn=true; break;
			}
			
			if (t==0) {
				t=1;
			}
			else {
				t=1;
				break; //kraj t->1
			}
		} //end if .
		else {
			   t=0;
			  }
			  if (document.form1.email.value.charAt(i)=='.') {
			brt=brt+1; tpos=i;
		}
		if (document.form1.email.value.charAt(i)=='-') {
			brtire=brtire+1; tirepos=i;
			
if ((document.form1.email.value.charAt(i-1)=='_')||(document.form1.email.value.charAt(i+1)=='_')) {
				frbddn=true; break;
			}
			
			if (tire==0) {
				tire=1;
			}
			else {
				tire=1;
				break; //kraj tire->1
			}
		} //end if .
		else {
			   tire=0;
			  }	
		if (document.form1.email.value.charAt(i)=='_') {
			brd=brd+1; dpos=i;
			if (d==0) {
				d=1;
			}
			else {
				d=1;
				break; //kraj tire->1
			}
		} //end if .
		else {
			   d=0;
			  }		  
	} //end for		
			if ((tpos==(l-3))||(tpos==(l-4))||(tpos==(l-5))) { //last dot in position l-3;l-4 or l-5, t.e. top level domain 2-4 characters
			tdom=1;
		}
	if ((n>1)||(n==0)||(pos==0)) { //0 || >1 @
		a=false;
	}
	if (brt==0) {
		dot=false;
	}
	if (t==1) { //sysedni . || krajna .
		dot=false;
	}
		if (tire==1) { //sysedni - || krajno -
		dash=false;
	}
			if (d==1) { //sysedni _ || krajno _
		underscore=false;
	}
		if ((document.form1.email.value.charAt(pos+1)=='.')||(document.form1.email.value.charAt(pos+1)=='-')||(document.form1.email.value.charAt(pos+1)=='_')||(document.form1.email.value.charAt(pos-1)=='.')||(document.form1.email.value.charAt(pos-1)=='-')||(document.form1.email.value.charAt(pos-1)=='_')||(document.form1.email.value.charAt(0)=='.')||(document.form1.email.value.charAt(0)=='-')||(document.form1.email.value.charAt(0)=='_')) { // @. || .@ || .111111@11111.111
			dot=false;
		}
		if (tpos<pos) {
			dot=false;
		}
	if ((a)&&(dot)&&(dash)&&(underscore)&&(!(frbddn))&&(fch==0)&&(minl==0)&&(tdom==1)) {
		document.form1.he.value=1;
	}
//	alert("question "+document.form1.hq.value+" email "+document.form1.he.value);
} //end function

function InitialProcess()
{
// --- START PROVERKA TELEFON ---
t=1; ha=1;
d1=document.form1.tel.value.length;
     	for(k1=0; k1<d1; k1++) {
		if ((document.form1.tel.value.charAt(k1)<"0")||(document.form1.tel.value.charAt(k1)>"9")){
			t=0;
			break;
		}//end if
	}//end for
	if (d1<5) {
                t=0;
               }
	document.form1.val_tel.value=t;
	//	alert("val_tel "+t);

//--- END PROVERKA TELEFON ---	
if (document.form1.ad.selectedIndex==0) {
	ha=0;
}
document.form1.hha.value=ha;
}