// JavaScript Document

var j$ = jQuery.noConflict();//instead of j$ use jQuery as
j$.extend({  
	_toggleKey: function (_a,_b,_key){
		var _open = false;
			if((_a.length)&&(_b.length)){
				_a.click(_slide);
				var _panelId = '#' + _b.get(0).id;
				if(location.hash==_panelId)_slide();
				j$('html').click(function(e){
					if((j$(e.target).parents(_panelId).length == 0)&&(_open == true))_slide();
				});
			}
			if((_a.length)&&(_b.length)&&(typeof _key != 'undefined')){
				j$(document).bind('keydown',{combi:_key,disableInInput:true},_slide);
			}
			function _slide(){
				_b.slideToggle('slow',
					function(){
						if(_open == false){
							_scroll();
						}
						else if(_open == true){
							j$(j$.browser.safari?'body':'html').animate({scrollTop:0},'slow');
						}
						_open = (_open==true?false:true);
					});
				return false;
			}
			function _scroll(){
				var _target = j$(_a.attr('href'));		
				if(_target.length) {
					var _top = _target.offset().top;
					j$(j$.browser.safari?'body':'html').animate({scrollTop:_top},'slow','swing');
				}
				return false;
			}
	},
	_floatKey: function (_a,_b,_key){
		var _open = false;
		if((_a.length)&&(_b.length)){
			var _panelId = "#" + _b.get(0).id;
			_a.click(_float);
			j$('html').click(function(e){
				if((j$(e.target).parents(_panelId).length == 0)&&(_open == true))_float();
			});
		}
		if((_a.length)&&(_b.length)&&(typeof _key != 'undefined')){
			j$(document).bind('keydown',{combi:_key,disableInInput:true},_float);
		}
		function _float(){
			_open==false?_b.fadeIn():_b.fadeOut();
			_open = (_open==true?false:true);
			return false;
		}
	},
	_jumpKey: function (_a,_key){
		var _href = (_a=='body') ? 'body' : (/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(_a))? _a : _a.attr('href');
		if((typeof _href != 'undefined')&&(typeof _key != 'undefined')&&(_href != 'body')){
		j$(document).bind('keydown',{combi:_key,disableInInput:true},function(){window.location.href=_href});
		}
		else if((typeof _href != 'undefined')&&(typeof _key != 'undefined')&&(_href == 'body')){
		j$(document).bind('keydown',{combi:_key,disableInInput:true},function(){
			var _top = j$("body").offset().top;
			j$(j$.browser.safari?'body':'html').animate({scrollTop:_top},'slow','swing');
			});
		}
	}
});
