	NS4 = (document.layers) ? true : false;
	IE4 = (document.all && !document.getElementById) ? true : false;
	IE5 = (document.all && document.getElementById) ? true : false;
	NS6 = (!document.all && document.getElementById) ? true : false;
	FF1 = (!window.showModalDialog && document.getElementById) ? true : false;
	
	reklamidx = 0;
	
	var rtext = ["AMS (Service 2000)","Autosoft CRM","Blokkol&oacute;","AMS-W","AMS-WARRANTY"];
	var rkep = ["images\\banner1.jpg","images\\banner2.jpg","images\\banner3.jpg","images\\banner4.jpg","images\\banner5.jpg"];
	var timerID;

	function getObj(obj)
	{
	    if (document.all)
	    {
		    return document.all(obj);
		}
		else
		    if (document.getElementById)
		    {
		        return document.getElementById(obj);
		    }
	}
    
    function MyToggle(divid)
    {
        if (getObj(divid).style.visibility != "hidden")
        {
            getObj(divid).style.visibility = "hidden";
            getObj(divid).style.display = "none";
        }
        else
        {
            getObj(divid).style.visibility = "visible";
            getObj(divid).style.display = "block";
        }
    }


	function pic(obj,pic)
	{
		obj.src=pic;	
	}

// menu aktiv value='visible' nem aktiv value='hidden'
	function menu(id,value)
	{
	    if (IE4 || IE5 )
		    document.all(id).style.visibility=value;
	    else if (FF1 || NS6)
		    document.getElementById(id).style.visibility=value;
	}
	
// reklam valt
	function reklam()
	{
		if (IE4 || IE5 )
		{
			document.all('reklamtext').innerHTML=rtext[reklamidx];
			document.all('reklamkep').src=rkep[reklamidx];
		}
		else if (FF1 || NS6)
		{
			document.getElementById('reklamtext').innerHTML=rtext[reklamidx];
			document.getElementById('reklamkep').src=rkep[reklamidx];
		};
		reklamidx++;	
		if (reklamidx>4)
		    reklamidx=0;
		setTimeout("reklam()", 4000); 	
	}


//ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )) 
//ns4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 )) 

if (NS4) 
{
    layerRef="document.layers['"; 
    styleRef="";
}
else if (IE4)
{
    layerRef="document.all."; 
	styleRef=".style";
}
else 
{
    layerRef="document.getElementById('";
	styleRef=".style";
}

function timerCalque(calque,parent,idx) 
{
    if (timerID)
        clearTimeout(timerID);				
	timerID=setTimeout("afficheCalque('"+calque+"','"+parent+"')", 600);
}

function afficheCalque(calque,parent) 
{
    if (timerID)
        clearTimeout(timerID);				
	if (IE4 || IE5 )
	{
        o=document.all(parent).offsetParent;	
        left=o.offsetLeft+
            o.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft;
        document.all(calque).style.left=left;
  	}
	else if (FF1 || NS6)
	{
        o=document.getElementById(parent).offsetParent;	
        left=o.offsetLeft+
            o.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft+
            o.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft;
        document.getElementById(calque).style.left=left + "px";
  	};
    eval(layerRef + calque + (NS4?"']":IE4?"":"')") + styleRef + '.visibility = "visible"');
}

function cacheCalque(calque) 
	{
	 if (timerID)clearTimeout(timerID);				
	 eval(layerRef + calque + (NS4?"']":IE4?"":"')") + styleRef + '.visibility = "hidden"');
	}

  function rot13(input) {
var coding = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyzabcdefghijklm";
for (var text = '', i = 0; i < input.length; i++) {
var ch = input.charAt(i), pos = coding.indexOf(ch);
if (pos > -1)
ch = coding.charAt(pos + 13);
text += ch;
}
return text;
}

function unrot13(link) {
if (link.href.indexOf("mailto:") != 0)
link.href = rot13(link.href);
}

function CommentMove()
{
  var item;
  var w_x;
  
  if (navigator.appName == "Netscape")
  {
      w_x=window.innerWidth-5;
      item = eval('document.usrComment_pnlComment');
      item.moveTo((w_x - 800) /2 + 15, 214);
  }
  else
  {
      w_x=document.body.clientWidth;
      item = eval('document.all.usrComment_pnlComment.style');
      item.pixelLeft = (w_x - 800) /2 + 15;
      item.pixelTop = 214;
  }
}

function CommentShow()
{
  CommentMove();
  window.onresize=CommentMove;
  SetShow("usrComment_pnlComment");
  eval("document.MainForm.usrComment_txtComment.focus()");
}

function CommentHide()
{
  window.onresize=null;
  SetHide("usrComment_pnlComment");
}

function SetShow(id)
{
    eval(layerRef + id + (NS4?"']":IE4?"":"')") + styleRef + '.visibility = "visible"');
}

function SetHide(id)
{
    eval(layerRef + id + (NS4?"']":IE4?"":"')") + styleRef + '.visibility = "hidden"');
}

function ShowPicture(pic, p_width, p_height)
{   
    Dialog.info({url: 'GetPicture.aspx?Pic='+pic, options: {method: 'get'}}, {className: 'alert', width:p_width, height:p_height}); 
    WindowCloseKey.init();
}

function SendData()
{
    var oXHR = zXmlHttp.createRequest();
    if (oXHR.readyState != 0)
        oXHR.abort();
    oXHR.open('GET', 'SendReg.aspx?n1=' + encodeURIComponent(getObj('txtName1').value) + '&t1=' + encodeURIComponent(getObj('txtTel1').value) + '&e=' + encodeURIComponent(getObj('txtEmail').value) + '&n2=' + encodeURIComponent(getObj('txtName2').value) + '&c=' + encodeURIComponent(getObj('txtCeg').value) + '&t2=' + encodeURIComponent(getObj('txtTel2').value), false);
    oXHR.send(null);
}
