/*$( document ).ready(
	function()
	{
		$("div.menu-c").mouseover( function(e) 
		{
			$( this ).parent().find( "div.menu-leftshadow" ).css( 'visibility', 'visible' );
			$( this ).parent().find( "div.menu-rightshadow" ).css( 'visibility', 'visible' );
		} );
		$("div.menu-c").mouseleave( function(e) 
		{
			if( !$( this ).parent().hasClass( 'selected' ) )
			{
				$( this ).parent().find( "div.menu-leftshadow" ).css( 'visibility', 'hidden' );
				$( this ).parent().find( "div.menu-rightshadow" ).css( 'visibility', 'hidden' );
			}
		} );
	}
);*/

$( document ).ready(
	function()
	{
		$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
	}
);

//Special offers script
$( document ).ready(
	function()
	{
		var category_link = $( 'a.more_details' );
		var category_find_out_more = $( 'a.category_find_out_more' );
		var category_description = Array();
		$( category_link ).each(
			function( index, item )
			{
				$( item ).parent().parent().children( '.category-descrption' ).attr( 'rel', index );
				category_description.push( $( item ).parent().parent().children( '.category-descrption' ) );
			}
		);
		var category_current_opened = -1;
		if ( ( category_link.length > 0 ) && ( category_description.length > 0 ) && ( category_link.length == category_description.length ) )
		{
			$( category_link ).each(
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							event.preventDefault();
							
							$( category_link[ category_current_opened ] ).html( 'view more details' );
							$( category_description[ category_current_opened ] ).hide();
							$( category_description[ category_current_opened ] ).parent().animate( { 'height': $( category_description[ category_current_opened ] ).parent().height() - $( category_description[ category_current_opened ] ).height() }, 100 );
							if( category_current_opened != index )
							{
								category_current_opened = index;
								$( category_link[ category_current_opened ] ).html( 'collapse details' );
								$( category_description[ category_current_opened ] ).show();
								$( category_description[ category_current_opened ] ).parent().animate( { 'height': $( category_description[ category_current_opened ] ).parent().height() + $( category_description[ category_current_opened ] ).height() }, 100 );
							}
							else
							{
								category_current_opened = -1;
							}
						}
					);
				}
			);
			$( category_find_out_more ).each(
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							event.preventDefault();
							
							var current_click = $( this ).parents( 'div.category' ).find( 'div.category-descrption' ).attr( 'rel' );
							$( category_link[ category_current_opened ] ).html( 'view more details' );
							$( category_description[ category_current_opened ] ).hide();
							$( category_description[ category_current_opened ] ).parent().animate( { 'height': $( category_description[ category_current_opened ] ).parent().height() - $( category_description[ category_current_opened ] ).height() }, 100 );
							if( category_current_opened != current_click )
							{
								category_current_opened = current_click;
								$( category_link[ category_current_opened ] ).html( 'collapse details' );
								$( category_description[ category_current_opened ] ).show();
								$( category_description[ category_current_opened ] ).parent().animate( { 'height': $( category_description[ category_current_opened ] ).parent().height() + $( category_description[ category_current_opened ] ).height() }, 100 );
							}
							else
							{
								category_current_opened = -1;
							}
						}
					);
				}
			);
		}
	}
);

$( document ).ready(
	function()
	{
		$( '#email-sing-up-form a.submit-btn-link' ).mousedown(
			function(e)
			{
				var email = "http://subscribe.acepllc.com/1?email=" + $( '#email-sing-up-form input' ).attr( 'value' ) + "&iframe=true&width=750&height=auto";
				$( '#email-sing-up-form a.submit-btn-link' ).attr( 'href', email );
			}
		);
	}
);

