function changeMonth(month, year, val, id, user, jump) {
	jump = typeof(jump) != 'undefined' ? jump : 0;
		
	$.ajax({
		type: "GET",
		url: "/ajax/calendar.php",
		data: 'month=' + month + "&year=" + year + "&val=" + val + "&id="+ id + "&user=" + user + "&jump=" + jump,
		success: function(msg){
			if (msg != "") $('div#calendar_section').html(msg);
		}
	});
}



function hideIcons(obj) {
	if (JQ_addnote || JQ_removenote || JQ_editnote || JQ_hovernote) return;
	
	if ((viewX > obj.offsetLeft()) && (viewX < (obj.offsetLeft() + obj.width()))) {
		if ((viewY > obj.offsetTop()) && (viewY < (obj.offsetTop() + obj.height()))) {
			return;
		}
	}
	
	
	obj.find('div#JQnotes_iconmenu').hide();
}

var timer = "";
$(document).ready(function() {

	$('a#toggle_archives').click(function() {
		$('#blog_archives').toggle(400);
		return false;
	});
	
	//$('a[rel*=facebox]').facebox();
	
	//$('table div[@class*=more_icons]').click(function() { $(this).next().toggle(400); });
	
	// initing the notes now
	$('table.imgContainer').hover(function(){
		$(this).find('div#JQnotes_iconmenu').show();
		JQnotes_addboxes($(this));
	},function(){
		obj = $(this);
		setTimeout('hideIcons(obj)', 200);
		
		if (JQ_addnote || JQ_removenote || JQ_editnote) return;
		remove = $(this).parents("div.JQnotes_container");

		JQ_timer[remove.attr("id")] = timer.setTimeout(function() {
			if ((viewX > remove.offsetLeft()) && (viewX < (remove.offsetLeft() + remove.width()))) {
				if ((viewY > remove.offsetTop()) && (viewY < (remove.offsetTop() + remove.height()))) {
					return;
				}
			}
			
			remove.find("div.JQnotes_notes").remove();
		}, 300);
	});
	
	$('a#submit_theme_icon').click(function() {
		
		if (confirm($('input#entry_theme').val())) {
		
			$.ajax({
				type: "GET",
				url: "/ajax/theme.php",
				data: 'id=' + $('input#JQnotes_entryID').val(),
				dataType : 'xml',
				success: function(xml){
					if ($("success",xml).text() == 1) {
						$('div#icon_notify_theme_bad').hide();
						$('div#icon_notify_theme').show(400);
					}
					else {
						$('div#icon_notify_theme').hide();
						$('div#icon_notify_theme_bad').show(400);
					}
				}
			});
		}
	});
	
	$('a#click_subscribe').click(function() {
		$.ajax({
			type: "POST",
			url: "/ajax/subscribe.php",
			data: 'username=' + photoblog_username,
			dataType : 'xml',
			success: function(xml){
				if ($("success",xml).text() == 1) $('div#log_done').show(400);
				else $('div#log_error').show(400);
			}
		});
	});
});
