//the first param is your Flickr developer key
//please substitute your own key here
var flickr = new FlickrAPI('7f0c3133d48a912d8baa482c670f8d5e', ''); 
var params = new Array();
params['photoset_id'] = '72157606971487641'; 
params['per_page'] = 15; 
params['api_key'] = '7f0c3133d48a912d8baa482c670f8d5e'; 
var json = flickr.callMethodJSON('flickr.photosets.getPhotos', params); 
var obj = eval('(' + json + ')');     
//var photos = obj.photos.photo;   
var photos = obj.photoset.photo;

function hide_content(){
    $("div.wide div").hide();
    return false;
};
function show(name){
    hide_content();
    $("#" + name).show();
    return false;
};

function randomizePhoto(){
    i = Math.round(Math.random() * (photos.length - 1));
    url = flickr.getPhotoURL(photos[i]);
    return url;
};

function randomImg(num){
    var inner_html = "";
    for (n = 0; n < num; n++){
        var url = randomizePhoto();
        inner_html += "<img src='" + url + "'/>";
    }
    return inner_html;
};

function news(){
	$("#morenews").show('slow');
	var innerhtml = "<a href='#' onClick='javas" + "cript:nonews();'>less news &#8593;</a>";
	$("#bt").html(innerhtml);
	return true;
};

function nonews(){
	$("#morenews").hide('fast');
	var innerhtml = "<a href='#' onClick='javas" + "cript:news();'>more news &#8595;</a>";
	$("#bt").html(innerhtml);
	return true;
};

function novice(){
	$("#morenews").show('slow');
	var innerhtml = "<a href='#' onClick='javas" + "cript:breznovic();'>manj novic &#8593;</a>";
	$("#bt").html(innerhtml);
	return true;
};

function breznovic(){
	$("#morenews").hide('fast');
	var innerhtml = "<a href='#' onClick='javas" + "cript:novice();'>več novic &#8595;</a>";
	$("#bt").html(innerhtml);
	return true;
};

;$(document).ready(function () {
    
    $("#news").css({background: "url("+ randomizePhoto() +") center"})
    $("#random").append( randomImg(3) );
    
    //When mouse rolls over
    $("li").mouseover(function(){
        $(this).stop().animate({height:'150px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });

    //When mouse is removed
    $("li").mouseout(function(){
        $(this).stop().animate({height:'50px'},{queue:false, duration:600, easing: 'easeOutBounce'})
    });    
    
});