function advert_list__show_advert(id, holder, path, visited_class)
{
    sw = screen.width;
    sh = screen.height;
    
    //w = 800;
    //h = 500;
    
    w = Math.round(sw / 2);
    if (w > 1000 || w < 700){
        w = 900;
    }
    
    h = Math.round(w / 1.5);
    
    url = path + id + '.html';
    wname = 'advert_' + id;
    st = 1;
    tool = 0;
    scrolll = 1;
    resize = 1;
    
    window.open(url, wname, 'width=' + w + ', height=' + h + ', status=' + st + ', toolbar=' + tool + ', scrollbars=' + scrolll + ', resizable=' + resize);
    
    if (visited_class) {
        holder.className = visited_class
    } else {
        holder.className = 'visited_advert_list';
    }
}

function advert_list__highlight(t, h)
{   
    h.style.background = t;
}

function advert_list__highlight2(t, h)
{
    var bc;
    
    if (t == 1){
        bc = '#91cefa';
    } else {
        bc = 'none';
    }
    
    h.style.background = bc;
}

/*
* Delete photo
*/
function delete_photo(input_object,id,img,pathh)
{
    fetch_object('forma').action = pathh;

    fetch_object('pic_id').value = id;
    
    fetch_object('del').value = img;
    
    document.forms['forma'].submit();
}

/*
* Upload photo
*/
function upload_photo(input_object,pathh)
{
    fetch_object('forma').action = pathh;

    id = input_object.id;

    fetch_object('pic_id').value = id;
    
    fetch_object(id + 'pi').style.display = '';
    
    input_object.style.visibility = 'hidden';
    
    document.forms['forma'].submit();
}

/*
* Save advert
*/
function save_advert()
{
    f = fetch_object('forma');
    f.target = '';
    f.action = 'add.php'; 
    f.submit();
}
