$(document).ready(function() 
    { 
    $("#form_odp").hide();
    //ukryj pelne teksty
    $(".forum_comment .forum_comment_full").hide();
    //ukryj pelne teksty w detalach
    $(".d_forum_comment .d_forum_comment_full").hide();
    	//ustaw wysokosci dla podkomentarzy jesli ie
    	if($.browser.msie){

	 $(".forum_subcomment").each(function(i,element){
      $(element).height($(element).outerHeight());
  });
  
  //w detalach ofery
  	 $(".d_forum_subcomment").each(function(i,element){
      $(element).height($(element).outerHeight());
  });
  }

  //ukryj wszytskie podkomentarze
  
  	 $(".forum_subcomments").each(function(i,element){
  	
       if ($(element).parents("div:first").find(".forum_comment_sign").children("img:first").attr("src")=="_img/_templates/plus_comment.gif"){
  $(element).hide();
  }
  /*else{
  $(element).parents("div:first").find(".forum_comment").css("background-color","#eaebed");
  }*/
  
  });

 // $(".forum_subcomments").hide();

    //w szczegolach oferty ukryj podkomentarze
    $(".d_forum_subcomments").hide();
    
    
  $("div.produkt_light").mouseover(function(){
       $(this).removeClass("produkt_light");
       $(this).addClass("produkt");
    }).mouseout(function(){
      $(this).removeClass("produkt");
	   $(this).addClass("produkt_light");
    });
	/*
	  $("div.produkt_blue").mouseover(function(){
		$.mydiv=$('div.produkt_wybrany');
		$.mydiv.removeClass("produkt_wybrany");
		$.mydiv.addClass("produkt_blue");
       $(this).removeClass("produkt_blue");
       $(this).addClass("produkt_wybrany");
    }).mouseout(function(){
		$.mydiv.removeClass("produkt_blue");
		$.mydiv.addClass("produkt_wybrany");
      $(this).removeClass("produkt_wybrany");
	   $(this).addClass("produkt_blue");
    });
	*/
	$("div.produkt_blue").mouseover(function(){
		   $.myNode=$(this).find(".produkt_title");
		   $.myNode2=$(this).find(".produkt_title_link");
		     $.myNode2.css("border-bottom","1px solid #505050");
		   //$.myNode.css("text-decoration","underline");
		   //$.myNode.css("text-decoration","underline");
		 //  $(this).css("cursor","pointer");//----------------30.07.09
       }).mouseout(function(){
$.myNode=$(this).find(".produkt_title");
$.myNode2=$(this).find(".produkt_title_link");
  $.myNode2.css("border-bottom","0");
		  // $.myNode.css("text-decoration","none");
		 //  $(this).css("cursor","auto");//--------------30.07.09
    });
		//-------pliki z wynikami KH KG--------//
		if ($("#szuk_cel_k").val()!=5){
$("#kkk_item").css("display","none");//ukrycie w formularzu konsolidacji
$("#kkk_item_sep").css("display","none");}
	
	/*najazd na zwykly wiersz */
	
	$.max_compare=2;
	$(".wyn_row").mouseover(function(){
		$.wasclicked=false;
		
		if ($(this).children(".row_content").attr("style")=='background-color: rgb(249, 247, 222);' || $(this).children(".row_content").attr("style")=='BACKGROUND-COLOR: #f9f7de' || $(this).children(".row_content").attr("style")=='background-color: #f9f7de' || $(this).children(".row_content").css("background-color")=='rgb(249, 247, 222)') 
        //jesli najazd byl juz na klikniety 
		{
			$.wasclicked=true;//zapamietaj by przy odjechaniu wrocic do klikniecia
		}
		$(this).children(".row_content").removeAttr("style");
		$(this).children(".row_content").css("background-color","#fff9bd");
	}).mouseout(function(){
	    if ($(this).children(".row_content").attr("style")=='background-color: rgb(255, 249, 189);' || $(this).children(".row_content").attr("style")=='BACKGROUND-COLOR: #fff9bd' || $(this).children(".row_content").attr("style")=='background-color: #fff9bd' || $(this).children(".row_content").css("background-color")=='rgb(255, 249, 189)') {
			$(this).children(".row_content").removeAttr("style");
			$(this).children(".row_content").css("background-color","#f7f7f7");
		} 
		if (($.wasclicked)&&($(this).children(".row_check").children("input:checkbox").attr("checked"))){
			$(this).children(".row_content").removeAttr("style");
			$(this).children(".row_content").css("background-color","#f9f7de");//wroc do klikniecia
		}
	   
	});
	/*
	$(".wyn_row").click(function(){
		$(this).children(".row_content").css("background-color","#f9f7de");
		if ($(this).children(".row_check").children("input:checkbox").attr("checked")){
		$(this).children(".row_check").children("input:checkbox").attr("checked","");
		$(this).children(".row_content").css("background-color","#fff9bd");
		}
		else{
		$(this).children(".row_check").children("input:checkbox").attr("checked","true");
		}
		if ($(".row_check input:checkbox:checked").length==$.max_compare) {
			$('#form_wyniki').submit();
		}
		if ($(".row_check input:checkbox:checked").length>$.max_compare) {
		alert("Można zaznaczyć tylko " + $.max_compare + " oferty!");
		}   
	});
	*/
		$(".wyn_row_first").mouseover(function(){
		$.wasclicked=false;
		if ($(this).children(".row_content_first").attr("style")=='background-color: rgb(249, 247, 222);' || $(this).children(".row_content_first").attr("style")=='BACKGROUND-COLOR: #f9f7de' || $(this).children(".row_content_first").attr("style")=='background-color: #f9f7de' || $(this).children(".row_content_first").css("background-color")=='rgb(249, 247, 222)') 
        
		//jesli najazd byl juz na klikniety 
		{
			$.wasclicked=true;//zapamietaj by przy odjechaniu wrocic do klikniecia
		}
		$(this).children(".row_content_first").removeAttr("style");
		$(this).children(".row_content_first").css("background-color","#fff9bd");
	}).mouseout(function(){
	    if ($(this).children(".row_content_first").attr("style")=='background-color: rgb(255, 249, 189);' || $(this).children(".row_content_first").attr("style")=='BACKGROUND-COLOR: #fff9bd' || $(this).children(".row_content_first").attr("style")=='background-color: #fff9bd' || $(this).children(".row_content_first").css("background-color")=='rgb(255, 249, 189)') {
			
			$(this).children(".row_content_first").removeAttr("style");
			$(this).children(".row_content_first").css("background-color","#fcfcfc");
		} 
		if (($.wasclicked)&&($(this).children(".row_check").children("input:checkbox").attr("checked"))){
			$(this).children(".row_content_first").removeAttr("style");
			$(this).children(".row_content_first").css("background-color","#f9f7de");//wroc do klikniecia
		}
	   
	});
	/*
	$(".wyn_row_first").click(function(){
	
		$(this).children(".row_content_first").css("background-color","#f9f7de");
		if ($(this).children(".row_check").children("input:checkbox").attr("checked")){
		$(this).children(".row_check").children("input:checkbox").attr("checked","");
		$(this).children(".row_content_first").css("background-color","#fff9bd");
		}
		else{
		$(this).children(".row_check").children("input:checkbox").attr("checked","true");
		}
		if ($(".row_check input:checkbox:checked").length==$.max_compare) {
			$('#form_wyniki').submit();
		}
		if ($(".row_check input:checkbox:checked").length>$.max_compare) {
		alert("Można zaznaczyć tylko " + $.max_compare + " oferty!");
		}   
	});
	*/
			$(".row_pomoc").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
    $(".row_pomoc").click(function(){
$("#doradca_pomoc_box_div").css("left",($(this).offset().left));
$("#doradca_pomoc_box_div").css("top",($(this).offset().top-100));
$("#doradca_pomoc_regulamin_dane").css("left",($(this).offset().left+10));
$("#doradca_pomoc_regulamin_dane").css("top",($(this).offset().top-90));
$("#doradca_pomoc_regulamin_produkty").css("left",($(this).offset().left+20));
$("#doradca_pomoc_regulamin_produkty").css("top",($(this).offset().top-80));

    });
    		$(".row_check").click(function(){
        
        $.parentclass=$(this).parents("div:first").attr("class");
		    if ($.parentclass=="wyn_row"){
		      $(this).parents("div:first").children(".row_content").css("background-color","#f9f7de");
		    }
		    else{//wyn_row_first
				  $(this).parents("div:first").children(".row_content_first").css("background-color","#f9f7de");
        }
		    if ($(this).children("input:checkbox").attr("checked")){
		        $(this).children("input:checkbox").attr("checked","");
	  		   if ($.parentclass=="wyn_row"){
		          $(this).parents("div:first").children(".row_content").css("background-color","#fff9bd");
		        }
		        else{//wyn_row_first
					     $(this).parents("div:first").children(".row_content_first").css("background-color","#fff9bd");
            }
           $(this).children("input:checkbox").attr("name",$(this).children("input:checkbox").attr("id"));
		    }
		      else{
    
		        $(this).children("input:checkbox").attr("checked","true");

		    }
		    for ($.i=0;$.i<$(".row_check input:checkbox:checked").length;$.i++){
		          $(".row_check input:checkbox:checked")[$.i].name="id_oferty"+($.i+1)+"_";
            }
		    if ($(".row_check input:checkbox:checked").length==$.max_compare) {
			     $('#form_wyniki').submit();
		    }
		    if ($(".row_check input:checkbox:checked").length>$.max_compare) {
		      alert("Można zaznaczyć tylko " + $.max_compare + " oferty!");
		    }   
	});
	$(".row_check input:checkbox").click(function(){
		if ($(this).attr("checked")){
		$(this).attr("checked","");
		}else{
		$(this).attr("checked","true");
		}
		
	});
	
//obsluga najazdu na wiersz z oferta sponsorowana w wywnikach
$(".row_content_spons").mouseover(function(){	
$(this).css("background-color","#fff9bd");}).mouseout(function(){
$(this).css("background-color","#F7F7F7");});
	
	
if (
//wyszukiwanie w kredytach hipotecznych
($("#szuk_bank").val()>0)||//wybranow bank
    (($("#szuk_rata_od").val()!=="")&&($("#szuk_rata_od").val()!==undefined))||//lub wpisano rate od
    (($("#szuk_rata_do").val()!=="")&&($("#szuk_rata_do").val()!==undefined))||//lub wpisano rate do
    ($("#szuk_oferta_rodzina").attr("checked"))||//lub zanzaczono rodzina na swoim
    ($("#szuk_oferta_b_prow").attr("checked"))||//bez prowizji
    ($("#szuk_oferta_b_prom").attr("checked"))||//bez promocyjnych ofert 
    ($("#szuk_oferta_b_wklad").attr("checked"))||
    //pola dla kredytow gotowkoych
    ($("#szuk_k_dowod").attr("checked"))||//na dowod osobisty
   ($("#szuk_oferta_b_ubez").attr("checked")) ||//bez wymaganego ubezp
      ($("#szuk_oferta_b_zabez").attr("checked")) ||//bez wymaganego zabez
        ($("#szuk_oferta_staly_k").attr("checked")) ||//dla stalych klinetow tylko
          ($("#szuk_oferta_naj_k").attr("checked")) ||//oporc dla naj klientow
          //pole tylko dla kredytu samochodowego
          ($("#szuk_marka_").attr("checked")) ||//wybrano marke
          //dla kart kredytoweych
          ($("#szuk_bez_opl_wyd").attr("checked"))||//bez oplat za wydanie
          ($("#szuk_oferta_b_co").attr("checked"))||//bez ofert cobrandowcyh
          ($("#szuk_oferta_dzien").attr("checked"))||//z mozliwoscia wyboru dnia zplaty kredytu
          //lokaty bankowe
          ($("#szuk_oferta_b_konta").attr("checked"))||//bez wymaganego zakladania konta
           ($("#szuk_oferta_l_online").attr("checked"))||//lokata online
            ($("#szuk_oproc_l").val()>0)||//oprocentowanie zmienne lub stale
           //produkty strukturyzowane
           ($("#szuk_oferta_oplata").attr("checked"))||//oplata wstepna
             ($("#szuk_oferta_wyjscie").attr("checked"))||//oplata za wyjscie
              ($("#szuk_oferta_gwarancja").attr("checked"))||//gwarancja kapitalu
              //konta osobiste
              ($("#debet_na_koncie").attr("checked"))||//mozliwosc debetu
              ($("#bez_oplaty_prowadzenie").attr("checked"))||//bez oplaty za prowadzenie
              ($("#bez_oplaty_przelewy_internetowe").attr("checked"))||//bez oplaty przelewe internetowy
              ($("#bez_oplaty_wyplaty_bankomat_z").attr("checked"))//bez oplaty za bankomat zewnetrzny
  
              
          
    )//bez wkladu wlasnego
    {
      	$("#show_more_opt").hide();
    	 $('#more_option').show();
	     $("#hide_more_opt").show();
    }else{
	$('#more_option').hide();
	$("#hide_more_opt").hide();}
	/*kursory jak na link*/
	  $("#show_more_opt").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
	
	$("#hide_more_opt").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
	
	/*wybor opcji wyszukiwania - pokazywanie i ukrywanie zaawansowanych opcji*/
	$("#show_more_opt").click(function(){
	$("#hide_more_opt").show();
	$("#more_option").show();
	$(this).hide();
	});
	
	$("#hide_more_opt").click(function(){
	$(this).hide();
	$("#show_more_opt").show();
	$("#more_option").hide();
	});
	/*wybrany produkt - przeladowanie strony*/ 
	$("#szuk_prod").change(function(){

	if ($(this).val().toLowerCase()==="kredyty samochodowe"){
		$.loadpage="../kredyty_samochodowe/?p=1";
	}
	else if ($(this).val().toLowerCase()==="lokaty strukturyzowane")
	{
		$.loadpage="../lokaty_strukturyzowane/?p=1";
	}
		else if ($(this).val().toLowerCase()==="konta bankowe")
	{
		$.loadpage="../konta_bankowe/?p=1";
	}
			else if ($(this).val().toLowerCase()==="kredyt hipoteczny")
	{
		$.loadpage="../kredyty_hipoteczne/?p=1";
	}
	else if ($(this).val().toLowerCase()==="kredyt gotówkowy")
	{
		$.loadpage="../kredyty_gotowkowe/?p=1";
	}
		else if ($(this).val().toLowerCase()==="lokaty bankowe")
	{
		$.loadpage="../lokaty_bankowe/?p=1";
	}
	window.document.location.href=$.loadpage;
	});
	/*obsluga komentarzy*/
	/*
	$(".forum_comment_sign").click(function(){
	$.father=$(this).parents("div:first");
	$.srctext=$(this).children("img:first").attr("src");
	if ($.srctext.indexOf("plus")>=0){
	$.father.siblings('div').css("display","block");
		$(this).children("img:first").attr("src","_img/_templates/minus_comment.gif");
	}
	else{
		$.father.siblings('div').css("display","none");
		$(this).children("img:first").attr("src","_img/_templates/plus_comment.gif");
	}
	});
	*/
	/*najazd na komentarz*/
   $(".forum_comment").mouseover(function () {
     $(this).css('background-color', '#eaebed');
    }).mouseout(function(){
      $(this).css('background-color', 'transparent');
    });
	$(".forum_subcomment").mouseover(function () {
     $(this).css('background-color', '#eaebed');
     
    }).mouseout(function(){
      $(this).css('background-color', 'transparent');
    });
	
	   $(".d_forum_comment").mouseover(function () {
     $(this).css('background-color', '#eaebed');
    }).mouseout(function(){
      $(this).css('background-color', 'transparent');
    });
	$(".d_forum_subcomment").mouseover(function () {
     $(this).css('background-color', '#eaebed');
    }).mouseout(function(){
      $(this).css('background-color', 'transparent');
    });
	//nacisniecie plusika rozwijanie
	$(".forum_comment_sign").click(function(){
	   $.myNode=$(this).parents('div:first').parents('div:first').find(".forum_subcomments");
	   if ($.myNode.css("display")=="none"){
	     $.myNode.css("display","block");
	     $(this).parents('div:first').find(".forum_comment_full").show();
	     $(this).parents('div:first').find(".forum_comment_short").hide();
	     $(this).children("img:first").attr("src","_img/_templates/minus_comment.gif");
    }
	 else{
        $.myNode.css("display","none");
        $(this).parents('div:first').find(".forum_comment_full").hide();
	     $(this).parents('div:first').find(".forum_comment_short").show();
		    $(this).children("img:first").attr("src","_img/_templates/plus_comment.gif");
	 }
	});
	//najazd na plusik
		$(".forum_comment_sign").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
    
    	//najazd na plusik
		$(".d_forum_comment_sign").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
	
	//przy detalach oferty d- detale
	$(".d_forum_comment_sign").click(function(){
	   $.myNode=$(this).parents('div:first').parents('div:first').find(".d_forum_subcomments");
	   if ($.myNode.css("display")=="none"){
	     $.myNode.css("display","block");
	     $(this).parents('div:first').find(".d_forum_comment_full").show();
	     $(this).parents('div:first').find(".d_forum_comment_short").hide();
	     $(this).children("img:first").attr("src","_img/_templates/minus_comment.gif");
    }
	 else{
        $.myNode.css("display","none");
        $(this).parents('div:first').find(".d_forum_comment_full").hide();
	     $(this).parents('div:first').find(".d_forum_comment_short").show();
		    $(this).children("img:first").attr("src","_img/_templates/plus_comment.gif");
	 }
	});
	
	
	$(".forum_show_all span").mouseover(function(){
       $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
		$(this).css("text-decoration","underline");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#505050");
		$(this).css("text-decoration","none");
    });
    
		$(".d_forum_show_all span").mouseover(function(){
       $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
		$(this).css("text-decoration","underline");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#505050");
		$(this).css("text-decoration","none");
    });
	/*pokaz wszystkie */
	$(".forum_show_all").click(function(){
	if ($(".forum_show_all span").html().indexOf("ukryj")>=0){
	 $(".forum_show_all span").html(" pokaż wszystkie komentarze");
	 $(".forum_subcomments").hide();
	  $(".forum_comment .forum_comment_full").hide();
	   $(".forum_comment .forum_comment_short").show();
		$(".forum_comment_sign img").attr("src","_img/_templates/plus_comment.gif");
  }
	else{
		  $(".forum_comment .forum_comment_full").show();
	   $(".forum_comment .forum_comment_short").hide();
    $(".forum_show_all span").html(" ukryj wszystkie komentarze");
	$(".forum_subcomments").show();
	//ustaw wysokosci
//	$(".forum_subcomment").each(function(i,element){
//$(element).height($(element).outerHeight());
//});
	
	
	
	
		$(".forum_comment_sign img").attr("src","_img/_templates/minus_comment.gif");
		}
	});
	
	
	$(".d_forum_show_all").click(function(){
	if ($(".d_forum_show_all span").html().indexOf("ukryj")>=0){
	 $(".d_forum_show_all span").html(" pokaż wszystkie komentarze");
	 $(".d_forum_subcomments").hide();
	  $(".d_forum_comment .d_forum_comment_full").hide();
	   $(".d_forum_comment .d_forum_comment_short").show();
		$(".d_forum_comment_sign img").attr("src","_img/_templates/plus_comment.gif");
  }
	else{
		  $(".d_forum_comment .d_forum_comment_full").show();
	   $(".d_forum_comment .d_forum_comment_short").hide();
    $(".d_forum_show_all span").html(" ukryj wszystkie komentarze");
	$(".d_forum_subcomments").show();
		$(".d_forum_comment_sign img").attr("src","_img/_templates/minus_comment.gif");
		}
	});
	
	$(".switch").mouseover(function(){
	   $(this).css("color","#3364ac");
	   $(this).css("text-decoration","underline");
	   $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#505050");
	   $(this).css("text-decoration","");
    });
	$("#konta_analizy .switch").click(function(){
		$("#konta_analizy").css("display","none");
		$("#konta_nowosci").css("display","block");
	});
		$("#konta_nowosci .switch").click(function(){
		$("#konta_nowosci").css("display","none");
		$("#konta_analizy").css("display","block");
	});
	
	//wyniki samochodowe
	$("#szuk_marka_sel").css("display","none");//ukryj na poczatku
	
  $("#szuk_marka_").click(function(){
  if (this.checked){
  $("#szuk_marka_sel").css("display","block");
  }
  else{
    $("#szuk_marka_sel").css("display","none");
  }
  });
	$(".forum_odpowiedz_plus").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
    	$(".d_forum_odpowiedz_plus").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
	
	//STARE----------------------------------------------
	//$(".forum_odpowiedz").click(function(){
	//   $.father=$(this).parents("div:first");  
	//   $.father.after($("#form_odp"));
	//  $("#form_odp").show();  
	//});
	$(".forum_odpowiedz, .d_forum_odpowiedz").click(
		function()
		{
    		$.up = $(this).parent("div").parent("div");
    		$.x = $(document).find(".hide[style='display:block']").hide();
			$(".hide").each(
				function (i)
				{
					if (this.style.display == "block")
					{
						this.style.display = "none";
					}
      			}
			);
    		$.up.children(".hide").show();
		}
	);
	//zmienione: tomek
	//---------------------------------------------------
	
		//$(".d_forum_odpowiedz").click(function(){
	   //$.father=$(this).parents("div:first");  
	   //$.father.after($("#form_odp"));
	  //$("#form_odp").show();
	   
	//});
		$(".forum_odpowiedz_text").mouseover(function(){
       $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
		$(this).css("text-decoration","underline");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#387ACA");
		$(this).css("text-decoration","none");
    });
    
    		$(".d_forum_odpowiedz_text").mouseover(function(){
       $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
		$(this).css("text-decoration","underline");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#387ACA");
		$(this).css("text-decoration","none");
    });

	$.limit_kom=320;
	 $(".f_odp_koment textarea").keyup(function(){

      $.text = $(this).val(); 
      $.textlength = $.text.length;
      if($.textlength > $.limit_kom)
      {
        alert('Maksymalna dlugosc komentrza wynosi ' +$.limit_kom+ ' znaków');
        $(this).val($.text.substr(0,$.limit_kom));
      }
});
	$.limit_tyt=120;
	 $(".f_odp_tytul input").keyup(function(){

      $.text = $(this).val(); 
      $.textlength = $.text.length;
      if($.textlength > $.limit_tyt)
      {
        alert('Maksymalna dlugosc tytulu wynosi ' +$.limit_tyt+ ' znaków');
        $(this).val($.text.substr(0,$.limit_tyt));
      }
});
	$.limit_aut=12;
	 $(".f_odp_autor input").keyup(function(){

      $.text = $(this).val(); 
      $.textlength = $.text.length;
      if($.textlength > $.limit_aut)
      {
        alert('Maksymalna dlugosc tytulu wynosi ' +$.limit_aut+ ' znaków');
        $(this).val($.text.substr(0,$.limit_aut));
      }
});

  		$(".close").mouseover(function(){
       $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
		$(this).css("text-decoration","underline");
    }).mouseout(function(){
      $(this).css("cursor","auto");
	  $(this).css("color","#e2e3e5");
		$(this).css("text-decoration","none");
    });
    
    
    //STARE----------------------------------------------
    //$(".close").click(function(){
    //$("#form_odp").hide();
    //});
    //
    $(".close").click(
		function()
		{
			$(this).parent("div").hide();
			$("#form_odp_main").next("center").show();
		}
	);
    //zmienione: tomek
		//---------------------------------------------------
		$(".f_odp_sub input").css("cursor","pointer");
		//---------------------------------------------------
		//DODANE: tomek
		$(".forum_add_comment_text, .d_kom_head_kom_text").click(
			function()
			{
				$("#form_odp_main").next("center").hide();
				$(".hide").each(
				function (i)
				{
					if (this.style.display == "block")
					{
						this.style.display = "none";
					}
      			}
			);
				$("#form_odp_main").show();
			}
		);
		$(".forum_add_comment_ico, .d_kom_head_kom_ico").click(
			function()
			{
				$("#form_odp_main").next("center").hide();
				$(".hide").each(
				function (i)
				{
					if (this.style.display == "block")
					{
						this.style.display = "none";
					}
      			}
			);
				$("#form_odp_main").show();
			}
		);
		$(".forum_add_comment_text").css("cursor","pointer");
		$(".forum_add_comment_ico").css("cursor","pointer");
			$("#form_odp form, #form_odp_main form").submit(
			function()
			{
		
				val = true;
				$.text = '';
				if( $(this).find("input[name='odp_autor']").val() == '')
				{
					$.text += 'Pole <strong>Autor</strong> jest puste. <br>';
					val = false;
				}
				if( $(this).find("input[name='odp_tytul']").val() == '')
				{
					$.text += 'Pole <strong>Tytuł</strong> jest puste. <br>';
					val = false;
				}
				if( $(this).find("textarea[name='odp_komentarz']").val() == '')
				{
					$.text += 'Pole <strong>Komentarz</strong> jest puste. <br>';
					val = false;
				}
				if( $(this).find("input[name='odp_obrazek']").val() == '')
				{
					$.text += 'Pole <strong>Kod</strong> jest puste. <br>';
					val = false;
				}
				else
				{//sprawdz czy kod z obrazka sie zgadza
//sprawdz czy kod z obrazka sie zgadza
				//wywoluje ajaxa - synchronicznie (async:false),metoda get dla pliku check_captcha przekazuje kod z obraza
             $.ajax({
                type: "GET",
                url: "../_inc/check_captcha.php",
                data: ({captcha_val:$(this).find("input[name='odp_obrazek']").val()}),
                async: false,
                success: function(data){
                  if(data=="-1"){
                  $.text += 'Wpisz poprawny kod.<br>';
                  val = false;
                  }
                }
              });
            
			}
			  if(!val)
				{
				  $(this).find("div[class='error']").html($.text);
					$(this).find("div[class='error']").show();
				}
				return val;	
			
			
			}
		);
//wywolanie aby uzupelnic obrazki
		$.ajax({
                type: "GET",
                url: "../_img/obrazek_refresh.php",
                async: false,
                success: function(data){
					           $(".f_odp_obrazek_aut").each(function(i,element){
                        $(element).children("img:first").attr("src",data);});
                        $("#kod_obrazek").attr("src",data);//uzupelnij przy newsletterze
                        }
              });
    



		//przeladowanie obrazka
		$(".refresh_obrazek").click(
    	function()
			{
			 $.ajax({
                type: "GET",
                url: "../_img/obrazek_refresh.php",
                async: false,
                success: function(data){
					           $(".f_odp_obrazek_aut").each(function(i,element){
                        $(element).children("img:first").attr("src",data);});
                        }
              });
           

			}
    );
		
		$(".full_odp").click(
			function()
			{
				$("#form_odp").show();
			}
		);
		$(".forum_search_button_input").click(	
			function()
			{
				wart = $("#forum_szukaj").find("input[name='forum_word_search']").val();
				
				wart = wart.replace(/</g, '_');
				wart = wart.replace(/>/g, '_');
				wart = wart.replace(/\*/g, '_');
				wart = wart.replace(/:/g, '_');
				wart = wart.replace(/&/g, '_');
				wart = wart.replace(/"/g, '_');
				wart = wart.replace(/'/g, '_');
				wart = wart.replace(/%/g, '_');
				wart = wart.replace(/\./g, '_');
				
				
				wart = wart.replace(/\s/g, '_');
				wart = wart.replace(/-/g, '_');
				
				addr = "forum-szukaj,wszystkie-"+wart+"-.html";
				window.location = addr;
			}
		);
		$.limit_szukaj = 50;
		$(".forum_search_field input").keyup(
			function()
			{
				$.text = $(this).val(); 
				$.textlength = $.text.length;
				if($.textlength > $.limit_szukaj)
				{
					alert('Maksymalna dlugość wynosi ' +$.limit_szukaj+ ' znaków');
					$(this).val($.text.substr(0,$.limit_szukaj));
				}
			}
		);
		$(".pytajnik").mouseover(
			function()
			{
				of = $(this).offset();

			   // top=($(this).parents("div:first").find(".opcje_troj").children("img:first").offset().top);
			  
				//$("#chmurka").css("top", of.top - $("#chmurka").height() - 3);
		

				$("#chmurka").css("left", of.left + 7);
				idp = $(this).attr("name");
				$.get("/ajax/pytajnik.php", 
					{id: idp}, 
					function(data)
					{
					  //$("#chmurka .m").html("");
						$("#chmurka .m").html(data);
						$("#chmurka").css("top", of.top - $("#chmurka").height() - 3);
					}
				);
				
				$("#chmurka").show();	
       

			}
		);
		$(".pytajnik").mouseout(
			function()
			{
				$("#chmurka").hide();
			}
		);

   //w podkatoegoria z ocena produktow zamiana listy artykulow na produkt
   $(".art_prod span").mouseover(function(){
    $(this).css("cursor","pointer");
	   $(this).css("color","#3364AC");
   }).mouseout(function(){
   $(this).css("cursor","auto");
    $(this).css("color","#505050");
   });
   $(".art_prod span").click(function(){
   if ($(this).html().indexOf("produkty")>=0){
  $(this).parents("div:first").parents("div:first").find(".kat_list").hide(); 
   $(this).parents("div:first").parents("div:first").find(".prod_list").show();
   $(this).html("artykuly");
   } else{
      $(this).parents("div:first").parents("div:first").find(".kat_list").show(); 
   $(this).parents("div:first").parents("div:first").find(".prod_list").hide();
  $(this).html("produkty");
   }
   
   });

  // if ($("#szuk_cel_k".val()==="Pożyczka")&&($("#szuk_cel_k").val()!==undefined)){
   if ($("#szuk_cel_k").val()==3)
{
  
       $("#rynek_item").hide();
    $("#rynek_item_sep").hide();
  $("#przedmiot_item").show();
    $("#przedmiot_item_sep").show();
   $("#przedmiot_pytaj").css('padding-top','4px');
    $("#przedmiot_select").css('padding-top','2px');
    $("#przedmiot_text").css('padding-top','0px');
    $("#przedmiot_text").css('line-height','13px');
   $("#przedmiot_text").html("przedmiot zabezpieczenia");
   $("#kkk_item").hide();
    $("#kkk_item_sep").hide();
   }
   
    /* obsluga dzialania kalkulatorow*/

    /*obsluga kalkulatora kh*/
$("#kalk_kh").click(function(){
//ukryj pozostale
    $("#kg_kalks").removeClass();
    $("#kg_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_kg").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    $("#ks_kalks").removeClass();
    $("#ks_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_ks").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    $("#kk_kalks").removeClass();
    $("#kk_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_kk").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    $("#in_kalks").removeClass();
    $("#in_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_in").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
//pokaz hipoteczny
    $("#kh_kalks").removeClass();
    $("#kh_kalks").addClass("showed_kalk"); 
      $.img=$("#kalk_kh").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat_w_dol.gif"); 
});
   /*oblsuga kalkulatora kg,ks,kk,in*/
  $("#kalk_kg,#kalk_ks,#kalk_kk,#kalk_in").click(function(){
   
//hide all and show only clicked
    $("#kh_kalks").removeClass();
    $("#kh_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_kh").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    
    $("#kg_kalks").removeClass();
    $("#kg_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_kg").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    
    $("#ks_kalks").removeClass();
    $("#ks_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_ks").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    
    $("#kk_kalks").removeClass();
    $("#kk_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_kk").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    
    $("#in_kalks").removeClass();
    $("#in_kalks").addClass("hidden_kalk");
    $.img=$("#kalk_in").find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat.gif");
    //show only klicked
    $(this).next().next().removeClass();
    $(this).next().next().addClass("showed_kalk");
    $(this).children("div:first").removeClass();
    $(this).children("div:first").addClass("opcje_troj2");
    $.img=$(this).find("div:first img");
    $.img.attr("src","../_img/_templates/trojkat_w_dol.gif");
   });
   
     $("#kalk_kh, #kalk_kg,#kalk_ks,#kalk_kk,#kalk_in").mouseover(function(){
       $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor","auto");
    });
   /*najazd na schowe*/
     $(".schowek_add").mouseover(function(){
     	$("#chmurka .m").html("<span style='font-size:11px'>Dodaj ofertę do schowka</span>");
     		$.of = $(this).offset();
        $("#chmurka").css("left", $.of.left + 7);
				$("#chmurka").css("top", $.of.top - $("#chmurka").height() - 3);
     	  $("#chmurka").show();
    }).mouseout(function(){
         	$("#chmurka").hide();
    });
         $(".schowek_rem").mouseover(function(){
     	$("#chmurka .m").html("<span style='font-size:11px'>Usuń ofertę ze schowka</span>");
     		$.of = $(this).offset();
        $("#chmurka").css("left", $.of.left + 7);
				$("#chmurka").css("top", $.of.top - $("#chmurka").height() - 3);
     	  $("#chmurka").show();
    }).mouseout(function(){
         	$("#chmurka").hide();
    });
    
    	$(".refresh_obrazek").mouseover(function(){
	
		  $(this).css("cursor","pointer");
       }).mouseout(function(){

		 $(this).css("cursor","auto");
    });
    /*do sitemapy*/
       $(".sitemap_ico").mouseover(function () {
     $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor", "auto");
    });
           $(".nl_refresh_obrazek").mouseover(function () {
     $(this).css("cursor","pointer");
    }).mouseout(function(){
      $(this).css("cursor", "auto");
    });
      //przeladowanie obrazka w newsletterze - polec znajomemu
      $(".nl_refresh_obrazek").click(
    	function()
			{
			 $.ajax({
                type: "GET",
                url: "../_img/obrazek_refresh.php",
                async: false,
                success: function(data){
                        $("#kod_obrazek").attr("src",data);
                        }
              });
			}
    );
    
    $(".shadow_logo_doradca_box").mouseover(function(){
	
		  $(this).find(".shadow_box_head_inside_doradca").css("border-left","2px solid #d70628");
		  $(this).find(".shadow_box_head_inside_doradca").css("border-top","2px solid #d70628");
		  $(this).find(".shadow_box_head_inside_doradca").css("border-right","2px solid #d70628");
		  $(this).find(".shadow_div_doradca").css("border-left","2px solid #d70628");
		  $(this).find(".shadow_div_doradca").css("border-bottom","2px solid #d70628");
		  $(this).find(".shadow_div_doradca").css("border-right","2px solid #d70628");
		  $(this).css("cursor","pointer");
       }).mouseout(function(){

		  $(this).find(".shadow_box_head_inside_doradca").css("border-left","2px solid #f0c311");
		  $(this).find(".shadow_box_head_inside_doradca").css("border-top","2px solid #f0c311");
		  $(this).find(".shadow_box_head_inside_doradca").css("border-right","2px solid #f0c311");
		  $(this).find(".shadow_div_doradca").css("border-left","2px solid #f0c311");
		  $(this).find(".shadow_div_doradca").css("border-bottom","2px solid #f0c311");
		  $(this).find(".shadow_div_doradca").css("border-right","2px solid #f0c311");
		  $(this).css("cursor","auto");
    });
    
	}

); 


