/* Author: 

*/
$(document).ready(function()  {


$('#subscription_form').submit(
			function(e){
				//$('#subscribe_start').fadeOut(100);
				//$('#subscribe_progress').fadeIn(100);
				try{
					/// set up some vars
					var sub_blog		= ( $("#subscribe_blog:checked").val() ?		1 : '' );
					var sub_work		= ( $("#subscribe_work:checked").val() ?		1 : '' );
					var sub_articles	= ( $("#subscribe_articles:checked").val() ?	1 : '' );
					var sub_news		= ( $("#subscribe_news:checked").val() ?		1 : '' );
					var email			= ( $("#subscribe_field").val() );
					var fbcode			= 	( sub_blog ? '1' : '' ) + 
											( sub_work ? '2' : '' ) + 
											( sub_articles ? '3' : '' ) + 
											( sub_news ? '4' : '' );
					/// build the values for our subscription script
					values = {
						'sub[email]': 		email,
						'sub[news]': 		sub_news,
						'sub[blog]': 		sub_blog,
						'sub[articles]': 	sub_articles,
						'sub[work]': 		sub_work,
						'sub[uri]': 		fbcode,
						'sub[loc]': 		'en_US',
						'ajax': 			1
					};
					/// build the feedburner url
					fburl = 'http://feedburner.google.com/fb/a/mailverify';
					fburl += '?email='+esc(email)+'&uri='+esc('kitcattnohr-'+fbcode)+'&loc='+esc('en_UK');
					/// log the request in our own logs
					$.get('/accept_subscription.php', values, function(res){});
					/// open the feedburner url and redirect the user there
					window.open( fburl );
					/// close up the subscribe area to show the user something is happening
					$('#subscribe_area').data('is_down',false);
					$('#subscribe_area').slideUp();
					/// prevent the default of the form
					e.preventDefault();
					return false;
				}catch(ee){
					return true;
				}
		});
	
		if( $('#subscribe_area.errored').length ){
			/// dont hide if we errored
		}else{
			$('#subscribe_area').hide();
		}
	
		$('#subscribe_button').click(
			function(){
				if( !$('#subscribe_area').data('is_down') ){
					$('#subscribe_area').data('is_down',true);
					$('#subscribe_area').slideDown();
					$('#rss_area').slideUp();
					$('#rss_area').data('is_down',false);
				}else{
					$('#subscribe_area').data('is_down',false);
					$('#subscribe_area').slideUp();
				}
				return false;
			}
		);
	
	/* Code to handle the subscription form - END */
	
	/* Code to handle the rss links - START */
	
		/*
		$('#subscription_form').submit(
			function(){
				$('#subscribe_start').fadeOut(100);
				$('#subscribe_progress').fadeIn(100);
			
				values = {
					'subs[email]': 		$("#subscribe_field").val(),
					'subs[news]': 		$("#subscribe_news").val(),
					'subs[blog]': 		$("#subscribe_blog").val(),
					'subs[articles]': 	$("#subscribe_articles").val(),
					'subs[work]': 		$("#subscribe_work").val(),
					'ajax': 			1
				};
			
				$.get('/accept_subsciption.php', values, function(){
					$('#subscribe_progress').fadeOut(100);
					$('#subscribe_finish').fadeIn(100);
				});
			 
				return false;
		});
		*/
	
		$('#rss_area').hide();
	
		$('#rss_button').click(
			function(){
				if( !$('#rss_area').data('is_down') ){
					$('#rss_area').data('is_down',true);
					$('#rss_area').slideDown();
					$('#subscribe_area').slideUp();
					$('#subscribe_area').data('is_down',false);
				}else{
					$('#rss_area').data('is_down',false);
					$('#rss_area').slideUp();
				}
				return false;
			}
		);
	
	/* Code to handle the subscription form - END */

	
	 });
























