	 getTwitters('tweet', { 
  id: 'fictitiousis', 
  count: 1, 
  enableLinks: true, 
  ignoreReplies: true, 
  clearContents: true,
  template: '"%text%" <br /> '
});

function displayAuthor(name)
{
	for (var i=0; i<shortname.length; i++) {
	
		if (shortname[i] == name)
		{
			getAuthorByName(name);
		}
	
	}

}

function getAuthorByName(name)
{
	$('.left').show();
	$('.left').unbind('click');
	$('.left').bind('click', function(){
	getAuthors();
	});
    $("#ajaxgaukur").load("/author.php?cat="+cat+"&name="+name,'',stilla); 	
    currentAuthor = id;

}


function callFancy(my_href) {
var j1 = document.getElementById("hiddenclicker");
j1.href = my_href;
$('#hiddenclicker').trigger('click');

}
function callyoutubeFancy(my_href) {
var j1 = document.getElementById("youtubehiddenclicker");
j1.href = my_href;
$('#hiddenclicker').trigger('click');
}

var currentAuthor = 0;

function openPoetry(id)
{
    $("#ajaxgaukur").load("/poem.php?id="+id,'',stilla); 	
	$('.left').unbind('click');
	$('.left').bind('click', function(){
	getAuthor(currentAuthor);
	});

}

function getAuthor(id)
{
	$('.left').show();
	$('.left').unbind('click');
	$('.left').bind('click', function(){
	getAuthors();
	});
    $("#ajaxgaukur").load("/author.php?cat="+cat+"&id="+id,'',stilla); 	
    currentAuthor = id;
}

function getAuthors()
{
	$('.left').hide();
    if (cat == 1) {
    $("#ajaxgaukur").load("/authors.php?cat="+cat,'',stilla); 	
    }
    if (cat == 2) {
    $("#ajaxgaukur").load("/authors_de.php?cat="+cat,'',stilla); 	
    }
    if (cat == 3) {
    $("#ajaxgaukur").load("/authors_is.php?cat="+cat,'',stilla); 	
    }
    currentAuthor = id;
}

function stilla()
{
var skjalStaerd = $(document).height();
$('#dim').height(skjalStaerd);
var skjalBreidd = $(document).width();
var x = $('.msgbox').width();
var y = $('.msgbox').height();
var hvarx = (skjalBreidd / 2) - (x /2);
var hvary = 50;
$('.msgbox').css({'top': hvary, 'left': hvarx } )
$('.closebox').css({'top': hvary - 10, 'left': hvarx + (x - 20), 'position': 'absolute', 'z-index': 220   } )
$('.left').css({'cursor': 'pointer'});
$('.left').css({'top': hvary - 10, 'left': hvarx - 10, 'position': 'absolute', 'z-index': 220   } )

}
function syna()
{
$('html,body').animate({scrollTop: 0}, 0);
$('#dim').show();
stilla();
}

var resizeTimer = null;


$(document).ready(function(){



stilla();
$(window).bind('resize', function() {
$('html,body').animate({scrollTop: 0}, 0);
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(stilla, 100);
});
$('.closebox').css({'cursor': 'pointer'});
$('.closebox').bind('click', function(){
$('#dim').hide();
$('#ajaxgaukur').html('');
});

$('a.fancylink').bind('click', function(e){
e.preventDefault();
$('#ajaxgaukur').html();
$('#dim').show();
$('#ajaxgaukur').load($(this).attr('href'),'','syna');
});

$('a.fancyyoutube').bind('click', function(e){
e.preventDefault();
$('#ajaxgaukur').html();
$('#dim').show();
htmlid = $(this).attr('href');
htmlid.replace("#", '');
htmlid = $(htmlid).html();
$('#ajaxgaukur').html(htmlid);
syna();
});


if(location.hash != '')
				{
					var hash = location.hash;
					hash = hash.replace("#", '');
					if (hash != "")
					{
					var itemid = hash+'-large';
					var cat = hash + '-cat';
					displayAuthor (hash);
					}
					else
					{
						location.hash = "";
					}
				}
				
else
{
$('#dim').hide();
$('.left').hide();
}


});
