ck=pck=false;
$(document).ready(function() {
  $('#movin2').css({display: 'none', position: 'absolute'});
  $('#pagesearch').click(function () {
		if ($('#movin2').css('display') == 'none'){
			$('#movin2').slideDown("normal", function(){pck=true;});
		}else{
			$('#movin2').slideUp("fast", function(){pck=false;});
		}
	});
  $('#movin').css({display: 'none', position: 'absolute'});
  $('#innocent_group').click(function () {
		var position = {};
		$('#innocent_group').position(position);
		if ($('#movin').css('display') == 'none'){
			$('#movin').fadeIn("slow", function (){ck=true;});			
		}else{
			$('#movin').fadeOut("normal", function(){ck=false;});
		}
		$('#movin').css('left', position.left);
		$('#movin').css('top', position.top - $('#movin').height());
	});
  $('#baseblock').click(function () {
    if(ck)$('#movin').fadeOut("normal",function(){ck=false;});
    if(pck)$('#movin2').slideUp("fast",function(){pck=false;});
  });
//swap img
  var conf = {className : 'btn',postfix : '_hit'};
  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; });
    });
});