	function box_val(box)
	{
		if (box.checked==true)
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}

	function color_change(this_element,new_color)
	{
			this_element.style.background=new_color;
			return;
	}

	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;

	function isInteger(s)
	{
		var i;
		for (i = 0; i < s.length; i++)
		{   
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		return true;
	}

	function stripCharsInBag(s, bag)
	{
		var i;
		var returnString = "";
		for (i = 0; i < s.length; i++)
		{   
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function daysInFebruary (year)
	{
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}

	function DaysArray(n) 
	{
		for (var i = 1; i <= n; i++) 
		{
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}

	function isDate(dtStr)
	{
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strDay=dtStr.substring(0,pos1)
		var strMonth=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)

		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) 
		{
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		var month=parseInt(strMonth)
		var day=parseInt(strDay)
		var year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			return false
		}
	return true
	}
	
	function f_date(old_data)
	{
		old_data=old_data+"";
		if (old_data.length==0)
		{
			old_data="01";
		}
		if (old_data.length==1)
		{
			old_data="0"+old_data;
		}
		return old_data	
	}

	function f_nelTest_Pers_Kods(str_kod)
	{
		if (str_kod.length > 0)
		{
			int1 = 0
			int1 = parseInt(str_kod.charAt(0)) 
			int1 = int1 + parseInt(str_kod.charAt(1) * 6)
			int1 = int1 + parseInt(str_kod.charAt(2) * 3)
			int1 = int1 + parseInt(str_kod.charAt(3) * 7)
			int1 = int1 + parseInt(str_kod.charAt(4) * 9)
			int1 = int1 + parseInt(str_kod.charAt(5) * 10)
			int1 = int1 + parseInt(str_kod.charAt(6) * 5)
			int1 = int1 + parseInt(str_kod.charAt(7) * 8)
			int1 = int1 + parseInt(str_kod.charAt(8) * 4)
			int1 = int1 + parseInt(str_kod.charAt(9) * 2)
			int1 = int1 % 11

			if (int1 > 2) 
			{
				int1 = 12 - int1
			}
			else
			{
				int1 = 1 - int1
			}

			if (parseInt(str_kod.charAt(10)) == int1)
			{
				// do nothing
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
		if (str_kod.length > 11)
		{
			return false;
		}
		return true;
	}

	function set_birth_date(tmp_person)
	{

		if (tmp_person==1)
		{
			polise.person_1_ip_kods.value=del_dash(polise.person_1_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_1_ip_kods.value)==true)
			{
				polise.birth_date_dd_1.value=polise.person_1_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_1.value=polise.person_1_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_1_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_1.value="19"+polise.person_1_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_1.value="20"+polise.person_1_ip_kods.value.substring(4,6)		
				}

				//id_birth_1.style.display = "none";
				polise.birth_date_dd_1.disabled=true;
				polise.birth_date_mm_1.disabled=true;
				polise.birth_date_yyyy_1.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_1.style.display = "";
				polise.birth_date_dd_1.disabled=false;
				polise.birth_date_mm_1.disabled=false;
				polise.birth_date_yyyy_1.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==2)
		{
			polise.person_2_ip_kods.value=del_dash(polise.person_2_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_2_ip_kods.value)==true)
			{
				polise.birth_date_dd_2.value=polise.person_2_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_2.value=polise.person_2_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_2_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_2.value="19"+polise.person_2_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_2.value="20"+polise.person_2_ip_kods.value.substring(4,6)		
				}

				//id_birth_2.style.display = "none";
				polise.birth_date_dd_2.disabled=true;
				polise.birth_date_mm_2.disabled=true;
				polise.birth_date_yyyy_2.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_2.style.display = "";
				polise.birth_date_dd_2.disabled=false;
				polise.birth_date_mm_2.disabled=false;
				polise.birth_date_yyyy_2.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==3)
		{
			polise.person_3_ip_kods.value=del_dash(polise.person_3_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_3_ip_kods.value)==true)
			{
				polise.birth_date_dd_3.value=polise.person_3_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_3.value=polise.person_3_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_3_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_3.value="19"+polise.person_3_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_3.value="20"+polise.person_3_ip_kods.value.substring(4,6)		
				}

				//id_birth_3.style.display = "none";
				polise.birth_date_dd_3.disabled=true;
				polise.birth_date_mm_3.disabled=true;
				polise.birth_date_yyyy_3.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_3.style.display = "";
				polise.birth_date_dd_3.disabled=false;
				polise.birth_date_mm_3.disabled=false;
				polise.birth_date_yyyy_3.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==4)
		{
			polise.person_4_ip_kods.value=del_dash(polise.person_4_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_4_ip_kods.value)==true)
			{
				polise.birth_date_dd_4.value=polise.person_4_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_4.value=polise.person_4_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_4_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_4.value="19"+polise.person_4_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_4.value="20"+polise.person_4_ip_kods.value.substring(4,6)		
				}

				//id_birth_4.style.display = "none";
				polise.birth_date_dd_4.disabled=true;
				polise.birth_date_mm_4.disabled=true;
				polise.birth_date_yyyy_4.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_4.style.display = "";
				polise.birth_date_dd_4.disabled=false;
				polise.birth_date_mm_4.disabled=false;
				polise.birth_date_yyyy_4.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==5)
		{
			polise.person_5_ip_kods.value=del_dash(polise.person_5_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_5_ip_kods.value)==true)
			{
				polise.birth_date_dd_5.value=polise.person_5_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_5.value=polise.person_5_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_5_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_5.value="19"+polise.person_5_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_5.value="20"+polise.person_5_ip_kods.value.substring(4,6)		
				}

				//id_birth_5.style.display = "none";
				polise.birth_date_dd_5.disabled=true;
				polise.birth_date_mm_5.disabled=true;
				polise.birth_date_yyyy_5.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_5.style.display = "";
				polise.birth_date_dd_5.disabled=false;
				polise.birth_date_mm_5.disabled=false;
				polise.birth_date_yyyy_5.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==6)
		{
			polise.person_6_ip_kods.value=del_dash(polise.person_6_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_6_ip_kods.value)==true)
			{
				polise.birth_date_dd_6.value=polise.person_6_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_6.value=polise.person_6_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_6_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_6.value="19"+polise.person_6_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_6.value="20"+polise.person_6_ip_kods.value.substring(4,6)		
				}

				//id_birth_6.style.display = "none";
				polise.birth_date_dd_6.disabled=true;
				polise.birth_date_mm_6.disabled=true;
				polise.birth_date_yyyy_6.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_6.style.display = "";
				polise.birth_date_dd_6.disabled=false;
				polise.birth_date_mm_6.disabled=false;
				polise.birth_date_yyyy_6.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==7)
		{
			polise.person_7_ip_kods.value=del_dash(polise.person_7_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_7_ip_kods.value)==true)
			{
				polise.birth_date_dd_7.value=polise.person_7_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_7.value=polise.person_7_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_7_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_7.value="19"+polise.person_7_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_7.value="20"+polise.person_7_ip_kods.value.substring(4,6)		
				}

				//id_birth_7.style.display = "none";
				polise.birth_date_dd_7.disabled=true;
				polise.birth_date_mm_7.disabled=true;
				polise.birth_date_yyyy_7.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_7.style.display = "";
				polise.birth_date_dd_7.disabled=false;
				polise.birth_date_mm_7.disabled=false;
				polise.birth_date_yyyy_7.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==8)
		{
			polise.person_8_ip_kods.value=del_dash(polise.person_8_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_8_ip_kods.value)==true)
			{
				polise.birth_date_dd_8.value=polise.person_8_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_8.value=polise.person_8_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_8_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_8.value="19"+polise.person_8_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_8.value="20"+polise.person_8_ip_kods.value.substring(4,6)		
				}

				//id_birth_8.style.display = "none";
				polise.birth_date_dd_8.disabled=true;
				polise.birth_date_mm_8.disabled=true;
				polise.birth_date_yyyy_8.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_8.style.display = "";
				polise.birth_date_dd_8.disabled=false;
				polise.birth_date_mm_8.disabled=false;
				polise.birth_date_yyyy_8.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==9)
		{
			polise.person_9_ip_kods.value=del_dash(polise.person_9_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_9_ip_kods.value)==true)
			{
				polise.birth_date_dd_9.value=polise.person_9_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_9.value=polise.person_9_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_9_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_9.value="19"+polise.person_9_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_9.value="20"+polise.person_9_ip_kods.value.substring(4,6)		
				}

				//id_birth_9.style.display = "none";
				polise.birth_date_dd_9.disabled=true;
				polise.birth_date_mm_9.disabled=true;
				polise.birth_date_yyyy_9.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_9.style.display = "";
				polise.birth_date_dd_9.disabled=false;
				polise.birth_date_mm_9.disabled=false;
				polise.birth_date_yyyy_9.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==10)
		{
			polise.person_10_ip_kods.value=del_dash(polise.person_10_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_10_ip_kods.value)==true)
			{
				polise.birth_date_dd_10.value=polise.person_10_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_10.value=polise.person_10_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_10_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_10.value="19"+polise.person_10_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_10.value="20"+polise.person_10_ip_kods.value.substring(4,6)		
				}

				//id_birth_10.style.display = "none";
				polise.birth_date_dd_10.disabled=true;
				polise.birth_date_mm_10.disabled=true;
				polise.birth_date_yyyy_10.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_10.style.display = "";
				polise.birth_date_dd_10.disabled=false;
				polise.birth_date_mm_10.disabled=false;
				polise.birth_date_yyyy_10.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==11)
		{
			polise.person_11_ip_kods.value=del_dash(polise.person_11_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_11_ip_kods.value)==true)
			{
				polise.birth_date_dd_11.value=polise.person_11_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_11.value=polise.person_11_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_11_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_11.value="19"+polise.person_11_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_11.value="20"+polise.person_11_ip_kods.value.substring(4,6)		
				}

				//id_birth_11.style.display = "none";
				polise.birth_date_dd_11.disabled=true;
				polise.birth_date_mm_11.disabled=true;
				polise.birth_date_yyyy_11.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_11.style.display = "";
				polise.birth_date_dd_11.disabled=false;
				polise.birth_date_mm_11.disabled=false;
				polise.birth_date_yyyy_11.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==12)
		{
			polise.person_12_ip_kods.value=del_dash(polise.person_12_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_12_ip_kods.value)==true)
			{
				polise.birth_date_dd_12.value=polise.person_12_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_12.value=polise.person_12_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_12_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_12.value="19"+polise.person_12_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_12.value="20"+polise.person_12_ip_kods.value.substring(4,6)		
				}

				//id_birth_12.style.display = "none";
				polise.birth_date_dd_12.disabled=true;
				polise.birth_date_mm_12.disabled=true;
				polise.birth_date_yyyy_12.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_12.style.display = "";
				polise.birth_date_dd_12.disabled=false;
				polise.birth_date_mm_12.disabled=false;
				polise.birth_date_yyyy_12.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==13)
		{
			polise.person_13_ip_kods.value=del_dash(polise.person_13_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_13_ip_kods.value)==true)
			{
				polise.birth_date_dd_13.value=polise.person_13_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_13.value=polise.person_13_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_13_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_13.value="19"+polise.person_13_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_13.value="20"+polise.person_13_ip_kods.value.substring(4,6)		
				}

				//id_birth_13.style.display = "none";
				polise.birth_date_dd_13.disabled=true;
				polise.birth_date_mm_13.disabled=true;
				polise.birth_date_yyyy_13.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_13.style.display = "";
				polise.birth_date_dd_13.disabled=false;
				polise.birth_date_mm_13.disabled=false;
				polise.birth_date_yyyy_13.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==14)
		{
			polise.person_14_ip_kods.value=del_dash(polise.person_14_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_14_ip_kods.value)==true)
			{
				polise.birth_date_dd_14.value=polise.person_14_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_14.value=polise.person_14_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_14_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_14.value="19"+polise.person_14_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_14.value="20"+polise.person_14_ip_kods.value.substring(4,6)		
				}

				//id_birth_14.style.display = "none";
				polise.birth_date_dd_14.disabled=true;
				polise.birth_date_mm_14.disabled=true;
				polise.birth_date_yyyy_14.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_14.style.display = "";
				polise.birth_date_dd_14.disabled=false;
				polise.birth_date_mm_14.disabled=false;
				polise.birth_date_yyyy_14.disabled=false;
				premija_count();
			}
		}

		if (tmp_person==15)
		{
			polise.person_15_ip_kods.value=del_dash(polise.person_15_ip_kods.value);
			if (f_nelTest_Pers_Kods(polise.person_15_ip_kods.value)==true)
			{
				polise.birth_date_dd_15.value=polise.person_15_ip_kods.value.substring(0,2)		
				polise.birth_date_mm_15.value=polise.person_15_ip_kods.value.substring(2,4)		
				if (parseInt(polise.person_15_ip_kods.value.substring(4,6))>(2007-2000))
				{
					polise.birth_date_yyyy_15.value="19"+polise.person_15_ip_kods.value.substring(4,6)		
				}
				else
				{
					polise.birth_date_yyyy_15.value="20"+polise.person_15_ip_kods.value.substring(4,6)		
				}

				//id_birth_15.style.display = "none";
				polise.birth_date_dd_15.disabled=true;
				polise.birth_date_mm_15.disabled=true;
				polise.birth_date_yyyy_15.disabled=true;
				premija_count();

			}
			else
			{
				//id_birth_15.style.display = "";
				polise.birth_date_dd_15.disabled=false;
				polise.birth_date_mm_15.disabled=false;
				polise.birth_date_yyyy_15.disabled=false;
				premija_count();
			}
		}


	}

	function person_add_del()
	{
	
		if (polise.person_count.value>=2){id_person_2.style.display="";}
		else
		{
			if (id_person_2.style.display=="")
			{
				polise.person_2_ip_kods.value="";
				polise.person_2_name.value="";
				polise.person_2_lastname.value="";
				polise.birth_date_dd_2.value="";
				polise.birth_date_mm_2.value="";
				polise.birth_date_yyyy_2.value="";
			}
			id_person_2.style.display="none";
		}
	
		if (polise.person_count.value>=3){id_person_3.style.display="";}
		else
		{
			if (id_person_3.style.display=="")
			{
				polise.person_3_ip_kods.value="";
				polise.person_3_name.value="";
				polise.person_3_lastname.value="";
				polise.birth_date_dd_3.value="";
				polise.birth_date_mm_3.value="";
				polise.birth_date_yyyy_3.value="";
			}
			id_person_3.style.display="none";
		}
	
		if (polise.person_count.value>=4){id_person_4.style.display="";}
		else
		{
			if (id_person_4.style.display=="")
			{
				polise.person_4_ip_kods.value="";
				polise.person_4_name.value="";
				polise.person_4_lastname.value="";
				polise.birth_date_dd_4.value="";
				polise.birth_date_mm_4.value="";
				polise.birth_date_yyyy_4.value="";
			}
			id_person_4.style.display="none";
		}
	
		if (polise.person_count.value>=5){id_person_5.style.display="";}
		else
		{
			if (id_person_5.style.display=="")
			{
				polise.person_5_ip_kods.value="";
				polise.person_5_name.value="";
				polise.person_5_lastname.value="";
				polise.birth_date_dd_5.value="";
				polise.birth_date_mm_5.value="";
				polise.birth_date_yyyy_5.value="";
			}
			id_person_5.style.display="none";
		}
	
		if (polise.person_count.value>=6){id_person_6.style.display="";}
		else
		{
			if (id_person_6.style.display=="")
			{
				polise.person_6_ip_kods.value="";
				polise.person_6_name.value="";
				polise.person_6_lastname.value="";
				polise.birth_date_dd_6.value="";
				polise.birth_date_mm_6.value="";
				polise.birth_date_yyyy_6.value="";
			}
			id_person_6.style.display="none";
		}
	
		if (polise.person_count.value>=7){id_person_7.style.display="";}
		else
		{
			if (id_person_7.style.display=="")
			{
				polise.person_7_ip_kods.value="";
				polise.person_7_name.value="";
				polise.person_7_lastname.value="";
				polise.birth_date_dd_7.value="";
				polise.birth_date_mm_7.value="";
				polise.birth_date_yyyy_7.value="";
			}
			id_person_7.style.display="none";
		}
	
		if (polise.person_count.value>=8){id_person_8.style.display="";}
		else
		{
			if (id_person_8.style.display=="")
			{
				polise.person_8_ip_kods.value="";
				polise.person_8_name.value="";
				polise.person_8_lastname.value="";
				polise.birth_date_dd_8.value="";
				polise.birth_date_mm_8.value="";
				polise.birth_date_yyyy_8.value="";
			}
			id_person_8.style.display="none";
		}
	
		if (polise.person_count.value>=9){id_person_9.style.display="";}
		else
		{
			if (id_person_9.style.display=="")
			{
				polise.person_9_ip_kods.value="";
				polise.person_9_name.value="";
				polise.person_9_lastname.value="";
				polise.birth_date_dd_9.value="";
				polise.birth_date_mm_9.value="";
				polise.birth_date_yyyy_9.value="";
			}
			id_person_9.style.display="none";
		}
	
		if (polise.person_count.value>=10){id_person_10.style.display="";}
		else
		{
			if (id_person_10.style.display=="")
			{
				polise.person_10_ip_kods.value="";
				polise.person_10_name.value="";
				polise.person_10_lastname.value="";
				polise.birth_date_dd_10.value="";
				polise.birth_date_mm_10.value="";
				polise.birth_date_yyyy_10.value="";
			}
			id_person_10.style.display="none";
		}
	
		if (polise.person_count.value>=11){id_person_11.style.display="";}
		else
		{
			if (id_person_11.style.display=="")
			{
				polise.person_11_ip_kods.value="";
				polise.person_11_name.value="";
				polise.person_11_lastname.value="";
				polise.birth_date_dd_11.value="";
				polise.birth_date_mm_11.value="";
				polise.birth_date_yyyy_11.value="";
			}
			id_person_11.style.display="none";
		}
	
		if (polise.person_count.value>=12){id_person_12.style.display="";}
		else
		{
			if (id_person_12.style.display=="")
			{
				polise.person_12_ip_kods.value="";
				polise.person_12_name.value="";
				polise.person_12_lastname.value="";
				polise.birth_date_dd_12.value="";
				polise.birth_date_mm_12.value="";
				polise.birth_date_yyyy_12.value="";
			}
			id_person_12.style.display="none";
		}
	
		if (polise.person_count.value>=13){id_person_13.style.display="";}
		else
		{
			if (id_person_13.style.display=="")
			{
				polise.person_13_ip_kods.value="";
				polise.person_13_name.value="";
				polise.person_13_lastname.value="";
				polise.birth_date_dd_13.value="";
				polise.birth_date_mm_13.value="";
				polise.birth_date_yyyy_13.value="";
			}
			id_person_13.style.display="none";
		}
	
		if (polise.person_count.value>=14){id_person_14.style.display="";}
		else
		{
			if (id_person_14.style.display=="")
			{
				polise.person_14_ip_kods.value="";
				polise.person_14_name.value="";
				polise.person_14_lastname.value="";
				polise.birth_date_dd_14.value="";
				polise.birth_date_mm_14.value="";
				polise.birth_date_yyyy_14.value="";
			}
			id_person_14.style.display="none";
		}
	
		if (polise.person_count.value>=15){id_person_15.style.display="";}
		else
		{
			if (id_person_15.style.display=="")
			{
				polise.person_15_ip_kods.value="";
				polise.person_15_name.value="";
				polise.person_15_lastname.value="";
				polise.birth_date_dd_15.value="";
				polise.birth_date_mm_15.value="";
				polise.birth_date_yyyy_15.value="";
			}
			id_person_15.style.display="none";
		}
	
	}

	function date_onblur(tmp_date)
	{
		if (tmp_date==1)
		{
			if ((document.activeElement.name!='no_date_dd')&&(document.activeElement.name!='no_date_mm')&&(document.activeElement.name!='no_date_yyyy'))
			{
				if (isDate(polise.no_date_dd.value+'/'+polise.no_date_mm.value+'/'+polise.no_date_yyyy.value)==false)
				{
					polise.no_date_dd.focus();
					alert('Tads datums neeksiste');
					return false;
				}
			}
		}
		else
		{
			if ((document.activeElement.name!='li_date_dd')&&(document.activeElement.name!='li_date_mm')&&(document.activeElement.name!='li_date_yyyy'))
			{
				if (isDate(polise.li_date_dd.value+'/'+polise.li_date_mm.value+'/'+polise.li_date_yyyy.value)==false)
				{
					polise.li_date_dd.focus();
					alert('Tads datums neeksiste');
					return false;
				}
			}
		}
	}

	function premija_count()
	{
		var no_date =polise.no_date_dd.value+'/'+polise.no_date_mm.value+'/'+polise.no_date_yyyy.value
		var li_date =polise.li_date_dd.value+'/'+polise.li_date_mm.value+'/'+polise.li_date_yyyy.value
/*		
		if ((isDate(no_date)==true) && (isDate(li_date)==true))
		{
		

		frame_premija.location.href='https://www.e-polise.lv/epolise/f_premija_tourist.asp?lng=LV&policy_number_id=24837615&person_count='+polise.person_count.value+'&days='+polise.days.value+'&no_date_dd='+polise.no_date_dd.value+'&no_date_mm='+polise.no_date_mm.value+'&no_date_yyyy='+polise.no_date_yyyy.value+'&li_date_dd='+polise.li_date_dd.value+'&li_date_mm='+polise.li_date_mm.value+'&li_date_yyyy='+polise.li_date_yyyy.value+'&territory='+getSelectedRadioValue(polise.territory)+'&program_changed='+polise.program_changed.value+'&program='+getSelectedRadioValue(polise.program)+'&program_optimal_plus='+box_val(polise.program_optimal_plus)+'&sport_id='+polise.sport_id.value+'&apdr_sum='+polise.apdr_sum.value+'&edala='+polise.edala.value+'&pay_type='+polise.pay_type.value+'&delivery_type='+polise.delivery_type.value+'&person_1_ip_kods='+polise.person_1_ip_kods.value+'&birth_date_1='+polise.birth_date_dd_1.value+'.'+polise.birth_date_mm_1.value+'.'+polise.birth_date_yyyy_1.value+'&birth_date_2='+polise.birth_date_dd_2.value+'.'+polise.birth_date_mm_2.value+'.'+polise.birth_date_yyyy_2.value+'&birth_date_3='+polise.birth_date_dd_3.value+'.'+polise.birth_date_mm_3.value+'.'+polise.birth_date_yyyy_3.value+'&birth_date_4='+polise.birth_date_dd_4.value+'.'+polise.birth_date_mm_4.value+'.'+polise.birth_date_yyyy_4.value+'&birth_date_5='+polise.birth_date_dd_5.value+'.'+polise.birth_date_mm_5.value+'.'+polise.birth_date_yyyy_5.value+'&birth_date_6='+polise.birth_date_dd_6.value+'.'+polise.birth_date_mm_6.value+'.'+polise.birth_date_yyyy_6.value+'&birth_date_7='+polise.birth_date_dd_7.value+'.'+polise.birth_date_mm_7.value+'.'+polise.birth_date_yyyy_7.value+'&birth_date_8='+polise.birth_date_dd_8.value+'.'+polise.birth_date_mm_8.value+'.'+polise.birth_date_yyyy_8.value+'&birth_date_9='+polise.birth_date_dd_9.value+'.'+polise.birth_date_mm_9.value+'.'+polise.birth_date_yyyy_9.value+'&birth_date_10='+polise.birth_date_dd_10.value+'.'+polise.birth_date_mm_10.value+'.'+polise.birth_date_yyyy_10.value+'&birth_date_11='+polise.birth_date_dd_11.value+'.'+polise.birth_date_mm_11.value+'.'+polise.birth_date_yyyy_11.value+'&birth_date_12='+polise.birth_date_dd_12.value+'.'+polise.birth_date_mm_12.value+'.'+polise.birth_date_yyyy_12.value+'&birth_date_13='+polise.birth_date_dd_13.value+'.'+polise.birth_date_mm_13.value+'.'+polise.birth_date_yyyy_13.value+'&birth_date_14='+polise.birth_date_dd_14.value+'.'+polise.birth_date_mm_14.value+'.'+polise.birth_date_yyyy_14.value+'&birth_date_15='+polise.birth_date_dd_15.value+'.'+polise.birth_date_mm_15.value+'.'+polise.birth_date_yyyy_15.value+'&territory_changed='+polise.territory_changed.value
		}
*/
		polise.program_changed.value=0;
	}

	function count_days()
	{
		var tmp_no_date=polise.no_date_dd.value+'/'+polise.no_date_mm.value+'/'+polise.no_date_yyyy.value
		var tmp_li_date=polise.li_date_dd.value+'/'+polise.li_date_mm.value+'/'+polise.li_date_yyyy.value

		if ((isDate(tmp_no_date)==true) && (isDate(tmp_li_date)==true))
		{
			no_date = new Date(polise.no_date_mm.value+'/'+polise.no_date_dd.value+'/'+polise.no_date_yyyy.value);
			li_date = new Date(polise.li_date_mm.value+'/'+polise.li_date_dd.value+'/'+polise.li_date_yyyy.value);

			var difference=(Math.round((Date.parse(li_date)-Date.parse(no_date))/(24*60*60*1000))*1)
			if (difference<0)
			{
				difference = -1;
			}
			polise.days.value=difference+1;
		}
	}

	function getSelectedRadioValue(buttonGroup)
	{
		if (buttonGroup.value != undefined)
		{
			return buttonGroup.value;
		}
	 
		for (var i=0; i<buttonGroup.length; i++)
		{
			if (buttonGroup[i].checked)
			{
				return buttonGroup[i].value;
				break;
			}
		}
		return "";
	}


	function del_dash(strin)
	{
		while (strin.search('-') >= 0)
		{
			strin=strin.substr(0,strin.search('-'))+strin.substr(strin.search('-')+1,strin.length)
		}
		return strin;
	}

	function return_val()
	{
	polise.person_1_ip_kods.focus()
	}


	
	function Form_Sub(find_what,tmp_lng)
	{

		polise.birth_date_dd_1.disabled=false;
		polise.birth_date_mm_1.disabled=false;
		polise.birth_date_yyyy_1.disabled=false;

		polise.birth_date_dd_2.disabled=false;
		polise.birth_date_mm_2.disabled=false;
		polise.birth_date_yyyy_2.disabled=false;

		polise.birth_date_dd_3.disabled=false;
		polise.birth_date_mm_3.disabled=false;
		polise.birth_date_yyyy_3.disabled=false;

		polise.birth_date_dd_4.disabled=false;
		polise.birth_date_mm_4.disabled=false;
		polise.birth_date_yyyy_4.disabled=false;

		polise.birth_date_dd_5.disabled=false;
		polise.birth_date_mm_5.disabled=false;
		polise.birth_date_yyyy_5.disabled=false;

		polise.birth_date_dd_6.disabled=false;
		polise.birth_date_mm_6.disabled=false;
		polise.birth_date_yyyy_6.disabled=false;

		polise.birth_date_dd_7.disabled=false;
		polise.birth_date_mm_7.disabled=false;
		polise.birth_date_yyyy_7.disabled=false;

		polise.birth_date_dd_8.disabled=false;
		polise.birth_date_mm_8.disabled=false;
		polise.birth_date_yyyy_8.disabled=false;

		polise.birth_date_dd_9.disabled=false;
		polise.birth_date_mm_9.disabled=false;
		polise.birth_date_yyyy_9.disabled=false;

		polise.birth_date_dd_10.disabled=false;
		polise.birth_date_mm_10.disabled=false;
		polise.birth_date_yyyy_10.disabled=false;

		polise.birth_date_dd_11.disabled=false;
		polise.birth_date_mm_11.disabled=false;
		polise.birth_date_yyyy_11.disabled=false;

		polise.birth_date_dd_12.disabled=false;
		polise.birth_date_mm_12.disabled=false;
		polise.birth_date_yyyy_12.disabled=false;

		polise.birth_date_dd_13.disabled=false;
		polise.birth_date_mm_13.disabled=false;
		polise.birth_date_yyyy_13.disabled=false;

		polise.birth_date_dd_14.disabled=false;
		polise.birth_date_mm_14.disabled=false;
		polise.birth_date_yyyy_14.disabled=false;

		polise.birth_date_dd_15.disabled=false;
		polise.birth_date_mm_15.disabled=false;
		polise.birth_date_yyyy_15.disabled=false;

		if (tmp_lng!=null)
		{
			polise.lng.value=tmp_lng;
		}
		polise.find_what.value=find_what;
		document.polise.submit();		
	}

	document.write(writeHints());