//jQueryを前提に記述されてます

//表示・非表示の切り替え
jQuery(function(){
	jQuery("#slideTrigger").toggle(
		function(){
			jQuery("#trans_check").slideDown();
			this.src = this.src.replace("btn_downarrow.gif","btn_uparrow.gif");
	},
		function(){
			jQuery("#trans_check").slideUp("fast");
			this.src = this.src.replace("btn_uparrow.gif","btn_downarrow.gif");
	});
});

function twitterWindowResizing(){

  if($('popup_body')){
   var dim = Element.getDimensions($('popup_body'));
   var elm;
   if(parent.Answer.dialog){
     elm = parent.Answer.dialog;
   }else if(parent.Word.dialog){
     elm = parent.Word.dialog;
   }else if(parent.Community.dialog){
     elm = parent.Community.dialog;
   }else if(parent.Report.dialog){
     elm = parent.Report.dialog;
   }
   
	   elm.setSize(dim.width + 1, dim.height + 1, true);
  }
}

jQuery(function(){
  var oCookie = new Cookie();
	jQuery("#slideTrigger2").toggle(
		function(){
    	if( oCookie.get('translate_confirmation_checked')==1 ){
			  jQuery("#trans_check").slideUp(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
			  this.src = this.src.replace("btn_uparrow.gif","btn_downarrow.gif");
	      oCookie.set('translate_confirmation_checked',0);
			  $('translate_confirmation_checkbox').value = 0;
      }else{
			  jQuery("#trans_check").slideDown(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
			  this.src = this.src.replace("btn_downarrow.gif","btn_uparrow.gif");
	      oCookie.set('translate_confirmation_checked',1);
			  $('translate_confirmation_checkbox').value = 1;
			}
				
	  },
		function(){
    	if( oCookie.get('translate_confirmation_checked')==1 ){
			  jQuery("#trans_check").slideUp(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
			  this.src = this.src.replace("btn_uparrow.gif","btn_downarrow.gif");
	      oCookie.set('translate_confirmation_checked',0);
			  $('translate_confirmation_checkbox').value = 0;
      }else{
			  jQuery("#trans_check").slideDown(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
			  this.src = this.src.replace("btn_downarrow.gif","btn_uparrow.gif");
	      oCookie.set('translate_confirmation_checked',1);
			  $('translate_confirmation_checkbox').value = 1;
			}
	  
	  }
	);
});

function translateConfirmationCheck()
{
    var oCookie = new Cookie();
    if( oCookie.get('translate_confirmation_checked')==1 ){
  
		  $('translate_confirmation_checkbox').value = 1;
			jQuery("#trans_check").slideDown(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
		  jQuery("#slideTrigger2").attr("src","/images/home/btn_uparrow.gif");
    }else{

		  $('translate_confirmation_checkbox').value = 0;
			jQuery("#trans_check").slideUp(
        {
					  complete: function() {
              twitterWindowResizing();
					  }
			  });
		  jQuery("#slideTrigger2").attr("src","/images/home/btn_downarrow.gif");
    }
}


//ツールチップ
jQuery(function(){
	jQuery("#cheki_status").hover(toolchipShow,toolchipHide);
});

function toolchipShow(){
	jQuery("#cheki_status").css("position","relative");
	jQuery("#cheki_status.chekitomo-jp").append('<img id="toolchip" src="/images/home/img_chekitomo_jp.gif">');
	jQuery("#cheki_status.chekiS-jp").append('<img id="toolchip" src="/images/home/img_chekiS_jp.gif">');
	jQuery("#cheki_status.chekiR-jp").append('<img id="toolchip" src="/images/home/img_chekiR_jp.gif">');
	jQuery("#cheki_status.nocheki-jp").append('<img id="toolchip" src="/images/home/img_nocheki_jp.gif">');
	jQuery("#cheki_status.chekitomo-cn").append('<img id="toolchip" src="/images/home/chekitomo_cn.gif">');
	jQuery("#cheki_status.chekiS-cn").append('<img id="toolchip" src="/images/home/img_chekiS_cn.gif">');
	jQuery("#cheki_status.chekiR-cn").append('<img id="toolchip" src="/images/home/img_chekiR_cn.gif">');
	jQuery("#cheki_status.nocheki-cn").append('<img id="toolchip" src="/images/home/img_nocheki_cn.gif">');
}

function toolchipHide(){
	jQuery("#toolchip").remove();
}