function css() {

	/* go on for IE in generall */
	if($.browser.msie){
	
		$('.csstable tr td:last-child').addClass('last-child');
		$('#footer ul li:first-child, .csstable tr td:first-child').addClass('first-child');
	
		/* take care IE 6 only */
		if($.browser.version <= 6) {
			$('.csstable tr').hover(function(){$(this).addClass('hover');}, function(){$(this).removeClass('hover');});
			
			
		
		}
	}

    $("span.call_checkbox").click(function(){
    	input_class = $(this).attr('rel');
    	// zaznaczenie wszystkich checkboksów
    	if($(this).is('.select_all')){
    		$("input."+input_class).attr('checked', 'checked');
    	}
    	// odznaczenie wszystkich checkboksów
    	else{
    		$("input."+input_class).attr('checked', '');	
    	}
    });

	// $('#logo').focus();
	//$('#new a').focus();
  
  $('.data-picker').datePicker(); 
  
	$('.user-form li:first-child').append('<a href="#" class="del">x</a>');
	$('.user-form li:first-child .del').hide();
	$('#add-field').click(function(){
		path = $('.user-form').children('li:first-child');
		ID = $(path).children('input').attr('id');
		_pre = ID.split('_')[0];
		ID = ID.split('_')[1];
		ID = parseInt(ID);
		ID = _pre+'_'+(ID+1);
    
    // tutaj trzeba cos zmienic.
	
  /*	
		if($('form').is('#form-add-action ')) { af_name = 'send_user[]'; }
		else { af_name = 'url[]'; }
  */
    af_name = 'url[]';
    		
    $(path).clone().attr('id', 'li_'+ID).prependTo('.user-form');
		$('.user-form #li_'+ID+' input').attr('id', ID).attr('name', af_name).attr('value','');
		$('.user-form #li_'+ID+' label').attr('for', ID);
		$('.user-form #li_'+ID+' .del').show().attr('href', '#'+ID);
		remove_row();
		//addComplete(ID);
		checkComplete(ID);
	});
	
	function remove_row(){
		$('.user-form li a.del').click(function(f){
			f.preventDefault();
			$(this).parent('li').remove();
		});
	}
	
	function checkComplete(chk_ID){
		$('input.username').click(function(){
		 	addComplete(chk_ID);
		});
	}
	 
	function addComplete(ac_ID){
		//$.getScript('/pliki/javascript/jq.autocomplete.js')
		$("input#"+ac_ID).autocomplete("/autocomplete-ajax.php");	
		return false;
	}
	
	checkComplete('id_1');


	if($('#top').attr('class') != '') { 
		topID = $('#top').attr('class');
		$('#top').css({background: 'url(/image/header/'+topID+'.gif) no-repeat 50% 0'})
	}
	
	
	$('.cloud').cloud();
	$('.overcloud').cloud();
	
 	
	$('.blogs-sort select').change(function(){
		$(this).parent().parent().submit();
	});
 

	$('.blogs-sort input.radio').change(function(){
		$(this).parent().parent().parent().submit();
	}); 
	
	$('.shoutbox-form').keypress(function(k){ 
		if (!k)
		k = event;
		if (k.shiftKey){ 
			if(k.keyCode==13){
				//alert(k.keyCode==13); 
			}
			else{
				//alert(k.keyCode); 			
			}
		}
		else if(k.keyCode==13){ k.preventDefault(); $(this).submit();  }
		
	});
	

	// read cookie value
	var slideMsgCookie = $.cookie('slideMsg');
	var slideTempo = 1000;
	// show slideMsg if 'value' when page loaded
	if (slideMsgCookie != 'OFF') { 
		$('#'+slideMsgCookie).addClass('active').show(); 
	}
	
	// save cookie value function
	function slideMsg(visible) {		
		$.cookie('slideMsg', visible, { path: '/', expires: 365 });
	}
	
	// hide slideMsg, change cookie value
	$('.slideMsg .close').click(function(sM){
		sM.preventDefault();
		$(this).parent('.slideMsg').removeClass('active').slideUp(slideTempo);
		slideMsg('OFF');
	});
	
	
	// show slideMsg, change cookie value
	$('.call').click(function(sM){
		sM.preventDefault();
		sM_ID = $(this).attr('id').split('-')[1];
		
		// hide this
		if($('#'+sM_ID).is('.active')){
			$('#'+sM_ID).removeClass('active').slideUp(slideTempo);
			slideMsg('OFF');
		}
		// show
		else {
			// hide siblings
			$('.slideMsg.active').removeClass('active').slideUp(slideTempo);
			// show this
			$('#'+sM_ID).addClass('active').slideDown(slideTempo);
			slideMsg(sM_ID);
		}
	});
	
      $("div#set-size").find("a.size1").click(function(){ 
      
        $("div#content-box").removeClass("size2");
        $("div#content-box").removeClass("size3");
        
        $("div#content-box").addClass("size1"); 
        
      });
    
    
      $("div#set-size").find("a.size2").click(function(){ 
      
        $("div#content-box").removeClass("size1");
        $("div#content-box").removeClass("size3");
        
        $("div#content-box").addClass("size2"); 
        
      });
    
      $("div#set-size").find("a.size3").click(function(){ 
      
        $("div#content-box").removeClass("size2");
        $("div#content-box").removeClass("size1");
        
        $("div#content-box").addClass("size3"); 
        
      }); 

}

$(document).ready(css);	

jQuery.fn.extend({
	cloud: function() {
		$('body').prepend('<div id="cloud"></div>');
		$(this).mouseover(function(e){
		
			cloudClass = $(this).attr('rel');
			if($(this).is('.cloud')){
				cloudTitle = $(this).text() || $(this).children().attr('alt');
				cloudTitle = '<strong>'+cloudTitle+'</strong>';
			}
			if($(this).is('.overcloud')){
				cloudTitle = $(this).children('.blog-desc').text();			
				cloudTitle = '<strong>'+cloudTitle+'</strong>';
			}
			if($(this).is('.clearcloud')){ cloudTitle = ''; }
			
			cloudText = $(this).attr('title');
			
			$('#cloud').addClass(cloudClass).html(cloudTitle+'<p>'+cloudText+'</p>');
			$(this).attr('title','');
			
		});
		$(this).mousemove(function(e){
			var x, y;
			try { x = e.pageX-20; y = e.pageY-30; } // FF
			catch(e) { x = event.clientX-20; y = event.clientY-40; } // IE
		
			y = y+40+'px';
			if($(this).is('.left')){ x = x-230+'px'; }
			else{ x = x+40+'px'; }
			$('#cloud').css({ display: 'block', top: y, left: x})
		});
		
		$(this).mouseout(function(e){ 
			$('#cloud').removeClass().css({ display: 'none'}); 
			cloudText = $('#cloud p').text();
			$(this).attr('title',cloudText);
		});	
	} // cloud()
});	