
	$(document).ready(function(){
								
		if($("#select_first").size() != 0) {
			var cleft = $("#select_first").offset();
			$("#first_options").css("left",cleft.left);
			$("#second_options").css("left",cleft.left);
		}
		
		$("#first_bt").click(function () { 
			$("#first_options").toggle("normal")
			$("#first_bt > img").toggle();			
			if($("#second_options").css("display") == "block") {
				$("#second_options").toggle("normal");
				$("#second_bt > img").toggle();				
			}
      return false;
    	});
		$("#first_options > a").click(function() {
			var $this = $(this);
			var first_content = $("#dokkolok > div:first");
			var ix = parseInt($this.attr("id").replace("dok_",''));
			var content = $("#dokkolok > div").eq(ix);

			var save = content.html();
			content.html(first_content.html());
			first_content.html(save);

			save = $("#select_first > span").html();
			$("#select_first > span").html($this.html());
			$this.html(save);

			$("#first_options").toggle("normal")
			return false;
		});
		$("#second_bt").click(function () { 
			$("#second_options").toggle("normal")
			$("#second_bt > img").toggle();
			if($("#first_options").css("display") == "block") {
				$("#first_options").toggle("normal");
				$("#first_bt > img").toggle();							
			}
			return true;
    	})

		$(".akcio").eq(0).attr("class","akcio selected");
		$(".akcio-content").eq(0).css("display","block");		
		$("#akciok").css("height",$(".akcio-content").eq(0).height()+30);
		$(".akcio a").click(function() {
			id = $(this).attr("id")
			$(".akcio").attr("class","akcio");		
			$(".akcio-content").css("display","none");            
			$("#"+id+"-content").css("display","block");
            $("#akciok").css("height",$("#"+id+"-content").height()+30);
			$(this).parent().attr("class","akcio selected");					
			return false;
		})

		
  	});
