/* funkce zmeni obrazek v okne preview */
function show_photo(file, description)
{
    //zjisteni url
    base_path = "http://" + window.location.host;
    base_path = base_path + '/';
    
    //zmena nahledu
    document.getElementById('preview').src = base_path+'uploads/photogalery/'+file;
    //zmena url v odkazech na maximalni velikost obrazku
    document.getElementById('full_image').href = base_path+'uploads/'+file;
    document.getElementById('full_image2').href = base_path+'uploads/'+file;
    //zmenime popisek
    document.getElementById('description').innerHTML = description;
    document.getElementById('preview').alt = description;
    document.getElementById('full_image').title = description;
    document.getElementById('full_image2').title = description;
}

/* funkce pro posouvani menu fotogalerie */
function carousel_move(where, max_id)
{
    //upravime max_id
    max_id = max_id -1;
    //zjistime aktualni zobrazene polozky
    //najdeme element se tridou body pomoci funkce ze scriptu v news_loader.js
    var id = getElementsByClass('normal');
    
    //vytahmene si z tohoto elementu hodnotu tagu id
    id = id[0].id;
    //vypreparujeme cislo aktuality
    id = id.split('_');
    id = id[1];
    
    //zjistime kam se mame posunout
    if(where == 'up')
    {
        var new_id = parseInt(id) - 1;
        var old_id = parseInt(id) + 2;
        
        //osetreni maximalniho poctu posunu
        if(new_id < 1) new_id = 1;
        if(new_id == 1) old_id = new_id + 3;
        if(old_id == max_id) old_id = max_id;
        
        //alert('id: '+id+', old id: '+old_id+', new id: '+new_id);
        
        //skryjeme spodni obrazek
        document.getElementById('thumb_'+old_id).className = 'hidden';
        
        //odkryjeme jeden spodni
        document.getElementById('thumb_'+new_id).className = 'normal';
    }
    
    if(where == 'down' && max_id != 3 && max_id != 2 && max_id != 1)
    {
        var new_id = parseInt(id) + 3;
        var old_id = parseInt(id);
        
        //osetreni maximalniho poctu posunu
        if(new_id > max_id) new_id = max_id;
        if(old_id == (max_id-2)) old_id = 1;
        
        //alert('id: '+id+', old id: '+old_id+', new id: '+new_id);
        
        //skryjeme horni obrazek
        document.getElementById('thumb_'+old_id).className = 'hidden';
        
        //odkryjeme jeden horni
        document.getElementById('thumb_'+new_id).className = 'normal';
    }
}
