function chgContent(QuestionID,nDsp) {
	var disp=nDsp? nDsp:document.getElementById(QuestionID).style.display;
	if(disp == "block") {
		document.getElementById(QuestionID).style.display = "none";
	} else {
		document.getElementById(QuestionID).style.display = "block";
		document.getElementById(QuestionID).style.zIndex = 1000;
	}
}
function deletes(url,kiji,all,head){
	var hombun='本当に';
	if(all){
		hombun =hombun + '掲載中の';
	}
	if(kiji){
		hombun =hombun + '「' + kiji + '」';
	} else {
		hombun =hombun + '本文';
	}
	hombun =hombun + 'を削除してもよろしいですか？';
	if(head && all){
		hombun =hombun + "\n" + '編集中の文章も含め記事全体を削除します';
	} else if(all){
		hombun =hombun + "\n" + '編集中の本文も全て削除します';
	} else {
		hombun =hombun + "\n" + '編集中の文章のみ削除します';
		hombun =hombun + "\n" + '掲載中の文章は削除されません';
	}
	if(confirm(hombun)){
		location=url;
	}
}
function closediv(div){
	var parents=document.getElementById(div);
	while (parents.firstChild) {
		parents.removeChild(parents.firstChild);
	}
	parents.style.display='none';
}
function removediv(div){
	var removedivs=document.getElementById(div);
	removedivs.parentNode.removeChild(removedivs);
}
function sucerrview(errtxt,sucerr,div){
	if(div==undefined || div==''){
		div="titleform";
	}
	var spn=document.getElementById('spnners');
	if(spn){
		spn.parentNode.removeChild(spn);
	}
	var oerr=document.getElementById('sucerr');
	if(oerr){
		oerr.parentNode.removeChild(oerr);
	}
	var err=document.createElement("DIV");
	err.id='sucerr';
	if(sucerr=='error'){
	err.style.backgroundColor="#fee";
	err.style.border="3px double Crimson";
	} else {
	err.style.backgroundColor="#eef";
	err.style.border="3px double #00f";
	}
	err.style.padding="10px";
	err.style.width="400px";
	err.style.margin="1em auto";
	//err.style.position='absolute';
	var a=document.createElement("A");
	a.setAttribute('href',"javascript:removediv('sucerr')");
	a.setAttribute('title',"閉じる");
	var img = document.createElement("IMG");
	img.className='imgr';
	img.setAttribute('src',topurl+"rel/icon_b1.gif");
	img.setAttribute('alt',"閉じる");
	img.style.width='16px';
	img.style.height='16px';
	img.style.border='0';
	img.setAttribute('align',"top");
	a.appendChild(img,null);
	err.appendChild(a,null);
	if(typeof(errtxt)=='string'){
		var back=errtxt;
		errtxt=new Array();
		errtxt[0]=back;
	}
	for(var i=0; i < errtxt.length; i++){
		if(i !=0) {
			var br=document.createElement("BR");
			err.appendChild(br,null);
		}
		var maru;
		if(sucerr=='error'){
			var span=document.createElement("SPAN");
			span.style.color='crimson';
			maru=document.createTextNode('●');
			span.appendChild(maru,null);
			err.appendChild(span,null);
		} else {
			maru=document.createTextNode('■');
			err.appendChild(maru,null);
		}
		var txt=document.createTextNode(' '+errtxt[i]);
		err.appendChild(txt,null);
	}
	var bd = document.getElementById(div);
	bd.parentNode.insertBefore(err,bd);
	var pos=elmPos(err,1);
	window.scrollTo(pos[0], pos[1])
}
function elmPos (obj,tops) {
	var bounds = obj.getBoundingClientRect();
	var curtop =bounds.top + posTop();
	var curleft =bounds.left + posLeft();
	var objHeight = obj.offsetHeight;
	return [curleft,curtop+(tops? 0:objHeight)];
}
function makespin(){
	var spins=document.createElement('IMG');
	spins.src=topurl+'rel/ajax-loader.gif';
	spins.id='spnners';
	spins.setAttribute('width',16);
	spins.setAttribute('height',16);
	return spins;
}
function pageWidth() {
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight() {
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}
function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;}
function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

