/**********************************************************************************************\
Arducane Development Javascript include
November 19, 2011

Written by Ronald D. Willis
2004-2012 Arducane Development.  All rights reserved.
\**********************************************************************************************/

$(function()
{
	$('a[rel="external"]').attr('target', '_blank');

	$('input, textarea').autocomplete({disabled : true});

	$('#contactinternal').click(function(e)
	{
		processEvent(e);
		$('html, body').animate({ 'scrollTop' : $('#contactcontainer').offset().top }, 800, 'linear', null);
	});

	$('#opener').one('click', function(e)
	{
		processEvent(e);
		$(this).fadeOut(800, function() { $(this).remove(); });
		$('body').css('overflow', 'auto');

		$('header')
			.animate({'height':'145px'}, {duration : 800, queue : false }, 'linear', null)
			.css({ 'box-shadow' : '0 4px 2px 1px rgba(0,0,0,0.8)', 'border-bottom-width': '2px' });

		$('footer')
			.animate({'height':'84px'}, {duration : 800, queue : false }, 'linear', null)
			.css({ 'box-shadow' : '0 -2px 2px 1px rgba(0,0,0,0.8)', 'border-top-width': '2px' });
	});

	$('#fcontact').submit(function(e)
	{
		processEvent(e);
		var data = {
			'fmsg' : escape($('#fmsg').val()),
			'em' : escape($('#cem').val()),
			'nm' : escape($('#cn').val())
		};

		if (data.fmsg != '' && data.em != '' && data.nm != '')
			$.post('index.php', data, function(results) { $('#fcontact').html(results); }, 'html');
	});
});
