// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

/*
 * Confirm question and post form to URL
 */
function confirmAndPost( t, question, url )
{
	hideActiveWindow();
	if (confirm( question )) { 
		var f = document.createElement('form'); 
		t.parentNode.appendChild(f); 
		f.method = 'POST'; 
		f.action = url; 
		f.submit(); 
	};
}

/*
 * Read blog RSS feed and quote last post
 */
function appReadBlogQuote()
{
	$("#blog").each(function(){ 
		$(this).html('<img src="/images/ajax-loader.gif">');
		$(this).load('/feed');
	});
}


/**
 * On page load — style elements:
 * - set rounded corners
 * - enable awards rollovers
 * - read RSS
 */
$(function() {

		// 1. Rounded corners
		$('.rounded').corner({
        tl: { radius: 5 },
        tr: { radius: 5 },
        bl: { radius: 5 },
        br: { radius: 5 },
        antiAlias: true,
        autoPad: true,
        validTags: ["div"]
    });

		// big curved corners
		$('.big-rounded').corner({
        tl: { radius: 10 },
        tr: { radius: 10 },
        bl: { radius: 10 },
        br: { radius: 10 },
        antiAlias: true,
        autoPad: true,
        validTags: ["div"]
    });
        
    // 2. Awards rollovers
		$('#awards > UL > LI > A').hover(
			function(){ 
				award = $(this).parent();
				award.addClass('hover');
				$('#awards-desc').remove();
				award.prepend('<div id="awards-desc"><div id="top"></div><div id="text">'+award.attr('content')+'</div><div id="bottom"></div></div>');
				$('#awards-desc').hide();
				$('#awards-desc').fadeIn('fast');
			},
			function(){ 
				$(this).parent().removeClass('hover');
				$('#awards-desc').fadeOut('fast', function(){$(this).remove()} );
			}
		);
    
    // 3. Read RSS
    appReadBlogQuote();
    
});




