
var ua = navigator.userAgent.toLowerCase(); 
var isIE6 = ((ua.indexOf("msie 6.0") != -1) );
var isOPERA = ((ua.indexOf("opera") != -1) );
var isFF = ((ua.indexOf("firefox") != -1) );
var defaultsubmenu;

$(document).ready(function(){

inittoplinemenu();
inittopmenu();
Init();


});

//-----------------------------------------------
function Init()
{
if(isIE6)
	{
		
	$('.defbutton').bind("mouseenter",
  	function()
  		{	
  		$(this).css({backgroundColor: '#ed5219'});
  		}
    )
    
  $('.defbutton').bind("mouseleave",
  	function()
  		{	
  		$(this).css({backgroundColor: 'black'});
  		}
    )
		    
    
  $('.ualist .column .item').bind("mouseenter",
  	function()
  		{	
  		$(this).css({backgroundPosition: 'left -160px'});
  		}
    )
  $('.ualist .item').bind("mouseleave",
  	function() 
  		{	
  		$(this).css({backgroundPosition: ''});
  		}
    )
    
  $('.ualist .columnfullwidth .item').bind("mouseenter",
  	function() 
  		{	
  		$(this).css({backgroundPosition: 'left -140px'});
  		}
    )    
    
  var ualistobj=document.getElementById('ualistceg');
	if(ualistobj!=null)
    {
    var alltags=ualistobj.getElementsByTagName('div');
    for (i=0; i<alltags.length; i++)
  		{
  		if (alltags[i].className=='item')
  			 {
  			 alltags[i].onmouseover= function() { this.runtimeStyle.backgroundColor = '#f6f6f5'; }
			   alltags[i].onmouseout= function() { this.runtimeStyle.backgroundColor = 'white'; }
  			 }
  		}
    }
    
      		
	}
	

var allinput;
var alltextarea;
var inp_normalcolor='white'
var inp_hovercolor='#f6f6f5';


for (i=0; i<document.forms.length; i++)
		{
		allinput=document.forms[i].getElementsByTagName('input');
		alltextarea=document.forms[i].getElementsByTagName('textarea');
		allselect=document.forms[i].getElementsByTagName('select');
				
		for (j=0; j<allinput.length; j++)
		  {
      if (allinput[j].className=='txtinput')
  			 {
  			 /*allinput[j].onfocus= function() { this.style.backgroundColor = inp_hovercolor; }
  		   allinput[j].onblur = function() { this.style.backgroundColor = inp_normalcolor; }*/
  		   
  		   if (allinput[j].attachEvent) allinput[j].attachEvent('onfocus', InputStyleFocus )
  		   if (allinput[j].attachEvent) allinput[j].attachEvent('onblur', InputStyleBlur )
  		   
  		   if (allinput[j].addEventListener) allinput[j].addEventListener('focus', InputStyleFocus, false )
  		   if (allinput[j].addEventListener) allinput[j].addEventListener('blur', InputStyleBlur, false )  		   
  			 }
      }
      
    for (j=0; j<alltextarea.length; j++)
		  {
      if (alltextarea[j].className=='txtarea')
  			 {
  			 /*alltextarea[j].onfocus= function() { this.style.backgroundColor = inp_hovercolor; }
  		   alltextarea[j].onblur = function() { this.style.backgroundColor = inp_normalcolor; }*/
  		   
  		   if (alltextarea[j].attachEvent) alltextarea[j].attachEvent('onfocus', InputStyleFocus )
  		   if (alltextarea[j].attachEvent) alltextarea[j].attachEvent('onblur', InputStyleBlur )
  		   
  		   if (alltextarea[j].addEventListener) alltextarea[j].addEventListener('focus', InputStyleFocus, false )
  		   if (alltextarea[j].addEventListener) alltextarea[j].addEventListener('blur', InputStyleBlur, false )  
  			 }
      }
      
    for (j=0; j<allselect.length; j++)
		  {
      if (allselect[j].className=='select')
  			 {  		   
  		   if (allselect[j].attachEvent) allselect[j].attachEvent('onfocus', InputStyleFocus )
  		   if (allselect[j].attachEvent) allselect[j].attachEvent('onblur', InputStyleBlur )
  		   
  		   if (allselect[j].addEventListener) allselect[j].addEventListener('focus', InputStyleFocus, false )
  		   if (allselect[j].addEventListener) allselect[j].addEventListener('blur', InputStyleBlur, false )  
  			 }
      }
		
		
		}
  
	
}
function linkopen(url,blank)
{
if(blank==null) blank=false;

if(!blank)
	window.location.href=url;
else
	window.open(url);
}
//--------------------------------------
function DecWriteMail(decstring, linkname)
{
var buff='';

for(var i=0;i<decstring.length;i++)
	{
	if(i%2==0)
		buff+=decstring.charAt(i);		
	}
if(!linkname) linkname=	buff;
	
document.write('<a href="mailto:'+buff+'">'+linkname+'</a>');
}
//-----------------------------------------------
function InputStyleFocus()
{
if(window.event)
  var sender=window.event.srcElement;
else
  var sender=this;

var inp_hovercolor='#f6f6f5';

sender.style.backgroundColor = inp_hovercolor;
}
//-----------------------------------------------
function InputStyleBlur()
{
if(window.event)
  var sender=window.event.srcElement;
else
  var sender=this;
  
var inp_normalcolor='white'

sender.style.backgroundColor = inp_normalcolor;
}
//-----------------------------------------------
function inputclicks(formid)
{
var mainform=('#'+formid);

$(mainform).find('input[title]').bind('focus', function(event)
  {    
  var title=$(this).attr('title');  
  if( $(this).val() == title ) $(this).val('');
  });
  
$(mainform).find('input[title]').bind('blur', function(event)
  {    
  var title=$(this).attr('title');  
  if( $(this).val() == '' ) $(this).val(title) ;
  });  
  
}
//-----------------------------------------------
function debug(txt)
{
try {
	console.debug(txt);
	}
catch(e){}
}
//-----------------------------------------------
function InputBlur(inp,deftext)
{
if(inp.value=='')
inp.value=deftext;
}
//-----------------------------------------------
function InputFocus(inp,deftext)
{
if(inp.value==deftext)
inp.value='';
}
//-----------------------------------------------
function inittoplinemenu()
{
topmenulast=0;

$('#topline .menu > li').each(function(){
if( $(this).find('ul').length>0 )
  {
  $(this).children('a').addClass('icon');
  
  var parentliwidth=$(this).width()-4;  
  var ulwidth=$(this).find('ul').width();
  
  $(this).find('ul li').css('width', Math.max(parentliwidth, ulwidth)+'px');    
  }
});


$('#topline .menu > li').bind("mouseenter",
	function(event) 
		{
		var index= $('#topline .menu > li').index( $(this) );		
		var position=$(this).position();		
		var ulwidth=$(this).find('ul').width();
		var liwidth=$(this).width();
		
		
		if(topmenulast!=index)
		{
		$('#topline .menu ul').slideUp(50);	
    $('#topline .menu >li').removeClass('active'); 	
		}
		
		topmenulast=index;

		
		$(this).addClass('active');
		
		var ul=$('#topline .menu > li:eq('+index+')').find('ul');								
    $(ul).css('left', /*position.left*/ /*- (ulwidth-awidth)/2 + 10*/  '-1px');					  		  
		$(ul).slideDown(50);
    }
  );
  
$('#topline .menu').bind("mouseleave",
	function(event) 
		{
		$('#topline .menu >li ul').slideUp(50);	  
    $('#topline .menu >li').removeClass('active');      	
    }
  );
  

$('#topline .menu ul').css('visibility', 'visible');  
$('#topline .menu ul').css('display', 'none');
}
//-----------------------------------------------
function inittopmenu()
{
$(document).ready(function(){

if( $('#topmenu2').length>0 && !$.browser.mozilla && !$.browser.safari )
  {
  var settings = {
        tl: { radius: 4 },
        tr: { radius: 4 },
        bl: { radius: 0 },
        br: { radius: 0 },
        antiAlias: true,
        autoPad: true,
        validTags: ["a"]
    }
  $('#topmenu2 a').each(function(){ curvyCorners(settings, this ); } );
  }
  });

}
//-----------------------------------------------
function initsideinfobox()
{
$('#sideinfobox .tabs a').bind('mouseenter', function()
  {
  var index=$('#sideinfobox .tabs a').index(this);

  $('#sideinfobox .tabs a').removeClass('active');
  $(this).addClass('active');
  
  $('#sideinfobox .boxes .cbox').css('display', 'none');
  $('#sideinfobox .cbox2 .content').css('display', 'none');
  $('#sideinfobox .boxes .cbox').eq(index).css('display', 'block');
  });
  
$('#sideinfobox .cbox2').bind('mouseenter', function()
  {
  $('#sideinfobox .tabs a').removeClass('active');
  $('#sideinfobox .boxes .cbox').css('display', 'none');
  
  $('#sideinfobox .cbox2 .content').css('display', 'block');
  });
  
$('#sideinfobox .tabs a:eq(0)').trigger('mouseenter');

}
//-----------------------------------------------
function hirdscrollobj()
{
var mainelem=$('#kiemhird');
var bannercnt=$(mainelem).find('.item').length;
var timeloop=8000;
var timer;
var bannermove=false;
var act=0;
var obj=this;

init();

function init()
{
if(bannercnt<=1) return;

var lastitemobj =$(mainelem).find('.item:last').clone();
var firstitemobj=$(mainelem).find('.item:first').clone();

$(mainelem).find('.item:first').before( lastitemobj );
$(mainelem).find('.item:last').after( firstitemobj );

bannercnt=$(mainelem).find('.item').length;


$(mainelem).find('.wrapper').stop().scrollTo( $(mainelem).find('.wrapper .item:eq(1)'), 0);
act=1;

$(mainelem).find('.control a.left').click(function(event)
  {
  event.preventDefault();
  obj.bannerscroll(-1, false);
  });
  
$(mainelem).find('.control a.right').click(function(event)
  {
  event.preventDefault();
  obj.bannerscroll(1, false);
  });  
  

timer=setTimeout('hirdscroll.hirdscrollloop();',timeloop);
}

this.hirdscrollloop=function()
{
obj.bannerscroll(1 ,true);
}

this.bannerscroll=function(direction, auto)
{
if( bannermove ) return;

clearTimeout(timer);

var newpos=act+direction;

act=newpos;

bannermove=true;

$(mainelem).find('.wrapper').stop().scrollTo( $(mainelem).find('.wrapper .item:eq('+(newpos)+')'), 800,  
  {
	onAfter:function()
    {
    if(newpos==bannercnt-1)
      {
      act=1;
      $(mainelem).find('.wrapper').scrollTo( $(mainelem).find('.wrapper .item:eq(1)'), 0);     
      }
    else if(newpos==0)
      {
      act=bannercnt-2;
      $(mainelem).find('.wrapper').scrollTo( $(mainelem).find('.wrapper .item').eq(bannercnt-2), 0);                       
      }
     
    bannermove=false;
    }
  });
  
timer=setTimeout('hirdscroll.hirdscrollloop();', timeloop);
  
}


//END;
};
//-----------------------------------------------
function feedbackscrollobj()
{
var mainelem=$('.sidepanel.userfeedback');
var itemcnt=$(mainelem).find('.item').length;

var timeloop=5000;
var timer;
//var bannermove=false;
var act=0;
var obj=this;

init();

function init()
{
if(itemcnt<=1) return;


$(mainelem).find('.wrapper').stop().scrollTo( $(mainelem).find('.wrapper .item:eq(0)'), 0);
act=0;

$(mainelem).find('.control a.left').click(function(event)
  {
  event.preventDefault();
  obj.itemscroll(-1, false);
  });
  
$(mainelem).find('.control a.right').click(function(event)
  {
  event.preventDefault();
  obj.itemscroll(1, false);
  });  
  

timer=setTimeout('feedbackscroll.scrollloop();',timeloop);
}

this.scrollloop=function()
{
obj.itemscroll(1 ,true);
}

this.itemscroll=function(direction, auto)
{
//if( bannermove ) return;

clearTimeout(timer);

var newpos=act+direction;

if(newpos==itemcnt) newpos=0;
else if(newpos<0) newpos=itemcnt-1;

act=newpos;

//bannermove=true;

$(mainelem).find('.wrapper').stop().scrollTo( $(mainelem).find('.wrapper .item:eq('+(newpos)+')'), 0 );
  
timer=setTimeout('feedbackscroll.scrollloop();', timeloop);
  
}


//END;
};
//-----------------------------------------------
function browseualistObj(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;

$(mainform).find('#browseua_gallery .item').equalizeCols();

if(isIE6)
  {
  $(mainform).find('#browseua_gallery .item, #browseua_list .item').bind('mouseenter', function()
    {
    $(this).addClass('hover');
    } );
  $(mainform).find('#browseua_gallery .item, #browseua_list .item').bind('mouseleave', function()
    {
    $(this).removeClass('hover');
    } );
  }
  
$(mainform).find('a.viewselect').bind('click', function(event)
  {
  event.preventDefault();
  
  var rel=$(this).attr('rel');
  
  $(mainform).find('input[name=view]').val(rel);
  refreshlist();
  });
  
$(mainform).find('select[name=uadb]').bind('change', function(event) 
  {
  var val=$(this).val();
  
  $(mainform).find('select[name=uadb]').val(val);
  
  refreshlist();
  });
  
  
$(mainform).find('.navpage a[rel]').bind('click', function(event)
  {
  event.preventDefault();
  
  var rel=$(this).attr('rel');
  
  $(mainform).find('input[name=page_2nd]').val(rel);
  refreshlist();
  });
  
$(mainform).find('.navpage .defbutton').bind('click', function(event)
  {
  refreshlist();
  });  
  
$(mainform).find('.searchbox .defbutton').bind('click', function(event)
  {
  refreshlist();
  }); 
  
  
$(mainform).find('.searchbox input[type=text]').bind('keyup', function(event)
  {
  $('#searchfrm input[name=srch]').val( $(this).val() );
  }); 
  
$(mainform).find('.searchbox input[type=text]').bind('keypress', function(event)
  {  
  if(EnterKey(event))
    {
    event.preventDefault();
    refreshlist();
    }
  });     
  

  
$(mainform).find('a.noteadd[rel]').bind('click', function(event)
  {
  event.preventDefault();  
  var rel=$(this).attr('rel');
  notelink=this;
  
    $.ajax({
     type: "POST",
     url: 'ajaxindex.php',
     data: {f : 1, s : 20, uaid : rel, whr : 1 },
     dataType: "html",
     success: function(result) 
   	   {
       eval(result);
   	   }
   	  });
  

  });
  
  
inputclicks(formid);
  
  
function refreshlist()
  {
  $(mainform)[0].scrollIntoView(true); 
  
  $.ajax({
     type: "POST",
     url: action,
     data: ( $(mainform).serialize() ),
     dataType: "html",
     success: function(result) 
	 	   {
	 	   //$(mainform).html(result);
	 	   $(mainform).replaceWith(result);
	 	   obj_browseualist= new browseualistObj('browseua');
	 	   }
	 	  });
  }
  

}
//-----------------------------------------------
function mainualistObj(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;

$(mainform).find('#maintabs a').bind('click', function(event)
  {
  event.preventDefault();
  
  var rel=$(this).attr('rel');
  
  $(mainform).find('input[name=ms]').val(rel);
  refreshlist();
  });
  
$(mainform).find('.filter .rght a').bind('click', function(event)
  {
  event.preventDefault();
  
  var rel=$(this).attr('rel');
  
  $(mainform).find('input[name=order]').val(rel);
  refreshlist();
  });  
  
  
function refreshlist()
  {
  $.ajax({
     type: "POST",
     url: action,
     data: ( $(mainform).serialize() ),
     dataType: "html",
     success: function(result) 
	 	   {
	 	   //$(mainform).html(result);
	 	   $(mainform).replaceWith(result);
	 	   obj_mainualistObj=new mainualistObj('mainualist');
	 	   }
	 	  });
  }



//--End--
};

//-----------------------------------------------
/*function InitTopMenu()
{
var topmenuobj=document.getElementById('topmenu2');
var anchortags=topmenuobj.getElementsByTagName('a');
defaultmenulink=0;

for (i=0; i<anchortags.length; i++)
	{				
	anchortags[i].onmouseover= function() { MenuShow(this,1);  }
 	anchortags[i].onmouseout= function()  { MenuShow(this,0);  }
 	
 	if(anchortags[i].className=='active')
 	  {
 	  defaultmenulink=anchortags[i];
 	  anchortags[i].Show=1;
 	  }
 	else anchortags[i].Show=0;
	}

var topsubmenuobj=document.getElementById('topsubmenu');
var divtags=topsubmenuobj.getElementsByTagName('div');

for (i=0; i<divtags.length; i++)
	{				
	divtags[i].onmouseover= function() { MenuShow(this,1);  }
 	divtags[i].onmouseout= function()  { MenuShow(this,0);  }
 	
 	if(divtags[i].style.display=='block')
 	  {
 	  defaultsubmenu=divtags[i];
 	  divtags[i].Show=1;
 	  }
 	else divtags[i].Show=0;
	}

}*/
/*
//-----------------------------------------------
function MenuShow(sender,open)
{
if(sender.tagName=='A') asender=true; else asender=false;

if(asender)
  {
  var rel=sender.rel;
  if(!rel) return;
  var target=document.getElementById(rel);
  }
else var target=sender;

if(!target) return;

if(open==1)
	{
	if(asender)
	 {
	  HideAllSubmenu();
	   
	 sender.Show=1;	
	 
	 if(sender!=defaultmenulink)
	   sender.className='hvr';
	 }
	else
	 ShowLink(sender.id,1);
	 	 
	target.Show=1;
	target.style.display='block';		
	}
else
  {
  if(asender)
   sender.Show=0;
  else ShowLink(sender.id,0);
  
  target.Show=0;
     
  setTimeout("delayHideSubmenu()",3000);
  }
}
//-------------------------------------------------------------------- 
function ShowDefaultMenu()
{
//alert(defaultmenulink);
if(defaultmenulink)
  defaultmenulink.className='active';
  
if(defaultsubmenu)
defaultsubmenu.style.display='block'
}
//--------------------------------------------------------------------  
function ShowLink(rel,open) 
{ 
var topmenuobj=document.getElementById('topmenu2');
var anchortags=topmenuobj.getElementsByTagName('a');

for (i=0; i<anchortags.length; i++)
	{				
	if(anchortags[i].rel==rel)
		anchortags[i].Show=open;    
	}
}
//-----------------------------------------------
function delayHideSubmenu()
{
var topmenuobj=document.getElementById('topmenu2');
var anchortags=topmenuobj.getElementsByTagName('a');
var cnt=0;

for (i=0; i<anchortags.length; i++)
	{				
	if(anchortags[i].Show==0)
    {	  
    if(anchortags[i]!=defaultmenulink)
		  anchortags[i].className='';		
		//document.getElementById(anchortags[i].rel).style.display='none';				
		}
	else cnt++;
	}
	

var topsubmenuobj=document.getElementById('topsubmenu');
var divtags=topsubmenuobj.getElementsByTagName('div');

for (i=0; i<divtags.length; i++)
	{		
	if(divtags[i].Show==0)
    {	  	
		divtags[i].style.display='none';				
		}
	else cnt++;	
	}
	
//alert(cnt);
if(cnt==0)
ShowDefaultMenu();
}
//-----------------------------------------------
function HideAllSubmenu()
{
var topsubmenuobj=document.getElementById('topsubmenu');
var divtags=topsubmenuobj.getElementsByTagName('div');

for (i=0; i<divtags.length; i++)
	{		  	
	divtags[i].style.display='none';						
	}
}
*/
//------------------------------------------------------------
/*function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) 
{ 
//Generic Animation Step Value Generator By www.hesido.com 
var delta = maxValue - minValue; 
var stepp = minValue+(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
return Math.ceil(stepp) 
} */
//-----------------------------------------------
/*function InitBanner()
{
if(bannercnt<=1) return;

var lastitemobj =$('#latestuas > div:last').clone();
var firstitemobj=$('#latestuas > div:first').clone();

$('#latestuas > div:first').before( lastitemobj );
$('#latestuas > div:last').after( firstitemobj );

$('#latestuas').stop().scrollTo($('#latestuas > div:eq(1)'), 0);
counter=0;
bannermove=false;
}
//-----------------------------------------------
function BannerScroll(id,direction,auto)
{
if(bannermove) return;

if(!auto)
counter=0;

var max=bannercnt+2;

var newpos=actualbanner+direction;
actualbanner=newpos;

bannermove=true;

$('#latestuas').stop().scrollTo($('#latestuas > div:eq('+(newpos-1)+')'), 800,  
  {
	onAfter:function()
    {     
    if(actualbanner==max)
      {
      actualbanner=2;
      $('#latestuas').scrollTo($('#latestuas > div:eq(1)'), 0);      
      }
    else if(actualbanner==1)
      {
      actualbanner=max-1; 
      $('#latestuas').scrollTo($('#latestuas > div:eq('+(max-2)+')'), 0);                  
      }
    var titleidx=actualbanner-1;
    $('#pagecnt').html( titleidx+'/'+bannercnt);
    $('#pagecim').html( '<a href="'+bannerhref[titleidx]+'" target="_blank">'+bannercimek[titleidx]+'</a>' );
    
    bannermove=false;        
    }
  });

}
//------------------------------------------------------------
function AutoLoop()
{
if(bannercnt<=1) return;
timer1=setTimeout("AutoLoop()",8000);

if(counter>0)	BannerScroll('latestuas',1,true);
counter++;
}	*/
//-----------------------------------------------
function InitHird()
{
var hirdboxheight=hird_rowheight*hird_itemcnt;

$('#kiemhird .wrapper2').css('height', hirdboxheight+'px');
$('#kiemhird #kiemcontainer').css('height', hirdboxheight+'px');
$('#kiemhird .navbar').css('height', hirdboxheight+'px');
$('#kiemhird .navbar a.downimg').css('margin-top', hirdboxheight-70+'px');

$('#cegualistscroll').css('height', hirdboxheight+'px');
$('#cegualistscroll #kiemcontainer').css('height', hirdboxheight+'px');
$('#cegualistscroll .navbar').css('height', hirdboxheight+'px');
$('#cegualistscroll .navbar a.downimg').css('margin-top', hirdboxheight-70+'px');

if(hirdcnt<=hird_itemcnt) return;

var lastitemobj=$('#kiemcontainer > div:last').clone();
var allitemobj=$('#kiemcontainer > div').clone();


$('#kiemcontainer > div:first').before( lastitemobj );
$('#kiemcontainer > div:last').after( allitemobj );

$('#kiemcontainer').stop().scrollTo($('#kiemcontainer > div:eq(1)'), 0);
counterhird=0;
}
//-----------------------------------------------
function HirdScroll(direction,auto)
{
if(!auto)
counterhird=0;

var max=1+hird_itemcnt+hirdcnt-hird_itemcnt+1;

var newpos=actualhird+direction;
actualhird=newpos;

$('#kiemcontainer').stop().scrollTo($('#kiemcontainer > div:eq('+(newpos-1)+')'), 800,  
  {
	onAfter:function()
    {        
    if(actualhird==max)
      {
      actualhird=2;
      $('#kiemcontainer').scrollTo($('#kiemcontainer > div:eq(1)'), 0);      
      }
    else if(actualhird==1)
      { 
      actualhird=max-1; 
      $('#kiemcontainer').scrollTo($('#kiemcontainer > div:eq('+(max-2)+')'), 0);       
      }
    }
  });

}
//------------------------------------------------------------
function AutoLoopHird()
{
if(hirdcnt<=hird_itemcnt) return;

timer2=setTimeout("AutoLoopHird()",8000);

if(counterhird>0)	HirdScroll(1,true);
counterhird++;
}
//------------------------------------------------------------
function CateglistShowHide()
{
var target=document.getElementById('categlistwrapper');
var targetimg=document.getElementById('categplmin');
var targettitle=document.getElementById('categtitle');

var imgsrcpl='plusprev.gif';
var imgsrcmin='minusprev.gif';

if(targetimg.src.indexOf(imgsrcmin)!=-1)
  {
  target.style.display='none';
  targetimg.src='data/img/'+imgsrcpl;
  targettitle.innerHTML='Kinyit';
  }
else
  {
  target.style.display='block';
  targetimg.src='data/img/'+imgsrcmin;
  targettitle.innerHTML='Bezár';
  }
}
//------------------------------------------------------------
function HistoryShowHide()
{
var target=document.getElementById('historywrapper');
var targetimg=document.getElementById('historyplmin');
var targettitle=document.getElementById('historytitle');

var imgsrcpl='plusprev.gif';
var imgsrcmin='minusprev.gif';

if(targetimg.src.indexOf(imgsrcmin)!=-1)
  {
  target.style.display='none';
  targetimg.src='data/img/'+imgsrcpl;
  targettitle.innerHTML='Kinyit';
  }
else
  {
  target.style.display='block';
  targetimg.src='data/img/'+imgsrcmin;
  targettitle.innerHTML='Bezár';
  }
}
//-----------------------------------------------
function textCounter( field, maxlimit ) 
{
var m=maxlimit-field.value.length;
if(m<0)   m=0
  
field.form.marad.value=m;
  
if ( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit );
    alert( 'A szöveg maximum '+maxlimit+' karakter lehet.');
    field.form.marad.value=maxlimit-field.value.length;
    return false;
  }
}
//-----------------------------------------------
function checkUncheckAll(theElement) 
{
var theForm = theElement.form; 	
for (var i = 0; i < theForm.elements.length; i++) 
	{
    var e = theForm.elements[i];
    if ((e.name != 'checkall') && (e.type == 'checkbox')) 
		{
		e.checked = theElement.checked;
		}
	}
}
//-----------------------------------------------
function SendQuickMsg(msgform)
{
var msgformobj=document.getElementById(msgform);
var errobj1=document.getElementById('error_subject');
var errobj2=document.getElementById('error_msgtext');

var errornumber=0;

errobj1.style.display='none';
errobj2.style.display='none';

if(msgformobj['targy'].value=='')
	{
	errornumber++;
			
	errobj1.innerHTML=regmsg_subject[0];
	errobj1.style.display='block';
	}
if(msgformobj['uztext'].value=='')
	{
	errornumber++;
			
	errobj2.innerHTML=regmsg_text[0];
	errobj2.style.display='block';
	}
else if(msgformobj['uztext'].value.length<20)
	{
	errornumber++;
			
	errobj2.innerHTML=regmsg_text[1];
	errobj2.style.display='block';
	}
	
if(errornumber>0) return false;

var buttonobj=document.getElementById('button_msgsend');
var loaderobj=document.getElementById('loader_msgsend');

buttonobj.style.display='none';
loaderobj.style.display='block';


for (var i=0;i<msgformobj.length;i++)
  {  
  getval=GetFormElementValue(msgformobj.elements[i]);
  
  if(getval!=null)
    ajax_quickmsg.setVar(msgformobj.elements[i].name, getval );  
  }
  
ajax_quickmsg.setVar('f', 1 );
ajax_quickmsg.setVar('s', 12 );
 
ajax_quickmsg.requestFile = "ajaxindex.php";
ajax_quickmsg.onCompletion = SendCompleted; 
ajax_quickmsg.runAJAX();

}
//-----------------------------------------------
function SendCompleted()
{
var msgobj=document.getElementById('msgsendform');
eval(ajax_quickmsg.response);
msgobj.innerHTML='<strong>'+msg+'</strong>';
}
//-----------------------------------------------
function GetFormElementValue(formelement)
{
if(!formelement.name) return null;

var tagname=formelement.tagName.toLowerCase();
var inputtype=formelement.getAttribute('type');

if(inputtype=='radio')
  {
  if(formelement.checked) return formelement.value;
  else return null;
  }
if(inputtype=='checkbox')
  {
  if(formelement.checked) return formelement.value;
  else return null;
  }

else
  {
  return formelement.value;
  }

}
//-----------------------------------------------
function RefreshUaMainlist(page, view)
{
var filterform=document.getElementById('filter');
var listform=document.getElementById('mainlist');
var loader=document.getElementById('ualistloader');
var getval;


ajax_mainlist.reset();


for (var i=0;i<filterform.length;i++)
  {        
  getval=GetFormElementValue(filterform.elements[i]);
    
  if(getval!=null)
    ajax_mainlist.setVar(filterform.elements[i].name, getval );      
  }

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_mainlist.setVar(listform.elements[i].name, getval );      
  }
  
if(page) ajax_mainlist.setVar('page', page ); 
  
ajax_mainlist.setVar('f', 1 );
ajax_mainlist.setVar('s', 1 );

if(view)
ajax_mainlist.setVar('view', view );

document.getElementById('mainlist').scrollIntoView(true); 

//ajax_mainlist.setVar('out', 'xml' );

  
ajax_mainlist.requestFile = "ajaxindex.php";
ajax_mainlist.element='mainlist';
ajax_mainlist.onCompletion = RefreshUaMainlistCompleted; 

loader.style.display='block';
ajax_mainlist.runAJAX();  
}
//-----------------------------------------------
function RefreshUaMainlistCompleted()
{
var loader=document.getElementById('ualistloader');

loader.style.display='none';
Init();
}
//-----------------------------------------------
function ChangeKtype(kt)
{
var filterform=document.getElementById('filter');
var ktobj=filterform['kt'];

ktobj.selectedIndex=kt;

RefreshUaMainlist(1);
}
//-----------------------------------------------
function GotoPage()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshUaMainlist(page);
}
//-----------------------------------------------
function OpenTab(tabpage)
{
ajax_opentab.reset();

ajax_opentab.setVar('f', 1 );
ajax_opentab.setVar('s', 2 );
ajax_opentab.setVar('tabpage', tabpage );
ajax_opentab.setVar('cid', document.getElementById('cid').value );

var login_redir=document.getElementById('login_redir');
if(login_redir)
ajax_opentab.setVar('redir', login_redir.value+'&tabpage='+tabpage );

ajax_opentab.requestFile = "ajaxindex.php";
ajax_opentab.element='cegdatpanel';

ajax_opentab.runAJAX(); 
}
//-----------------------------------------------
function RefreshUaCeglist(page, view)
{
var listform=document.getElementById('submainlist');
var loader=document.getElementById('ualistloader');
var getval;

ajax_mainlist.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_mainlist.setVar(listform.elements[i].name, getval );  
    
  }
  
if(page) ajax_mainlist.setVar('page', page ); 
  
ajax_mainlist.setVar('f', 1 );
ajax_mainlist.setVar('s', 3 );

if(view)
ajax_mainlist.setVar('view', view );

document.getElementById('submainlist').scrollIntoView(true); 
  
ajax_mainlist.requestFile = "ajaxindex.php";
ajax_mainlist.element='submainlist';
ajax_mainlist.onCompletion = RefreshUaCeglistCompleted; 

loader.style.display='block';

ajax_mainlist.runAJAX();  
}
//-----------------------------------------------
function RefreshUaCeglistCompleted()
{
var loader=document.getElementById('ualistloader');

loader.style.display='none';
Init();
}
//-----------------------------------------------
function GotoPageCeglist()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshUaCeglist(page);
}
//-----------------------------------------------
function EnterKey(e)
{
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;

if(code==13) return true;
return false;
}
//-----------------------------------------------
function Login()
{
var loginform=document.getElementById('login');
var errorobj=document.getElementById('error_login');
var loaderobj=document.getElementById('loader_login');
var buttonobj=document.getElementById('button_login');

errorobj.style.display='none';

var emailval=loginform['email'].value;
var passval=loginform['pass'].value;

if(emailval=='' || passval=='')
  {
  errorobj.innerHTML=login_errors[0];
  errorobj.style.display='block';
  return;
  }
  
if (!emailval.match(/^[a-z0-9_\.\-]+@[a-z0-9\.\-]+\.[a-z]{2,4}$/i))
    {
    errorobj.innerHTML=login_errors[1];
    errorobj.style.display='block';
    return;
    }
  
buttonobj.style.display='none';
loaderobj.style.display='block';

var getval;

ajax_login.reset();

for (var i=0;i<loginform.length;i++)
  {        
  getval=GetFormElementValue(loginform.elements[i]);
    
  if(getval!=null)
    ajax_login.setVar(loginform.elements[i].name, getval );      
  }
  
ajax_login.requestFile = "includes/loginfunc.php";
ajax_login.onCompletion = LoginResponse; 
ajax_login.runAJAX(); 
}
//-----------------------------------------------
function LoginResponse()
{
var loginform=document.getElementById('login');
var errorobj=document.getElementById('error_login');
var loaderobj=document.getElementById('loader_login');
var buttonobj=document.getElementById('button_login');

loaderobj.style.display='none';
buttonobj.style.display='block';

eval(ajax_login.response);
}
//-----------------------------------------------
function Lostpass()
{
var lostpassform=document.getElementById('lostpass');
var errorobj=document.getElementById('error_lostpass');
var loaderobj=document.getElementById('loader_lostpass');
var buttonobj=document.getElementById('button_lostpass');

errorobj.style.display='none';

var emailval=lostpassform['email'].value;

if(emailval=='')
  {
  errorobj.innerHTML=lostpass_errors[0];
  errorobj.style.display='block';
  return;
  }
  
if (!emailval.match(/^[a-z0-9_\.\-]+@[a-z0-9\.\-]+\.[a-z]{2,4}$/i))
    {
    errorobj.innerHTML=lostpass_errors[1];
    errorobj.style.display='block';
    return;
    }
  
buttonobj.style.display='none';
loaderobj.style.display='block';

var getval;

ajax_lostpass.reset();

for (var i=0;i<lostpassform.length;i++)
  {        
  getval=GetFormElementValue(lostpassform.elements[i]);
    
  if(getval!=null)
    ajax_lostpass.setVar(lostpassform.elements[i].name, getval );      
  }
  
ajax_lostpass.requestFile = "lostpassfunc.php";
ajax_lostpass.onCompletion = LostpassResponse; 
ajax_lostpass.runAJAX(); 
}
//-----------------------------------------------
function LostpassResponse()
{
var lostpassform=document.getElementById('lostpass');
var errorobj=document.getElementById('error_lostpass');
var loaderobj=document.getElementById('loader_lostpass');
var buttonobj=document.getElementById('button_lostpass');

loaderobj.style.display='none';
buttonobj.style.display='block';

eval(ajax_lostpass.response);
}
//-----------------------------------------------
function RefreshUaOfficelist(page, order, option, uaid)
{
var listform=document.getElementById('uaofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
if(uaid)
  {
  ajax_office.setVar('uaid', uaid );
  }
  

  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 9 );

//ajax_mainlist.setVar('out', 'xml' );

  
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='uaofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPageUaOfficelist()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshUaOfficelist(page);
}
//-----------------------------------------------
function UaDelSelected()
{
if( confirm(confirm_del) )
  RefreshUaOfficelist(null,null,'del');
}
//-----------------------------------------------
function UaRepostSelected()
{
if( confirm(confirm_repost) )
  RefreshUaOfficelist(null,null,'repost');
}
//-----------------------------------------------
function UaRepost(uaid)
{
if( confirm(confirm_repost2) )
  RefreshUaOfficelist(null,null,'repost',uaid);
}
//-----------------------------------------------
function RefreshMsgList(page, order, option)
{
var listform=document.getElementById('msgofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 11 );

//ajax_mainlist.setVar('out', 'xml' );

  
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='msgofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPageMsgList()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshMsgList(page);
}
//-----------------------------------------------
function MsgDelSelected()
{
if( confirm(confirm_del) )
  RefreshMsgList(null,null,'del');
}
//-----------------------------------------------
function MsgDel(msgid,type)
{
if( confirm(confirm_del) )
  linkopen('index.php?f=3&s=13&msgid='+msgid+'&type='+type+'&option=del');
}
//-----------------------------------------------
function MsgRecoverSelected()
{
if( confirm(confirm_recover) )
  RefreshMsgList(null,null,'recover');
}
//-----------------------------------------------
function RefreshPartnerList(page, order, option)
{
var listform=document.getElementById('partnerofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 13 );

//ajax_mainlist.setVar('out', 'xml' );

  
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='partnerofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPagePartnerList()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshPartnerList(page);
}
//-----------------------------------------------
function PartnerDel()
{
if( confirm(confirm_del) )
  RefreshPartnerList(null,null,'del');
}
//-----------------------------------------------
function AddToPartners(userid,sender)
{
ajax_office.reset();

ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 14 );
ajax_office.setVar('cid', userid );

ajax_office.requestFile = "ajaxindex.php";
ajax_office.element=sender.parentNode.id;
ajax_office.runAJAX();  
}
//-----------------------------------------------
function TabboxOpen(tabid)
{
for(var i=1;i<4;i++)
  {
  var target=document.getElementById('tbc'+i);
  var target2=document.getElementById('tabblink'+i);
  
  if(i==tabid)
    { 
    target.style.display='block';
    target2.className='active';
    }
  else
    { 
    target.style.display='none';
    target2.className='';
    }
  }
  
var closelabel=document.getElementById('closelabel');
if(tabid==0) closelabel.style.display='none';
else closelabel.style.display='block';
  
}
//-----------------------------------------------
function Sideselect(sp)
{
ajax_sideselectpanel.reset();

ajax_sideselectpanel.setVar('f', 1 );
ajax_sideselectpanel.setVar('s', 17 );
ajax_sideselectpanel.setVar('sp', sp );

ajax_sideselectpanel.requestFile = "ajaxindex.php";
ajax_sideselectpanel.element='sspcontainer';
ajax_sideselectpanel.runAJAX(); 
}
//-----------------------------------------------
function Mainlistselect(ms)
{
ajax_mainlist.reset();

ajax_mainlist.setVar('f', 1 );
ajax_mainlist.setVar('s', 18 );
ajax_mainlist.setVar('ms', ms );

ajax_mainlist.requestFile = "ajaxindex.php";
ajax_mainlist.element='mainlist';
ajax_mainlist.runAJAX(); 
}
//-----------------------------------------------
function MainlistExportselect(ms)
{
ajax_mainlist.reset();

ajax_mainlist.setVar('f', 1 );
ajax_mainlist.setVar('s', 34 );
ajax_mainlist.setVar('ms', ms );

ajax_mainlist.requestFile = "ajaxindex.php";
ajax_mainlist.element='mainlist_export';
ajax_mainlist.runAJAX(); 
}

//-----------------------------------------------
function RefreshNotesOfficelist(page, order, option, noteid)
{
var listform=document.getElementById('notesofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
if(noteid)
  {
  ajax_office.setVar('noteid', noteid );
  }
  

  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 19 );

//ajax_mainlist.setVar('out', 'xml' );

  
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='notesofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPageNotesOfficelist()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshNotesOfficelist(page);
}
//-----------------------------------------------
function NoteDelSelected()
{
if( confirm(confirm_del) )
  RefreshNotesOfficelist(null,null,'del');
}
//-----------------------------------------------
function AddNote(uaid, whr)
{
if(whr==null) whr=0;

ajax_office.reset();

ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 20 );

ajax_office.setVar('whr', whr );

ajax_office.setVar('uaid', uaid );

ajax_office.requestFile = "ajaxindex.php";
ajax_office.onCompletion = AddNoteCompleted; 
ajax_office.runAJAX(); 
}
//-----------------------------------------------
function AddNoteCompleted()
{
eval(ajax_office.response);

//if(notelink) notelink.innerHTML='';
}
//-----------------------------------------------
function OpenTestimonial(tid)
{
ajax_testimonial.reset();

ajax_testimonial.setVar('f', 1 );
ajax_testimonial.setVar('s', 21 );

ajax_testimonial.setVar('tid', tid );

ajax_testimonial.requestFile = "ajaxindex.php";
ajax_testimonial.element='testimonialdetail';
ajax_testimonial.runAJAX(); 
}
//-----------------------------------------------
function InitOfficeBanner()
{
$('#welcomebox').stop().scrollTo($('#welcomebox > div:eq(1)'), 0);
officebannerloopcnt=0;
AutoLoopOfficeBanner();
}
//-----------------------------------------------
function AutoLoopOfficeBanner()
{
officebannerloopcnt++;
timer1=setTimeout("AutoLoopOfficeBanner()",8000);
if(officebannerloopcnt<=1) return;
OfficeBannerScroll(1, true);
}
//-----------------------------------------------
function OfficeBannerScroll(direction, auto)
{
if(!auto)
officebannerloopcnt=0;

var max=$('#welcomebox .item').length;

var newpos=office_banner_act+direction;

office_banner_act=newpos;

var titleidx=newpos-2;
if(newpos==max) titleidx=0;
else if(newpos==1) titleidx=max-3;

$('#bannertitle').html(office_banner_titles[titleidx]);


$('#welcomebox').stop().scrollTo($('#welcomebox > div:eq('+(newpos-1)+')'), 800,  
  {
	onAfter:function()
    {        
    if(office_banner_act==max)
      {
      office_banner_act=2;
      $('#welcomebox').scrollTo($('#welcomebox > div:eq(1)'), 0);      
      }
    else if(office_banner_act==1)
      { 
      office_banner_act=max-1; 
      $('#welcomebox').scrollTo($('#welcomebox > div:eq('+(max-2)+')'), 0);       
      }
    }
  });
  
}
//-----------------------------------------------
function OpenInfo(pid, scrollto)
{
if(!scrollto) scrollto='office_passinfohead';
document.getElementById(scrollto).scrollIntoView(true); 

var pheight=$('#office_passinfo #passinfoitem'+pid).height();

$('#office_passinfo').css('height', pheight+'px');

office_info_actpage=pid;
$('#office_passinfo').scrollTo($('#office_passinfo #passinfoitem'+pid), 800);

$('#passmenu a').removeClass();
$('#passmenu a:eq('+(pid-1)+')').addClass('active');

}
//-----------------------------------------------
function OpenInfoArrow(direction, scrollto)
{
var newpage=office_info_actpage+direction;
var lngth=$('#office_passinfo .item').length;

if(newpage<1) newpage=lngth;
else if(newpage>lngth) newpage=1;

OpenInfo(newpage, scrollto);
}
//-----------------------------------------------
function RefreshTradealertList(page, order, option)
{
var listform=document.getElementById('tradealaertofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 23 );

//ajax_mainlist.setVar('out', 'xml' );

ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='tradealaertofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPageTradealertList()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshTradealertList(page);
}
//-----------------------------------------------
function TradealertDelSelected()
{
if( confirm(confirm_del) )
  RefreshTradealertList(null,null,'del');
}
//-----------------------------------------------
function Quicktradealert()
{
chkform=document.getElementById('tradealaertbanner');
var errs=0;

var loaderobj=document.getElementById('loader_dataform');
var msgobj=document.getElementById('resultmsg_dataform');

if(chkform.logged.value!=1)
  {
  errs++;
  msgobj.innerHTML=errormsg_tradealert[0];
  msgobj.style.display='block';
  
  var srch=chkform.kulcs.value;
  if(srch==tradealerrtdef) srch='';
  
  linkopen('index.php?f=2&s=5&redir=index.php%3Ff=3%26s=17%26srch='+srch);
  return;
  }
if(chkform.kulcs.value=='' || chkform.kulcs.value==tradealerrtdef)
  {
  errs++;
  msgobj.innerHTML=errormsg_tradealert[1];
  msgobj.style.display='block';
  return;
  }
if(chkform.kulcs.value.length<3)
    {
    errs++;
    msgobj.innerHTML=errormsg_tradealert[2];
    msgobj.style.display='block';
    return;
    }
    
if(!chkform.kulcs.value.match(/^[0-9a-zA-Zöüóőúáéűí][0-9a-zA-Zöüóőúáéűí ]+$/i) )
    {
    errs++;
    msgobj.innerHTML=errormsg_tradealert[3];
    msgobj.style.display='block';
    return;
    }


loaderobj.style.display='block'
msgobj.style.display='none';

var getval;

ajax_formdat.reset();

for (var i=0;i<chkform.length;i++)
  {
  getval=GetFormElementValue(chkform.elements[i]);
    
  if(getval!=null)
    ajax_formdat.setVar(chkform.elements[i].name, getval );      
  }

ajax_formdat.setVar('f', 1 );
ajax_formdat.setVar('s', 22 );

  
ajax_formdat.requestFile = "ajaxindex.php";
ajax_formdat.onCompletion = SaveCompleted; 
ajax_formdat.runAJAX();  

//return true;
}
//-----------------------------------------------
function SaveCompleted()
{
var loaderobj=document.getElementById('loader_dataform');
var msgobj=document.getElementById('resultmsg_dataform');
eval(ajax_formdat.response);
msgobj.innerHTML=msg;
loaderobj.style.display='none'
msgobj.style.display='block';

if(redir)
  linkopen(redir);
}
//-----------------------------------------------
function RefreshHistory()
{
if(!document.getElementById('history')) return;

ajax_mainlist.reset();

ajax_mainlist.setVar('f', 1 );
ajax_mainlist.setVar('s', 25 );
ajax_mainlist.requestFile = "ajaxindex.php";
ajax_mainlist.element='history';
ajax_mainlist.runAJAX();  
}
//-----------------------------------------------
function AddFav()
{
if(isFF || isOPERA) { alert('Kérjük használja a Ctrl+D billentyűzetkombinációt!'); return; }
window.external.AddFavorite('http://www.uzletiajanlatok.hu','Üzletiajánlatok.hu');
}
//-----------------------------------------------
function Forward(uid)
{
frww=window.open('forwardua.php?ua='+uid,'frwwin','width=410,height=430,status=1,resizable=0,scrollbars=0');
var xc =(screen.width - 410) / 2;
var yc =(screen.height - 430) / 2;
frww.moveTo(xc, yc);
frww.focus(); 
}
//-----------------------------------------------
function TradealertUnsubscribe()
{
ajax_office.reset();
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 26 );
ajax_office.setVar('unsubscribe', 1 );
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='tradealaertunsubscribe';
ajax_office.runAJAX(); 		
}
//-----------------------------------------------
function UsLink(on)
{
if(on==1)
  {
  $('#uslinkcnt').css('display', 'none');
  $('#usconfirmcnt').css('display', 'block');  
  }
else
  {
  $('#uslinkcnt').css('display', 'inline');
  $('#usconfirmcnt').css('display', 'none'); 
  }
}
//-----------------------------------------------
function HirlevSubscribe(on)
{
ajax_office.reset();
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 27 );
ajax_office.setVar('subscribe', on );
ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='mailsubscribe';
ajax_office.runAJAX(); 		
}
//-----------------------------------------------
function RefreshInvitationOfficelist(page, order, option)
{
var listform=document.getElementById('inviteofficelist');
var getval;

ajax_office.reset();

for (var i=0;i<listform.length;i++)
  {        
  getval=GetFormElementValue(listform.elements[i]);
    
  if(getval!=null)
    ajax_office.setVar(listform.elements[i].name, getval );  
    
  }
  
if(order)
  {
  page=1;
  ajax_office.setVar('order', order ); 
  }
  
if(option)
  {
  ajax_office.setVar('option', option );
  }
  
  
if(page) ajax_office.setVar('page', page ); 


  
ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 32 );

//ajax_mainlist.setVar('out', 'xml' );

ajax_office.requestFile = "ajaxindex.php";
ajax_office.element='inviteofficelist';
ajax_office.runAJAX();  
}
//-----------------------------------------------
function GotoPageInvitationOfficelist()
{
var page=document.getElementById('page').value;
if (!page.match(/^[0-9]+$/)) return;
RefreshInvitationOfficelist(page);
}
//-----------------------------------------------
function FeedBackSelect(opt)
{
$('#office_feedback .s1').css('display', 'none');
$('#office_feedback .s2').css('display', 'block');

feedbackselected=opt;
}
//-----------------------------------------------
function FeedBackSend()
{
var inpval=$('#office_feedback .txtinput').val();

if(inpval=='' || inpval==definptext) return;

ajax_office.reset();

ajax_office.setVar('feedbackselected', feedbackselected );
ajax_office.setVar('feedbacktext', inpval );

ajax_office.setVar('f', 1 );
ajax_office.setVar('s', 33 );


ajax_office.requestFile = "ajaxindex.php";
ajax_office.onCompletion = FeedBackSendCompleted; 
ajax_office.runAJAX();  
}
//-----------------------------------------------
function FeedBackSendCompleted()
{
eval(ajax_office.response);
}
//-----------------------------------------------
/*function InitFeedBacklist()
{
if(feedbackcnt<=1) return;

var lastitemobj =$('#feedbacklist .wrapper > div:last').clone();
var firstitemobj=$('#feedbacklist .wrapper > div:first').clone();

$('#feedbacklist .wrapper > div:first').before( lastitemobj );
$('#feedbacklist .wrapper > div:last').after( firstitemobj );

$('#feedbacklist .wrapper').stop().scrollTo($('#feedbacklist .wrapper > div:eq(1)'), 0);
feedbackcounter=0;
AutoLoopFeedback();
feedbackmove=false;
}
//-----------------------------------------------
function AutoLoopFeedback()
{
feedbackcounter++;
timer1=setTimeout("AutoLoopFeedback()",4000);
if(feedbackcounter<=1) return;
FeedbackScroll(1, true);
}
//-----------------------------------------------
function FeedbackScroll(direction,auto)
{
if(feedbackmove) return;

if(!auto)
feedbackcounter=0;

var max=feedbackcnt+2;

var newpos=actualfeedback+direction;
actualfeedback=newpos;

feedbackmove=true;

$('#feedbacklist .wrapper').stop().scrollTo($('#feedbacklist .wrapper > div:eq('+(newpos-1)+')'), 0,  
  {
	onAfter:function()
    {
    if(actualfeedback==max)
      {
      actualfeedback=2;
      $('#feedbacklist .wrapper').scrollTo($('#feedbacklist .wrapper > div:eq(1)'), 0);      
      }
    else if(actualfeedback==1)
      {
      actualfeedback=max-1; 
      $('#feedbacklist .wrapper').scrollTo($('#feedbacklist .wrapper > div:eq('+(max-2)+')'), 0);                  
      }
      
    feedbackmove=false;     
    }
  });

}*/
//-----------------------------------------------
function ProductExpressForm(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;	


$(mainform).find('.defbutton').click(function()
	{
	$(mainform).find('.loader').css('display', 'inline');	
	$(mainform).find('.msg').css('display', 'none');
		
	$.ajax({
	     type: "POST",
	     url: action,
	     data: ( $(mainform).serialize() ),
	     dataType: "html",
	     success: function(result) 
  			{
  			$(mainform).find('.loader').css('display', 'none');	 
  			eval(result);          
  			}
	    });	
	});
	
$(mainform).find('input[name=webpage]').bind('keypress', function(event) { var code = (event.keyCode ? event.keyCode : event.which); if(code==13)   return false;  }  );

$(mainform).find('input[name=webpage]').bind('keypress', function(event) { var code = (event.keyCode ? event.keyCode : event.which); if(code==13)   $(mainform).find('.defbutton').trigger('click');  }  );	

}
//-----------------------------------------------
function uadetailsObj(formid)
{
var mainform = $('#' + formid);
//var action = $(mainform).attr('action');
var formobj = this;


Initpager();

$(mainform).find('.pagerpanel a[rel]').bind('click', function(event)
  {
  event.preventDefault();  
  var rel=$(this).attr('rel');  
  navigate(rel);
  });

function navigate(page)
  {  
  $.ajax({
     type: "POST",
     url: 'ajaxindex.php',
     data: { f : 1, s : 37, page : page },
     dataType: "html",
     success: function(result) 
	 	   {
	 	   //$(mainform).html(result);
	 	   $(mainform).replaceWith(result);
	 	   obj_uadetailscontent=new uadetailsObj('uadetailscontent');	 	   
	 	   }
	 	  });
  }
  
  
function Initpager()
{
var pagerpanel=$(mainform).find('.pagerpanel');

if( $(pagerpanel).length>0 )
  {
  var sumwidth=0;
  
  $(pagerpanel).find('a.nav,div.navpage').each( function()
    {
    sumwidth+=$(this).outerWidth(true);
    });
        
  $(pagerpanel).css('width', sumwidth+'px');  
  }
}



//--End--
};
//-----------------------------------------------
function uavscrollobj(element)
{
var mainelement = $('#' + element);
var mainobj = this;

var act;
var moving=false;
var timer;

var itemcnt=$(mainelement).find('.item').length;
var itemperpage=3;
var scrollspeed=1000;
var timerspeed=5000;

Init();

function Init()
{
if( itemcnt > itemperpage )
{
var item_first=$(mainelement).find('.item:first');

$(mainelement).find('.item').each(function(idx)
  {
  var clone1=$(this).clone();
  var clone2=$(this).clone();
  
  
  if(idx >= itemcnt-itemperpage)
    {
    $(item_first).before(clone1);
    }
  
  if(idx < itemperpage)
    {
    $(mainelement).find('.item:last').after(clone2);
    }
  
  
  });
  
  
$(mainelement).find('.scrollbox').stop().scrollTo( $(mainelement).find('.scrollbox .item:eq('+itemperpage+')'), 0, {axis:'x' });

$(mainelement).find('a.navleft').click(function(event)
  {
  event.preventDefault();
  Scroll(-1)
  });
  
$(mainelement).find('a.navright').click(function(event)
  {
  event.preventDefault();
  Scroll(1)
  });

act=itemperpage;
}
else
{
$(mainelement).find('a.nav').css('display', 'none');
}


var sumwidth=0;
$(mainelement).find('.item').each(function()
  {
  sumwidth+=$(this).outerWidth(true);
  });
  
$(mainelement).find('.cw').css('width', sumwidth+'px');


Timerfunc(true);

}

function Scroll(direction)
{
if(moving) return;
act+=direction;

moving=true;
Timerfunc(false);

$(mainelement).find('.scrollbox').stop().scrollTo( $(mainelement).find('.scrollbox .item:eq('+act+')'), scrollspeed, 
  {
  axis:'x',
  onAfter:function()
    {
    if(act==0)
      {
      act=itemperpage+(itemcnt-itemperpage);
      }
    else if(act==itemperpage+itemcnt)
      {
      act=itemperpage;            
      }
      
    $(mainelement).find('.scrollbox').scrollTo( $(mainelement).find('.scrollbox .item:eq('+act+')'), 0, {axis:'x' });
      
    moving=false;
    Timerfunc(true);
    }
  });

}

function Timerfunc(start)
{
if(start)
timer=setInterval ( function() { Scroll(1); } , timerspeed );
else
clearInterval(timer);
}


//--End--
};
//-----------------------------------------------
function QuickMsgobj(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;


$(mainform).find('.button').click(function()
	{
	$(mainform).find('.loader').css('display', 'inline');	
	$(mainform).find('.error').html('');
		
	$.ajax({
	     type: "POST",
	     url: action,
	     data: ( $(mainform).serialize() ),
	     dataType: "html",
	     success: function(result) 
  			{
  			$(mainform).find('.loader').css('display', 'none');	 
  			eval(result);          
  			}
	    });	
	});


//--End--
};
