﻿/* 上へ移動ここから */

<!--
function backToTop() {
  var x1 = x2 = x3 = 0;
  var y1 = y2 = y3 = 0;
  if (document.documentElement) {
      x1 = document.documentElement.scrollLeft || 0;
      y1 = document.documentElement.scrollTop || 0;
  }
  if (document.body) {
      x2 = document.body.scrollLeft || 0;
      y2 = document.body.scrollTop || 0;
  }
  x3 = window.scrollX || 0;
  y3 = window.scrollY || 0;
  var x = Math.max(x1, Math.max(x2, x3));
  var y = Math.max(y1, Math.max(y2, y3));
  window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
  if (x > 0 || y > 0) {
      window.setTimeout("backToTop()", 25);
  }
}
//-->

/* 上へ移動ここまで */
/* 表示・非表示ここから */

function btn( boxid ) {
   var target = document.getElementById(boxid);
   if( target.style.display != "none" ) {
      target.style.display = "none";
   }
   else {
      target.style.display = "";
   }
}

/* 表示・非表示ここまで */
/* メール確認ダイアログここから */

function check(){
	var flag = 0;
	if(document.form.text.value == ""){ 
		flag = 1;
	}
	if(flag){
		window.alert('※印は必須項目です。'); 
		return false; 
	}else{
		if(window.confirm('送信してよろしいですか？')){ // 確認ダイアログを表示
		return true; // 「OK」時は送信を実行
	}else{ // 「キャンセル」時の処理
		window.alert('キャンセルされました'); // 警告ダイアログを表示
		return false; // 送信を中止
	}
	}
}

/* メール確認ダイアログここまで */
/* iframe設定ここから */

function iFrameHeight() {       var h = 0;       var Opera = window.opera ? true : false;       if (Opera) {           h = document.getElementById('blockrandom').contentDocument.getElementById('inHeight').offsetHeight + 20;           document.getElementById('blockrandom').setAttribute("height",h);       } else if ( !document.all ) {           h = document.getElementById('blockrandom').contentDocument.height;           document.getElementById('blockrandom').style.height = h + 10 + 'px';       } else if( document.all ) {           h = document.frames('blockrandom').document.body.scrollHeight;           document.all.blockrandom.style.height = h + 20 + 'px';       }   }   

/* iframe設定ここまで */
/* 管理画面ここから */

var C_POS=0;
//カーソル位置を記録して置く
function c_pos(el){
var sel=document.selection.createRange();
var r=el.createTextRange();
var all=r.text.length;
r.moveToPoint(sel.offsetLeft,sel.offsetTop);
r.moveEnd("textedit");
C_POS=all-r.text.length;
}

function a(link){
//リンクテキスト
var str=selectionText(link);
//リンクURL
var url=document.form.url.value;
//リンク先
var target=document.form.target.value;
selectionTextReplace(link, '<a href="'+url+'" target="'+target+'">' + str + '</a>');
}

function img(image){
//画像name
var img=document.form.imgname.value;
//画像説明
var alt=document.form.alt.value;
selectionTextReplace(image, '<img src="http://abeatsushi.com/img/blog/'+img+'" alt="'+alt+'"/>');
}

function selectionText(el){
if(document.all){ //IE
return document.selection.createRange().text;
} else { //Firefox
return el.value.substring(el.selectionStart, el.selectionEnd);
}
}
function selectionTextReplace(el, repStr){
if(document.all){ //IE
if(document.selection.createRange().text!=""){
document.selection.createRange().text = repStr;
} else {
el.value = 
el.value.substring(0, C_POS) +
repStr +
el.value.substr(C_POS);
}
} else { //Firefox
el.value = 
el.value.substring(0, el.selectionStart) +
repStr +
el.value.substr(el.selectionEnd);
}
}
//△△リンク・画像挿入△△




//掲示板がみれない
function bbs(){
	showModalDialog("bbs/bbs.php?ver=dialog",window,"status:false;dialogWidth:200px;dialogHeight:600px;");
}
