ck=false;
$(document).ready(function() {
var targetbox = $('#movin');
var groupbtn = $('#innocent_group');
targetbox.css({display: 'none', position: 'absolute'});
  groupbtn.click(function () {
		var position = groupbtn.offset();
		if (targetbox.css('display') == 'none'){
			targetbox.fadeIn("normal", function(){ck=true;});
		}else{
			targetbox.fadeOut("fast", function(){ck=false;});
		}
		targetbox.css({'left':position.left,'top':position.top-targetbox.height()-50});
	});
  $('#base').click(function () {
    if(ck)targetbox.fadeOut("normal",function(){ck=false;});
  });
  
//swap img
var conf = {
    className : 'btn',
    postfix : '2'
  };
  var image_cache = new Object();
  $('img.'+conf.className).each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) +  conf.postfix + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
  
  //fade over
	$("a img.fade").hover(
	function(){
		$(this).fadeTo(50, 0.8);
	},
	function(){
		$(this).fadeTo(50, 1.0);
	}
	);
  
//archive menu

$("div#item_archives ul").css({'display' : 'none'});
$("div#item_archives ul#thisyear").css({'display' : 'block'});

$("div#item_archives h3 a").click(function(){
	var target = $(this).parent().next("ul");
	
	if (target.css('display') == 'none'){
		
		target.show("700").siblings("ul:visible").hide("700");
		
	}else{
		target.hide("700");
	}
	
 });
  
  
});

