
//***************************************************************************************

var abl;
var phpabl;
var nyitas;
var scrl_mag=450;
var szovegmagassag=0;
var clipmagassag=0;
var gorditendo_neve='szoveg';
var gordito_ablak='szovegkeret';
var rulersebesseg="0";
sc_tmb=new Array(7);
tmb=new Array(20);
var maxTop=0;	// maximum ennyire fel lehet grditeni a layer(eke)t
var layerT=0,layerH=0,clipT=0,clipL=0,clipB=0,clipR=0,clipMag=0;;

browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) > 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )));
 N = (navigator.appName == "Netscape");
 N4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 ));
 IE4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ));
 scrl_prm=0;

function scroll_init(prm_tmb)	//****** Egy layerben gorditve "CLIP"-pel alapadatok visszaadasa ********
{

	if (ie4)
	{
	prm_tmb[0]= document.all[prm_tmb[1]].style.pixelTop;		// scrolling layer felso szele

	klip=new String(document.all[prm_tmb[1]].style.clip);
	strlen=klip.length;
	klip=klip.substr(5,strlen-6);
	clipArr=klip.split(' ');

	clipTop=new String(clipArr[0]);
	clipTop=clipTop.substr(0,clipTop.indexOf('px'));
	clipT=parseInt(clipTop);

	clipBot=new String(clipArr[2]);
	clipBot=clipBot.substr(0,clipBot.indexOf('px'));
	clipB=parseInt(clipBot);

	clipMag=clipB-clipT;

	fullMag= parseInt(document.all[prm_tmb[1]].scrollHeight); 	// teljes layer magassag
	fullMag2= parseInt(document.all[prm_tmb[5]].scrollHeight);
	gombMag= parseInt(document.all[prm_tmb[6]].scrollHeight);

	
	prm_tmb[2]=(fullMag2-gombMag)/(fullMag-clipMag);		// rulersebesseg
	}

	if (n4)
	{
	prm_tmb[0]=document.layers[prm_tmb[1]].top;		// scrolling layer felso szele

	clipT=document.layers[prm_tmb[1]].clip.top;
	clipB=document.layers[prm_tmb[1]].clip.bottom;
	
	clipMag=clipB-clipT;

	fullMag=prm_tmb[7]; 	// teljes layer magassag
	fullMag2=document.layers[prm_tmb[5]].clip.bottom;
	gombMag=document.layers[prm_tmb[6]].clip.bottom;
	
	prm_tmb[2]=(fullMag2-gombMag)/(fullMag-clipMag);		// rulersebesseg

	}
	
return prm_tmb;
}

function status_load(prm_tmb)//****** Egy layerben gorditve "CLIP"-pel ********
{
	var klip;
//	for (j=0; j<=6; j++) sc_tmb[j]=prm_tmb[j];
	sc_tmb=prm_tmb;
	if(ie4)
	{
	// gorditendo layer pozicioi
		tmb[1]= parseInt(document.all[prm_tmb[1]].scrollHeight); 	// teljes layer magassag
//		layerH=tmb[1];
		tmb[2]= document.all[prm_tmb[1]].style.pixelLeft;		// bal szele
		tmb[3]= document.all[prm_tmb[1]].style.pixelTop;		// felso szele
		layerT=tmb[3];
	// Layer clipping:
		tmb[4]= document.all[prm_tmb[1]].style.clip;			// clip RECT (x x x x)
		klip=new String(tmb[4]);
		strhossz=klip.length;
		klip=klip.substr(5,strhossz-6);
		clipArr=klip.split(' ');

		clipTop=new String(clipArr[0]);
		clipTop=clipTop.substr(0,clipTop.indexOf('px'));
		clipT=parseInt(clipTop);

		clipRight=new String(clipArr[1]);
		clipRight=clipRight.substr(0,clipRight.indexOf('px'));
		clipR=parseInt(clipRight);

		clipBot=new String(clipArr[2]);
		clipBot=clipBot.substr(0,clipBot.indexOf('px'));
		clipB=parseInt(clipBot);

		clipLeft=new String(clipArr[3]);
		clipLeft=clipLeft.substr(0,clipLeft.indexOf('px'));
		clipL=parseInt(clipLeft);

		clipMag=clipB-clipT;
		maxTop=tmb[1]-(layerT+clipB);

	// felfele nyil layere
//		tmb[5]= document.all[prm_tmb[3]].style.pixelLeft;
//		tmb[6]= document.all[prm_tmb[3]].style.pixelTop;		
	// lefele nyil layere
//		tmb[7]= document.all[prm_tmb[4]].style.pixelLeft;
//		tmb[8]= document.all[prm_tmb[4]].style.pixelTop;
	// ruler layer
		tmb[9]= parseInt(document.all[prm_tmb[5]].scrollHeight);
		tmb[10]= document.all[prm_tmb[5]].style.pixelTop;
//		alert (prm_tmb[5]+"::"+tmb[9]);
	// gordito gomb layere
		tmb[11]= document.all[prm_tmb[6]].scrollHeight;
		tmb[12]= document.all[prm_tmb[6]].style.pixelLeft;
		tmb[13]= document.all[prm_tmb[6]].style.pixelTop;		
		tmb[20]=tmb[3]+clipT;	
	}
	if(n4)
	{
		tmb[1]= document.layers[prm_tmb[1]].clip.bottom;
		tmb[2]= document.layers[prm_tmb[1]].left;
		tmb[3]= document.layers[prm_tmb[1]].top;
	// gordito ablak magassaga
//		tmb[4]= document.layers[prm_tmb[1]].clip.bottom;
	// felfele nyil IMAGE NEVE
//		tmb[5]= document.layers[prm_tmb[3]].document.images['szfel'].width;
//		tmb[6]='';
	// lefele nyil IMAGE NEVE
//		tmb[7]= document.layers[prm_tmb[4]].left;
//		tmb[8]= document.layers[prm_tmb[4]].top;
	// drag layer
		tmb[9]= document.layers[prm_tmb[5]].clip.bottom;
		tmb[10]= document.layers[prm_tmb[5]].top;
//		alert (tmb[10]);
	// gordito gomb ruler layere
		tmb[11]= document.layers[prm_tmb[6]].clip.bottom;
		tmb[12]= document.layers[prm_tmb[6]].left;
		tmb[13]= document.layers[prm_tmb[6]].top;		
	// lefele nyil layere

	clipMag=document.layers[prm_tmb[1]].clip.bottom-document.layers[prm_tmb[1]].clip.top;
	clipT=document.layers[prm_tmb[1]].clip.top;
//	alert (clipT);
	maxTop=prm_tmb[0]-(prm_tmb[7]-clipMag);

	}

//	alert (clipMag);
//	alert (maxTop);
	return sc_tmb;
}

function jobbgombletilt()//****************************************************
{
//alert ('letiltva');
    document.onkeypress=warn;
    document.onmousedown=warn;
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    window.onmousedown=warn;
}

function overload()
{
return false;
}
	function warn(evnt){
//        if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null) {
        if (N) {
            if (evnt.which >= 2){
            alert("::Soft Contact::");
            document.onmouseup=overload
            return false;
          }
        } else {
            if (event.button != 1){
              alert("::Soft Contact::");
              document.onmouseup=overload
              return false;
          }
          }
        }
function goaway(evnt)
{
     if (evnt.which == 0){
     alert("::Soft Contact::");
     return false;
     }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


//***************************************************************************************

function mozgat(p_l_nev,p_fuggo,p_vizsz,p_pixel,p_db)
{
sum_db=p_db;
eddig_ennyiszer=0;
layer_move (p_l_nev,p_fuggo,p_vizsz,p_pixel,eddig_ennyiszer,sum_db);
}

//***************************************************************************************

function layer_move (p_l_nev,p_fuggo,p_vizsz,p_pixel,p_eddig_ennyiszer,p_summ_db)
{
edd_ennyi=p_eddig_ennyiszer;
summa_db=p_summ_db;
l_nev=p_l_nev;
fuggo=p_fuggo;
vizsz=p_vizsz;
pixel=p_pixel;

edd_ennyi=edd_ennyi+1;

if (edd_ennyi<summa_db){
 if (N4) {
		document[l_nev].moveBy(vizsz*pixel,0);
		document[l_nev].moveBy(0,fuggo*pixel);
}
  if (IE4) {
		document.all[l_nev].style.posLeft=document.all[l_nev].style.posLeft+vizsz*pixel;
		document.all[l_nev].style.posTop=document.all[l_nev].style.posTop+fuggo*pixel;
}
setTimeout ("layer_move (l_nev,fuggo,vizsz,pixel,edd_ennyi,summa_db)",0);
}
}

//***************************************************************************************

function mozgat_w(p_l_nevw,p_fuggow,p_vizszw,p_pixelw,p_dbw)
{
sum_dbw=p_dbw;
eddig_ennyiszerw=0;
eddig_ennyiszerw=layer_move_w (p_l_nevw,p_fuggow,p_vizszw,p_pixelw,eddig_ennyiszerw,sum_dbw);
}

//***************************************************************************************

function layer_move_w (p_l_nev,p_fuggo,p_vizsz,p_pixel,p_eddig_ennyiszer,p_summ_db)
{
edd_ennyiw=p_eddig_ennyiszer;
summa_dbw=p_summ_db;
l_nevw=p_l_nev;
fuggow=p_fuggo;
vizszw=p_vizsz;
pixelw=p_pixel;

edd_ennyiw=edd_ennyiw+1;

if (edd_ennyiw<summa_dbw){
 if (N4) {
		document[l_nevw].moveBy(vizszw*pixelw,0);
		document[l_nevw].moveBy(0,fuggow*pixelw);
}
  if (IE4) {
		document.all[l_nevw].style.posLeft=document.all[l_nevw].style.posLeft+vizszw*pixelw;
		document.all[l_nevw].style.posTop=document.all[l_nevw].style.posTop+fuggow*pixelw;
}
setTimeout ("layer_move_w (l_nevw,fuggow,vizszw,pixelw,edd_ennyiw,summa_dbw)",1);
}
}

//***************************************************************************************

function mozgat_g(p_l_nevg,p_fuggog,p_vizszg,p_pixelg,p_dbg)
{
sum_dbg=p_dbg;
eddig_ennyiszerg=0;
layer_move_g (p_l_nevg,p_fuggog,p_vizszg,p_pixelg,eddig_ennyiszerg,sum_dbg);
}

//***************************************************************************************

function layer_move_g (p_l_nev,p_fuggo,p_vizsz,p_pixel,p_eddig_ennyiszer,p_summ_db)
{
edd_ennyig=p_eddig_ennyiszer;
summa_dbg=p_summ_db;
l_nevg=p_l_nev;
fuggog=p_fuggo;
vizszg=p_vizsz;
pixelg=p_pixel;

edd_ennyig=edd_ennyig+1;

if (edd_ennyig<summa_dbg){
 if (N4) {
		document[l_nevg].moveBy(vizszg*pixelg,0);
		document[l_nevg].moveBy(0,fuggog*pixelg);
}
  if (IE4) {
		document.all[l_nevg].style.posLeft=document.all[l_nevg].style.posLeft+vizszg*pixelg;
		document.all[l_nevg].style.posTop=document.all[l_nevg].style.posTop+fuggog*pixelg;
}
setTimeout ("layer_move_g (l_nevg,fuggog,vizszg,pixelg,edd_ennyig,summa_dbg)",1);
}
}

//***************************************************************************************

function mozgat_m(p_l_nevm,p_fuggom,p_vizszm,p_pixelm,p_dbm)
{
sum_dbm=p_dbm;
eddig_ennyiszerm=0;
layer_move_m (p_l_nevm,p_fuggom,p_vizszm,p_pixelm,eddig_ennyiszerm,sum_dbm);
}

//***************************************************************************************

function layer_move_m (p_l_nevm,p_fuggom,p_vizszm,p_pixelm,p_eddig_ennyiszerm,p_summ_dbm)
{
edd_ennyim=p_eddig_ennyiszerm;
summa_dbm=p_summ_dbm;
l_nevm=p_l_nevm;
fuggom=p_fuggom;
vizszm=p_vizszm;
pixelm=p_pixelm;

edd_ennyim=edd_ennyim+1;

if (edd_ennyim<summa_dbm){
 if (N4) {
		document[l_nevm].moveBy(vizszm*pixelm,0);
		document[l_nevm].moveBy(0,fuggom*pixelm);
}
  if (IE4) {
		document.all[l_nevm].style.posLeft=document.all[l_nevm].style.posLeft+vizszm*pixelm;
		document.all[l_nevm].style.posTop=document.all[l_nevm].style.posTop+fuggom*pixelm;
}
setTimeout ("layer_move_m (l_nevm,fuggom,vizszm,pixelm,edd_ennyim,summa_dbm)",1);
}
}

//***************************************************************************************

function layer_to_top (nev)
{

 if (N4) {
		document[_nev].pageX=_left;
		document[_nev].pageY=_top;
	 }
  if (IE4) {
		document.all[_nev].style.posLeft=_left;
		document.all[_nev].style.posTop=_top;
	    }

}
//***************************************************************************************

function gotulayer (p_nev,p_left,p_top)
{

_nev=p_nev;
_left=p_left;
_top=p_top;

 if (N4) {
		document[_nev].pageX=_left;
		document[_nev].pageY=_top;
	 }
  if (IE4) {
		document.all[_nev].style.posLeft=_left;
		document.all[_nev].style.posTop=_top;
	    }

}

//***************************************************************************************

function gotulayer2 (p_nev2,p_left2,p_top2)
{

_nev2=p_nev2;
_left2=p_left2;
_top2=p_top2;

 if (N4) {
		document[_nev2].pageX=_left2;
		document[_nev2].pageY=_top2;
	 }
  if (IE4) {
		document.all[_nev2].style.posLeft=_left2;
		document.all[_nev2].style.posTop=_top2;
	    }

}

//***************************************************************************************

function scroll(scptmb,s2,speed)
 {
 var sss=5;
 if (speed > 0 && speed <999) {sss=speed;}
 scptmb=status_load(scptmb);
 if (browser) 
   { 
     scrl_prm=parseInt(s2);
     if (s2=='1') {fel(sss);}
     if (s2=='2') {le(sss);} 
     if (s2=='3') {jobb(sss);}
     if (s2=='4') {bal(sss);} 
   }
  return scptmb;
  }
  
//***************************************************************************************

function noscroll()

{if (browser){scrl_prm=0;}}

//***************************************************************************************

 function bal(pb)
 {
	sebesseg=pb;
	if ((document.all["szoveg"].style.posLeft<0) && (scrl_prm==4) | (scrl_prm==44))
      {
	ujpoz=document.all["szoveg"].style.posLeft+sebesseg;
      document.all["szoveg"].style.posLeft=ujpoz;
      setTimeout("bal(sebesseg)",25);
      }
 }
//***************************************************************************************

 function jobb(pj)
 {
	sebesseg=pj;
	if ((document.all["szoveg"].style.posLeft>-(kep_szelesseg-670)) && (scrl_prm==3) | (scrl_prm==33))
      {
	ujpoz=document.all["szoveg"].style.posLeft-sebesseg;
      document.all["szoveg"].style.posLeft=ujpoz;
	setTimeout("jobb(sebesseg)",25);
      }
  }
//***************************************************************************************

  function fel(pf)
  {
	sebesseg=pf;
	if (IE4){
	subxx=document.all[sc_tmb[1]].style.posTop-sebesseg;
	if ((subxx>=-maxTop) && (scrl_prm==1) | (scrl_prm==11))
	{
	document.all[sc_tmb[1]].style.posTop=document.all[sc_tmb[1]].style.posTop-sebesseg;
	clip_move();
	setTimeout("fel(sebesseg)",25);
	}
	else
	{
		if (subxx<-maxTop)
		{
		document.all[sc_tmb[1]].style.posTop=-maxTop;
		clip_move();
		}
	}
	}	
	if (N4){
	if ((document.layers[sc_tmb[1]].top>maxTop) && (scrl_prm==1) | (scrl_prm==11))
	{
	document.layers[sc_tmb[1]].top=document.layers[sc_tmb[1]].top-sebesseg;
	clip_move(1);
      	setTimeout("fel(sebesseg)",25);
	}
	}
  }

//***************************************************************************************
function ruler_drag()
{
	if (ie4)
	{
	document.all[sc_tmb[1]].style.posTop=sc_tmb[0]-(document.all[sc_tmb[6]].style.posTop-tmb[10])/sc_tmb[2];
	curclip=sc_tmb[0]-document.all[sc_tmb[1]].style.posTop;
	document.all[sc_tmb[1]].style.clip="rect("+eval(curclip)+' '+eval(clipR)+' '+eval(curclip+clipMag)+' '+eval(clipL)+")";// T,R,B,L
	}
	if (n4)
	{
	document.layers[sc_tmb[1]].top=sc_tmb[0]-(document.layers[sc_tmb[6]].top-tmb[10])/sc_tmb[2];
	curclip=sc_tmb[0]-document.layers[sc_tmb[1]].top;
	document.layers[sc_tmb[1]].clip.top=curclip;
	document.layers[sc_tmb[1]].clip.bottom=curclip+clipMag;
	
//	rulpoz=document.layers[sc_tmb[6]].top-tmb[10];
//	curclip=sc_tmb[0]-document.layers[sc_tmb[1]].top;
//	document.layers[sc_tmb[1]].top=(-rulpoz)/sc_tmb[2];
	}
}

//***************************************************************************************
function clip_move(move_prm)
{
	if (ie4)
	{
	curclip=sc_tmb[0]-document.all[sc_tmb[1]].style.posTop;
	document.all[sc_tmb[1]].style.clip="rect("+eval(curclip)+' '+eval(clipR)+' '+eval(curclip+clipMag)+' '+eval(clipL)+")";// T,R,B,L
	clipT=curclip;	
	document.all[sc_tmb[6]].style.posTop=tmb[10]+clipT*sc_tmb[2];
	}
	if (n4)
	{
//	alert (tmb[10]);
	document.layers[sc_tmb[1]].clip.top=document.layers[sc_tmb[1]].clip.top+sebesseg*(move_prm);
	document.layers[sc_tmb[1]].clip.bottom=document.layers[sc_tmb[1]].clip.bottom+sebesseg*(move_prm);
	clipT=sc_tmb[0]-document.layers[sc_tmb[1]].top;
	document.layers[sc_tmb[6]].top=tmb[10]+clipT*sc_tmb[2];
	}
}

//***************************************************************************************

  function le(pl)
  {
	sebesseg=pl;
	if (IE4){
	subx=document.all[sc_tmb[1]].style.posTop+sebesseg;
	if (subx<=sc_tmb[0] && (scrl_prm==2) | (scrl_prm==22))
	{
	document.all[sc_tmb[1]].style.posTop=document.all[sc_tmb[1]].style.posTop+sebesseg;
	clip_move();
	setTimeout("le(sebesseg)",25);
	}
	else{
		if (subx>sc_tmb[0])
		{
		document.all[sc_tmb[1]].style.posTop=sc_tmb[0];
		clip_move();
		}
	}}
	if (N4){
	subx=document.layers[sc_tmb[1]].top+sebesseg;
	if ((subx<=sc_tmb[0]) && (scrl_prm==2) | (scrl_prm==22))
	{
	document.layers[sc_tmb[1]].top=document.layers[sc_tmb[1]].top+sebesseg;
	clip_move(-1);
	setTimeout("le(sebesseg)",25);
 	}
 	}
  }


//***************************************************************************************

function forumablak (_mit)
{
phpfile=_mit;
forum_abl=window.open(phpfile,"forumablak","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=500,fullscreen=0");
forum_abl.focus();
}

//***************************************************************************************

function kisablak (mit,_w,_h)
{
file=mit;
szelesseg=_w;
magassag=_h;
abl=window.open(file,"kisablak","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+szelesseg+",height="+magassag+",fullscreen=0");
abl.focus();
}

//***************************************************************************************

function kisablak2 (mit,_w,_h)
{
file=mit;
szelesseg=_w;
magassag=_h;
abl2=window.open(file,"kisablak2","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width="+szelesseg+",height="+magassag+",fullscreen=0");
abl2.focus();
}

//***************************************************************************************

function kepablak (mit,_w,_h)
{
file=mit;
szelesseg=_w;
magassag=_h;
kepabl=window.open(file,"kepablak","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+szelesseg+",height="+magassag+",fullscreen=0",innerWidth="+szelesseg+",innerHeight="+magassag+");
}

//***************************************************************************************

function mutasslayert(mitmuti,prm)
{
if (IE4){document.all[mitmuti].style.visibility=prm;}
if (N4){document[mitmuti].visibility=prm;}
}

