	$(function() {
		//all
		$('#subtop-toggle').click(function() {
			$('#submenu').animate({right : 0},1000)
		}).bind('mouseenter',function() {
			if(parseInt($("#submenu").css('left')) > 400) $('#submenu').animate({right : -553},{duration:90, queue:false})
		});
		$("#submenu").bind('mouseleave',function() {
			$('#submenu').animate({right : -563},{duration:1000, queue:false})
		});
		$("#moresub-toggle").click(function() {
			w = (($("subtop").children().length)*140)+5;
			if($("#screen").attr('scrollLeft') >= w) $("#screen").animate({scrollLeft : 0}, {duration:500, queue:false})
			else $("#screen ").animate({scrollLeft : "+=560px"}, {duration:500, queue:false})
		})
		
		$('.linkbox').click(function() {
			document.location = $('a',this).attr('href');
		}).css('cursor','pointer')
		
		$('.valueswap').bind('focus',function() {
			if(this.value == this.title) this.value = ''
		}).bind('blur',function() {
			if(this.value == "") this.value = this.title;
		}).each(function() {
			this.value = this.title;
		})
		
		$('#mainmenu').css({backgroundPosition: '-250px 0px'});
		$('#mainmenu>li').each(function(el) {
			$(this).bind('mouseenter',function() {
				$("#mainmenu>li ul").css({
					height: "0px",
					opacity : 0
				});
				u = $($("ul",this)[0]).css('display','block');
				h = u.children().length*27;
				u.animate({height : h+"px", opacity : 1},{duration:120, queue : false});
			}).bind('mouseleave',function() {
				$("ul", $("#mainmenu>li")).stop().hide().css('height',0);
			});
		});
		try {
			$('.sociable img').tooltip({
				track : true,
				delay : 0,
				left:-35,
				extraClass: "share-tooltip",
				top:-38,
				showURL : false,
				bodyHandler: function() {
					return "Post to "+this.tooltipText;
				}
			});
		} catch(e) {}
		
		$("#wp-calendar a").tooltip({
			track : true,
			delay : 50,
			fade : true,
			left :-228,
			top:-10,
			extraClass: "calendar-tooltip",
			showURL : false,
			bodyHandler: function() {
				return this.tooltipText;
			}
		});
		
		$(".featured-thumb").tooltip({
			track : true,
			delay : 50,
			fade : true,
			left :-50,
			top:10,
			extraClass: "cat-tooltip",
			showURL : false,
			bodyHandler: function() {
				return this.tooltipText;
			}
		}).css("opacity",0.3).bind('mouseenter',function() {
			$(this).fadeTo("fast",1)
		}).bind('mouseleave',function() {
			$(this).fadeTo("normal",0.3)
		});
		$('.widget_categories ul').children().each(function() {
			$(this).click(function() {
				$("ul",this).slideToggle();
			});
			$("ul",this).hide();
		});
		$('.postlist-thumb').each(function() {
			new Image(140,140).src = this.src.replace('/modify/60','');
		}).css('display','block').bind('mouseenter',function() {
			//var p = this.offset();
			var im = $(this).clone().css({
				position:'absolute',
				'z-index' : 99
			}).bind('mouseleave',function() {
				$(this).remove();
			}).attr('src', this.src.replace("/modify/60","")).insertBefore(this);
		});
	});

