/*
	usage: tt_SelBox.go('szjKategoriak')
*/
(function($) {
		$.tt_SelBox={
		ID:"",
		maxH:'300',

		oOut: function(o){
			return (($(o).offset().top - $(window).scrollTop() + $(o).height()) > $(window).height());
		},

		go: function(ID){
				var o="",oldO="",oH=0,maxH=0,ieVers=8;
				ieVers=parseInt($.browser.version,10);
				o=$('#'+ID)[0];
				if(this.ID!==ID && this.ID!=="")//korábbi, másik bezárása
				{
					oldO=$('#'+this.ID)[0];
					if($(oldO).css('display')==="block")
					{
						$(oldO).height('auto');
						$(oldO).css({'display':'none'});
					}
				}
				if($(o).css('display')==="block")//Elrejt:
				{
					if(ieVers>=8)
					{
						oH=$(o).outerHeight();
						$(o).stop(true,true).animate({
						height: 0
						},600,'easeOutQuart',function(){
						$(o).height('auto');				
						$(o).css({'display':'none'});

						});
					}
					else
					{
						$(o).height(this.maxH);		
						$(o).css('display','none');	
					}
				}
				else //Mutat
				{
					if(ieVers>=8)
					{
						$(o).css('display','block');
						$(o).height('auto');
						oH=o.offsetHeight;
						maxH=(oH<this.maxH) ? oH : this.maxH;
						$(o).height('0');
						$(o).stop(true,true).animate({
						height: maxH
						},600,'easeOutQuart',function(){
							if( $.tt_SelBox.oOut(o) )
							{
								o.scrollIntoView(false);
							}
						});
					}
					else
					{
						$(o).css('display','block');
						$(o).height('auto');
						oH=o.offsetHeight;
						maxH=(oH<this.maxH) ? oH : this.maxH;
						$(o).height(maxH);
						if($.tt_SelBox.oOut(o))
						{
							o.scrollIntoView(false);
						}	
					}
				}
				this.ID=ID;
			}//end .go func
		};//end class
})(jQuery); 


/*
	usage: jQuery.tt_drag(object amit húzni kell,object ami húzza);
*/

(function($) {
    $.tt_drag = function(o,od){
		od=od||o||null;
		if(!od){return;}

		tt_drag={
			obj: o,
			objToDrag: od,
			isdrag: false,
			x: 0,
			y: 0,
			tx: 0,
			ty: 0,
			dobj: "",

			movemouse: function(e)
			{
				e = e||window.event;	
				if(tt_drag.isdrag)
				{
					if(e.clientX||e.clientY)
					{
						tt_drag.dobj.style.left = (tt_drag.tx + e.clientX - tt_drag.x)+"px";
						tt_drag.dobj.style.top  = (tt_drag.ty + e.clientY - tt_drag.y)+"px";
					}
					return false;
				}
				return true;
			},

			selectmouse: function(e)
			{
				var fobj;
				e=e||window.event;
				fobj=e.target||e.srcElement;
				if(fobj===tt_drag.objToDrag)
				{
					tt_drag.isdrag = true;
					tt_drag.dobj = tt_drag.obj;
					tt_drag.tx = parseInt(tt_drag.dobj.style.left,10);
					tt_drag.ty = parseInt(tt_drag.dobj.style.top,10);
					tt_drag.x = e.clientX;
					tt_drag.y = e.clientY;
					document.onmousemove = tt_drag.movemouse;		
					return false;
				}
				return true;
			},

			upmouse: function()
			{
				tt_drag.isdrag = false;
				document.onmousemove = null;
			}
		};
		document.onmousedown = tt_drag.selectmouse;
		document.onmouseup = tt_drag.upmouse;
		return tt_drag;
	};
})(jQuery); 


/*********************************************************
	Usage: var tallest = $('div').maxHeight(); // Returns the height of the tallest div
*/
(function( $ ){

  $.fn.maxHeight = function() {
  
    var max = 0;

    this.each(function() {
      max = Math.max( max, $(this).height() );
    });

    return max;
  };
})( jQuery );


/*********************************************************
	Usage: jQuery("h1.cim").tt_textShadow();
*/
(function($) {
    $.fn.tt_textShadow=function(){
        if (!$.browser.msie){
        	return;
        }
		this.css({'position':'relative'});
		if(this.css('z-index')==='auto' || this.css('z-index')<0){
			this.css({'z-index':'0'});
		}
		if ($.browser.version < 7){
			this.css({"zoom":"1"});
		}		
		this.each(function(){
			var w=$(this).width();
			var t=$(this).text();
			$(this).append("<span>"+t+"</span>");
			$(this).children().last().css({
				'position': 'absolute',
				'top': '-1px',
				'left': '-1px',
				'color': '#000000',
				'overflow-x': 'hidden',
				'z-index': '-1',
				'width': w,
				'filter': 'progid:DXImageTransform.Microsoft.Blur(pixelradius=1.5)'
				});
		});
	};
})(jQuery);
