var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function moveItUP(ijd,Mup,currPos) {
	if (Mup>0) {
	var Mdiv = document.getElementById(ijd); 
	var poss=Mdiv.offsetTop;
	if (poss>currPos) {
	speedchk=poss-currPos;
	if (speedchk>5) speed=1;
	if (speedchk>10) speed=2;
	if (speedchk>20) speed=3;
	if (speedchk>30) speed=5;
	if (speedchk>50) speed=10;
	if (speedchk>100) speed=30;
	if (speedchk>200) speed=50;
	if (speedchk>300) speed=100;
	Mup-=speed;
	poss-=speed;
	if (poss>currPos) {
	Mdiv.style.top=poss+"px";
	} else {
	Mdiv.style.top=currPos+"px";}
	} else {
	Mdiv.style.top=currPos+"px";		
	}
	}
}
	
function moveItDOWN(ijd,Mdwn,currPos) {
	if (Mdwn>0) {
	var Mdiv = document.getElementById(ijd); 
	var poss=Mdiv.offsetTop;
	if (poss<currPos) {
	speedchk=currPos-poss;
	if (speedchk>5) speed=1;
	if (speedchk>10) speed=2;
	if (speedchk>20) speed=3;
	if (speedchk>30) speed=5;
	if (speedchk>50) speed=10;
	if (speedchk>100) speed=30;
	if (speedchk>200) speed=50;
	if (speedchk>300) speed=100;
	Mdwn-=speed;
	poss+=speed;
	if (poss<currPos) {
	Mdiv.style.top=poss+"px";
	} else {
	Mdiv.style.top=currPos+"px";}
	} else {
	Mdiv.style.top=currPos+"px";		
	}
	}
}
	
function moveIt(ijd,z) {
var supported = (document.getElementById); 
if (!supported) return; 
var Mdiv = document.getElementById(ijd); 
var currPos=Mdiv.offsetTop;
var y=document.documentElement.scrollTop;
var dist=y-z;
//if (MVar!='true' && ijd!='MovingMenu') {
//	alert (Mdiv.offsetHeight);
//		alert (document.getElementById('left').offsetHeight);
if ((document.getElementById('Menucont').offsetHeight+10<document.getElementById('left').offsetHeight) && ijd=='MovingMenu') {
if (dist > 0) {
if (dist>currPos) {
Mdwn = dist-currPos;
moveItDOWN(ijd,Mdwn,dist);
} 
if (dist<currPos) {
Mup = currPos-dist;
moveItUP(ijd,Mup,dist);
}
} else {
ncurrPos=0;
Mup = ncurrPos+currPos;
moveItUP(ijd,Mup,ncurrPos);
}
//}
}
setTimeout("moveIt('" + ijd + "'," + z + ")",5); 
}

function movePic(x,xleft,xwidth,ntop) {
var supported = (document.getElementById); 
var Pdiv = document.getElementById('PGmove');
if (!supported) return; 
if (!x) {
x=0;
Pdiv.style.position='absolute';
x=Pdiv.offsetTop;
xleft=Pdiv.offsetLeft;
xwidth=Pdiv.offsetWidth;
PPdiv=Pdiv;
while (PPdiv = PPdiv.offsetParent) {
x += PPdiv.offsetTop;
}
//alert ("x"+x);
}
if (!ntop) {ntop=0;}
var y=document.documentElement.scrollTop;
var dist=x-y;
speed=1;
//alert(dist);
if (dist < 0) {
currPos = y-x;
speedchk=ntop+currPos;
if (speedchk>5) speed=1;
if (speedchk>10) speed=2;
if (speedchk>20) speed=3;
if (speedchk>30) speed=5;
if (speedchk>100) speed=30;
if (speedchk>200) speed=50;
curraPos = ntop+speed;
if (curraPos<currPos) currPos=curraPos;
} else {
currPos = 0;
speedchk=currPos+ntop;
if (speedchk>5) speed=1;
if (speedchk>10) speed=2;
if (speedchk>20) speed=3;
if (speedchk>30) speed=5;
if (speedchk>100) speed=30;
if (speedchk>200) speed=50;
curraPos = ntop-speed;
if (curraPos>currPos) currPos=curraPos;
}
Pdiv.style.top=currPos+5+"px";
Pdiv.style.left=xleft+"px";
Pdiv.style.width=xwidth+"px";
ntop=currPos;
setTimeout("movePic("+x+","+xleft+","+xwidth+","+ntop+")",5); 
}

function log_in() {
var log_user=document.getElementById('Log_usern').value;
var log_pass=document.getElementById('Log_passw').value;
var errormsg="";
if (log_user=="" || !log_user) errormsg+='kérem adja meg felhasználói nevét! \n';
if (log_pass=="" || !log_pass) errormsg+='kérem adja meg a jelszavát! \n';
if (errormsg!="") alert(errormsg); else document.getElementById('login_form').submit();
}