$(document).ready(function() {
	
	if($(".colorbox").length){
		$(".colorbox").colorbox({iframe:true, opacity:0.5, innerWidth:"340", innerHeight:"361", initialWidth:"340", initialHeight:"361"});
	}
	
	// Add file type icons to downloadable resources
	$(".item .meta a.download[href$='.pdf']").addClass("pdf");
	$(".item .meta a.download[href$='.xls']").addClass("xls");
	$(".item .meta a.download[href$='.doc']").addClass("doc");
	$(".item .meta a.download[href$='.ppt']").addClass("other");
	$(".item .meta a.download[href$='.txt']").addClass("other");

	// hide the following from ie6
	if ($.browser.msie && parseInt($.browser.version, 10) == "6") {
		return
	} else {
	
		$(".search-field").hide();
		$(".lang ul li").not(".selected").hide();
	
    
		$(".search").hover(
		  function () {
			if(($(".search-field").css("display")) == "none"){
				$(".search-field").show("blind", 1000 );
			}
		  }, 
		  function () {
			return
		  }
		);
	
		$(".lang ul").hover(
		  function () {
			$(".lang ul li").show("fast");
			$('.lang ul li').removeClass("arrow");
		  }, 
		  function () {
			$(".lang ul li").not(".selected").hide("fast");
			$('.lang ul li.selected').addClass("arrow");
		  var target = $(".lang ul li").not(".selected");
		  $(target).detach();
		  $(target).insertAfter($(".lang ul li.selected"));
	
		  }
		);
	
		$('.lang ul li').click(function() {
		  // the clicked LI
		  $('.lang ul li').removeClass("selected");
		  var clicked = $(this);
		  $(this).addClass("selected");
	
		});
	
	}
	
});
