//-----------------------------------------------
function KerFormObj(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;
		
//-----------------------------------------------
this.Init = function()
{

	
$(mainform).find('.kertable .td3 .cnt').each( function()
	{
	$('#tooltipker').html( $(this).html() )
	
	//debug( $('#tooltipker').width() );
	
	if ( $('#tooltipker').width()>163 ) 
		{
		//$(this).wrapInner('<div class="cnt"><div><div></div></div></div>');
		$(this).wrapInner('<div><div></div></div>');
		//$(this).tooltip({tooltipid: 'tooltipker',leftmod: 3,topmod: 0,	parentcolor: true});
		$(this).tooltip({tooltipid: 'tooltipker',leftmod: 0,topmod: 0,	parentcolor: true});
		}
	});
	
//setTimeout( function() {  	
//----------------------Scroll beállítása-----------------	
$(mainform).find('.scrollwrapper.mainscroll').makescrollable({speed : 100});
	
	/*afterinit : function()
	{	*/
	//setTimeout( function() {
		
		/*debug( $(mainform).find('.scrollwrapper.mainscroll .scrollbutton2').css('display') );	
			
		if( $(mainform).find('.scrollwrapper.mainscroll .scrollbutton2').css('display')=='none' ) 		
		$(mainform).find('.scrollwrapper.mainscroll .bottomscroll').css('display', 'none');
		
		debug( $(mainform).find('.scrollwrapper.mainscroll .bottomscroll').css('display') );*/
		//}, 100 );
	
	/*if( $(mainform).find('.scrollwrapper.mainscroll .scrollbutton2').css('display')=='block' ) 
		$(mainform).find('.scrollwrapper.mainscroll .bottomscroll').css('display', 'block');*/	
		
	//} });

//}, 500);

/*	
if( $(mainform).find('.scrollwrapper.mainscroll .scrollbutton2').css('display')=='none' ) 		
$(mainform).find('.scrollwrapper.mainscroll .bottomscroll').css('display', 'none');*/

/* 2010.08.26 kepernyofrissitesre rakva
$(mainform).find('.kertable a.details').click( function(event) 
	{
	event.preventDefault();  
	toggleloader(true, 1);
		
	var rel=$(this).attr('rel');	
			
	$.ajax({
       type: "POST",
       url: action,
       data: ({ m : 'uta1', a : 'betolt', kod : rel }),
       dataType: "json",
       success: function(result) { LoadModule(result); }
      }); 
	});
	*/
$(mainform).find('a.bbutton.varos').click( function (event) { event.preventDefault(); searchform_obj.Select('U'); searchform_obj.Show(); /*formobj.OpenCity(this);*/ } );
$(mainform).find('a.bbutton.ar').click( function (event) { event.preventDefault(); formobj.OpenAr(this); } );



$(mainform).find('.formpopup').bind('mouseleave', function(event)
  {
  $(this).animate({ opacity: 'hide' }, 300);
  });

$(mainform).find('.formpopup a.close').bind('click', function(event) { event.preventDefault(); formobj.Closepopup( $(this).parent() ) } );

$(mainform).find('.kerimg img').bind('click', function(event) { event.preventDefault();  $(this).parent().css('display', 'none'); } );
$(mainform).find('.kerimg a.close').bind('click', function(event) { event.preventDefault();  $(this).parent().css('display', 'none'); } );



$(mainform).find('a.bbutton.ker2').click( function (event) 
	{
	event.preventDefault();
	toggleloader(true, 1);
	
	var ut_tipval=$(mainform).find('input[name=ut_tip]').val();	
	var ker_tipval=$(mainform).find('input[name=ker_tip]').val();
	var ut_altipval=$(mainform).find('input[name=ut_altip]').val();
	
	$.ajax({
       type: "POST",
       url: action,
	   data: ({ m : 'KER', a : 'ker_kep', ker_tip : ker_tipval, ut_tip : ut_tipval, ut_altip : ut_altipval }),       
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
	
	});
	
	
InitCitylist();
InitArlist();

}

//-----------------------------------------------
function InitCitylist()
{
var itemcnt=$('#form_city table tr').length;

if(itemcnt>=9)
	{	
	$('#form_city').css('left', -10000);
	$('#form_city').css('display', 'block');
	$('#form_city').makescrollable({angle : 'vertical', speed: 50});
	$('#form_city .scrollwrapper').css('height', '189px');
	$('#form_city .scrollbox').css('height', '189px');
	}
else
	{
	$('#form_city .scrollwrapper').css('height', 'auto');
	$('#form_city .scrollbox').css('height', 'auto');
	$('#form_city .scrollwrapper > a').css('display', 'none');		
	}
	
$(mainform).find('#form_city table a[rel]').click( function (event) 
	{
	event.preventDefault();
	toggleloader(true, 1);
	
	var rel=$(this).attr('rel');
	var ut_tipval=$(mainform).find('input[name=ut_tip]').val();	
	var ker_tipval=$(mainform).find('input[name=ker_tip]').val();
	var ut_altipval=$(mainform).find('input[name=ut_altip]').val();
	
	$.ajax({
       type: "POST",
       url: action,
       data: ({ m : 'KER', a : 'orszag', kod : rel, ker_tip : ker_tipval, ut_tip : ut_tipval, ut_altip : ut_altipval }),
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
		
	});
}
//-----------------------------------------------
this.OpenCity=function(sender)
{
$('.formpopup:not(#form_city)').animate({ opacity: 'hide' }, 300);

var position=$(sender).position();
$('#form_city').css('left', position.left-1+'px');
$('#form_city').css('top', position.top+27+'px');


$('#form_city').animate({ opacity: 'show' }, 300);
};
//-----------------------------------------------
function InitArlist()
{
var itemcnt=$('#form_ar table tr').length;

if(itemcnt>=9)
	{	
	$('#form_ar').css('left', -10000);
	$('#form_ar').css('display', 'block');
	$('#form_ar').makescrollable({angle : 'vertical', speed: 50});
	$('#form_ar .scrollwrapper').css('height', '189px');
	$('#form_ar .scrollbox').css('height', '189px');
	}
else
	{
	$('#form_ar .scrollwrapper').css('height', 'auto');
	$('#form_ar .scrollbox').css('height', 'auto');
	$('#form_ar .scrollwrapper > a').css('display', 'none');		
	}
	
	
$(mainform).find('#form_ar table a[rel]').click( function (event) 
	{
	event.preventDefault();
	toggleloader(true, 1);
	
	var rel=$(this).attr('rel');	
	var ut_tipval=$(mainform).find('input[name=ut_tip]').val();
	var ker_tipval=$(mainform).find('input[name=ker_tip]').val();
	var ut_altipval=$(mainform).find('input[name=ut_altip]').val();
	
	$.ajax({
       type: "POST",
       url: action,
	   data: ({ m : 'KER', a : 'ar', kod : rel, ker_tip : ker_tipval, ut_tip : ut_tipval, ut_altip : ut_altipval }),       
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
		
	});
}
//-----------------------------------------------
this.OpenAr=function(sender)
{
$('.formpopup:not(#form_ar)').animate({ opacity: 'hide' }, 300);

var position=$(sender).position();
$('#form_ar').css('left', position.left-1+'px');
$('#form_ar').css('top', position.top+27+'px');


$('#form_ar').animate({ opacity: 'show' }, 300);
};
//-----------------------------------------------
this.Closepopup=function(pobj)
{
var id=$(pobj).attr('id');
$(pobj).animate({ opacity: 'hide' }, 300);
}

//--End--
};






//-----------------------------------------------
function Ker2FormObj(formid)
{
var mainform = $('#' + formid);
var action = $(mainform).attr('action');
var formobj = this;


//-----------------------------------------------
this.Init = function()
{
//----------------------Scroll beállítása-----------------
$(mainform).find('.scrollwrapper.mainscroll').makescrollable({speed : 100 });

//if( $(mainform).find('.scrollwrapper.mainscroll .scrollbutton2').css('display')=='none' ) $(mainform).find('.scrollwrapper.mainscroll .bottomscroll').css('display', 'none');

InitCitylist();
InitArlist();

$(mainform).find('#imagelist .c1').each( function()
	{
	$('#tooltipker').html( $(this).html() )
	if ( $('#tooltipker').width()>174 ) 
		{
		$(this).wrapInner('<div><div></div></div>');
		$(this).tooltip({tooltipid: 'tooltipker',leftmod: 4,topmod: 2,	parentcolor: true});
		}
	});

$(mainform).find('a.bbutton.varos').click( function (event) { event.preventDefault(); formobj.OpenCity(this) } );
$(mainform).find('a.bbutton.ar').click( function (event) { event.preventDefault(); formobj.OpenAr(this) } );



$(mainform).find('.formpopup').bind('mouseleave', function(event)
  {
  $(this).animate({ opacity: 'hide' }, 300);
  });

$(mainform).find('.formpopup a.close').bind('click', function(event) { event.preventDefault(); formobj.Closepopup( $(this).parent() ) } );


$(mainform).find('#imagelist .rbpanel a[rel]').click( function(event) 
	{
	event.preventDefault();  
	toggleloader(true, 1);
		
	var rel=$(this).attr('rel');		
			
	$.ajax({
       type: "POST",
       url: action,
       data: ({ m : 'uta1', a : 'betolt', kod : rel }),
       dataType: "json",
       success: function(result) { LoadModule(result); }
      }); 
	});


}




//-----------------------------------------------
function InitCitylist()
{
var itemcnt=$('#form_city table tr').length;

if(itemcnt>=9)
	{	
	$('#form_city').css('left', -10000);
	$('#form_city').css('display', 'block');
	$('#form_city').makescrollable({angle : 'vertical', speed: 50});
	$('#form_city .scrollwrapper').css('height', '189px');
	$('#form_city .scrollbox').css('height', '189px');
	}
else
	{
	$('#form_city .scrollwrapper').css('height', 'auto');
	$('#form_city .scrollbox').css('height', 'auto');
	$('#form_city .scrollwrapper > a').css('display', 'none');		
	}
	
$(mainform).find('#form_city table a[rel]').click( function (event) 
	{
	event.preventDefault();
	toggleloader(true, 1);
	
	var rel=$(this).attr('rel');
	var ut_tipval=$(mainform).find('input[name=ut_tip]').val();
	var ker_tipval=$(mainform).find('input[name=ker_tip]').val();
	var ut_altipval=$(mainform).find('input[name=ut_altip]').val();
	
	$.ajax({
       type: "POST",
       url: action,
	   data: ({ m : 'KER', a : 'orszag', kod : rel, ker_tip : ker_tipval, ut_tip : ut_tipval, ut_altip : ut_altipval }),
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
		
	});
}
//-----------------------------------------------
this.OpenCity=function(sender)
{
$('.formpopup:not(#form_city)').animate({ opacity: 'hide' }, 300);

var position=$(sender).position();
$('#form_city').css('left', position.left-1+'px');

//var top=position.top+27;
//if(top>300) top=300;

$('#form_city').css('top', 'auto');
$('#form_city').css('bottom', '0px');


$('#form_city').animate({ opacity: 'show' }, 300);
};
//-----------------------------------------------
function InitArlist()
{
var itemcnt=$('#form_ar table tr').length;

if(itemcnt>=9)
	{	
	$('#form_ar').css('left', -10000);
	$('#form_ar').css('display', 'block');
	$('#form_ar').makescrollable({angle : 'vertical', speed: 50});
	$('#form_ar .scrollwrapper').css('height', '189px');
	$('#form_ar .scrollbox').css('height', '189px');
	}
else
	{
	$('#form_ar .scrollwrapper').css('height', 'auto');
	$('#form_ar .scrollbox').css('height', 'auto');
	$('#form_ar .scrollwrapper > a').css('display', 'none');		
	}
	
	
$(mainform).find('#form_ar table a[rel]').click( function (event) 
	{
	event.preventDefault();
	toggleloader(true, 1);
	
	var rel=$(this).attr('rel');	
	var ut_tipval=$(mainform).find('input[name=ut_tip]').val();
	var ker_tipval=$(mainform).find('input[name=ker_tip]').val();
	var ut_altipval=$(mainform).find('input[name=ut_altip]').val();
	
	$.ajax({
       type: "POST",
       url: action,
	   data: ({ m : 'KER', a : 'ar', kod : rel, ker_tip : ker_tipval, ut_tip : ut_tipval, ut_altip : ut_altipval }),       
       dataType: "json",
       success: function(result) { LoadModule(result); }
      });
		
	});
}
//-----------------------------------------------
this.OpenAr=function(sender)
{
$('.formpopup:not(#form_ar)').animate({ opacity: 'hide' }, 300);

var position=$(sender).position();
$('#form_ar').css('left', position.left-1+'px');
//$('#form_ar').css('top', position.top+27+'px');

$('#form_ar').css('top', 'auto');
$('#form_ar').css('bottom', '0px');


$('#form_ar').animate({ opacity: 'show' }, 300);
};
//-----------------------------------------------
this.Closepopup=function(pobj)
{
var id=$(pobj).attr('id');
$(pobj).animate({ opacity: 'hide' }, 300);
}

//--End--
};