// Determine browser.

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;

function open_window(url)
{
	remotewindow = window.open(url, "RemoteWindow", "toolbar=0,location=0,directories=0,status=yes,menubar=yes,scrollbars=yes,resizable=0,width=530,height=450");
}

function openalert(perm)
{
	alert("Erről a gépről vagy IP számról "+perm+" másodpercenként csak egy szavazatot adhat le!")
}

function makeArray(n) {
	this.length = n;
	for (i=1;i<=n;i++) {
		this[i]=0;
	}
	return this;
}

function ShowSText(id) 
{
	if (document.getElementById) document.getElementById("SText" + id).style.visibility = "visible";  	
}
function HideSText(id) 
{
  	if (document.getElementById) document.getElementById("SText" + id).style.visibility = "hidden"; 
}

function displayDate(lang) 
{
	var this_month = new makeArray(12);
	var this_day = new makeArray(7);
	
	var today = new Date();
	var dayofweek = today.getDay();
	var day   = today.getDate();
	var month = today.getMonth();
	var year  = today.getYear();
	
	if (year < 1900) 
	{
		year += 1900;
	}
	
	if(lang == "hu")
	{
		this_month[0]  = "január";
		this_month[1]  = "február";
		this_month[2]  = "március";
		this_month[3]  = "április";
		this_month[4]  = "május";
		this_month[5]  = "június";
		this_month[6]  = "július";
		this_month[7]  = "augusztus";
		this_month[8]  = "szeptember";
		this_month[9]  = "október";
		this_month[10] = "november";
		this_month[11] = "december";
	   
		this_day[0] = "vasárnap";
		this_day[1] = "hétfő";
		this_day[2] = "kedd";
		this_day[3] = "szerda";
		this_day[4] = "csütörtök";
		this_day[5] = "péntek";
		this_day[6] = "szombat";
		
		return(year + ". " + this_month[month] + " " + day + "." + " " + this_day[dayofweek]);
	}
		
	if(lang == "sl")
	{
		this_month[0]  = "januára";
		this_month[1]  = "februára";
		this_month[2]  = "marca";
		this_month[3]  = "apríla";
		this_month[4]  = "mája";
		this_month[5]  = "júna";
		this_month[6]  = "júla";
		this_month[7]  = "augusta";
		this_month[8]  = "septembra";
		this_month[9]  = "októbra";
		this_month[10] = "novembra";
		this_month[11] = "decembra";
	   
		this_day[0] = "nedeµa";
		this_day[1] = "pondelok";
		this_day[2] = "utorok";
		this_day[3] = "streda";
		this_day[4] = "ątvrtok";
		this_day[5] = "piatok";
		this_day[6] = "sobota";
		
		return(day + ". " + this_month[month] + " " + year + "," + " " + this_day[dayofweek]);
	}
		
	if(lang == "en")
	{
		this_month[0]  = "january";
		this_month[1]  = "february";
		this_month[2]  = "march";
		this_month[3]  = "april";
		this_month[4]  = "may";
		this_month[5]  = "june";
		this_month[6]  = "july";
		this_month[7]  = "august";
		this_month[8]  = "september";
		this_month[9]  = "oktober";
		this_month[10] = "november";
		this_month[11] = "december";
	   
		this_day[0] = "Sundy";
		this_day[1] = "Mondy";
		this_day[2] = "Tuesdy";
		this_day[3] = "Wednsdy";
		this_day[4] = "Thursdy";
		this_day[5] = "Friday";
		this_day[6] = "Saturday";
		
		return(day + "th " + this_month[month] + " " + year + "." + " " + this_day[dayofweek]);
	}
	
	if(lang == "cz")
	{
		this_month[0]  = "januára";
		this_month[1]  = "februára";
		this_month[2]  = "marca";
		this_month[3]  = "apríla";
		this_month[4]  = "mája";
		this_month[5]  = "júna";
		this_month[6]  = "júla";
		this_month[7]  = "augusta";
		this_month[8]  = "septembra";
		this_month[9]  = "októbra";
		this_month[10] = "novembra";
		this_month[11] = "decembra";
	   
		this_day[0] = "nedeµa";
		this_day[1] = "pondelok";
		this_day[2] = "utorok";
		this_day[3] = "streda";
		this_day[4] = "ątvrtok";
		this_day[5] = "piatok";
		this_day[6] = "sobota";
		
		return(day + ". " + this_month[month] + " " + year + "," + " " + this_day[dayofweek]);
	}
	
	if(lang == "de")
	{
		this_month[0]  = "january";
		this_month[1]  = "february";
		this_month[2]  = "march";
		this_month[3]  = "april";
		this_month[4]  = "may";
		this_month[5]  = "june";
		this_month[6]  = "july";
		this_month[7]  = "august";
		this_month[8]  = "september";
		this_month[9]  = "oktober";
		this_month[10] = "november";
		this_month[11] = "december";
	   
		this_day[0] = "Sundy";
		this_day[1] = "Mondy";
		this_day[2] = "Tuesdy";
		this_day[3] = "Wednsdy";
		this_day[4] = "Thursdy";
		this_day[5] = "Friday";
		this_day[6] = "Saturday";
		
		return(day + "th " + this_month[month] + " " + year + "." + " " + this_day[dayofweek]);
	}
	
	if(lang == "pl")
	{
		this_month[0]  = "january";
		this_month[1]  = "february";
		this_month[2]  = "march";
		this_month[3]  = "april";
		this_month[4]  = "may";
		this_month[5]  = "june";
		this_month[6]  = "july";
		this_month[7]  = "august";
		this_month[8]  = "september";
		this_month[9]  = "oktober";
		this_month[10] = "november";
		this_month[11] = "december";
	   
		this_day[0] = "Sundy";
		this_day[1] = "Mondy";
		this_day[2] = "Tuesdy";
		this_day[3] = "Wednsdy";
		this_day[4] = "Thursdy";
		this_day[5] = "Friday";
		this_day[6] = "Saturday";
		
		return(day + "th " + this_month[month] + " " + year + "." + " " + this_day[dayofweek]);
	}
	
	if(lang == "fr")
	{
		this_month[0]  = "january";
		this_month[1]  = "february";
		this_month[2]  = "march";
		this_month[3]  = "april";
		this_month[4]  = "may";
		this_month[5]  = "june";
		this_month[6]  = "july";
		this_month[7]  = "august";
		this_month[8]  = "september";
		this_month[9]  = "oktober";
		this_month[10] = "november";
		this_month[11] = "december";
	   
		this_day[0] = "Sundy";
		this_day[1] = "Mondy";
		this_day[2] = "Tuesdy";
		this_day[3] = "Wednsdy";
		this_day[4] = "Thursdy";
		this_day[5] = "Friday";
		this_day[6] = "Saturday";
		
		return(day + "th " + this_month[month] + " " + year + "." + " " + this_day[dayofweek]);
	}
	
}

function openaPopup()
{
 	if (isMinNS4) aPopup.visibility = "show";
  	if (isMinIE4) aPopup.style.visibility = "visible";
}

function closeaPopup()
{
 	if (isMinNS4) aPopup.visibility = "hide";
  	if (isMinIE4) aPopup.style.visibility = "hidden";
}

function openSearching()
{
 	if (isMinNS4) Searching.visibility = "show";
  	if (isMinIE4) Searching.style.visibility = "visible";
}

function fnShowSearchType()
{
	// Pri vybere organizacie sa zobrazi dalsi riadok pri vyhladavani v zavislosti od typu organizacie
	
	if(Search_Inst.xpSel.options.value==8)
	{
		if (isMinNS4) InstSearchIsk.visibility = "show"; InstSearchSzerv.visibility = "hide";
	  	if (isMinIE4) InstSearchIsk.style.visibility = "visible"; InstSearchSzerv.style.visibility = "hidden";
  	}
  	else
  	{
  		if (isMinNS4) InstSearchSzerv.visibility = "show"; InstSearchIsk.visibility = "hide";
	  	if (isMinIE4) InstSearchSzerv.style.visibility = "visible"; InstSearchIsk.style.visibility = "hidden";
  	}
}

function fnShowFormType()
{
	// Pri vybere typu organizacie sa zobrazi prislusny formular
	
	if(Submit_Inst.itSel.options.value==8)
	{
		 if (isMinNS4){ InstIskForm.position="static"; InstIskForm.visibility = "show"; InstSzervForm.position="absolute"; InstSzervForm.visibility = "hide";}
	  	if (isMinIE4){ InstIskForm.style.position="static"; InstIskForm.style.visibility="visible"; InstSzervForm.style.position="absolute"; InstSzervForm.style.visibility="hidden";}
  	}
  	else
  	{
  		if (isMinNS4) InstSzervForm.visibility = "show"; InstSzervForm.position = "static"; InstIskForm.visibility = "hide"; InstIskForm.position = "absolute";
	  	if (isMinIE4) InstSzervForm.style.visibility = "visible"; InstSzervForm.style.position = "static"; InstIskForm.style.visibility = "hidden"; InstIskForm.style.position = "absolute";
  	}
}

function FindRecord(c,ca,n)
{
			
	var x, i = 0;
	while(i < ca.length)
	{
		if(c == ca[i].substr(0, c.length))
		{
			n.value = ca[i];
					
			var r = n.createTextRange(ca[i]);
			x = ca[i].substr(c.length);
			if(x.substr(0, 2) == ", ") x = ca[i].substr(c.length+2);
			if(r.findText(x) != false)
			{	
				r.select();
			}
		return(c);			
		}		
		i++;
	}	
}

function changeLangPr(lang) 
{
	if(lang == "hu")
	{
		if (document.getElementById) document.getElementById("span31").style.width = "175px";
		//if (document.getElementById) document.getElementById("span31").style.height = "20px";
		if (document.getElementById) document.getElementById("span31").style.backgroundColor = "#92B47B";
		if (document.getElementById) document.getElementById("span31").style.padding = "1px";
		if (document.getElementById) document.getElementById("span31").style.align = "center";
		//if (document.getElementById) document.getElementById("span31").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
		
	}
	if(lang == "sl")
	{
		if (document.getElementById) document.getElementById("span32").style.width = "175";
		//if (document.getElementById) document.getElementById("span32").style.height = "20";
		if (document.getElementById) document.getElementById("span32").style.backgroundColor = "#928DB5";
		if (document.getElementById) document.getElementById("span32").style.padding = "1px";
		if (document.getElementById) document.getElementById("span32").style.align = "center";
		//if (document.getElementById) document.getElementById("span32").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
	if(lang == "en")
	{
		if (document.getElementById) document.getElementById("span33").style.width = "175";
		//if (document.getElementById) document.getElementById("span33").style.height = "20";
		if (document.getElementById) document.getElementById("span33").style.backgroundColor = "#CC8D7B";
		if (document.getElementById) document.getElementById("span33").style.padding = "1px";
		if (document.getElementById) document.getElementById("span33").style.align = "center";
		//if (document.getElementById) document.getElementById("span33").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
	if(lang == "cz")
	{
		if (document.getElementById) document.getElementById("span34").style.width = "175";
		//if (document.getElementById) document.getElementById("span34").style.height = "20";
		if (document.getElementById) document.getElementById("span34").style.backgroundColor = "#B98D7B";
		if (document.getElementById) document.getElementById("span34").style.padding = "1px";
		if (document.getElementById) document.getElementById("span34").style.align = "center";
		//if (document.getElementById) document.getElementById("span34").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
	if(lang == "de")
	{
		if (document.getElementById) document.getElementById("span35").style.width = "175";
		//if (document.getElementById) document.getElementById("span35").style.height = "20";
		if (document.getElementById) document.getElementById("span35").style.backgroundColor = "#D9C47F";
		if (document.getElementById) document.getElementById("span35").style.padding = "1px";
		if (document.getElementById) document.getElementById("span35").style.align = "center";
		//if (document.getElementById) document.getElementById("span35").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
	if(lang == "pl")
	{
		if (document.getElementById) document.getElementById("span36").style.width = "175";
		//if (document.getElementById) document.getElementById("span36").style.height = "20";
		if (document.getElementById) document.getElementById("span36").style.backgroundColor = "#DFDAC8";
		if (document.getElementById) document.getElementById("span36").style.padding = "1px";
		if (document.getElementById) document.getElementById("span36").style.align = "center";
		//if (document.getElementById) document.getElementById("span36").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
	if(lang == "fr")
	{
		if (document.getElementById) document.getElementById("span37").style.width = "175";
		//if (document.getElementById) document.getElementById("span37").style.height = "20";
		if (document.getElementById) document.getElementById("span37").style.backgroundColor = "#000080";
		if (document.getElementById) document.getElementById("span37").style.padding = "1px";
		if (document.getElementById) document.getElementById("span37").style.align = "center";
		//if (document.getElementById) document.getElementById("span37").style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=30, style=1, StartX=100, FinishX=0)";
	}
}


function PostcardTrans()
{
	//var Lap_Array = new Array("357","358","359","363","364","365","367","374","375","377","380","383","385","386","389","390","394","395","399","1747","1751","1759","1762","1763","1770","1774","1775","1783","1788","1789","1","2","99","103","1084","1086","1087","1088","1089","1090","1091","1093","1114","1121","1122","1129","214","216","218","219","221","224","226","228","231","233","250","254","255","256","610","615","834","835","837","838","842","852","2072","2073","2075","2076","2092","2096","2097");
	var fRunning = 0
	var x = Math.round((Math.random( )*(Lap_Array.length - 1)))
	
	if (fRunning == 0)
	{
		fRunning = 1
		LapID.filters[0].Apply();
		LapID.src = "./images/lapok/" + Lap_Array[x] + "-Lap-500.jpg"
		LapID.alt="";
		
		//if(!LapID.width) PostcardTrans();
		
		LapID.filters[0].Play();
		
		//if(LapID.width >= LapID.height)
		//{
		//	LapID.width = 180;	
		//	LapID.height = 125;	
		//}
		//elseif
		//{
		//	PostcardTrans();
		//	fRunning = 0;
		//}
		
		//Lap_Info.innerHTML = "../../images/lapok/" + Lap_Array[x] + "-Lap-500.jpg";
	}
	
}


function FindMe(cValue) 
{
	if (cValue == null || cValue == '')
	{
		alert("Specify a value to search for");
		return;
	}
	
	var rng = document.body.createTextRange();
	
	for (i=0; rng.findText(cValue)!=false; i++) 
	{
    		rng.execCommand("Bold");
    		rng.execCommand("BackColor", "false", "#000000");
    		rng.execCommand("ForeColor", "false", "#FFFFFF");
    		rng.collapse(false);    		
    	}
    	spanFound.innerHTML = "<b>" + i + "</b> találat! ";
}

function FindiHeight(val,id,ido,w,h,inp,sr,tx) 
{
	ido.value = Math.round((1/(w/h))*val);
	inp.value = "<img src=" + sr + " width=" + val + " height=" + Math.round((1/(w/h))*val) + ">" + "<br>" + tx;
}


function fnCountResult(nap)
{
	// Pri zmenách vo formuláry sa vypocita vysledna suma
	
	// 1 nap
	
	if(nap == "szall_1")
	{
		if (SzottMegr.szall_1nap[0].checked)
		{
	        		SzottMegr.szall_1nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_1nap[1].checked)
	    	{
	    		SzottMegr.szall_1nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_1")
	{
	    	if (SzottMegr.vacs_1nap[0].checked)
		{
	        		SzottMegr.vacs_1nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_1nap[1].checked)
	    	{
	    		SzottMegr.vacs_1nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 2 nap
    	
    	if(nap == "dij_2")
	{
		if (SzottMegr.dij_2nap[0].checked)
		{
	        		SzottMegr.dij_2nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.dij_2nap[1].checked)
	    	{
	    		SzottMegr.dij_2nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "szall_2")
	{
		if (SzottMegr.szall_2nap[0].checked)
		{
	        		SzottMegr.szall_2nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_2nap[1].checked)
	    	{
	    		SzottMegr.szall_2nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "reg_2")
	{
	    	if (SzottMegr.reg_2nap[0].checked)
		{
	        		SzottMegr.reg_2nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_2nap[1].checked)
	    	{
	    		SzottMegr.reg_2nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "ebed_2")
	{
	    	if (SzottMegr.ebed_2nap[0].checked)
		{
	        		SzottMegr.ebed_2nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.ebed_2nap[1].checked)
	    	{
	    		SzottMegr.ebed_2nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_2")
	{
	    	if (SzottMegr.vacs_2nap[0].checked)
		{
	        		SzottMegr.vacs_2nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_2nap[1].checked)
	    	{
	    		SzottMegr.vacs_2nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 3 nap
    	
    	
    	if(nap == "dij_3")
	{
		if (SzottMegr.dij_3nap[0].checked)
		{
	        		SzottMegr.dij_3nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.dij_3nap[1].checked)
	    	{
	    		SzottMegr.dij_3nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "szall_3")
	{
		if (SzottMegr.szall_3nap[0].checked)
		{
	        		SzottMegr.szall_3nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_3nap[1].checked)
	    	{
	    		SzottMegr.szall_3nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "reg_3")
	{
	    	if (SzottMegr.reg_3nap[0].checked)
		{
	        		SzottMegr.reg_3nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_3nap[1].checked)
	    	{
	    		SzottMegr.reg_3nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "ebed_3")
	{
	    	if (SzottMegr.ebed_3nap[0].checked)
		{
	        		SzottMegr.ebed_3nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.ebed_3nap[1].checked)
	    	{
	    		SzottMegr.ebed_3nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_3")
	{
	    	if (SzottMegr.vacs_3nap[0].checked)
		{
	        		SzottMegr.vacs_3nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_3nap[1].checked)
	    	{
	    		SzottMegr.vacs_3nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 4 nap
    	
    	if(nap == "dij_4")
	{
		if (SzottMegr.dij_4nap[0].checked)
		{
	        		SzottMegr.dij_4nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.dij_4nap[1].checked)
	    	{
	    		SzottMegr.dij_4nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "szall_4")
	{
		if (SzottMegr.szall_4nap[0].checked)
		{
	        		SzottMegr.szall_4nap_drb.value = 1;
	        		zottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_4nap[1].checked)
	    	{
	    		SzottMegr.szall_4nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "reg_4")
	{
	    	if (SzottMegr.reg_4nap[0].checked)
		{
	        		SzottMegr.reg_4nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_4nap[1].checked)
	    	{
	    		SzottMegr.reg_4nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "ebed_4")
	{
	    	if (SzottMegr.ebed_4nap[0].checked)
		{
	        		SzottMegr.ebed_4nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.ebed_4nap[1].checked)
	    	{
	    		SzottMegr.ebed_4nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_4")
	{
	    	if (SzottMegr.vacs_4nap[0].checked)
		{
	        		SzottMegr.vacs_4nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_4nap[1].checked)
	    	{
	    		SzottMegr.vacs_4nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 5 nap
    	
    	if(nap == "dij_5")
	{
		if (SzottMegr.dij_5nap[0].checked)
		{
	        		SzottMegr.dij_5nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.dij_5nap[1].checked)
	    	{
	    		SzottMegr.dij_5nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "szall_5")
	{
		if (SzottMegr.szall_5nap[0].checked)
		{
	        		SzottMegr.szall_5nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_5nap[1].checked)
	    	{
	    		SzottMegr.szall_5nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "reg_5")
	{
	    	if (SzottMegr.reg_5nap[0].checked)
		{
	        		SzottMegr.reg_5nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_5nap[1].checked)
	    	{
	    		SzottMegr.reg_5nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "ebed_5")
	{
	    	if (SzottMegr.ebed_5nap[0].checked)
		{
	        		SzottMegr.ebed_5nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.ebed_5nap[1].checked)
	    	{
	    		SzottMegr.ebed_5nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_5")
	{
	    	if (SzottMegr.vacs_5nap[0].checked)
		{
	        		SzottMegr.vacs_5nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_5nap[1].checked)
	    	{
	    		SzottMegr.vacs_5nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 6 nap
    	
    	if(nap == "dij_6")
	{
		if (SzottMegr.dij_6nap[0].checked)
		{
	        		SzottMegr.dij_6nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.dij_6nap[1].checked)
	    	{
	    		SzottMegr.dij_6nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "szall_6")
	{
		if (SzottMegr.szall_6nap[0].checked)
		{
	        		SzottMegr.szall_6nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.szall_6nap[1].checked)
	    	{
	    		SzottMegr.szall_6nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "reg_6")
	{
	    	if (SzottMegr.reg_6nap[0].checked)
		{
	        		SzottMegr.reg_6nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_6nap[1].checked)
	    	{
	    		SzottMegr.reg_6nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "ebed_6")
	{
	    	if (SzottMegr.ebed_6nap[0].checked)
		{
	        		SzottMegr.ebed_6nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.ebed_6nap[1].checked)
	    	{
	    		SzottMegr.ebed_6nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	else if(nap == "vacs_6")
	{
	    	if (SzottMegr.vacs_6nap[0].checked)
		{
	        		SzottMegr.vacs_6nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.vacs_6nap[1].checked)
	    	{
	    		SzottMegr.vacs_6nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}
    	
    	// 7 nap
    	
    	else if(nap == "reg_7")
	{
	    	if (SzottMegr.reg_7nap[0].checked)
		{
	        		SzottMegr.reg_7nap_drb.value = 1;
	        		SzottMegr.osszeg.value = fnCountSum();
	        	}
	    	else if (SzottMegr.reg_7nap[1].checked)
	    	{
	    		SzottMegr.reg_7nap_drb.value = 0;
	    		SzottMegr.osszeg.value = fnCountSum();
	    	}
    	}

}

function fnCountSum()
{
	sum = Math.ceil(SzottMegr.szall_1nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_1nap_drb.value) * 80 + Math.ceil(SzottMegr.szall_2nap_drb.value) * 100 + Math.ceil(SzottMegr.reg_2nap_drb.value) * 40 + Math.ceil(SzottMegr.ebed_2nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_2nap_drb.value) * 80 + Math.ceil(SzottMegr.szall_3nap_drb.value) * 100 + Math.ceil(SzottMegr.reg_3nap_drb.value) * 40 + Math.ceil(SzottMegr.ebed_3nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_3nap_drb.value) * 80 + Math.ceil(SzottMegr.szall_4nap_drb.value) * 100 + Math.ceil(SzottMegr.reg_4nap_drb.value) * 40 + Math.ceil(SzottMegr.ebed_4nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_4nap_drb.value) * 80 + Math.ceil(SzottMegr.szall_5nap_drb.value) * 100 + Math.ceil(SzottMegr.reg_5nap_drb.value) * 40 + Math.ceil(SzottMegr.ebed_5nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_5nap_drb.value) * 80 + Math.ceil(SzottMegr.szall_6nap_drb.value) * 100 + Math.ceil(SzottMegr.reg_6nap_drb.value) * 40 + Math.ceil(SzottMegr.ebed_6nap_drb.value) * 100 + Math.ceil(SzottMegr.vacs_6nap_drb.value) * 80 + Math.ceil(SzottMegr.reg_7nap_drb.value) * 40;
	if(SzottMegr.orszagSel.options.value == 1)
	{
		dij = 400;
		dijsum = Math.ceil(SzottMegr.dij_2nap_drb.value) * dij + Math.ceil(SzottMegr.dij_3nap_drb.value) * dij + Math.ceil(SzottMegr.dij_4nap_drb.value) * dij + Math.ceil(SzottMegr.dij_5nap_drb.value) * dij + Math.ceil(SzottMegr.dij_6nap_drb.value) * dij;
		if(dijsum == 800) dijsum = 760;
		if(dijsum == 1200) dijsum = 1140;
		if(dijsum == 1600) dijsum = 1520;
		if(dijsum == 2000) dijsum = 1900;
	}
	else 
	{
		dij = 30;
		dijsum = Math.ceil(SzottMegr.dij_2nap_drb.value) * dij + Math.ceil(SzottMegr.dij_3nap_drb.value) * dij + Math.ceil(SzottMegr.dij_4nap_drb.value) * dij + Math.ceil(SzottMegr.dij_5nap_drb.value) * dij + Math.ceil(SzottMegr.dij_6nap_drb.value) * dij;
		dijsum = dijsum * 29;
	}
	
	sum = sum + dijsum;
	return(sum);
}
