 
 
jQuery(document).ready(function(){
 
 
  jQuery('#facebook_box_icon img').click(function(){
	       if(jQuery("#facebook_box_content").css('display') == 'block'){
	           jQuery("#facebook_box_content").hide(300);
	           jQuery("#facebook_box").animate({
                width: 48,
                }, 300 );
              
	       }else{
	           jQuery("#facebook_box").animate({
                width: 255,
                }, 300 );
              jQuery("#facebook_box_content").show(300); 
	       }
        });
        
        jQuery('#facebook_box_icon img').hover(function(){
            jQuery('#facebook_box_icon img').click();
        }, function(){});
 
    jQuery('.left ul li span').click(function(){
        var id=jQuery(this).attr('rel');
        var par=jQuery(this).parent();

        var bef =jQuery.cookie("menusel");
        
        if (bef!=id) {
            jQuery.cookie("menusel", "0", { expires: 1 });
            //jQuery('.left ul.childsmenu').each(function (i) {
            jQuery('li ul',par.parent().parent()).each(function (i) {
                if (jQuery('span',jQuery(this).parent()).attr('rel')==bef) {
                    jQuery(this).hide('400');
                    classSwitch(jQuery(this).parent(),'childsup','childsdown');
                }

                /*if(parseInt(jQuery(this).css('height'))>1) {
                    jQuery(this).animate({
                    height: '0'
                    }, 300, function() {
                        classSwitch(jQuery(this).parent(),'childsup','childsdown');                        
                        jQuery(this).hide();
                    });
                }*/
            });
        }



        if (id>0) {
            jQuery('ul',par).animate({
                height: 'toggle'
            }, 300, function() {
                classSwitch(jQuery(this).parent(),'childsup','childsdown');

                if (jQuery.cookie("menusel")==id)
                    jQuery.cookie("menusel", "0", { expires: 1 });
                else
                    jQuery.cookie("menusel", id, { expires: 1 });

            });

            
        }

        return true;
    });


    jQuery('select[name=lang]').change(function(){
       jQuery(this).parent().submit();
    });

    jQuery('.lang_button').click(function(){
        var id = jQuery(this).attr('id');
        var lang = id.substr(0,2);
        jQuery('select[name=lang]').val(lang).parent().parent().submit();
    });

 
   
    
    infoSwitch(2);

    weatherSwitch(0);

    galSwitch(0);

    //Load the slideshow
    theRotator();

    jQuery('#size1').click(function() {
       jQuery('li').css('font-size','12px');
       jQuery('p').css('font-size','12px');
       //jQuery.cookie("sizesel", '#size1', { expires: 1 });
       jQuery.cookie("sizesel", 'null', { expires: 1 });
    });

    jQuery('#size2').click(function() {
       jQuery('li').css('font-size','14px');
       jQuery('p').css('font-size','14px');
       jQuery.cookie("sizesel", 14, { expires: 1 });
    });

    jQuery('#size3').click(function() {
       jQuery('li').css('font-size','18px');
       jQuery('p').css('font-size','18px');
       jQuery.cookie("sizesel", 18, { expires: 1 });
    });


    var fontMin = 10;
    var fontMax = 22;

    jQuery('#zoomin').click(function() {
       var curFont = parseInt(jQuery('p').css('font-size'))
       var needFont = curFont+1;

       if (needFont<=fontMax) {
           jQuery('p').css('font-size',needFont+'px');
           jQuery('li').css('font-size',needFont+'px');
       }

       jQuery.cookie("sizesel", needFont, { expires: 1 });
    });

    jQuery('#zoomout').click(function() {
       var curFont = parseInt(jQuery('p').css('font-size'));
       var needFont = curFont-1;

       if (needFont>=fontMin) {
           jQuery('p').css('font-size',needFont+'px');
           jQuery('li').css('font-size',needFont+'px');
       }

       jQuery.cookie("sizesel", needFont, { expires: 1 });
    });




    var current_size = jQuery.cookie("sizesel");
    
    if (current_size!=null) {
        //jQuery(current_size).click();
        jQuery('p').css('font-size',current_size+'px');
        jQuery('li').css('font-size',current_size+'px');
    }


    jQuery('.topAnchor').click(function() { 
       jQuery('html body').animate({scrollTop: (jQuery("a[name='info_top']").offset().top)-20},500);
       window.location.hash = "#";
       return false;
    });

    jQuery('.helth_cities a').click(function() {
       var h = jQuery(this).attr('href').replace('#','');
       jQuery('html body').animate({scrollTop: (jQuery("a[name='"+h+"']").offset().top)-20},500);
       window.location.hash = "#"+h;
       return false;
    });




    jQuery('form.pool').submit(function() {
       pool = '#'+jQuery(this).attr('id');

       if (jQuery(pool+' input[name="answer"]:checked').val() > 0) {
           var d  = 'answer='+jQuery(pool+' input[name="answer"]:checked').val()+'&ajax=1';

           jQuery.ajax({
		type: 'POST',
		url: jQuery(pool).attr('action'),
		cache: false,
		data: d,
                beforeSend: function(html){
                    
		},
		success: function(html){

                    jQuery(pool).parent().html(jQuery(html).contents().find("#output").html());
		}
            });


           return false;

       }
       else {
           //alert('Wybierz odpowiedź');
           return false;
       }
       
    });






    
});

jQuery(function() {
    jQuery(function() {
        jQuery('a[@rel*=lightbox]').lightBox();
    });

});

