// JavaScript Document
var timer=new Date().getTime();
var pictIndex;
var valthato=true;
var nextPict=0;
var aktOpac;
var imgGal= new Image();
var selPictPath;
var showPictPath;
var imgCont;
var ndlAdded=false;
function getNavType(){
	return navigator.appName=='Netscape'?'ns':'ie';
}
function setFooterPosition(){
	var sLeftObj = nav=="ns"?document.getElementById("sidebar_left_foot"):document.all['sidebar_left_foot'];
	var pos_sLeftObj=getOffset(sLeftObj,'top');
	var sRightObj = nav=="ns"?document.getElementById("sidebar_right_foot"):document.all['sidebar_right_foot'];
	var pos_sRightObj=sRightObj==null?0:getOffset(sRightObj,'top');
	var contentObj = nav=="ns"?document.getElementById("end_content"):document.all['end_content'];
	var pos_contentObj = getOffset(contentObj,'top');
	var footerObj = nav=="ns"?document.getElementById("footer"):document.all['footer'];
	var pos_footerObj = getOffset(footerObj,'top');
	var maxSidePos = pos_sLeftObj>pos_sRightObj?pos_sLeftObj:pos_sRightObj;
	//sLeftObj.innerHTML+=pos_sRightObj.toString();
	
	while((getOffset(footerObj,'top')-20)<maxSidePos){
		//var ind = parseInt((maxSidePos-pos_footerObj)/15);
		
		//for(i=0;i<ind;i++){
			contentObj.innerHTML+='<br/>';
		//}
	}
	
}
function getOffset(obj, offsetType){//a hiba ablak számára meghatározzuk, hogy a meghívó objektum milyen eltolással rendelkezik
	var offset=offsetType=='top'?obj.offsetTop:obj.offsetLeft;
	var parentObj=obj.offsetParent;
	while(parentObj!=null){
		offset+=offsetType=='top'?parentObj.offsetTop:parentObj.offsetLeft;
		parentObj=parentObj.offsetParent;
	}
	return offset;
}
function printHoNap(){
	var hirForm = nav == "ns"?document.getElementById("hirAdmin"):document.all['hirAdmin'];
	var tmString='<label for="hirNap">nap:</label>';
	tmString+='<select id="hirNap" name="hirNap">';
	tmString+='<option value="01" selected="selected">01</option>';
	for(i=2;i<32;i++){
		if(i<10)
			tmString+='<option value="0'+i+'">0'+i+'</option>';
		else
			tmString+='<option value="'+i+'">'+i+'</option>';
	}
	tmString+='</select>';
	//hirForm.innerHTML+= tmString;
	document.write(tmString);
}
function printIdo(){
	var hirForm = nav == "ns"?document.getElementById("hirAdmin"):document.all['hirAdmin'];
	var tmString="";
	tmString+='<select id="hirIdo" name="hirIdo">';
	tmString+='<option value="00" selected="selected">00</option>';
	for(i=1;i<25;i++){
		if(i<10)
			tmString+='<option value="0'+i+'">0'+i+'</option>';
		else
			tmString+='<option value="'+i+'">'+i+'</option>';
	}
	tmString+='</select>';
	tmString+=':';
	tmString+='<select id="hirIdoMin" name="hirIdoMin">';
	tmString+='<option value="00" selected="selected">00</option>';
	for(i=1;i<60;i++){
		if(i<10)
			tmString+='<option value="0'+i+'">0'+i+'</option>';
		else
			tmString+='<option value="'+i+'">'+i+'</option>';
	}

	//hirForm.innerHTML+= tmString;
	document.write(tmString);
}
function checkDate(){
	var evObj = nav == "ns"?document.getElementById("hirEv"):document.all['hirEv'];
	var napObj = nav == "ns"?document.getElementById("hirNap"):document.all['hirNap'];
	var hoObj = nav == "ns"?document.getElementById("hirHo"):document.all['hirHo'];
	var ev = parseInt(evObj.value);
	if(isNaN(ev))
		return "Adja meg az evet!";
	var nap = parseInt(napObj.value);
	var tmString="";
	switch(hoObj.value){
		case "01":
		case "03":
		case "05":
		case "07":
		case "08":
		case "10":
		case "12":{
			tmString="ok";
		};break;
		case "02":{
			if(ev%4==0){
					if(nap>29){
						tmString='A nap nem lehet 29 - nel nagyobb!';
					}
					else
						tmString='ok';
			}
			else{
					if(nap>28){
						tmString='A nap nem lehet 28 - nal nagyobb!';
					}
					else
						tmString='ok';
			}
		};break;
		default:{
			if(nap>30){
				tmString='A nap nem lehet 30 - nal nagyobb!';
			}
			else
				tmString='ok';
		};break;
	}
	return tmString;
}
function submitForm(op){
	var muvObj = nav == "ns"?document.getElementById("muv"):document.all['muv'];
	var formObj = nav == "ns"?document.getElementById("hirAdmin"):document.all['hirAdmin'];
	var ell = checkDate();
	muvObj.value=op;
	if(ell=="ok")
		formObj.submit();
	else
		alert(ell);
}
function submitPictForm(op){
	var muvObj = nav == "ns"?document.getElementById("muv"):document.all['muv'];
	var formObj = nav == "ns"?document.getElementById("pictAdmin"):document.all['pictAdmin'];
	muvObj.value=op;
	formObj.submit();
}
function hirEdit(nr,dat,cim,tart,lin,targ,fn){
	var cimObj = nav == "ns"?document.getElementById("hirCim"):document.all['hirCim'];
	var evObj = nav == "ns"?document.getElementById("hirEv"):document.all['hirEv'];
	var napObj = nav == "ns"?document.getElementById("hirNap"):document.all['hirNap'];
	var hoObj = nav == "ns"?document.getElementById("hirHo"):document.all['hirHo'];
	var oraObj = nav == "ns"?document.getElementById("hirIdo"):document.all['hirIdo'];
	var minObj = nav == "ns"?document.getElementById("hirIdoMin"):document.all['hirIdoMin'];
	var contObj = nav == "ns"?document.getElementById("hirTartalom"):document.all['hirTartalom'];
	var linkObj = nav == "ns"?document.getElementById("hirLink"):document.all['hirLink'];
	var fileObj = nav == "ns"?document.getElementById("hirFName"):document.all['hirFName'];
	var idObj = nav == "ns"?document.getElementById("hirID"):document.all['hirID'];
	idObj.value=nr;
	cimObj.value=cim;
	contObj.value=tart;
	linkObj.value=lin;
	fileObj.value=targ
	var datArr= dat.split(" ");
	var ehn = datArr[0].split("-");
	var ho= new Number(ehn[1]);
	//ho=parseInt(ho);
	var nap = new Number(ehn[2]);
	nap = nap-1;
	var opm = datArr[1].split(":");
	var ora=new Number(opm[0]);
	var perc=new Number(opm[1]);
	evObj.value=ehn[0];
	hoObj.options[ho].selected="selected";
	napObj.options[nap].selected="selected";
	oraObj.options[ora].selected="selected";
	minObj.options[perc].selected="selected";
}
function addMapContent(mapName){
	var formObj = nav=="ns"?document.forms['pictAdmin']:document.all['pictAdmin'];
	var pictM = nav=="ns"?document.getElementById("pictMap"):document.all['pictMap'];
	var muv = nav=="ns"?document.getElementById("muv"):document.all['muv'];
	pictM.value=mapName;
	muv.value="add";//add folder
	formObj.submit();
}
function switchPictAllando(index){
	var pArray=new Array(4);
	pArray[0]=new Array(2);
	pArray[0][0]='pictures/allando/gyongyk.jpg';
	pArray[0][1]='Gyöngyfűzők';
	pArray[1]=new Array(2);
	pArray[1][0]='pictures/allando/mazsorettk.jpg';
	pArray[1][1]='Mazsorettek';
	pArray[2]=new Array(2);
	pArray[2][0]='pictures/allando/rajzk.jpg';
	pArray[2][1]='Rajz szakkör';
	pArray[3]=new Array(2);
	pArray[3][0]='pictures/allando/termeszetjarok.jpg';
	pArray[3][1]='Természetjárók';
	var pictObj= nav=="ns"?document.getElementById("allKep"):document.all['allKep'];
	var pictSzoveg= nav=="ns"?document.getElementById("allandoSzoveg"):document.all['allandoSzoveg'];
	setPictOpac(0, pictObj);
	pictObj.src=pArray[index][0];
	pictSzoveg.innerHTML=pArray[index][1];
	aktOpac=0;
	
}
function switchPictTimer(){
	var tmDate=new Date();
	var showPictTime=parseInt((tmDate.getTime()-timer)/1000);
	pictIndex=parseInt(showPictTime/6);
	if(pictIndex<=3){
		if(nextPict==pictIndex && valthato){
			valthato=false;
			halvanyit();
		}
	}else{
		nextPict=0;
		pictIndex=0;
		timer=new Date().getTime();
	}
	window.status=showPictTime.toString();
	//window.status=timer.toString();
	window.setTimeout('switchPictTimer()',10);
}
function erosit(){
	var pictObj= nav=="ns"?document.getElementById("allKep"):document.all['allKep'];
	if(aktOpac<100){
		aktOpac++;
		setPictOpac(aktOpac, pictObj);
		window.setTimeout('erosit()',10);
	}else{
		valthato=true;
		nextPict++;
	}
}
function halvanyit(){
	var pictObj= nav=="ns"?document.getElementById("allKep"):document.all['allKep'];
	if(aktOpac>0){
		aktOpac--;
		setPictOpac(aktOpac, pictObj);
		window.setTimeout('halvanyit()',10);
	}else{
		if(!valthato);
		switchPictAllando(pictIndex);
		erosit();
	}
}
function setPictOpac(opac, obj){
	//var opacObj= nav=="ns"?document.getElementById(obj):document.all[obj];
	
	//var nbr=nav=="ns"?document.getElementById("contItemNbr"):document.all['contItemNbr'];
	var p = nav=="ie" ? "filter" : "MozOpacity";
	opac = nav=="ie" ? "alpha(opacity="+opac+")" : opac/100;
    obj.style[p] = opac;
	/*if(nav=="ie"){
		for(i=0;i<nbr.value;i++){
			contObj="cont"+i;
			var opObj= nav=="ns"?document.getElementById(contObj):document.all[contObj];
			opObj.style[p] = opac;
		}
	}else
		opacObj.style[p] = opac;*/
	
}
function gotoDay(lap){
	var lok="hetirendszeres.html"+lap;
	document.location.href=lok;
}
function gotoGoup(lap){
	var lok="csoportok.php"+lap;
	document.location.href=lok;
}
function gotoSzolg(lap){
	var lok="szolgaltat.php"+lap;
	document.location.href=lok;
}
function switchImageMousOver(obj,url){
	obj.src=url;
}
function downloadPlakat(target){
	window.open(target,"DowloadWindow");
}
function setPictRowPosition(pictRow, pictShadow){
	var rowObj=nav=="ns"?document.getElementById(pictRow):document.all[pictRow];
	var shadowObj=nav=="ns"?document.getElementById(pictShadow):document.all[pictShadow];
	var posRow=getOffset(rowObj,'top');
	var posShadow=getOffset(shadowObj,'top');
	posShadow=nav=="ns"?posShadow-5:posShadow-475;
	var kiir="rowpos="+posRow+", shadowpos="+posShadow;
	/*rowObj.style.position="absolute";*/
	rowObj.style.top=(posShadow-posRow)+'px';
	setPictOpac(30, shadowObj);
}
function setOffsetPict(obj, offs){
	if(offs!=0)
		obj.style.cursor='pointer';
	obj.style.top=offs+'px';
	obj.style.left=offs+'px';
}
function loadImageIframe(obj){
	/*imgGal= new Image();*/
	pMenuAktObj=obj;
	var pW=obj.width;
	var pH=obj.height;
	var newWidth;
	var newHeight;
	showPictPath="";
	selPictPath=obj.src;
	selPictPath=selPictPath.replace("thumbnails","images");
	var pArray=selPictPath.split("/");
	selPictPath=pArray[3]+"/"+pArray[4]+"/"+pArray[5]+"/"+pArray[6];
	//selPictPath=selPictPath.slice(0,selPictPath.indexOf("/"));
	/*if(pW>pH){
			newWidth=580;
			newHeight=parseInt(580*0.75);
	}else{
			newHeight=parseInt(580*0.75);
			newWidth=parseInt(newHeight*0.75);
	}
	var imgP;
	//if(newWidth>newHeight)
		imgP="showPict.php?src="+selPictPath+"&width="+newWidth+"&height="+newHeight;
		//alert(imgP);
	/*else
		imgP="showPictSt.php?src="+selPictPath+"&width="+newWidth+"&height="+newHeight;
	if(showPictPath=="next")
		document.location.href=imgP;
	else{
		
		window.open(imgP,'newW','left=50,top=50,width=600,height=510,toolbar=0,resizable=0,scrollbar=0');
	}*/
		//showPict('iFrameCont',1);
	imgGal.src=selPictPath;
	
	loadPict();
	
}
function prevNextPict(path){
	/*imgGal= new Image();*/
	showPictPath="next";
	selPictPath=path;
	imgGal.src=path;
	loadPict();
}
function showNotDown(){
	var aWindow=nav=="ns"?document.getElementById('notDown'):document.all['notDown'];
	var aBg=nav=="ns"?document.getElementById('notDownPict'):document.all['notDownPict'];
	setPictOpac(50, aBg);
	aWindow.style.visibility="visible";
	
}
function loadPict(){
	//window.status=imgGal.sec;
	var w=parseInt(imgGal.width);
	if(w==0 || w==Number.NaN){
		window.status="loading image";
		window.setTimeout('loadPict()',10);
	}
	else{
		var newWidth;
		var newHeight;
		var width=parseInt(imgGal.width);
		var height=parseInt(imgGal.height);
		var rate=height/width;
		//alert("w="+width+"::h="+height);
		
		if(width>height){
			
			newWidth=580;
			newHeight=parseInt((newWidth/width)*height);
		}else{
			var rate=width/height;
			newHeight=parseInt(580*rate);
			newWidth=parseInt(width*(newHeight/height));
		}
		var imgP;
		//if(newWidth>newHeight)
			imgP="showPict.php?src="+selPictPath+"&width="+newWidth+"&height="+newHeight;
		/*else
			imgP="showPictSt.php?src="+selPictPath+"&width="+newWidth+"&height="+newHeight;*/
		if(showPictPath=="next")
			document.location.href=imgP;
		else{
			/*var iframe=nav=="ns"?document.getElementById('showPictures'):document.all['showPictures'];
			iframe.src=imgP;*/
			window.open(imgP,'newW','left=50,top=50,width=600,height=510,toolbar=0,resizable=0,scrollbar=0');
		}
		/*var iFrameCont=nav=="ns"?document.getElementById('iFrameCont'):document.all['iFrameCont'];
		var posTop=getOffset(pMenuAktObj,'top')-600;
		//var posLeft=getOffset(pMenuAktObj,'left')-350;
		iFrameCont.style.top=posTop+"px";
		iFrameCont.style.left="200px";
		iFrameCont.style.visibility="visible";*/
		//showPict('iFrameCont',1);
		imgGal= new Image();
	}
}
function showPict(obj,op){
	showPictObj= nav=="ns"?document.getElementById(obj):document.all[obj];
	var pageYof = nav=="ns"?pageYOffset:document.documentElement.scrollTop;
	var myHeight = nav=="ns"?innerHeight:document.documentElement.clientHeight;
	var hstyle=showPictObj.style;
	var posObj=nav=="ns"?document.getElementById('leftBar'):document.all['leftBar'];
	var leftPos=getOffset(posObj,'left')+270;
	y=(pageYof + myHeight)-1200;
	if(op==1){
		hstyle.top=y+'px';
		hstyle.left=leftPos+'px';
		hstyle.visibility="visible";
		floatPict();
	}
	else
		hstyle.visibility="hidden";
}
function floatPict(){
	var hstyle1=showPictObj.style;
	var pageYof = nav=="ns"?pageYOffset:document.documentElement.scrollTop;
	var myHeight = nav=="ns"?innerHeight:document.documentElement.clientHeight;
	/*var posObj=nav=="ns"?document.getElementById('leftBar'):document.all['leftBar'];
	var leftPos=getOffset(posObj,'left')+100;
	hstyle1.left=leftPos+'px';*/
	command='floatPict()';
	y=(pageYof + myHeight)-560;
	y=y+(y%6);
	var obj_y;
	ofs=getOffset(showPictObj,'top');
	if(ofs<y){
		if((y-ofs)<6)
			obj_y=y;
		else
			obj_y = ofs+6;
		hstyle1.top=obj_y+'px';
		window.setTimeout(command,10);
	}else if(ofs>y){
		if((ofs-y)<6)
			obj_y=y;
		else
			obj_y = ofs-6;
		hstyle1.top=obj_y+'px';
		window.setTimeout(command,10);
	}else
		window.setTimeout(command,10);
}
function closeAWindow(objName){
	var aWindow=nav=="ns"?document.getElementById(objName):document.all[objName];
	aWindow.style.visibility="hidden";
}
function initgMenuInner(){
	var gMenuNbr=nav=="ns"?document.getElementById('gMenuNbr'):document.all['gMenuNbr'];
	var gMenuSel=nav=="ns"?document.getElementById('gMenuSel'):document.all['gMenuSel'];
	var hossz=parseInt(gMenuNbr.value);
	gMenuInner=new Array(hossz);
	gMenuStatus=new Array(hossz);
	var dObj=new Date();
	var myYear=nav=="ns"?(parseInt(dObj.getYear())+1900):parseInt(dObj.getYear());
	
	for(i=0;i<hossz;i++){
		var mName='pMenuCont_id'+i;
		var menuitem=nav=="ns"?document.getElementById(mName):document.all[mName];
		gMenuInner[i]=menuitem.innerHTML;
		mName='tabTitle_id'+i;
		var tmItem=nav=="ns"?document.getElementById(mName):document.all[mName];
		var year=parseInt(tmItem.innerHTML.slice(0,4));
		mName='bOpener_id'+i+"_1";
		var zar=nav=="ns"?document.getElementById(mName):document.all[mName];
		mName='bOpener_id'+i+"_0";
		var nyit=nav=="ns"?document.getElementById(mName):document.all[mName];
		if(year<myYear){
		//alert(parseInt(gMenuSel));
			if(parseInt(gMenuSel.value)==i){
				gMenuStatus[i]=1;
				zar.style.visibility="visible";
				nyit.style.visibility="hidden";
			}else{
				menuitem.innerHTML="";
				gMenuStatus[i]=0;
				zar.style.visibility="hidden";
				nyit.style.visibility="visible";
			}
			
		}else{
			gMenuStatus[i]=1;
			zar.style.visibility="visible";
			nyit.style.visibility="hidden";
		}
	}
}
function gMenuPover(obj,ind){
	var tmName=new Array("pictures/closegmenu","pictures/opengmenu");
	var base=tmName[ind]+"_felette.jpg";
	
	obj.src=base;
	obj.style.cursor="pointer";
}
function gMenuPout(obj,ind){
	var tmName=new Array("pictures/closegmenu","pictures/opengmenu");
	var base=tmName[ind]+".jpg";
	obj.src=base;
}
function openClosegMenu(id){
	var mName='pMenuCont_id'+id;
	var menuitem=nav=="ns"?document.getElementById(mName):document.all[mName];
	mName='bOpener_id'+id+"_1";
	var zar=nav=="ns"?document.getElementById(mName):document.all[mName];
	mName='bOpener_id'+id+"_0";
	var nyit=nav=="ns"?document.getElementById(mName):document.all[mName];
	if(gMenuStatus[id]==0){
		gMenuStatus[id]=1;
		menuitem.innerHTML=gMenuInner[id];
		zar.style.visibility="visible";
		nyit.style.visibility="hidden";
	}else{
		gMenuStatus[id]=0;
		menuitem.innerHTML="";
		zar.style.visibility="hidden";
		nyit.style.visibility="visible";
	}
}
function showGallery(tableID,gMenuID){
	var path="agaleria.php?table="+tableID+"&gmenu="+gMenuID;
	document.location.href=path;
}
function downloadVideo(obj,path){
	window.open(path,'vieoWin','left=20,top=20,width=358,height=292,toolbar=0,resizable=0,scrollbar=0');
}
function initHirMenuArray(){
	var itemNbrObj=nav=="ns"?document.getElementById("hirNbr"):document.all['hirNbr'];
	var itemNbr=parseInt(itemNbrObj.value);
}
function openCloseYar(obj){
	hirMenuInner
	var objName=obj.id;
	var tmArr=obj.id.split("_");
	var objName="OP_"+tmArr[1];
	var bodyName="hirEvBody_"+tmArr[1];
	var OPitem=nav=="ns"?document.getElementById(objName):document.all[objName];
	var badyItem=nav=="ns"?document.getElementById(bodyName):document.all[bodyName];
	if(OPitem.innerHTML=="-"){
		OPitem.innerHTML="+";
		badyItem.style.height=0;
		badyItem.style.visible="hidden";
		//alert("close");
	}else{
		OPitem.innerHTML="-";
		//alert ("open");
	}
}
function notDownload(e){
	var rightclick;
	if (!e) var e = window.event;
	if (e.which) rightclick = (e.which == 3);
	else if (e.button) rightclick = (e.button == 2);
	if(rightclick){
		var imgC=(window.event)?document.all['outerImageContainer']:document.getElementById('outerImageContainer');
		var imgContainer=(window.event)?document.all['hoverNav']:document.getElementById('hoverNav');
		var lbox=(window.event)?document.all['lightbox']:document.getElementById('lightbox');
		if(lbox.style.display!='none'){
			imgCont=imgC.innerHTML;
			var wString=imgC.style.width;
			var wInt=parseInt(wString.substring(0,wString.indexOf('px')));
			var hString=imgC.style.height;
			var hInt=parseInt(hString.substring(0,hString.indexOf('px')))+40;
			var lbox=(window.event)?document.all['lightbox']:document.getElementById('lightbox');
			
			var ndl=document.createElement('div');
			ndl.id='notDwnl';
			
			var tx=ndl.appendChild(document.createElement('div'));
			tx.innerHTML='A szerző nem engedélyezi a képek letöltését!';
			tx.style.marginTop='100px';
			//alert(wInt);
			ndl.style.position='absolute';
			ndl.style.top='0';
			ndl.style.left='0';
			ndl.style.backgroundColor='#222';
			ndl.style.color='#fff';
			ndl.style.fontSize='12pt';
			ndl.style.width=wInt+'px';
			ndl.style.height=hInt+'px';
			ndl.style.visibility="visible";
			imgContainer.appendChild(ndl);
			ndlAdded=true;
			setTimeout("removeNotDownloadLayer()",3000);
		}
	}
}
function restoreImage(e){
	var rightclick;
	if (!e) var e = window.event;
	if (e.which) rightclick = (e.which == 3);
	else if (e.button) rightclick = (e.button == 2);
	if(ndlAdded && !rightclick){
		ndlAdded=false;
		var imgC=(window.event)?document.all['hoverNav']:document.getElementById('hoverNav');
		var ndl=(window.event)?document.all['notDwnl']:document.getElementById('notDwnl');
		imgC.removeChild(ndl);
		//alert('click');
	}
}
function removeNotDownloadLayer(){
	
	var imgC=(window.event)?document.all['hoverNav']:document.getElementById('hoverNav');
	var ndl=(window.event)?document.all['notDwnl']:document.getElementById('notDwnl');
	if(ndl){
		imgC.removeChild(ndl);
		ndlAdded=false;
	}
}
