function preloadPremiseContent( tab, item_id, lf_id ) {
	
	$( '#premise_tab_' + tab + ' span' ).addClass( 'active_span' );
	// vykdom uzklausa
	$.ajax({
		
		// jei viskas ok, isidedam i cache ir parodom useriui. pazymim aktyvu taba
		success : function ( data, text_status ) {
			
			if ( $( '#premises_cache #premise_content_' + tab ).html() == null || $( '#premises_cache #premise_content_' + tab ).html().length == 0 ) {
				
				var c = '<div id="premise_content_' + tab + '">' + data + '</div>';
				$( '#premises_cache' ).append( c );
			}
		},
		
		// leidziamas timeout - 10sek
		timeout : 10000,
		
		// urlas ajaxo callui
		url : root_url + '?act=ajax/premises/' + tab + '&item_id=' + item_id + '&lf_id=' + lf_id
	});
}

function loadPremiseContent( tab, item_id, lf_id ) {
	
	// pasalinam visus aktyvius tabus
	$( '.tabs .tab_item' ).removeClass( 'active' );
	$( '.tabs .tab_item span' ).removeClass( 'active_span' );
	
	// vykdom uzklausa
	$.ajax({
		
		// pries ajaxindami patikrinam, gal turim cache, jei ne - tada parodom preloaderi ir laukiam kol vyks callas
		beforeSend: function(){
			
			if ( $( '#premises_cache #premise_content_' + tab ).html() != null && $( '#premises_cache #premise_content_' + tab ).html().length > 0 ) {
				
				$( '#pub_list_item_content' ).html( $( '#premises_cache #premise_content_' + tab ).html() );
				$( '#premise_tab_' + tab ).addClass( 'active' );
				$( '#premise_tab_' + tab + ' span' ).addClass( 'active_span' );
				
				// stabdom viska, turim contenta uzkesuota
				return false;
			} else {
				
				var preloader = $( '#premises_preloader' ).html();
				$( '#pub_list_item_content' ).html( preloader );
			}
		},
		
		// jei ivyko klaida - apie tai papasakojam vartotoja, kad nebelauktu
		error : function ( XMLHttpRequest, text_status, error_thrown ) {
			
			$( '#pub_list_item_content' ).html( loading_error );
		},
		
		// jei viskas ok, isidedam i cache ir parodom useriui. pazymim aktyvu taba
		success : function ( data, text_status ) {
			
			var content = $( '#premises_cache #premise_content_' + tab ).html();
			
			// reiskia reikia iterpti i cache
			if ( content == null ) {
				
				var c = '<div id="premise_content_' + tab + '">' + data + '</div>';
				$( '#premises_cache' ).append( c );
				$( '#pub_list_item_content' ).html( data );
				
			} else { // reiskia jau yra cache, updatinam cache ir parodom rezultata
				
				$( '#premise_content_' + tab ).html( data )
				$( '#pub_list_item_content' ).html( data );
			}
			
			$( '#premise_tab_' + tab ).addClass( 'active' );
		},
		
		// leidziamas timeout - 10sek
		timeout : 10000,
		
		// urlas ajaxo callui
		url : root_url + '?act=ajax/premises/' + tab + '&item_id=' + item_id + '&lf_id=' + lf_id
	});
}