// JavaScript Document
$(document).ready(function()
{
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
		$("#close").show();
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
		$("#close").hide();
	});		
	
	$('#navigationDropdown').hover(function(){$(this).addClass('hov');},function(){$(this).removeClass('hov');});
	$('#nav_link_2').parent().hoverIntent(function(){$('#navigationDropdown').addClass('nav');},function(){$('#navigationDropdown').removeClass('nav');});

	var _location = ''+window.location;
	var _message = '';
	if (_location.indexOf('?subscribe=1') > 1)
	{
		_message = '<h3>Thankyou<br /> for registering</h3><p>We have added your email to our mailing list.</p>';
	}
	else if (_location.indexOf('?subscribe=2') > 1)
	{
		_message = '<h3>Invalid email address</h3><p>Please supply a valid email address.</p><form id="Newsletter" method="post" action="http://send.silkstream.org/send/form.php?form=2"><input type="text" class="newsInput" name="email"/><input type="submit" value="Sign up" class="newsSubmit" name=""/><input type="hidden" value="h" name="format"/></form>';
	}

	if (_message != '')
	{
		$('#footerBlockCenter').html(_message);
		var _dest = $('#footerBlockCenter').offset().top;
	   	$('html:not(:animated),body:not(:animated)').animate({ scrollTop: _dest},800,function(){$('#footerBlockCenter').effect('bounce', { distance:5, times:3, direction: 'left' }, 300);});
		
//		setTimeout(function()
//		{
//			$('div.homeColumns div.column:eq(2)').slideUp('slow',function()
//			{
//				$(this).html('<h2><span>Thankyou</span> for registering</h2><div class="postEntry"><div style="float: left; width: 210px;"><h2>We have added your email to our mailing list.</h2></div></div>').slideDown('slow')
//			});
//        },2000);
	}
	
	if ($.fn.prettyPopin)
	{
		$("a[rel^='feedback']").prettyPopin({
			modal: false, /* true/false */
			width: 500, /* true/false */
			height: false, /* true/false */
			opacity: 0.1, /* value from 0 to 1 */
			animationSpeed: 'fast', /* slow/medium/fast */
			followScroll: true, /* true/false */
			loader_path: '/images/preloader-white.gif', /* path to your loading image */
			callback: function(){} /* callback called when closing the popin */
		});
	}

});