// JavaScript Document
function IncludeStyle(cssFile)
{
	document.write('<link rel="stylesheet" href="' +cssFile+ '" type="text/css" media="screen" />');
}
function IncludeScript(jsFile)
{
	document.write('<scr'+'ipt type="text/javascript" src="' +jsFile+ '"><\/scr'+'ipt>');
}

//include the required styles for the calendar
IncludeStyle('/files/style/stylemain.css');
IncludeStyle('/files/style/scal.css');

//include the required scripts for the calendar
//IncludeScript('/files/js/prototype.js');
//IncludeScript('/files/js/effects.js');
IncludeScript('/files/js/scal.js');
IncludeScript('/files/js/scalplanner.js');

var samplecal;
function showcalendars(fdate){


Object.extend(Date.prototype, {
    monthnames: ["يناير", "فبراير", "مارس", "ابريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"],
    daynames: ["أح", "اث", "ث", "أر", "خ", "ج", "س"]	
	});

			  
	if(typeof(fdate) == 'undefined')
		samplecal = new scal('samplecal',updateyear,{titleformat:'mmmm yyyy',closebutton:'X',dayheadlength:2,weekdaystart:0});
	else
	{		
		data_parts = fdate.split('-');
		
		_day = parseInt(data_parts[2]);
		_month = parseInt(data_parts[1]);
		_year = parseInt(data_parts[0]);		

		samplecal = new scal('samplecal',updateyear,{titleformat:'mmmm yyyy',closebutton:'X',dayheadlength:2,weekdaystart:0,year:_year,month:_month,day:_day});	
	}
}

function updateyear(d){
    currentDate = new Date();
    
    if(d > currentDate)
    {   
        samplecal.setCurrentDate(currentDate,true); 
        return;
    }
    window.location.href = '/short_news.php?date=' +  d.format('yyyy-mm-dd');
}

function explodeday(){
	$(samplecal).setCurrentDate(samplecal.selecteddate);
	$(samplecal).buildCalendar();
	$(samplecal).getCalendar();
	$(samplecal.baseelement).update();
	$(samplecal.baseelement).appendChild(samplecal.selecteddatecell);
}
