	$(document).ready(function(){
		$("#counter").load("counter.php");
		$("#result").hide();
		$("#privacy").hide();
		$("#getLastTen").hide();		
		
		$("#privacy-link").click(function(){			
			$("#home").hide('slow');
			$("#privacy").show('slow');
		});
				
	 	$("#home-link").click(function(){
					
			$("#privacy").hide('slow');
			$("#home").show('slow');
		});
		
		$("#getLastTen").click(function(){
			getLastTen();
			});
		
		$("#generate").click(function(){
		    GetRssLink();
		}); 	
	}); //document ready
		
		function GetRssLink(){
				$("#result").hide();
			
				var submitted_link  = $("#link").val();
			
				
				var submitted_url = "url="+submitted_link;
				
			
				$.ajax({ 
				method: "get",url: "process.php",data: submitted_url,
                      beforeSend: function(){$("#result").show('fast');
                      $("#result").html(" <br/> <img src='images/loading.gif' id='loadimg' />");}, 
                      complete: function(){ $("#loadimg").remove(); }, //stop showing loading 
                      success: function(result){
				
				
						
							// print the result
							$("#counter").load("counter.php");
							$("#result").html(result);
					         $("#getLastTen").show();          
			
					                          		
                      }//funtion(result)
								
									
									
                }); //ajax


								
		}//GetTheShorterLink();
		
		
		
	function getLastTen(){
			//	
			
				var submitted_link2  = $("#link").val();
			
				
				var submitted_url2 = "getLastTen=1"+"&url="+submitted_link2;
				
			
				$.ajax({ 
				method: "get",url: "process.php",data: submitted_url2,
                      beforeSend: function(){$("#result").show('fast');
                      $("#result").html(" <br/> <img src='images/loading.gif' id='loadimg' />");}, 
                      complete: function(){ $("#loadimg").remove(); }, //stop showing loading 
                      success: function(result){
				
				
						$("#result").show();
							// print the result
							//$("#counter").load("counter.php");
							$("#result").html(result);
					               
		
					                          		
                      }//funtion(result)
								
									
									
                }); //ajax


								
		}//GetTheShorterLink();

					
					
		

		
		




		
