
function showFullCn(keyid) {
    if (jQuery('#Cn_short'+keyid).css('display')=='none') {
        jQuery('#Cn_short'+keyid).show();
        jQuery('#Cn_full'+keyid).hide();
    }
    else {
        jQuery('#Cn_short'+keyid).hide();
        jQuery('#Cn_full'+keyid).show();
    }

    return false;
}

function theRotator() {
    //Set the opacity of all images to 0
    jQuery('div#rotator ul li').css({
        opacity: 0.0
    });

    //Get the first image and display it (gets set to full opacity)
    jQuery('div#rotator ul li:first').css({
        opacity: 1.0
    });

    //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('rotate()',15000);

}

function rotate() {
    //Get the first image
    var current = (jQuery('div#rotator ul li.show')?  jQuery('div#rotator ul li.show') : jQuery('div#rotator ul li:first'));

    //Get next image, when it reaches the end, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? jQuery('div#rotator ul li:first') :current.next()) : jQuery('div#rotator ul li:first'));

    //Set the fade in effect for the next image, the show class has higher z-index
    next.css({
        opacity: 0.0
    })
    .addClass('show')
    .animate({
        opacity: 1.0
    }, 1000);

    //Hide the current image
    current.animate({
        opacity: 0.0
    }, 1000)
    .removeClass('show');

};

function infoSwitch(id) {
    laduj_plik('.informations','include/ajax/informations','id_infotype='+id);
    return false;
}

function healthSwitch(id) {
    laduj_plik('.healthunits','include/ajax/health_units','id_healthtype='+id);
    return false;
}

function weatherSwitch(id) { 
    if (id>0) jQuery.cookie("defweather["+jQuery('input[name="current_lang"]').val()+"]", id, { expires: 14 });
    laduj_plik('.weather','include/ajax/weather','id='+id);
    return false;
}

function weatherChange() {
    jQuery('ul.weather').animate({
        height: 'toggle'
    }, 300);

    return false;
}


function galSwitch(id) {
    laduj_plik('.galleries','include/ajax/galleries','id='+id);
    return false;
}
 
		
function classSwitch(sel,cl1,cl2) {
    if (jQuery(sel).attr('class')==cl1)
        jQuery(sel).attr('class',cl2)
    else
        jQuery(sel).attr('class',cl1)
}

function laduj_plik(blok,plik,zmienne) {
    jQuery.ajax({
        type: 'POST',
        url: plik+".php",
        cache: false,
        data: zmienne,
				async:true,
        beforeSend: function(html){
            if (blok!='') jQuery(blok).html('<br /><center><img src="../../img/loading.gif" /></center>');
        },
        success: function(html){
            if (blok!='') jQuery(blok).html(html);
        }
    });
}









function laduj(blok,plik,dane) {
    jQuery.ajax({
	
        type: 'POST',
        url: plik+".php",
        cache: false,
        data: dane,
        beforeSend: function(html){
            jQuery(blok).html('<br /><center><img src="../../img/loading.gif" /></center>');
        },
        error: function(html){
            jQuery(blok).html('<div class="laduj_plik"> error </div>');
        },
        success: function(html){
            jQuery(blok).html(html);
        }
    });
}
