// fix background image flicker for IE 6
try {document.execCommand("BackgroundImageCache", false, true);} catch(err) {}

// for jQuery
$(function(){

	// close message
	$("#message").animate({opacity: 1.0}, 3000).fadeOut("slow");

	$('#post1').jqDrag();

	var forgot_password = $('#forgot_password')[0];
	$('#show_forgot_password').click(function() {
		$.blockUI(forgot_password, { width: '275px' });
	});

	$('#send').click(function() {
		// $('div.forgot_password').block('<h2>Doing something...</h2>'); 
		$.blockUI("<h2>Doing something...</h2>");

	});
	$('#cancel').click($.unblockUI);

	$('form .guide').focus(function() {

		var offset = $(this).offset();
		var offsetLeft = offset.left;
		var offsetTop = offset.top;

		var position = $(this).position();
		var positionLeft = position.left;
		var positionTop = position.top;
		var theWidth = $(this).width();
		
		var posLeft = positionLeft+theWidth;

		$(this).next('div.guide').css({ top:positionTop }).css({ left:posLeft }).show();

	});
	$('form .guide').blur(function() {
		$(this).next('div.guide').hide();
	});


	// annotation 
	$('p.annotation').before('<a class="annotation" href="#">B</a>');
	$('a.annotation').click(function(){
		return false;
	}).focus(function(){
		$(this).next('p.annotation').css($(this).offset()).show();
		return false;
	}).blur(function(){
		$(this).next('p.annotation').hide();
		return false;
	}).hover(function(){
		$('p.annotation:visible').hide();
		$(this).next('p.annotation').css($(this).offset()).show();
	},function(){
		$(this).next('p.annotation').hide();
	});


	/*
	//tooltip:
	$('form p.help').before('<a class="help" href="#">?</a>');
	$('form a.help').click(function(){
		return false;
	}).focus(function(){
		$(this).next('p.help').css($(this).offset()).show();
		return false;
	}).blur(function(){
		$(this).next('p.help').hide();
		return false;
	}).hover(function(){
		$('form p.help:visible').hide();
		$(this).next('p.help').css($(this).offset()).show();
	},function(){
		$(this).next('p.help').hide();
	});
	*/

	// $("table.sortable").tablesorter({sortList:[[0,0]], widgets: ['zebra']});
	// $('input.cal').calendar();


	$('a.annotation').click(function(){
		return false;
	})

});
