var loadedNews = 0;

function loadNews(id) {
	var news = $('[id^=news_]');
	if (id<0 || id>=news.length) return;
	
	news.hide();
	news.eq(id).show();
	loadedNews = id;
}

$(document).ready(function() {
//	$("#rssBoxes ul li div ul").not("ul:first").slideUp("slow");
//	$("#rssBoxes ul li div div div a").click(function() {
//		$("#rssBoxes ul li div ul:visible").slideUp("slow");
//		$(this).parent("#rssBoxes ul li div ul").next("ul").slideDown("slow");
//	});
});

function slideRSS(id) {
	$("#rssBoxes ul li div ul:not(:eq("+id+")):visible").slideUp("slow");
	$("#rssBoxes ul li div ul:eq("+id+"):not(:visible)").slideDown("slow");
}

function rozwin(id) {
	$("#"+id).slideToggle(200);
}

function pobierzDane (plik, id, kotwica) {
	$("#loading").ajaxStart(function(){    
		$(this).show();  
	});
	$("#loading").ajaxStop(function(){    
		$(this).hide();  
	});
	$.ajax({
   type: "POST",
   url: plik,
   data: "id="+id,
   success: function(html){
	 $("#commentsContent").html(html);
	 document.location.href="#"+kotwica;
   }
 });
}

function MM_setTextOfTextfield(objId,x,newText) { //v9.0
  with (document){ if (getElementById){
    var obj = getElementById(objId);} if (obj) obj.value = newText;
  }
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}



function wyslijFormularzPolec(formularz) {
	var params = {};
	var pola = $(':input', $(formularz));
	for(var i=0 ; i<pola.length ; i++) {
		params[pola.eq(i).attr('name')] = pola.eq(i).val();
	}

	if (pola.eq(0).val() == '' || pola.eq(1).val() == '' || pola.eq(2).val() == '') {
		$('#polecInfo').html('<b>wypełnij wszystkie pola.</b>');
		return;
	}

	$('#polecInfo').html('wysyłam...');
	$.post(formularz.attr('action'), params, function(data){
		$('#polecInfo').html(data);
		setTimeout("$('#commentBox').slideUp(500); $('#polecInfo').html('');", 2000);
	});	
}


function showInformation(lp) {
	$('.news').hide();
	$('.news').eq(lp).show();
	$('.newsList ul li a').removeClass('selected');
	$('.newsList ul li a').eq(lp).addClass('selected');
}
