//Resize Large Images
jQuery(document).ready(function(){
	var size = 580;
	var image = jQuery('#content img');
	
	for (i=0; i<image.length; i++) {
		var bigWidth = image[i].width;
		var bigHeight = image[i].height;
	
		if (bigWidth > size) {	
			var newHeight = bigHeight*size/bigWidth;
			image[i].width = size;
			image[i].height = newHeight;
		}
	}
});

//Tabs
	$(function(){
		var $titleLi = $(".tabs-title li"),
			hov = "current",
			$warp = $(".tabs-content"),
			$warpUL = $warp.find(".tabs-box"),
			$warpUlone = $warpUL.eq(0);
		$warpUL.hide();
		$warpUlone.show();
		
		function Height (){
			$warpUL.each(function(){
				$warp.height("");
				$warpUL.height("");
			});			
		}
		$("*").bind("click",function(){ Height () })
		
		$titleLi.click(
			function(){
				var navLiindex = $(this).index(),
					$listUl = $warpUL.eq(navLiindex),
					boxheight = $listUl.innerHeight();	
				$(this).addClass(hov).siblings().removeClass(hov);
				$listUl.siblings().fadeOut(50);
				$warp.stop().animate({ height:boxheight}, function(){$listUl.fadeIn();Height ()});	
			}	
		);
});

//search
$(function(){
		$("#widget-submit-input")
		.attr({value:"Looking for something?"})		
		.blur(function(){$(this).val($(this).val())})
		.focus(function(){$(this).val("")})

		$("#nomatch-input")
		.attr({value:"Looking for something?"})		
		.blur(function(){$(this).val($(this).val())})
		.focus(function(){$(this).val("")})

		$(".btn").hover(
		function(){$(this).addClass("btnon")},
		function(){$(this).removeClass("btnon")}
		);

     //remove a
    $("a").focus(
    function() {
        $(this).blur();
    }
    );
});

//Img hover
$(function(){
	$(".hover-bg").hover(function(){
		$(this).stop().fadeTo("slow", 0.6);
		},
		function(){
		$(this).stop().fadeTo("slow", 0);
	}).fadeTo(0, 0);	   
});
