// JavaScript Document

$(function(){

	var tab_height;

	$("#info .tab").css("height", "23px");

	//PRVI TAB OTVORENI
	//$("#info .tab:not(:first)").css("height", "23px");
	//$("#info .tab:first").addClass("tab_bottom active_tab");
	
	
	//$("#info .tab").click(function(){return false});
	
	$("#info .tab").click(function()
	{
		
		if($(this).hasClass("active_tab")==false)
		{
			
			$(".active_tab").animate({ height: "23px" },1000).removeClass("active_tab").removeClass("tab_bottom");
				
			$(this).css("height", "auto").addClass("tab_bottom");
			
			tab_height = $(this).height();
			
			$(this).css("height", "23px");
	
			$(this).addClass("active_tab");
			
			$(this).animate({ height:tab_height }, 1000);		
			
			var href = $(this).find("a").attr("href");
			
			href = href.replace("metal_media_proizvod.php?id=","");
			//console.log(href);
			
			$.getJSON("inc/ajax_proizvodi.php", {id:href}, function(json)
			{
				//$("#simo").html(a.("#kateg").html());
				//var a = data;
				//var b = $(a).("#kateg").html();
				//$("#simo").html("JSON Data: "+b);
				
				$("#content h1").html(json.kateg);
				$("#text h2").html(json.naslov);
				$("#text p").html(json.text);
				$("#text #pdf_container").html(json.pdf);
				$("#language").attr('href', "metal_media_proizvod.php?id="+href+"&lang="+json.lang)
				//$("title").html("Metal Media - "+json.naslov);
				
			}); // END $getJson

			return false;	

		}						
		else
		{
			return false;
		}		
		
		return false;

	});
	
//	$("#info .tab a.slide").click(function(){ return true; });

})
