function on(pic) {
	if (document.images[pic]) {
		document.images[pic].src = "pics/menu/over/" + pic + ".jpg";
	}
}

function off(pic) {
	if (document.images[pic]) {
		document.images[pic].src = "pics/menu/out/" + pic + ".jpg";
	}
}

function refon(pic,refid) {
	if (document.images['ref']) {
		document.images['ref'].src = "pics/module/referenciak/medium/" + pic;
		document.getElementById('thumbnail').href = "pics/module/referenciak/viewsize/" + pic;
		document.getElementById('firstrefname').style.display = "none";
		document.getElementById('firstrefdata').style.display = "none";
		
		LastRefIds = document.getElementById('lastrefid').value;
		if (LastRefIds!='') {
			document.getElementById('ref' + LastRefIds).style.display = "none";
			document.getElementById('ref2' + LastRefIds).style.display = "none";
		}
		document.getElementById('lastrefid').value = refid;
		document.getElementById('ref' + refid).style.display = "block";
		document.getElementById('ref2' + refid).style.display = "block";
	}
}

// programme calendar
function programmecalendar(url,info,scrollbar,status,width,height) {
	var width_center=(screen.width-width)/2;
	var height_center=(screen.height-height)/2;
	if (width>(screen.width)) {
		window_width=(screen.width-30);	
	}
	else {
		window_width=width;
	}
	
	if (height>(screen.height)) {
		window_height=(screen.height-30);	
	}
	else {
		window_height=height;
	}
	
	open("elements/jswindow.php"+url,info,"scrollbars="+scrollbar+",toolbar=no,menubar=no,directories=no,status="+status+"," +  "resizable=no,left="+width_center+",top="+height_center+",width="+window_width+",height="+window_height+"");
}
//-->

// gallery zoom
function openpict(url,info,scrollbar,status,width,height,alt) {
	var width_center=(screen.width-width)/2;
	var height_center=(screen.height-height)/2;
	if (width>(screen.width)) {
		window_width=(screen.width-30);	
	}
	else {
		window_width=width;
	}
	
	if (height>(screen.height)) {
		window_height=(screen.height-30);	
	}
	else {
		window_height=height;
	}
	
	open_pict=open(url,info,"scrollbars="+scrollbar+",toolbar=no,menubar=no,directories=no,status="+status+"," +  "resizable=no,left="+width_center+",top="+height_center+",width="+window_width+",height="+window_height+"");
	open_pict.document.write('<html>\n<title>Szegedi Sport és Fürdők kft.</title>\n</head>\n\n<body bgcolor="#FFFFFF" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">\n');
	open_pict.document.write('<div align="center"><a href="javascript:;" onclick="window.close()"><img src="',url,'" border="0" width="',width,'" height="',height,'" alt="',alt,' - (klikk a bezáráshoz)"></a></div>');
	open_pict.document.write('</body></html>');
}
//-->

// admin open new window
function openadmin(url,info,scrollbar,status,width,height) {
	var width_center=(screen.width-width)/2;
	var height_center=(screen.height-height)/2;
	if (width>(screen.width)) {
		window_width=(screen.width-30);	
	}
	else {
		window_width=width;
	}
	
	if (height>(screen.height)) {
		window_height=(screen.height-30);	
	}
	else {
		window_height=height;
	}
	
	open("elements/jswindowadmin.php"+url,info,"scrollbars="+scrollbar+",toolbar=no,menubar=no,directories=no,status="+status+"," +  "resizable=no,left="+width_center+",top="+height_center+",width="+window_width+",height="+window_height+"");
}
//-->

// open webseta
function OpenNewWindow(url,info,scrollbar,status,width,height) {
	var width_center=(screen.width-width)/2;
	var height_center=(screen.height-height)/2;
	if (width>(screen.width)) {
		window_width=(screen.width-30);	
	}
	else {
		window_width=width;
	}
	
	if (height>(screen.height)) {
		window_height=(screen.height-30);	
	}
	else {
		window_height=height;
	}
	
	open(url,info,"scrollbars="+scrollbar+",toolbar=no,menubar=no,directories=no,status="+status+"," +  "resizable=no,left="+width_center+",top="+height_center+",width="+window_width+",height="+window_height+"");
}
//-->

// programme calendar ordercat
function programme_year() {
	var a=document.forms.programme;
	var url=a.orderyear.options[a.orderyear.selectedIndex].value;
	newPage=window.location.href=url;
}

function programme_cat() {
	var a=document.forms.programme;
	var url=a.ordercat.options[a.ordercat.selectedIndex].value;
	newPage=window.location.href=url;
}
//-->

// change selected option
function chinpsel(formname,inputtname) {
	var a = eval( 'document.' + formname );
	var srcList = eval( 'a.' + inputtname );
	
	if (!srcList.disabled) {
		var url=srcList.options[srcList.selectedIndex].value;
		newPage=window.location.href=url;
	}
}
//-->

function deselectoption(formname,inputtname1,inputtname2,val) {
	var a = eval( 'document.' + formname );
	var srcList1 = eval( 'a.' + inputtname1 );
	var srcList2 = eval( 'a.' + inputtname2 );
	
	if (val==1) {
		a.targetlist.options[1].selected = true;
		a.href.disabled = false;
		srcList2.options[0].selected = true;
	}
	else {
		a.targetlist.options[2].selected = true;
		a.href.disabled = true;
		srcList2.options[srcList2.selectedIndex].selected = false;
	}
}

function selectvalue(formname,inputtname1,inputtname2,inputtname3) {
	var a = eval( 'document.' + formname );
	var srcList1 = eval( 'a.' + inputtname1 );
	var srcList2 = eval( 'a.' + inputtname2 );
	var srcList3 = eval( 'a.' + inputtname3 );
	
	var subnews_count = 0;
	if (srcList1.value!='') {
		for (i=0;i<=(srcList2.options.length)-1;i++) {
			if (srcList2.options[i].value == srcList1.value) {
				srcList2.options[i].selected = true;
				subnews_count++;
			}
			if (subnews_count == '0') {
				for (j=0;j<=(srcList3.options.length)-1;j++) {
					if (srcList3.options[i].value == srcList1.value) {
						srcList3.options[j].selected = true;
					}
				}
			}
		}
	}	
}

function selectvalue2(formname,inputtname1,inputtname2) {
	var a = eval( 'document.' + formname );
	var srcList1 = eval( 'a.' + inputtname1 );
	var srcList2 = eval( 'a.' + inputtname2 );
	
	if (srcList1.value!='') {
		for (i=0;i<=srcList2.options.length;i++) {
			if (srcList2.options[i].value == srcList1.value) {
				srcList2.options[i].selected = true;
			}
		}
	}
}

// confirm change selected option
function confirmchinpsel(msg,formname,inputtname) {
	x = window.confirm(msg);
	
	if (x==true) {
		var a = eval( 'document.' + formname );
		var srcList = eval( 'a.' + inputtname );
		
		if (!srcList.disabled) {
			var url=srcList.options[srcList.selectedIndex].value;
			newPage=window.location.href=url;
		}
	}
}
//-->

// change selected option (mod)
function chinpsel2(formname,inputtname1,inputtname2,divname) {
	var a = eval( 'document.' + formname );
	var srcList1 = eval( 'a.' + inputtname1 );
	var srcList2 = eval( 'a.' + inputtname2 );
	
	var selvalue=srcList1.options[srcList1.selectedIndex].value;
	
	if (selvalue==999) {
		document.getElementById(divname).style.display = "block";
		srcList2.focus();
	}
	else {
		document.getElementById(divname).style.display = "none";
		srcList2.value='';
	}
}
//-->

// html tag hide/show
function showhtmltag(id,gebi) {
	if (id == 0) { 
		document.getElementById(gebi).style.display = "none";
	}
	if (id == 1) { 
		document.getElementById(gebi).style.display = "block";
	}
}
//-->

// html tag hide/show ver.2
function showhtmltag2(id,gebi,gebi2) {
	if (id == 0) { 
		document.getElementById(gebi).style.display = "none";
		document.getElementById(gebi2).style.display = "block";
	}
	if (id == 1) { 
		document.getElementById(gebi).style.display = "block";
		document.getElementById(gebi2).style.display = "none";
	}
}
//-->

// confirm
function ConfirmMsg(msg) {
	x = window.confirm(msg);
	return x;
}
//-->

// checkall
var ie  = document.all  ? 1 : 0;

function hl(cb) {
   if (ie) {
	   while (cb.tagName != "TR") {
		   cb = cb.parentElement;
	   }
   }
   else {
	   while (cb.tagName != "TR") {
		   cb = cb.parentNode;
	   }
   }
   cb.className = 'ReadMsgSelected';
}

function dl(cb) {
   if (ie) {
	   while (cb.tagName != "TR") {
		   cb = cb.parentElement;
	   }
   }
   else {
	   while (cb.tagName != "TR") {
		   cb = cb.parentNode;
	   }
   }
   cb.className = 'ReadMsgNonSelected';
}

function cca(cb) {
   if (cb.checked) {
	   hl(cb);
   }
   else {
	   dl(cb);
   }
}

// roll selected list
function rollselected(cba) {
	cba_tra = 'tra'+cba;
   	document.getElementById(cba_tra).className = 'ReadMsgSelected';
}
function rollunselected(cba) {
	cba_tra = 'tra'+cba;
	cba_inp = 'inp'+cba;
	locked_img = 'locked'+cba
	if (document.getElementById(cba_inp).checked == false) {
		document.getElementById(cba_tra).className = 'ReadMsgNonSelected';
	}
	if (document.getElementById(cba_inp).name == locked_img) {
		document.getElementById(cba_tra).className = 'ReadMsgNonSelected';
	}
}
//-->

function CheckAll(formname,checkboxname,othercheckbox,cb) {
	var fmobj = eval( 'document.' + formname );
	var fmobj2 = eval ( 'fmobj.' + checkboxname );
	for (var i=0;i<fmobj.elements.length;i++) {
		var e = fmobj.elements[i];
		if ((e.name != checkboxname) && (e.type=='checkbox') && (!e.disabled)) {
			e.checked = fmobj2.checked;
			if (fmobj2.checked) {
			   hl(e);
			}
			else {
			   dl(e);
			}
		}
	}
}
//-->

// cancel
function cancel(url) {
	window.location=url;
}
//-->

function insertpictlink(gebi,url) {
	document.getElementById(gebi).value = url;
}

function changeselectedvalue(gebi) {
	document.getElementById(gebi).checked = true;
}
