$( function() {
	if( $( '.category' ).length >0 ) 
	{
		$( '.category' ).click( function() {
			$( this ).toggleClass( 'active' )
			$( this ).siblings( '.dropdown' ).toggle();
			$( this ).find( '.indicator' ).toggleClass( 'indicator-active' );
			return false;
		} );
	}
	
	if( getURLParameter('email') != "" )
	{
		$('#s2email').val(getURLParameter('email'));
		$('input[name="subscribe"]').hide();
	}
	
	$('#navigation ul.children').css('display', 'none');
	
	var s2i = $('#s2_form_widget-2').html();
	if(  s2i.indexOf('s2_error') === -1 && s2i.indexOf('s2_message') === -1 ) $('#s2_form_widget-2').css('display', 'none');
	
	$('#s2-toggle').click(function(){
		$('#s2_form_widget-2').toggle();	
	});
	
	$('#navigation .cat-item').hover(function() {
		//$('#navigation ul.children').css('display', 'none');
        $(this).find('ul').show();
	    },
	    function() {
	      $(this).find('ul').hide();
	});
	
} );


function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}


