$(document).ready(function(){
		
	$.fn.pause = function(duration) {   
		$(this).animate({ dummy: 1 }, duration);    
		return this;
	};
		
		$("#intro .second")
			.fadeIn("slow")
			.pause(200)
			.fadeOut("slow")
			.pause(1000)	
			.fadeIn("slow");
		$("#intro .first")
			.pause(400)
			.fadeIn("slow")
			.pause(200)
			.fadeOut("slow")
			.pause(600)	
			.fadeIn("slow");
		$("#intro .third")
			.pause(600)	
			.fadeIn("slow")
			.pause(200)
			.fadeOut("slow")
			.pause(400)	
			.fadeIn("slow");
	
		
		$("#glow").pause(2500).animate({ 
			opacity: 0.5,
			marginLeft: "2.00in"
        }, 1000 );
		
		$("#glow2").pause(2900).animate({ 
			opacity: 0.5,
			marginLeft: "2.00in"
        }, 900 );
		
		$("#glow3").pause(3300).animate({ 
			opacity: 0.5,
			marginLeft: "2.00in"
        }, 800 );
		
		$("#intro .right").pause(2200).animate({ 
			marginTop: "1.20in",
			opacity: 1
        }, 2000 );
		

		
			$.ajaxSetup ({   
				cache: false  
			});   
			var ajax_load = "<div id='loading'><img src='css/images/load.gif' alt='loading...' /></div>";  
			
			
			//$("#outer").animate({opacity:"100"}, 20000);
			 
			$(".item").click(function(){ 
								  
				var loadUrl = $(this).attr('id');
				
				$(".active").removeClass('active');
				$("#"+loadUrl).addClass('active');
				
				
				
				$("#load").html(ajax_load);
				
				$.ajax({
					type: "POST",
				   	url: loadUrl + ".php",
				   	success: function(msg)
					{
						
						$("#load").fadeOut('fast', function (){
															 
							$(this).html(msg).fadeIn("slow");	
						
															 
						
						tag_click();
				
						
						$(".vino").each(function(){ 
												 
							$(this).click(function (){ 
									 
								var loadUrl = $(this).attr('id');
								
								var f1 = function()
								{
									
									$("#load").html(ajax_load);
								
						
									$.ajax({
										type: "GET",
										url: loadUrl + ".php",
										success: function(value) 
										{	
											$("#load").fadeOut('fast', function (){
																 
														$(this).html(value).fadeIn("slow");	
														
														tag_click();
														
														$(".vino").click(function(){
														loadUrl = $(this).attr('id');
														f1();
														})
																					
																				   
											});
											//$("#load").html(value);
											
											
											
											
											
										}//success		
									});//$.ajax					
								}//f1();
								
									
								f1();
						
							})//click
							
						}); //each
						
						$(".jela").each(function(){ 
												 
							$(this).click(function (){ 
									 
								var loadUrl = $(this).attr('id');
								
								var f1 = function()
								{
									$("#load").html(ajax_load);
									
									$.ajax({
										type: "GET",
										url: loadUrl + ".php",
										success: function(value) 
										{	
										
											$("#load").fadeOut('fast', function (){
																 
														$(this).html(value).fadeIn("slow");	
														
														tag_click();
														
														$(".jela").click(function(){
														loadUrl = $(this).attr('id');
														f1();
														})
																					
																				   
											});
											
										}//success		
									});//$.ajax					
								}//f1();
								
									
								f1();
						
							})//click
							
						}); //each
						
						})
							
				   }//success
				   
				 });
			
			});  
			
		
		function tag_click()
		{
			$("#tag a").click(function()
			{
				var cl_new = $(this).attr("rel");
				
				var loadUrl1 = $(this).attr("href");
			
				//$("#bottom").html(ajax_load_bottom);
				
				$.ajax(
				{
					type: "GET",
					url: loadUrl1,
					success: function(value) 
					{	
						$("#bottom_load").fadeOut('fast', function (){
								$(this).html(value).slideDown('slow')							   
															   
						});
					

						var cl = $("#content").attr("class"); 
						
						$("#content").fadeOut('fast', function (){
															
								$("#content").removeClass(cl).addClass(cl_new).removeClass("ajax_loading").fadeIn("slow");	;
															   
						});
						
						//$("#content").removeClass(cl).addClass(cl_new);
						
						
						
						
					}//success
							
				});//$.ajax
				
				return false;
			})
		}
		
	
		
		

		

	});
