// ==UserScript==
// @name           Plurk Calendar
// @namespace      http://plurk.com/
// @description    Go back to the past timeline
// @include        http://www.plurk.com/*
// @author         Rein

//calendar modifed from basiccalendar http://www.dynamicdrive.com/dynamicindex7/basiccalendar.htm

(function (window) {
_time="23:59:59"



function showCalendar(gomonth)
	{
	
	//
	var showdate = document.createElement('script');
	showdate.setAttribute('language','JavaScript');
    showdate.setAttribute('src','http://rein.murmur.in/plurk/showcal_v2.1.js');  
	document.getElementsByTagName('head')[0].appendChild(showdate);    
	var style = document.createElement('link');
    style.setAttribute('href','http://rein.murmur.in/plurk/dark_.css');
    style.setAttribute('rel','stylesheet');
    style.setAttribute('type','text/css');
    document.getElementsByTagName('head')[0].appendChild(style);
	var ftb=document.getElementById('filter_tab')
	var element = document.createElement('li');
	element.setAttribute('id','calswitch');
	element.innerHTML="<a title='show Calendar' onclick='showCal()' href='#' class='off_tab'>Calendar</a>";
	ftb.appendChild(element);
	/*var calbox = document.getElementById('top_login')
	var todaydate=new Date()
	var curmonth=todaydate.getMonth()+1+gomonth //get current month (1-12)
	var curyear=todaydate.getFullYear() //get current year
	var content=buildCal(curmonth ,curyear, "main", "month", "daysofweek", "days", 0);
	var element2 = document.createElement('div');
	element2.setAttribute('id','calendar');
	element2.setAttribute('style','visibility:hidden');
	element2.setAttribute('class','cnight');
	element2.innerHTML=content;
	//element.innerHTML+="<a href='javascript:updateCalendar("+(curmonth+1)+","+curyear+")'>next</a> /<a href='javascript:updateCalendar("+(curmonth-1)+","+curyear+")'>next</a> ";
	calbox.appendChild(element2);*/	
	}

window.addEventListener("load", function(){
	setTimeout(function(){
	if(document.getElementById('filter_tab')!=null){showCalendar(0);}
	},2000);

}, false);

})((typeof unsafeWindow != 'undefined') ? unsafeWindow : window);