// JavaScript Document// JavaScript Document

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header


var hotDog, whichDog, whatDog, topDog, offsetx, offsety, nowX, nowY, ddEnabled, N4, isN4, isNN, isIE, isHot, N4x, N4y,dd;
isIE	=	false;
isNN	=	false;
isN4	=	false;
isHot	=	false;

if(browser == "Internet Explorer") {
	isIE	=	true;
}

if(browser == "Netscape Navigator") {
	isNN	=	true;
	if(version == "4") {
		isN4	=	true;
	}
}
a=1;

function ddInit(e){
	topDog=isIE ? "BODY" : "HTML";
	whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer"); 
	hotDog=isIE ? event.srcElement : e.target; 
	
	// IE scrollbar hack by nj
	// in IE on clicking the scrollbar, the hotDog value is NULL
	// what means that there is no DOM correspondence for scrollbar in IE ??!!
	if(hotDog.id == "") return;
	// by nj end

	while (hotDog.id != "titleBar" && hotDog.tagName!=topDog){
		hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
	}

	if (hotDog.id=="titleBar"){

		offsetx=isIE ? event.clientX : e.clientX;
		offsety=isIE ? event.clientY : e.clientY;
		nowX=parseInt(whichDog.style.left);
		nowY=parseInt(whichDog.style.top);
		ddEnabled=true;
		document.onmousemove=dd;
	}
}
function dd(e){
	if (!ddEnabled) return;
	// by nj hack for XHTML
	// 'px' needed after pixel value in positioning parameteres
	var njX	=	isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
	var njY =	isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
	whichDog.style.left	=	njX+'px';
	whichDog.style.top	=	njY+'px';
	// by nj end
	return false; 
}
function ddN4(whatDog){
	if (!isN4) return;
	N4	=	eval(whatDog);
	N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	N4.onmousedown		=	function(e){
		N4.captureEvents(Event.MOUSEMOVE);
		N4x=e.x;
		N4y=e.y;
	}
	N4.onmousemove		=	function(e){
		if (isHot){
			N4.moveBy(e.x-N4x,e.y-N4y);
			return false;
		}
	}
	N4.onmouseup=function(){
		N4.releaseEvents(Event.MOUSEMOVE);
	}
}

function hideMe(){
	if (isIE||isNN) whichDog.style.visibility	=	"hidden";
	else if (isN4) document.theLayer.visibility	=	"hide";
}
function showMe(){
	if (isIE||isNN) whichDog.style.visibility	=	"visible";
	else if (isN4) document.theLayer.visibility	=	"show";
}

function njOver() {
	isHot=true;
	if (isN4) ddN4(theLayer);
}

function njOut() {
	isHot=false;
}

function ddStop(e) {
//	alert(whichDog.style.left);
	ddEnabled=false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function InitValues() {
	var	myLayer	=		document.getElementById("theLayer");
	myLayer.style.visibility	=	"visible";

}

document.onmousedown=ddInit;
document.onmouseup=ddStop;

/*

msz

*/
function FocusWin() { clearTimeout(TimeoutID); xwin.focus(); xwin.parentwin=window; }
 
function openSubwin(wname,src,width,height) 
 {
     var wpars='status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,resizable=0,dependent=1,width='+width+',height='+height;
	var newwindow=window.open(src,wname,wpars);
	if (window.focus) {newwindow.focus()}
 } 
 
 
function openSubwinresize(wname,src,width,height) 
 {
     wpars='status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=1,resizable=1,dependent=1,width='+width+',height='+height;
	newwindow=window.open(src,wname,wpars);
	if (window.focus) {newwindow.focus()}
 } 
 
function openHelp(name,src,width,height) 
{
wpars='status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=0,resizable=0,dependent=1,width='+width+',height='+height;
newwindow=window.open(src,name,wpars);
if (window.focus) {newwindow.focus()}
}
 
 
function confirmation(szoveg) {
		 if (confirm(szoveg)) {return true;} else {return false;}
}

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_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 SetCookie (name, value) {
         var argv = SetCookie.arguments;
         var argc = SetCookie.arguments.length;
         var expires = (argc > 2) ? argv[2] : null;
         var path = (argc > 3) ? argv[3] : null;
         var domain = (argc > 4) ? argv[4] : null;
         var secure = (argc > 5) ? argv[5] : false;
         document.cookie = name + "=" + escape (value) +
         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
         ((path == null) ? "" : ("; path=" + path)) +
         ((domain == null) ? "" : ("; domain=" + domain)) +
         ((secure == true) ? "; secure" : "");
}
function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return unescape (document.cookie.substring(offset, endstr));
}
function GetCookie(name) {
   var arg = name+"=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }
   return null;
}


function checkemail(form) {
var str=form;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Az e-mail cím szintaktikailag hibás!")
testresults=false
}
return (testresults)
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  
  return '';
}
MM_preloadImages();

