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,mod){
	ablak = open("kepdialog.php?mod=1&num="+n, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=417, height=342, scrollbars-1");
}

function KepDialog3(n,d){
	//if(mod == 1){
		ablak = open("kepdialog.php?mod=1&num="+n+"&curr_dir="+d, "kepdialog", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=0, width=417, height=342, scrollbars-1");
	//} else {
	//	ablak = open("./admin/kepdialog.php?mod=2&num="+n, "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 == "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 {
		document.getElementById('previmage').innerHTML = "<IMG src='"+dir+fn+"'>";
	}
}


function KepDlgBeszur(dir,num){
	if(document.kepform.filenev.selectedIndex > -1){
		fn = document.kepform.filenev.options[document.kepform.filenev.selectedIndex].value;
		if(num == 0){
			opener.document.form1.kep.value=fn;
		} else {
			id = "";
			if(num > 1){
				id = num;
			}
			opener.document.getElementById('kepkeret'+id).innerHTML = "<IMG src='"+dir+fn+"' width='100' border='1' id='previmg"+id+"'>";
			opener.document.getElementById('kep'+id).value=fn;
		}
		self.close();
	}
}


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 Login_Kijelol(obj,alapszoveg1,alapszoveg2){
	i1 = document.getElementById("usrnev");
	i2 = document.getElementById("pwd");

	if(i1.value.indexOf(alapszoveg1)==0){
		i1.value="";
		i1.alapszoveg = alapszoveg1;
	}
	if(i2.value.indexOf(alapszoveg2)==0){
		i2.value="";
		i2.alapszoveg = alapszoveg2;
	}	
	if(obj==i1){
		i2.value="";
	}
	
	obj.select();
}

function Login_InputKitolt(obj){
	i1 = document.getElementById("usrnev");
	i2 = document.getElementById("pwd");

	if(i1.value == ""){
		i1.value = i1.alapszoveg;
	}
	if(i2.value == ""){
		i2.value = i2.alapszoveg;
	}	
}


function takaro(n){
	d = document.getElementById("takaro_div");
	if(n==1){
		d.style.display = "";
	} else {
		d.style.display = "none";
	}
}

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 getFlashMovieObject(movieName){
	if (window.parent.document[movieName]){
   		return window.parent.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (parent.document.embeds && parent.document.embeds[movieName]){
			return parent.document.embeds[movieName]; 
		}
	} else {
		if (navigator.appName.indexOf("Microsoft Internet")!=-1){
 			return parent.document.getElementById(movieName);
		}
	}
}

function Leallit(id,lejatszok){
	lista = lejatszok.split("#");
	l = lista.length;
	for(i=0; i<l; i++){
		lejatszo = lista[i];
		if(id!=lejatszo){
			flash = getFlashMovieObject(lejatszo);
			if(flash){
				flash.SetVariable("g_func", "stop");
			}
		}
	}				
}

function Hatterzene_fut(f){
		setCookie("hatterzene", f);
}

function setCookie(NameOfCookie, value, expiredays) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

	document.cookie = NameOfCookie + "=" + escape(value) + 
	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())+"; path= /;";
}



//---Ajax--------------------------------------------------------------------
var ajax_obj;

function loaded(nyelv){
	MagassagBeallit();
}

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










