function Preview(num,filenev){
	document.form1.action = filenev;
	document.form1.target="self";
	document.form1.prev.value=num;
}


function Rogzit(filenev){
	document.form1.action = filenev;
	document.form1.target="menu";
	document.form1.prev.value='';
}


function KepDialog(n,dir){
	ablak = open("kepdialog.php?mod=1&num="+n+"&curr_dir="+dir, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=417, height=342, scrollbars-1");
}

function KepDialog2(n,dir){
	ablak = open("/admin/kepdialog.php?mod=1&num="+n+"&curr_dir="+dir, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=417, height=342, scrollbars-1");
}

function KepDialog3(n,dir,w,bgmod){
	ablak = open("/admin/kepdialog.php?mod=1&num="+n+"&curr_dir="+dir+"&w="+w+"&bgmod="+bgmod, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=417, height=342, scrollbars-1");
}

function KepDlgPreview(dir){
	fn = document.kepform.filenev.options[document.kepform.filenev.selectedIndex].value;
	kit = fn.substr(fn.length-3, 3);
	if(kit.toLowerCase() == "swf"){
		html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">';
        html +=	'<param name="movie" value="'+dir+fn+'">';
        html += '<param name="quality" value="high">';
        html += '<embed src="'+dir+fn+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed></object>';
        document.getElementById('previmage').innerHTML = html;
	} else {
		if(kit.toLowerCase() == "jpg" || kit.toLowerCase() == "gif" || kit.toLowerCase() == "png"){
			document.getElementById('previmage').innerHTML = "<IMG src='"+dir+fn+"'>";
		}
	}
}


function KepDlgBeszur(dir,subdir,num,input_id,wsize,bgmod){
	if(document.kepform.filenev.selectedIndex > -1){
		o = document.kepform.filenev.options[document.kepform.filenev.selectedIndex];
		w = 100;
		if(wsize != "") w = wsize;
		if(o.style.color!="#0000ff"){
			fn = o.value;
			
			if(bgmod == '1'){
				
			} else {
				id = num;
				if ( (opener.document.getElementById('kepkeret'+id)) && ((fn.indexOf("jpeg")>-1) || (fn.indexOf("jpg")>-1)
					|| (fn.indexOf("gif")>-1)|| (fn.indexOf("png")>-1)|| (fn.indexOf("JPEG")>-1) || (fn.indexOf("JPG")>-1)
					|| (fn.indexOf("GIF")>-1)|| (fn.indexOf("PNG")>-1))) {
						opener.document.getElementById('kepkeret'+id).innerHTML = "<IMG src='/"+dir+subdir+fn+"' width='"+w+"' border='1' id='previmg"+id+"'>";
				}
				opener.document.getElementById('kep'+id).value=subdir+fn;
			}
			self.close();
		}
	}
}

function SubDirBetolt(){
	o = document.kepform.filenev.options[document.kepform.filenev.selectedIndex];
	if(o.style.color=="#0000ff"){
		f = document.subdirform;
		f.subdir.value = o.value;
		//alert(o.value);
		f.submit();
	}
}


function TartalomUrit(url){
	window.parent.document.getElementById("tartalom").src = "ures.html";
}


function PreviewFrissit(url){
	if(url != ''){
		window.parent.document.getElementById("preview").src = url;
	}
}


function MenuAktiv(classnev,id){
	//currlayer = document.getElementById("menu_layer"+id);
	//currlayer.className = classnev;
}

function CreatePreview(){
	konyvtar = document.form1.konyvtar.options[document.form1.konyvtar.selectedIndex].text;
	ablak = open("./createpreview.php?dir="+konyvtar, "", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=320, height=240, scrollbars=0");
}


function Vissza(){
	history.go(-1);
}


function UgyfelSzures(id){
	f = document.getElementById("szukitform_"+id);
	f.submit();
}

function urldialog(mid){
	ablak = open("./urldialog.php?mid="+mid, "", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=240, height=100, scrollbars=0");
}

function UserLapoz(pos){
	document.oldal.pos.value = pos;
	document.oldal.submit();
}


function Kijelol(obj,alapszoveg){
	if(obj.value.indexOf(alapszoveg)==0){
		obj.value="";
		obj.alapszoveg = alapszoveg;
	}
	obj.select();
}

function InputKitolt(obj){
	if(obj.value == ""){
		obj.value = obj.alapszoveg;
	}
}

function CsakSzam(obj){
	obj.value = obj.value.replace(/[^0-9, ',']/g, '');
}

function MagassagBeallit(){
	k_h = document.getElementById("kozepre").offsetHeight;
	f_h = document.getElementById("fejlec").offsetHeight;
	l_h = document.getElementById("lablec").offsetHeight
	full_h = f_clientHeight();
	
	max = k_h-f_h-l_h;
	
	document.getElementById("bal_oldal").style.height = max;
	document.getElementById("oldal_kozep").style.height = max;
	document.getElementById("jobb_oldal").style.height = max;
	
	d1 = document.getElementById("tartalom_kozep_div");
	d2 = document.getElementById("tartalom_lezaro_div");
	if(d1.offsetHeight+d2.offsetHeight<max){
		d2.style.height = max-d1.offsetHeight;
	}
}

function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
			
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
			
			
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function Galeria(g){
		ablak = open(g, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=540, height=430, scrollbars=0");
}

function ChkUserForm(){
	f = document.getElementById("user_form");
	if(f.pwd.value==f.pwd2.value && f.pwd.value!=''){
		f.submit();
	} else {
		alert('Jelszó nem megfelelő!');
	}
}

function ChkUserForm2(){
	f = document.getElementById("user_form");
	if(f.pwd.value==f.pwd2.value){
		f.submit();
	} else {
		alert('Jelszó nem megfelelő!');
	}
}

function EredmenyHozzaad(){
	d = document.getElementById("eredmenylista");
	n = parseInt(document.getElementById("eredmeny_num").value);
	
	var newdiv = document.createElement('div');
	id = 'eredmeny_'+(n+1);
	newdiv.setAttribute('id',id);

	newdiv.innerHTML += '<div style="padding-bottom: 5px;">';
	newdiv.innerHTML += 'Év: <input type="text" name="ev_'+(n+1)+'" style="width:50px;" />';
	newdiv.innerHTML += '&nbsp;Kiállítás: <input type="text" name="kiallitas_'+(n+1)+'" style="width:250px;" />';
	newdiv.innerHTML += '&nbsp;Kiemelt: <input type="checkbox" name="kiemelt_'+(n+1)+'" value="I" />';
	newdiv.innerHTML += '&nbsp;<input type="button" value="X" onclick="if(confirm(\'Biztos törli a kiválaszott elemet?\')) EredmenyTorol('+(n+1)+')" />';
	newdiv.innerHTML += '</div>';
	
	d.appendChild(newdiv);
	
	document.getElementById("eredmeny_num").value = n+1;
}

function EredmenyTorol(num){
	d = document.getElementById("eredmenylista");
	id = 'eredmeny_'+num;
	curr = document.getElementById(id);
	d.removeChild(curr);
}

//---Ajax--------------------------------------------------------------------
function AjaxObjFree(obj){
	res = false;
	if(!obj.__client){
		res = true;
	} else {
		if(obj.__client.xmlhttp.readyState == 4){
			res = true;
		}
	}
	return res;
}











