var isStyle = (document.getElementById) ? 2 : 0;

/*
------------------------------------------------------------
共有：フォントサイズ変更
------------------------------------------------------------*/
function WriteChFS( path ){
   if(isStyle) {
      var FSS_ON  = new Image();  FSS_ON.src = path + 'shared/bt_fontsize_s.gif';
      document.writeln('<div class="option_fontsize">');
      document.writeln('<h3><img src="' + path + 'shared/km_fontsize.gif" alt="文字サイズ" width="49" height="16" /></h3>');
      document.writeln('<ul>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_s.gif" width="15" height="16" alt="小" onclick="ChFS(1,\'' + path +'\')" id="FS_S" /></li>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_m.gif" width="15" height="16" alt="中" onclick="ChFS(2,\'' + path +'\')" id="FS_M" /></li>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_l.gif" width="15" height="16" alt="大" onclick="ChFS(3,\'' + path +'\')" id="FS_L" /></li>');
      document.writeln('</ul>');
      document.writeln('</div>');
      var C = getCookie("fontsize");
      ChFS(Number(C), path);
   }
}

function WriteChFS_en( path ){
   if(isStyle) {
      var FSS_ON  = new Image();  FSS_ON.src = path + 'shared/bt_fontsize_s.gif';
      document.writeln('<div class="option_fontsize_en">');
      document.writeln('<h3><img src="' + path + 'shared/km_fontsize.gif" alt="TEXT SIZE" width="53" height="16" /></h3>');
      document.writeln('<ul>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_s.gif" width="15" height="16" alt="小" onclick="ChFS(1,\'' + path +'\')" id="FS_S" /></li>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_m.gif" width="15" height="16" alt="中" onclick="ChFS(2,\'' + path +'\')" id="FS_M" /></li>');
      document.writeln('<li><img src="' + path + 'shared/bt_fontsize_l.gif" width="15" height="16" alt="大" onclick="ChFS(3,\'' + path +'\')" id="FS_L" /></li>');
      document.writeln('</ul>');
      document.writeln('</div>');
      var C = getCookie("fontsize");
      ChFS(Number(C), path);
   }
}

function ChFS( size, path ){
   switch( size ){
      case 1:
         document.body.style.fontSize   = '70%';
         document.images.FS_S.src =  path + 'shared/bt_fontsize_s_here.gif';
         document.images.FS_M.src =  path + 'shared/bt_fontsize_m.gif';
         document.images.FS_L.src =  path + 'shared/bt_fontsize_l.gif';
         document.cookie = 'fontsize=1; path=/; expires=Tue, 31-Dec-2030 23:59:59; ';
         break;
      case 2:
         document.body.style.fontSize   = '80%';
         document.images.FS_S.src =  path + 'shared/bt_fontsize_s.gif';
         document.images.FS_M.src =  path + 'shared/bt_fontsize_m_here.gif';
         document.images.FS_L.src =  path + 'shared/bt_fontsize_l.gif';
         document.cookie = 'fontsize=2; path=/; expires=Tue, 31-Dec-2030 23:59:59; ';
         break;
      case 3:
         document.body.style.fontSize   = '90%';
         document.images.FS_S.src =  path + 'shared/bt_fontsize_s.gif';
         document.images.FS_M.src =  path + 'shared/bt_fontsize_m.gif';
         document.images.FS_L.src =  path + 'shared/bt_fontsize_l_here.gif';
         document.cookie = 'fontsize=3; path=/; expires=Tue, 31-Dec-2030 23:59:59; ';
         break;
      default:
         document.body.style.fontSize   = '80%';
         document.images.FS_S.src =  path + 'shared/bt_fontsize_s.gif'
         document.images.FS_M.src =  path + 'shared/bt_fontsize_m_here.gif'
         document.images.FS_L.src =  path + 'shared/bt_fontsize_l.gif'
         document.cookie = 'fontsize=2; path=/; expires=Tue, 31-Dec-2030 23:59:59; ';
         break;
   }
}
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}

/*
------------------------------------------------------------
共有：Window Open
------------------------------------------------------------*/
/*別窓（サイズ指定可）*/
function WinOpen(src,width,height){
   if(! WinOpen.arguments[1]) width  = 500;
   if(! WinOpen.arguments[2]) height = 500;
   var wo = window.open(src,"_blank","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);
   wo.window.focus();
}

/*別窓（サイズ固定）*/
function WinFixOpen(src){
   var wo = window.open(src,"_blank","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=300,height=400");
   wo.window.focus();
}

/*別窓（サイズ自動）*/
function WinAutoOpen(src){
   var wo = window.open(src,"_blank","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
   wo.window.focus();
}

/*別窓（サイズ自動）*/
function WinGalleryOpen(src){
   var wo = window.open(src,"_blank","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
   wo.window.focus();
}

/*
------------------------------------------------------------
共有：Window Close
------------------------------------------------------------*/
function WinClose(){
   self.window.close();
}


/*
------------------------------------------------------------
共有：コピペ禁止
------------------------------------------------------------*/
function GetKeytype(event){
	if(navigator.userAgent.indexOf('Netscape') != -1){
		if(event.ctrlKey && (event.which == 99 || event.which == 118 || event.which == 120))return false;
	} else {
		if(event.ctrlKey && (event.keyCode == 67 || event.keyCode == 86 || event.keyCode == 88))return false;
	}
}
