


//Höhe der fenster
function getSize() {
    var myWidth = 0, myHeight = 0;var space=0;
 
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
	if(myWidth > 1240){
		space = (myWidth-1240)/2;
		myWidth = 1240;
	}
    return [ myWidth, myHeight, space ];
}

var size = getSize();



//FLICKR ************************************************************************************

function newImage(id){
	if(id == undefined){
		imgid =$(".sidebarthumbnails:first").attr("id");
		id =imgid.replace("t_", "");
		$("#next").unbind("click");
		$("#next").click(function(){newImage(id)});
	}
	var thumbid = "#t_" + id;
	if ($(thumbid).attr("src") != undefined) {
		var thumbPath = $(thumbid).attr("src");
	}
	else {
		var thumbPath = $(".sidebarthumbnails:first").attr("src");
	}
	var path = thumbPath.replace("_s.jpg", ".jpg");
	$("#image").attr("src", path);

	if ($(thumbid).next().next().attr('id')!= undefined) {
	var newNext = $(thumbid).next().next().attr('id');
	newNext = newNext.replace("t_", "");
	}

	var newPrev =  $(thumbid).prev().prev().attr('id');

	

	$("#next").unbind('click');

	if(newNext!=''){
		$("#next").show();

		$("#next").click(function() { newImage(newNext); });
	}else{
		$("#next").hide();
	}
	$("#prev").unbind('click');
	
	if(newPrev!=undefined){
		newPrev = newPrev.replace("t_", "");
		if(newPrev!=''){
			$("#prev").show();
			$("#prev").click(function() { newImage(newPrev); });
		}else{
			$("#prev").hide();
		}
	}

	$("#t_"+id).parents().find("img").fadeTo("fast",1);
	$("#t_"+id).fadeTo("fast",0.3);
	var title = $("#"+id).attr("title");
	$("#pictitle").html(title);


}

