
//-----------------------------------------------
function SightsObj(divid)
{
var maindiv = $('#' + divid);
var divobj = this;
	
//-----------------------------------------------
this.Init = function()
{
	
$(maindiv).find('.gallery').imagegallery({tooltipid : 'tooltipsight', openimage : false});

$(maindiv).find('#form_continent table a').makeselect(null, divobj.Aftercontinentselect);

							
//----------------------Scroll beállítása-----------------
$(maindiv).find('.images').makescrollable({speed : 50 });
//if( $(maindiv).find('.images .scrollbutton2').css('display')=='none' ) $(maindiv).find('.text .bottomscroll').css('display', 'none');

//----------------------Click beállítása-----------------
/*$(maindiv).find('.images a[rel]').click(function(event)
	{
	event.preventDefault();
	var rel=$(this).attr('rel');
	
	toggleloader(true, 1);
	
	$.ajax({
		type: "POST",
		url: "index.php",
		data: ({m : 'LATNI', a : 'egykislatni', kod : rel}),
		dataType: "json",
		success: function(result)
			{
			LoadModule(result);
			sighlistobj=new SightTextObj('sights');
			sighlistobj.Init();
			
			$('#sights .scrollbox').scrollTo('#item_'+rel, 0);
			$('#sights .scrollbox').scrollTo('-=8px', 0);
			}
		});
		
	});*/
	
	
//$(maindiv).find('.images a[rel]').imagegallery({makeoutertags : false});	
	
$(maindiv).find('.topline a.back').click( function (event) 
	{
	event.preventDefault();
	
	toggleloader(true, 1);
	
	$.ajax({
		 type: "POST",
		 url: 'index.php',
		 data: ({ m : 'fooldal' }),
		 dataType: "json",
		 success: function(result) { LoadModule(result); }
		});
	
	});	
	
$(maindiv).find('a.contsearch').click(function(event){ event.preventDefault(); divobj.OpenContinent(this); });

	
$(maindiv).find('.formpopup').bind('mouseleave', function(event)
  {
  $(this).animate({ opacity: 'hide' }, 300);
  });


$(maindiv).find('#latnivalokpopup a.close').bind('click', function(event)
	{
	event.preventDefault();	
	$('#latnivalokpopup').animate({ opacity: 'hide' }, 0);
	});
	
$(maindiv).find('.images a[rel]').bind('click', function(event)
    {
	event.preventDefault();			
	openlatnipopup(this);
	});	


};

//-----------------------------------------------
function openlatnipopup(sender)
{
var rel=$(sender).attr('rel');
var target=$(maindiv).find('#latnivalokpopup');

//$(target).animate({ opacity: 'show' }, 0);	
//$(target).find('.txtbox').makescrollable({speed : 100 });


$.ajax({
     type: "POST",
     url: 'index.php',
     data: ({m : 'LATNI', a : 'egykislatni', kod : rel}),
     dataType: "json",			 
     success: function(result) 
	 	{ 
		LoadModule(result);	
		
		if (result.success == 1) 
			{
			$(target).find('.imgbox .txt').html(result.data['kepleir']);
			$(target).find('.imgbox img').attr('src', result.data['src']);	
			$(target).find('.txtbox .textcontent').html(result.data['leiras']);
			
						
			$(target).find('.fav a[rel]').bind('click', function(event)
				{
				event.preventDefault();
				
				var rel = $(this).attr('rel');	
				
				$.ajax({
			       type: "POST",
			       url: 'index.php',
			       data: ({ m : 'UTA1', a : 'betolt', kod : rel }),
			       dataType: "json",
			       success: function(result) { LoadModule(result); }
			      });
				  	 		
				});
			
				
			$(target).animate({ opacity: 'show' }, 0);	
			$(target).find('.txtbox').makescrollable({speed : 100 });		
			}				
		}		
	});	
	
	
}
//-----------------------------------------------
this.OpenContinent=function(sender)
{
$('.formpopup:not(#form_continent)').animate({ opacity: 'hide' }, 300);

//var position=$(sender).position();
$('#form_continent').css('left', '5px');
$('#form_continent').css('top', 'auto');
$('#form_continent').css('bottom', '25px');


$('#form_continent').animate({ opacity: 'show' }, 300);
};
//-----------------------------------------------
this.Aftercontinentselect=function(obj, active)
{
if(active)
  {  
  var rel=$(obj).attr('rel');
  
  $.ajax({
     type: "POST",
     url: 'index.php',
     data: ({ m : 'LATNI', a : 'fo', kontinens : rel }),
     dataType: "json",
     success: function(result) { LoadModule(result);  }
    });
	
  $('#form_continent').animate({ opacity: 'hide' }, 300);
  }
};

//--End--
};

//-----------------------------------------------
function SightTextObj(divid)
{
var maindiv = $('#' + divid);
var divobj = this;


		
//-----------------------------------------------
this.Init = function()
{
	
//----------------------Scroll beállítása-----------------
$(maindiv).find('.text').makescrollable({speed : 100 });
//if( $(maindiv).find('.text .scrollbutton2').css('display')=='none' ) $(maindiv).find('.text .bottomscroll').css('display', 'none');


$(maindiv).find('.topline a.back').click( function (event) 
	{
	event.preventDefault();
	
	toggleloader(true, 1);
	
	$.ajax({
		 type: "POST",
		 url: 'index.php',
		 data: ({ m : 'LATNI' }),
		 dataType: "json",
		 success: function(result) { LoadModule(result); }
		});
	
	});
	
	
$(maindiv).find('.fav a[rel]').bind('click', function(event)
	{
	event.preventDefault();
	
	var rel = $(this).attr('rel');	
	
	$.ajax({
       type: "POST",
       url: 'index.php',
       data: ({ m : 'UTA1', a : 'betolt', kod : rel }),
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
	  	 		
	});	
	
	
$(maindiv).imagegallery({makeoutertags : false, openimage : false, kislatni : true});	


};
	
//--End--
};
	
