/**
 * @author witz
 */

 $(document).ready(function(){
				
				showJtButtons();
				
				
				$().click(function(e){
					
					var target=e.target;
					if ($(target).hasClass('jt-btn')){
						
					}
					else{
					$(".jumpto").hide();
					$(".jt-btn"). removeClass("btn-border");
					}
				})
				
				
			
				$(".jt-btn").click(function(){
					toggleJT(this);
				})
				
				
				
			})
			
			function showJtButtons(){
				
				if ((jQuery.browser.msie && jQuery.browser.version >=7 ) || !(jQuery.browser.msie) ){
				$("img.jt-btn").show();
				}
			}
			
			
			
			function toggleJT(button){
				
				var coordinates = $(button).offset()
				
				var div = $(button).next();
				if($(div).css("display")=='none'){
					showJT(button, div, coordinates);
				}
				else{
					hideJT(div);
				}
			}
			
			function showJT(button, menu, coordinates){
				
				var ypos = getAbsoluteTop(button);
				$(menu).css("top", ypos);
				
				$(".jumpto").hide();
				$(".jt-btn"). removeClass("btn-border");
				$(button).addClass("btn-border");
				$(menu).css
				$(menu).slideDown(100);
			}
			
			function hideJT(menu){
				$(menu).slideUp(100);
				$(".jt-btn"). removeClass("btn-border");
			}
			
			
		function getAbsoluteTop(o) {
			// Get an object top position from the upper left viewport corner
			oTop = o.offsetTop            // Get top position from the parent object
			while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
				oParent = o.offsetParent  // Get parent object reference
				oTop += oParent.offsetTop // Add parent top position
				o = oParent
			}
				return oTop
			}
			
			
		function closeJTOnOutsideClick(){
			
			document.onclick = function (e) {
	e = e || event
	var target = e.target || e.srcElement
	var box = document.getElementById("box")
	do {
		if (box == target) {
			// Click occured inside the box, do nothing.
			return
		}
		target = target.parentNode
	} while (target)
	// Click was outside the box, hide it.
	box.style.display = "none"
}

		}