function sWinopen(wUrl,wName,wWidth,wHeight,wScroll) {
	var wArg = "";
	wArg = wArg + "menubar=no";
	wArg = wArg + ",location=no";
	wArg = wArg + ",toolbar=no";
	wArg = wArg + ",resizable=yes";
	wArg = wArg + ",status=no";
	if (wScroll != "") {
		wArg = wArg + ",scrollbars=" + wScroll;
	 } else {
		wArg = wArg + ",scrollbars=no";
	}
	if (wHeight != "") {
		wArg = wArg + ",height=" + wHeight;
	}
	if (wWidth != "") {
		wArg = wArg + ",width=" + wWidth;
	}
	var wTop = 0;
	if (wHeight != "") {
		wTop = Number(window.screen.availHeight - wHeight)/2;
	}
	wArg = wArg + ",top=" + wTop;
	var wLeft = 0;
	if (wWidth != "") {
		wLeft = Number(window.screen.availWidth - wWidth)/2;
	}
	wArg = wArg + ",left=" + wLeft;
    wWin = window.open(wUrl, wName, wArg);
    wWin.focus();
}
function sWinopen2(wUrl) {
	var IE = navigator.appName.indexOf('Microsoft',0) != -1;
	var NN = navigator.appName.indexOf('Netscape',0) != -1;
	var scWidth = screen.availWidth;
	var scHeight = screen.availHeight;
	var setw = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0,';
	if(IE) {
		setw = setw + 'width=' + (scWidth-12) + ',height=' + (scHeight-31);
	}
	else if(NN){
		setw = setw + 'outerwidth=' + scWidth + ',outerheight=' + scHeight;
	}
	else {
		setw = setw + 'width=' + scWidth + ',height=' + scHeight;
	}

	max_window = window.open(wUrl,'win1',setw);
	max_window.focus();
}

function sOpenPreview (f) {
    var wSaveScript = f.action;
    window.open('blank.html', 'comments','left=150,top=100,width=640,height=480,scrollbars=yes,resizable=yes,status=yes');
    f.action = "preview.php";
    f.target = "comments";
    f.submit();
    f.target = "_self";
    f.action = wSaveScript;
}

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.
function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") + (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}
function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}
function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}
function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (f.name == "entry_form") {
        setCookie('mtcmtauth', f.title.value, now, '/', '', '');
        setCookie('mtcmthome', f.text_more.value, now, '/', '', '');
    } else {
        setCookie('mtcmtauth', f.author.value, now, '/', '', '');
        setCookie('mtcmthome', f.url.value, now, '/', '', '');
    }
}
function forgetMe (f) {
    deleteCookie('mtcmthome', '/', '');
    deleteCookie('mtcmtauth', '/', '');
    if (f.name == "entry_form") {
        f.title.value = '';
        f.text_more.value = '';
    } else {
        f.author.value = '';
        f.url.value = '';
    }
}
function keystrokes(f) {
    f.userkeystrokes.value = 1;
}
function sSetFormValue(f) {
    if (f.name == "entry_form") {
        f.title.value = getCookie("mtcmtauth");
        f.text_more.value = getCookie("mtcmthome");
        if (f.text_more.value == "") {
            f.text_more.value = "http://"
        }
    } else {
        f.author.value = getCookie("mtcmtauth");
        f.url.value = getCookie("mtcmthome");
        if (f.url.value == "") {
            f.url.value = "http://"
        }
    }
}
function sDisplay(id,f) {
    var disp = document.getElementById(id).style.display;
    if (disp == "none") {
        document.getElementById(id).style.display= "block";
        sSetFormValue(f);
/*        location.hash = id; */
    } else {
        document.getElementById(id).style.display= "none";
    }
}
function isZen(obj){
  var str=obj.value; /* 入力値 */
  for(var i=0; i<str.length; i++){
    var len=escape(str.charAt(i)).length;
    if(len>=4){
/*      alert('全角文字が含まれています'); */
      return false;
    }
  }
/*  alert('全角文字は含まれていません'); */
  return true;
}
/* 　 */
