// JavaScript Document
	$(document).ready(function() {
		//раскрываем выбранный в URL пункт
		if (window.location.hash.length > 0) $("fieldset"+window.location.hash).removeClass('startClosed').addClass('collapsible');
		//сворачиваем все остальные
		$("fieldset.collapsible").collapse();
		$("fieldset.startClosed").collapse( { closed: true } );
		
		
		//корректируем ссылку
		$(".collapsed").click(function () { 
			window.location.hash = $(this).attr('id'); 
			
			var tag=document.getElementsByTagName('br');
			for (i=0; i!=tag.length; i++){
			if (tag[i].style.display=='inline-block') {
			tag[i].style.display="none";
			}
			}
			
		    });
		//$(".collapsed").click(function () { 
		//	if (window.location.hash == '#') window.location.hash = $(this).attr('id');
		//	if (window.location.hash != '#') window.location.hash = ''; 
		//   });
				
		$(".draggable").draggable({
		    start: function(event, ui) {
		        $(this).addClass("noclick");
		    },
		    stop: function(event, ui) {
		        $(this).removeClass("noclick");
		        $(this).css("zIndex",Counter());
		    }		
		});
		$(".draggable").draggable({ opacity: 0.35 });
	 	$(".draggable").draggable({ zIndex: 2700 });
	
		$(".highslide").click(function() {
		    if ($(this).hasClass("noclick")) {
		        $(this).removeClass("noclick");
		    }
		    else {
		       // actual click event code 
		       return hs.expand(this);
		    }
		});	
		

	});
	
	var Counter = (function() {
		var privateCounter = 100;
		return function() {
			privateCounter += 1;
			return privateCounter;
		}
	})() ;
