var cur_cal = '';

function reload_cal(year,month) {											
	// Ajax
	
	$.get("ajax.php", { type: 'calendar', year: year, month: month }, function(data)
	{	
		cur_cal = '';
		$('#calendar').html(data);
		//$('#calendar').slideDown('slow');
	});
}

function cal(year,month) {											
	// Ajax
	if($('#cal_pop').is(":visible")){
		$('#cal_pop').slideUp('slow',function(){
	//if($('#calendar').is(":visible")){
		//$('#calendar').slideUp('slow',function(){
			reload_cal(year,month);
		});
	}else{
		reload_cal(year,month);
	}
}

function caltog_slide(new_cal){
	var day_entries = $('#'+new_cal).html();
	$('#cal_pop').html(day_entries);
	$('#cal_pop').slideDown();
}

function caltog(new_cal){
	
	if(new_cal != cur_cal){	
		if($('#cal_pop').is(":visible")){
			$('#cal_pop').slideUp('slow',function(){	  
					caltog_slide(new_cal);
					cur_cal = new_cal;
			});
		}else{
			caltog_slide(new_cal);
			cur_cal = new_cal;
		}
	}
	
}

function ajax_fetch(x,y)
{ return true; }


function plasma( video_path , image_path , description )
{
	try
	{
		clearInterval(intervalId);
	}
	catch(e)
	{
	}
	
	$('select').hide();
	
	if( video_path.lastIndexOf(".flv") != -1)
	{
		
		var so = new SWFObject('http://www.tapdev.co.uk/www.filmsofrecord.com/assets/flash/mediaplayer.swf','mpl','680','450','8');
		so.addParam('allowscriptaccess','always');
		so.addParam('allowfullscreen','true');
		so.addVariable('height','450');
		so.addVariable('width','680');
		so.addVariable('file',video_path);
		so.addVariable('image',image_path);
		so.addVariable('autostart','true');
		so.write('player');
	
	}

	
	$('#plasma #description').html( description );
	$('#plasma').fadeIn('fast');
	
	//$('#outer_wrapper').fadeTo('fast',0.2);
	return false;

}

function hideplasma()
{
	$('select').show();
	$('#plasma').fadeOut('slow');
	//$('#outer_wrapper').fadeTo('fast',1);
	return false;
}

