function Nyomtatas(){
		if (window.print) {
			setTimeout('window.print();',200);
		} else if (agt.indexOf("mac") != -1) {
			alert("A cikk nyomtat�s�hoz nyomja meg a 'Cmd+p' gombokat !");
		} else {
			alert("A cikk nyomtat�s�hoz nyomja meg a 'Ctrl+p' gombokat!");
		}
}


function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			//alert(a_all_cookies);
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}



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];
		//alert('ok');
		if(o.style.color!="#0000ff"){
			fn = o.value;
			if(!parseInt(num)){
				opener.document.getElementById(num).value=fn;
			} else {
				id = "";
				if(num != 1){
					id = num;
				}
				w = 100;
				if(wsize != "") w = wsize;
				if(bgmod == '1'){
					//newImage = "url(/template/hatterkep.php?fn="+fn+")";
					//d = opener.document.getElementById('kep'+id);
					//d.style.backgroundImage = newImage;
					//if(opener.document.getElementById('previmg'+id)){
					//	opener.document.getElementById('previmg'+id).display = "none";
					//}
					//d.innerHTML += "<IMG src='/"+dir+fn+"' width='"+w+"' border='0' id='previmg"+id+"' style='visibility:hidden'>";
				} else {
					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 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(){
	if(document.getElementById("bal")){
		b_h = document.getElementById("bal").offsetHeight;
		t_h = document.getElementById("tartalom").offsetHeight;
		if(b_h<t_h){
			document.getElementById("bal").style.height = t_h+"px";
		}
		if(document.getElementById("bannerbox")){
			bk = document.getElementById("bannerbox_keret");
			bb = document.getElementById("bannerbox");
			if(bb.offsetHeight<t_h){
				h = t_h-bk.offsetTop;
				bk.style.height = h+"px";
			} else {
				document.getElementById("bal").style.height = (bk.offsetTop+bb.offsetHeight)+"px";
				b_h = document.getElementById("bal").offsetHeight;
				h = b_h-bk.offsetTop;
				bk.style.height = h+"px";
			}
		}
	}
}

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 getAbsoluteTop(objectId){
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	return oTop
}

function getAbsoluteLeft(objectId){
	o = document.getElementById(objectId)
	oLeft= o.offsetLeft            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent top position
		o = oParent
	}
	return oLeft
}

function ws_Feldolgozas(host_id,dir,rid,fmod,szmod){
	if(ajax_obj){
		if(AjaxObjFree(ajax_obj)){
			ajax_obj.ws_feldolgozas(host_id,dir,rid, fmod, szmod);
		}	
	} else {
		f = "ws_Feldolgozas('"+host_id+"','"+dir+"','"+rid+"','"+fmod+"','"+szmod+"')";
		setTimeout(f,1000);
	}
}


function ws_Nagykep(fn){
	ablak = open("/template/nagykep.php?fn="+fn, "nagykep", "toolbar=0, location=0, directories=0, status=0, menubar=0, resizable=1, width=320, height=200, scrollbars=1");
}

function Loading(){
	d = document.getElementById("loading");
	dt = document.getElementById("loading_tartalom");
	
	ch = f_clientHeight();
	sy = getScrollY();
	dt.style.paddingTop = Math.round(sy+ch/2)+"px";	
	
	h = Math.max(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight));
	d.style.height = h+"px";
	d.style.background = "#ffffff";
	d.style.textIndent = "0px";	
}

function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && document.body.scrollTop) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}


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

function loaded(nyelv){
	var MyClassHandler = {
		ws_feldolgozas_uj: function(result){
			alert(result);
			if(result[0] == 1){
				window.location.href = result[8];				
			} else {
				setTimeout("ws_Feldolgozas('"+result[2]+"','"+result[3]+"','"+result[4]+"','"+result[5]+"','',"+result[8]+"')",1000);
			}
		},
		ws_feldolgozas: function(result){
			if(result[0] == 1){ // rescode 1: success
				document.getElementById("amix_valasz_div").innerHTML = result[1];				
				if(result[4]>0){				
					/*
					try {
					
						var pageTracker = _gat._getTracker("UA-22377183-1");
						pageTracker._initData();
						pageTracker._trackPageview();
						pageTracker._addTrans(
							result[4], // Rendelésazonosító
							"", // Részleg
							result[7], // Összesen
							"0", // Adó
							"0", // Szállítás
							"", // Város
							"", // Állam
							"" // Ország
						);	
						l = result[6].length;
						for(i=0; i<l; i++){
							//alert();
							pageTracker._addItem(
										result[4], // Rendelésazonosító
										result[6][i][0], // Cikkszám
										result[6][i][1], // Terméknév
										"", // Kategória
										result[6][i][2], // Ár
										result[6][i][3] // Mennyiség
										);						
						}
						pageTracker._trackTrans();
					} catch(err) {}
					*/
				} else {
					//alert(result[4]);
				}
			} else if(result[0] == 2) { // rescode 2: transfer error, try again
				setTimeout("ws_Feldolgozas('"+result[2]+"','"+result[3]+"','"+result[4]+"','"+result[5]+"','"+result[8]+"')",10000);
			} else {
				setTimeout("ws_Feldolgozas('"+result[2]+"','"+result[3]+"','"+result[4]+"','"+result[5]+"','"+result[8]+"')",1000);
			}
		}			
	}
	ajax_obj = new myclass(MyClassHandler); 
	MagassagBeallit();
	if(document.getElementById("cikkszamkeres_form")){
		document.getElementById("cikkszamkeres_form").mit.focus();
	}
}

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

//PNG--------------------------------------------------------------------------------
function alphaFixIE() {
	var s, i, j;
	// IMG
	var els = document.getElementsByTagName("IMG");
	for (i=0; i<els.length; i++) {
		s = els[i].src;
		if (s.toLowerCase().indexOf(".png") != -1) {
			els[i].src = "./bitmap/spacer.gif";
			els[i].style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + s + "', sizingMethod=image);";
		}
	}
	// CSS: background
	for (i=0; i<document.styleSheets.length; i++) {
		var pos = document.styleSheets[i].href.lastIndexOf("/");
		var cssDir = (pos != -1) ? document.styleSheets[i].href.substring(0, pos + 1) : "";
		for (j=0; j<document.styleSheets[i].rules.length; j++) {
			var style = document.styleSheets[i].rules[j].style;
			if (style.backgroundImage.toLowerCase().indexOf(".png") != -1) {
				var filename = style.backgroundImage.substring(4, style.backgroundImage.length - 1);
				if (filename.indexOf("http://") != 0 && filename.indexOf("/") != 0)
					filename = cssDir + filename;
				style.backgroundImage = "none";
				style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + filename + "', sizingMethod='scale', enabled=true);";
			}
		}
	}
}

if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1){
	//window.attachEvent("onload", alphaFixIE);
}
//----------------------------------------------------------------------------------------- 











