var _doc;
_doc=document;
var oWrap;
var oScreen;
var	iInnerWidth=Number();
var isPlatform;

window.onscroll=function(){
	try{
		if(window.pageYOffset){
			oScreen.style.top=window.pageYOffset+"px";
		}else{
			oScreen.style.top=_doc.documentElement.scrollTop;
		}
	}catch(e){}
	if(window.pageYOffset){
		try{
			objZoomImg.style.top=(window.pageYOffset+10)+"px";
		}catch(e){}
	}else{
		try{
				objZoomImg.style.top=(_doc.documentElement.scrollTop+10)+"px";
		}catch(e){}
	}
	try{
		setChangePicturePanelPos()
	}catch(e){}
}

function resizeBlock(){
	try{
		iInnerWidth=_doc.body.clientWidth;
	}catch(e){
		iInnerWidth=window.innerWidth;
	}
	var oBlock=Array();
	oBlock[curPage+'-main']=_doc.getElementById(curPage+"-main");
	oBlock[curPage+'-main'].style.width=(iInnerWidth-403)+"px";
	
	try{
		var oSearchResult;
		if(oSearchResult =_doc.getElementById("search-result")){
			oSearchResult.style.width =(iInnerWidth-40)+"px";
		}
	}catch(e){}

}


function onResizeExe(){
	setChangePicturePanelPos();
	setScreenWholeSize();
}

function onLoadCommon(){
	oWrap=_doc.getElementById("wrap");
	oOuter=_doc.getElementById("outer");
	doInit();
	
	try{
		iInnerWidth=_doc.body.clientWidth;
	}catch(e){
		iInnerWidth=window.innerWidth;
	}
	
	
	setObjPagetop();
	try{
		oPagetop	=_doc.getElementById("pagetop");
		oPagetop.onmousedown	=mouseDownEvent;
	}catch(e){}
	/*try{
		oPagetopDraft	=_doc.getElementById("idealist-stat-draft").getElementsByTagName("a")[0];
		oPagetopDraft.onmousedown	=mouseDownEvent;
	}catch(e){}*/
	try{
		oLogout =_doc.getElementById("global-nav-account-sign-logout-btn");
		oLogout.setAttribute("href","javascript:showLogoutPanel();");
	}catch(e){}
	showPagetopBtn();
	/*if(	location.href.indexOf("idea")>-1||
		location.href.indexOf("mypage")>-1){*/
	if(	location.href.indexOf("idea")>-1){
    	onLoadIdea();
	}
	
	escapeSubmitOnInput();

	if(location.pathname.indexOf("/entry")>-1){	
		setFormChangeFlag(1);
	}
	if(location.pathname.indexOf("/tsubu")>-1){	
		setFormChangeFlag(2);
	}
	if(location.pathname.indexOf("/pick")>-1&&location.pathname.indexOf("/idea")<0){
		if(_doc.pick.url.value!=""&&_doc.pick.url.readOnly!="readonly"){
			checkUrlExists(_doc.pick.url.value,'pick-url-check');
		}
		setFormChangeFlag(3);
	}

	try{
		_doc.search.searchText.onkeypress=function(event){
			return searchItemsWithEnterKey(event);
		}
	}catch(e){}

	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes("", "/call/call_frame.php?func=checkScript","" , aFuncs, aErrs);

	//イメージのプレロード
	var preImg =new Array();
	preImg['followList'] =new Image();
	preImg['followList'].src ="/images/global/loading.follow.list.gif";

}

function switchPlatform(mode){
	var aFuncs =Array('location.reload()');
	var aErrs =Array();
	if(mode=="desktop"){
		setWholeMobScreen(true);
	}else{
		setScreenWhole(true);
	}
	callHtmlNodes("", "/call/call_common.php?func=switchPlatform", "mode="+mode, aFuncs, aErrs);
}



function setTwitterSync(objId,sync){
	var aFuncs =Array('setCookie("prefs[twitterSync]","'+sync+'",365,"/")');
	var aErrs =Array();
	//callHtmlNodes(objId, "../call/call_format.php?func=setTwitterSync", "objId="+objId+"&sync="+sync, aFuncs, aErrs);
	callHtmlNodes(objId, "/call/call_format.php?func=setTwitterSync", "objId="+objId+"&sync="+sync, aFuncs, aErrs);
}

function switchPageBox(objId,type,cnrId,box,tpcId){
	var aFuncs =Array("initDocument()");
	var aErrs =Array();
	//callHtmlNodes(objId, "../call/call_format.php?func=switchPageBox&item="+cnrId, "type="+type+"&cnrId="+cnrId+"&box="+box+"&tpcId="+tpcId, aFuncs, aErrs);
	callHtmlNodes(objId, "/call/call_format.php?func=switchPageBox&item="+cnrId, "type="+type+"&cnrId="+cnrId+"&box="+box+"&tpcId="+tpcId, aFuncs, aErrs);
}


function showHomeMainListMore(type,code){
	var oList =_doc.getElementById("home-main-"+type+"-"+code);
	var oMainListLis =oList.getElementsByTagName("li");
	var sClassName =String();
//oList.innerHTML+="<!-- /"+ oMainListLis[0].getAttributeNode("class").nodeValue +"/ -->"	
	for(i=0;i<oMainListLis.length;i++){
		try{
		sClassName =oMainListLis[i].getAttributeNode("class").nodeValue;
		if(sClassName.substr(sClassName.indexOf(" ")+1)=="display-none"){
			oMainListLis[i].getAttributeNode("class").nodeValue =sClassName.substr(0,sClassName.indexOf(" "));
		}
		}catch(e){}
	}
	var oListBtn =_doc.getElementById("home-main-"+type+"-"+code+"-show-btn");
	
	oListBtn.setAttribute("href","/"+type+"/?code="+code);
	//oListBtn.style.display ="none";
}

function postRatingStars(type,cnrId,starNum,starNumOld){
	if(starNum!=starNumOld){
		var oRatingStarParent =_doc.getElementById(ratingStarParentId);
		oRatingStarParent.style.position="relative";
		var oLoading =_doc.createElement("div");
		oLoading.setAttribute("id","post-rating-star-loading");
		oLoading.style.width ="75px";
		oLoading.style.textAlign ="center";
		oLoading.style.position ="absolute";
		oLoading.style.top ="0";
		oLoading.style.left ="0";
		oLoading.style.backgroundColor ="#fff";
		
		var oLoadingImg =_doc.createElement("img");
		oLoadingImg.src="/images/global/loading.15.gif";
		//oLoadingImg.alt="!"+ratingStarParentId;
		oLoading.appendChild(oLoadingImg);
		oRatingStarParent.appendChild(oLoading);
	
		var aFuncs =Array("offsetRatingStars('"+ratingStarParentId+"')");
		var aErrs =Array("postRatingStarsErr()");
		callHtmlNodes(ratingStarParentId, "/call/call_common.php?func=postRatingStars","parentId="+ratingStarParentId+"&type="+type+"&cnrId="+cnrId+"&starNum="+starNum , aFuncs, aErrs);
	}
}

function postRatingStarsErr(){
	alert("評価を投票できませんでした。");
	var oRatingStarParent =_doc.getElementById(ratingStarParentId);
	var oLoading =_doc.getElementById("post-rating-star-loading");
	oRatingStarParent.removeChild(oLoading);
}

function hoverRatingStar(starNum){
	var oRatingStarParent;
	if(oRatingStarParent =_doc.getElementById(ratingStarParentId)){
		var oAs =oRatingStarParent.getElementsByTagName("a");
		for(i=0;i<oAs.length;i++){
			sClass =oAs[i].getAttributeNode("class").nodeValue;
			//if(sClass.substr(0,sClass.indexOf(" "))=="rating-stars"){
			if(sClass.substr(sClass.indexOf(" ")+1)=="rating-btn"){
				if(i<starNum){
					oAs[i].style.backgroundPosition ="-50px -50px";
				}else{
					oAs[i].style.backgroundPosition ="-50px -75px";
				}
			}
		}
	}
}
var ratingStarParentId;
function onsetRatingStars(parentId){
		ratingStarParentId =parentId
		var oRatingStarParent;
		if(oRatingStarParent =_doc.getElementById(ratingStarParentId)){
			var oDivs =oRatingStarParent.getElementsByTagName("div");
			for(i=0;i<oDivs.length;i++){
				try{
				switch(oDivs[i].getAttributeNode("class").nodeValue){
					case "rating-form":
					oDivs[i].style.display ="block";
					break;
					case "rating-body":
					oDivs[i].style.display ="none";
					break;
					case "rating-sum":
					oDivs[i].style.display ="block";
					break;
				}
				}catch(e){}
			}
			
			oRatingStarParent.onmouseout=function(){
				try{
					offsetRatingStars(ratingStarParentId);
				}catch(e){}
			}
		}
}

function offsetRatingStars(ratingStarParentId){
	var oRatingStarParent;
	if(oRatingStarParent =_doc.getElementById(ratingStarParentId)){
		var oDivs =oRatingStarParent.getElementsByTagName("div");
		for(i=0;i<oDivs.length;i++){
			switch(oDivs[i].getAttributeNode("class").nodeValue){
				case "rating-form":
				oDivs[i].style.display ="none";
				break;
				case "rating-body":
				oDivs[i].style.display ="block";
				break;
				case "rating-sum":
				oDivs[i].style.display ="none";
				break;
			}
		}
	}
}


function showTerms(mode){
	var oTermsInFrame =_doc.createElement("div");
	oTermsInFrame.setAttribute("id","terms-in-frame");
	/*oTermsInFrame.style.position ="absolute";
	oTermsInFrame.style.top ="5px";
	oTermsInFrame.style.left ="10px";
	oTermsInFrame.style.zIndex =2;
	oTermsInFrame.style.width ="800px";
	*/
	oOuter.appendChild(oTermsInFrame);
	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes("terms-in-frame", "/call/call_terms.php?func=showTerms","mode="+mode , aFuncs, aErrs);
	oWrap.onclick =function(){
		hideTerms();
	}
}
function hideTerms(){
	var oTermsInFrame =_doc.getElementById("terms-in-frame");
	oOuter.removeChild(oTermsInFrame);
}
function startFollow(type,cnrId,list){
	var oFollowBtn =_doc.getElementById(type+"-followbtn-"+cnrId);
	var oImgLoadingFollowList =_doc.createElement("img");
	if(list==1){
		var sList =".list";
	}else{
		var sList ="";		
	}
	oImgLoadingFollowList.src="/images/global/loading.follow"+sList+".gif";
	oImgLoadingFollowList.id ="loading-follow-list";
	oImgLoadingFollowList.style.position ="absolute";
	oImgLoadingFollowList.style.top ="0";
	oImgLoadingFollowList.style.left ="0";

	oFollowBtn.appendChild(oImgLoadingFollowList);
	
	var aFuncs =Array();
	var aErrs =Array('startFollowErr("'+type+"-followbtn-"+cnrId+'")');
	callHtmlNodes(type+"-followbtn-"+cnrId, "/call/call_common.php?func=startFollow","type="+type+"&cnrId="+cnrId+"&list="+list , aFuncs, aErrs);
}

function downloadItems(type,url){
	cnrId =url.substring(url.indexOf("/id")+3,url.lastIndexOf("?"));
	//var aFuncs =Array("open('"+url+"','"+type+cnrId+"','')");
	//var aErrs =Array("open('"+url+"','"+type+cnrId+"','')");
	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes("", "/call/call_common.php?func=downloadItems","type="+type+"&cnrId="+cnrId, aFuncs, aErrs);
	
}

function startFollowErr(btnId){
	var oFollowBtn =_doc.getElementById(btnId);
	var oImgLoadingFollowList =_doc.getElementById("loading-follow-list");
	oFollowBtn.removeChild(oImgLoadingFollowList);
}

function showFollowPanel(type,cnrId,list){
	
	var oFollowPanel =_doc.createElement("div");
	oFollowPanel.setAttribute("id","follow-panel");
	oFollowPanel.style.position="absolute";
	oFollowPanel.style.right="230px";
	oOuter.appendChild(oFollowPanel);
	
	var objId =type+"-followbtn-"+cnrId
	//sOrigFollow =_doc.getElementById(objId).innerHTML;
	if(list==1){
		var sList =".list";
	}else{
		var sList ="";		
	}
	var oFollowLoading =_doc.createElement("img");
	oFollowLoading.setAttribute("id","follow-loading");
	oFollowLoading.src ="/images/global/loading.followPanel"+sList+".gif";
	oFollowLoading.style.position ="absolute";
	oFollowLoading.style.top ="0";
	oFollowLoading.style.left ="0";

	var oFollow =_doc.getElementById(objId);
	oFollow.appendChild(oFollowLoading);
	

	var aFuncs =Array("showFollowPanelAfter('"+objId+"')");
	var aErrs =Array();
	var oFollowPanel;
	if(oFollowPanel=_doc.getElementById("follow-panel")){
	}else{
		oFollowPanel =_doc.createElement("div");
		oFollowPanel.setAttribute("id","follow-panel");
		oOuter.appendChild(oFollowPanel);
	}
	
	oFollowPanel.style.position ="absolute";
	oFollowPanel.style.zIndex =2;
	if(offsetX>570){
		stick ="br";
		oFollowPanel.style.left =(offsetX-570)+"px";
	}else{
		oFollowPanel.style.left =(offsetX-50)+"px";
		stick ="bl";
	}
	callHtmlNodes("follow-panel", "/call/call_format.php?func=showFollowPanel","type="+type+"&cnrId="+cnrId+"&list="+list+"&stick="+stick, aFuncs, aErrs);

	oWrap.onclick	=function(){
		hideFollowPanel();
	}
}

function showFollowPanelAfter(objId){
	var iFollowCount =_doc.getElementById("follow-count").innerHTML;
	//var oFavstarPanel =iPull =135+38*Math.ceil(iFavsarCount/15);
	var oFollowPanel;
	var iPull =135+38*Math.ceil(iFollowCount/15);
	oFollowPanel=_doc.getElementById("follow-panel");
	oFollowPanel.style.top =(offsetY-iPull)+"px";
	var oFollowLoading =_doc.getElementById("follow-loading");
	var	oFollow=_doc.getElementById(objId);
	oFollow.removeChild(oFollowLoading);
}

function hideFollowPanel(){
	try{
		var oFollowPanel=_doc.getElementById("follow-panel");
		oOuter.removeChild(oFollowPanel);
	}catch(e){}
}

function stopFollow(type,cnrId,list){
	var oFollowPanelControl =_doc.getElementById("follow-panel-control");
	sFollowPanelControlOrig =oFollowPanelControl.innerHTML;
	oFollowPanelControl.innerHTML ='<span style="font-size:90%;float:right;padding-right:18px;position:relative;color:#666;"><img style="position:absolute;top:0;left:0;" src="/images/global/loading.12.gif" />解除中</span>';
	var objId =type+"-followbtn-"+cnrId;
	//var aFuncs =Array("stopFollowAfter('"objId+"')");
	if(isPlatform=="mobile"){
		var aFuncs =Array("closeFollowPanel()");
	}else{
		var aFuncs =Array("hideFollowPanel()");	
	}
	var aErrs =Array("stopFollowErr('"+objId+"')");
	callHtmlNodes(objId, "/call/call_common.php?func=stopFollow","type="+type+"&cnrId="+cnrId+"&list="+list, aFuncs, aErrs);
}
function stopFollowAfter(objId){
	
	//callHtmlNodes(objId, "/call/call_common.php?func=stopFollowAfter","", aFuncs, aErrs);
}
function stopFollowErr(objId){
	var oFollowPanelControl =_doc.getElementById("follow-panel-control");
	oFollowPanelControl.innerHTML =sFollowPanelControlOrig;
}

function sendSysReport(){
	var aSysReportType =_doc.sysReport.sysReportType;
	var sType =String();
	for(i=0;i<aSysReportType.length;i++){
		if(aSysReportType[i].checked){
			sType =aSysReportType[i].value;
			break;
		}
	}
	if(sType!=""){
		var sMail =_doc.sysReport.sysReportMail.value;
		var sText =_doc.sysReport.sysReportText.value;
		var sUrl =_doc.sysReport.sysReportUrl.value;
		var sTitle =_doc.sysReport.sysReportTitle.value;
		if(sType=="3"&&sMail.length==0){
			alert("「お問い合わせ」の際は、必ず「メールアドレス」を入力してください。");
			_doc.sysReport.sysReportMail.focus();
			_doc.sysReport.sysReportMail.style.backgroundColor="#fda";
		}else if(sText.length==0){
			alert("「コメント」は、必ず入力してください。");
		}else{
			//sOrigSysReportFormBody =_doc.getElementById("sys-report-form-body").innerHTML;
			sOrigSysReportSubmit =_doc.getElementById("sys-report-submit").innerHTML;

			var aFuncs =Array('_doc.getElementById("sys-report-form-body").style.height="315px"');
			var aErrs =Array("sendSysReportError()");
			if(isPlatform=="mobile"){
				_doc.getElementById("sys-report-submit").innerHTML='<div style="text-align:center;padding:10px 0;"><img src="/images/global/loading.15.gif" /></div>\n';		
				callHtmlNodes("sys-report-form-body", "/mobile.call/call_format.php?func=sendSysReport","type="+sType+"&mail="+sMail+"&text="+sText+"&url="+sUrl+"&title="+sTitle , aFuncs, aErrs);
			}else{
				_doc.getElementById("sys-report-submit").innerHTML='<span" id="sys-report-submit-btn" style="background-position:-150px -350px;position:relative;text-align:left;text-indent:20px;"><img style="position:absolute;top:1px;left:1px;" src="/images/global/picture.updating.gif" alt="送信中" />送信中</span>';
				callHtmlNodes("sys-report-form-body", "/call/call_format.php?func=sendSysReport","type="+sType+"&mail="+sMail+"&text="+sText+"&url="+sUrl+"&title="+sTitle , aFuncs, aErrs);
			}
		}
	}else{
		alert("「ご報告内容」は、必ず選択してください。");	
	}
}

function sendSysReportError(){
	//_doc.getElementById("sys-report-form-body").innerHTML =sOrigSysReportFormBody;
	_doc.getElementById("sys-report-submit").innerHTML =sOrigSysReportSubmit;
	if(aResponse[2]=="mail"){
		_doc.sysReport.sysReportMail.focus();
		_doc.sysReport.sysReportMail.style.backgroundColor="#fda";
	}
}

function switchSysReportType(){
	var aSysReportType =_doc.sysReport.sysReportType;
	for(i=0;i<aSysReportType.length;i++){
		if(aSysReportType[i].checked){
			sType =aSysReportType[i].value;
			break;
		}
	}
	if(sType==1){
		_doc.getElementById("sys-report-info").style.display="block";
	}else{
		_doc.getElementById("sys-report-info").style.display="none";
	}
	
	if(sType==3){
		_doc.getElementById("sys-report-usr-email-label").innerHTML ='メールアドレス<span class="color-f30">（必須）</span>:&nbsp;';	
	}else{
		_doc.getElementById("sys-report-usr-email-label").innerHTML ='メールアドレス（任意）:&nbsp;';	
	}
}

function openSysReportForm(url){
	//alert(location.search);
	var url =escape(location.protocol+location.hostname+location.pathname+location.search+location.hash);
	var title =_doc.getElementsByTagName("title")[0].innerHTML;
	title =title.split(" | ");
	title =title[0];
	
	var oSysReport =_doc.getElementById("sys-report");
	sSysReportOrig =oSysReport.innerHTML;
	
	oSysReport.innerHTML ='<div style="text-align:center;"><img src="/images/global/loading.15.gif" /></div>\n';
	oSysReportForm =_doc.createElement("div");
	oSysReportForm.setAttribute("id","sys-report-form");
	oOuter.appendChild(oSysReportForm);
	oSysReportForm.style.top =(offsetY-420)+"px";
	var aFuncs =Array("openSysReportFormAfter()","escapeSubmitOnInput()");
	var aErrs =Array();
	callHtmlNodes("sys-report-form", "/call/call_format.php?func=openSysReportForm","url="+url+"&title="+title , aFuncs, aErrs);
	oWrap.onclick =function(){
		hideSysReportForm();
	}
	
}

function openSysReportFormAfter(){
	
	_doc.getElementById("sys-report").innerHTML =sSysReportOrig;
}

function hideSysReportForm(){
	var oSysReportForm =_doc.getElementById("sys-report-form");
	if(_doc.sysReport.sysReportText.value!=""||_doc.sysReport.sysReportMail.value!=""){
		if(confirm("「お問い合わせ・ご連絡フォーム」を閉じます。\n未送信のデータは破棄されます。")){
			_doc.sysReport.sysReportText.value ="";
			_doc.sysReport.sysReportMail.value ="";
			try{
				oOuter.removeChild(oSysReportForm);
			}catch(e){}
		}
	}else{
		try{
			oOuter.removeChild(oSysReportForm);
		}catch(e){}
	}
}

function showUsrInfo(usrId,screenName){
	if(oUsrInfo =_doc.getElementById("usrinfo")){
	}else{
		oUsrInfo =_doc.createElement("div");
		oUsrInfo.setAttribute("id","usrinfo");
		oOuter.appendChild(oUsrInfo);
	}
	iHeight=230;iWidth=50;
	oUsrInfo.style.top =(offsetY-iHeight)+"px";
	oUsrInfo.style.left =(offsetX-iWidth)+"px";
	
	oUsrInfo.innerHTML=
'<div class="balloon-white">\n'+
'<div class="balloon-close"><a class="ico-close-a" href="javascript:hideUsrInfo();"><span class="hidden">閉じる</span></a></div>\n'+
'<div class="balloon-bl">\n'+
'<div class="balloon-crn-tl">\n'+
'<div class="balloon-crn-tr">&nbsp;</div>\n'+
'<div class="balloon-main">\n'+
'<strong>'+screenName+'さんのプロフィール</strong>\n'+
'<div style="text-align:center;height:95px;padding:50px 0 0 0;"><img src="/images/global/loading.small.gif" /></div>\n'+
'</div><!-- balloon-main -->\n'+
'</div><!-- balloon-crn-tl -->\n'+
'<div class="balloon-crn-bl">\n'+
'<div class="balloon-crn-br">\n'+
'</div>\n'+
'<div class="balloon-stick"></div>\n'+
'</div>\n'+
'</div>\n'+
'</div>';

	var aFuncs =Array('_doc.getElementById("usrinfo").style.width ="auto"');
	var aErrs =Array();
	
	callHtmlNodes("usrinfo", "/call/call_format.php?func=showUsrInfo","usrId="+usrId , aFuncs, aErrs);
	
	oWrap.onclick =function(){
		hideUsrInfo();
		oWrap.onclick =function(){
			try{
				hideTopicFavstarPanel();
			}catch(e){}
			try{
				hideFollowPanel();
			}catch(e){}
		}
	}
}
function hideUsrInfo(){
	oUsrInfo =_doc.getElementById("usrinfo");
	try{
	oOuter.removeChild(oUsrInfo);
	}catch(e){}
}

function showUsrInfoMessage(){
	oUsrInfoMessage =_doc.getElementById("usrinfo-message");
	oUsrInfoMessage.style.display="block";
	iW =iH =0;
	var oUsrInfoMessageBtn =_doc.getElementById("usrinfo-message-btn");
	if(isPlatform=="mobile"){
		oUsrInfoMessageBtn.style.backgroundPosition ='-210px -325px';
	}else{
		oUsrInfoMessageBtn.style.backgroundPosition ='-100px -570px';
	}
	oUsrInfoMessageBtn.getAttributeNode("href").nodeValue ='javascript:return false;';
	intShowUsrInfoMessage =setInterval("showUsrInfoMessageExe()",30);
}
function showUsrInfoMessageExe(){
	if(iW<10){
		iW++;		
	}else{
		iW =10;
		oUsrInfoMessageInner =_doc.getElementById("usrinfo-message-inner")
		oUsrInfoMessageInner.style.display ="block";
		var oUsrInfoMessageBtn =_doc.getElementById("usrinfo-message-btn");
		oUsrInfoMessageBtn.getAttributeNode("href").nodeValue ='javascript:hideUsrInfoMessage();';
		oUsrInfoMessageBtn.getAttributeNode("title").nodeValue ='メッセージを隠す';
		oUsrInfoMessageBtn.getAttributeNode("class").nodeValue ='ico-message-close-btn';
		if(isPlatform=="mobile"){
			oUsrInfoMessageBtn.style.backgroundPosition ='-210px -300px';
		}else{
			oUsrInfoMessageBtn.style.backgroundPosition ='-130px -550px';
		}
		clearInterval(intShowUsrInfoMessage);
	}
	if(iH<10){
		iH++;
	}else{
		iH =10;
	}
	
	if(isPlatform=="mobile"){
		iWpx =250/10*iW		
		iHpx =145/10*iH;
	}else{
		iWpx =405/10*iW
		iHpx =115/10*iH;
	}
	
	oUsrInfoMessage.style.width =iWpx+"px";
	oUsrInfoMessage.style.height =iHpx+"px";
}

function hideUsrInfoMessage(){
	oUsrInfoMessageInner =_doc.getElementById("usrinfo-message-inner")
	oUsrInfoMessageInner.style.display ="none";
	oUsrInfoMessage =_doc.getElementById("usrinfo-message");
	iW =10;
	iH =10;
	var oUsrInfoMessageBtn =_doc.getElementById("usrinfo-message-btn");
	if(isPlatform=="mobile"){
		oUsrInfoMessageBtn.style.backgroundPosition ='-160px -325px';
	}else{
		oUsrInfoMessageBtn.style.backgroundPosition ='-130px -570px';
	
	}
	oUsrInfoMessageBtn.getAttributeNode("href").nodeValue ='javascript:return false;';
	intHideUsrInfoMessage =setInterval("hideUsrInfoMessageExe()",30);
}
function hideUsrInfoMessageExe(){
	if(iW>0){
		iW--;		
	}else{
		iW =0;
		var oUsrInfoMessageBtn =_doc.getElementById("usrinfo-message-btn");
		oUsrInfoMessageBtn.getAttributeNode("href").nodeValue ='javascript:showUsrInfoMessage();';
		oUsrInfoMessageBtn.getAttributeNode("title").nodeValue ='メッセージを表示する';
		oUsrInfoMessageBtn.getAttributeNode("class").nodeValue ='ico-message-btn';
		if(isPlatform=="mobile"){
			oUsrInfoMessageBtn.style.backgroundPosition ='-160px -300px';
		}else{
			oUsrInfoMessageBtn.style.backgroundPosition ='-100px -550px';
		}
		oUsrInfoMessage.style.display="none";
		clearInterval(intHideUsrInfoMessage);
	}
	if(iH>0){
		iH--;
	}else{
		iH =0;
	}
	
	if(isPlatform=="mobile"){
		iWpx =250/10*iW		
		iHpx =145/10*iH;
	}else{
		iWpx =405/10*iW
		iHpx =115/10*iH;
	}
	
	oUsrInfoMessage.style.width =iWpx+"px";
	oUsrInfoMessage.style.height =iHpx+"px";
}

function showMoreTopicLine(type,mode,name,cnrId,tpcId,nextToken){
	var aFuncs =Array();
	var aErrs =Array();
	if(name=="topic"){
		var loadingId ="topic-line-more";
		var objId ="topic-line-ol";
		//var url ="/call/call_format.php?func=printTopicsListUlInner";
		var sParam =String();
		if(location.search!=""){
			sParam =location.search.replace("?","&");
		}
	

		var url ="/call/call_format.php?func=printTopicsListUlInner"+sParam;
		var data="type="+type+"&mode="+mode+"&cnrId="+cnrId+"&tpcId="+tpcId+"&nextToken="+nextToken;
		//aFuncs =Array("printTopicsListUlInner('"+type+"','"+mode+"','"+crnId+"','"+tpcId+"','"+nextToken+"')");
	}else{
		var loadingId ="topic-replies"+tpcId+"-line-more";
		var objId ="topic-replies"+tpcId+"-ol";
		var url ="/call/call_format.php?func=printTopicsRepliesUlInner";
		var data="type="+type+"&mode="+mode+"&cnrId="+cnrId+"&tpcId="+tpcId+"&nextToken="+nextToken;
		//aFuncs =Array("printTopicsRepliesUlInner('"+type+"','"+mode+"','"+tpcId+"','"+nextToken+"')");
	}
	
	_doc.getElementById(loadingId).innerHTML +='<div style="position:absolute;top:0;left:0;width:100%;text-align:center;background:url(../images/global/global.png) repeat-x 0 -650px;"><img src="/images/global/loading.more.gif" /></div>\n';
	
	getMoreTopicLine(objId,url,data);
	
	//callHtmlNodes("", "/call/call_format.php?func=removeTopicLine","type="+type+"&mode="+mode+"&name="+name+"&tpcId="+tpcId , aFuncs, aErrs);


}

function getMoreTopicLine(objId,url,data){
//function callHtmlNodes(objId, url, data, funcs, errs){
	//XMLHttpRequestオブジェクト生成
	
	var httpoj = createHttpRequest();
	
	httpoj.open("post", url , true );
	httpoj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	httpoj.onreadystatechange = function(){ 
		if (httpoj.readyState==4){ 			
			var sResponse=httpoj.responseText;
			//safari
			var ajax_filter = function(t){return t};
			if ( navigator.appVersion.indexOf( "KHTML" ) > -1 ) {
				var esc = escape( sResponse );
				if ( esc.indexOf("%u") < 0 && esc.indexOf("%") > -1 ) {
					sResponse = decodeURIComponent( esc );
				}
			}
			aResponse =sResponse.split(":");
			if(aResponse[0]!="Error"){
				if(objId!=""){
					var oElmnts =_doc.getElementById(objId);
					var oTopicLi =oElmnts.getElementsByTagName("li");
					var sList=String();
					for(i in oTopicLi){
						try{
							if(oTopicLi[i].getAttributeNode("class").nodeValue==objId+"-li"){
								sList+='<li class="'+oTopicLi[i].getAttributeNode("class").nodeValue+'">'+oTopicLi[i].innerHTML+'</li>\n';
							}
						}catch(e){}
					}
					oElmnts.charset="UTF-8";
					oElmnts.innerHTML=sList+sResponse;
				}
				if(funcs.length>0){
					for(i in funcs){
						eval(funcs[i]);	
					}
				}
			}else{
				alert(aResponse[1]);
				if(errs.length>0){
					for(i in errs){
						alert(errs[i]);
						eval(errs[i]);	
					}
				}
			}			
		}
	}
    
	
    //send メソッド
    httpoj.send( data );
	
}

function removeTopic(type,tpcId){
	var aFuncs =Array();
	var aErrs =Array();
	var loadingId ="topic-trash";
	aFuncs =Array("printTopics('"+type+"','"+tpcId+"')");
	
	_doc.getElementById(loadingId).innerHTML ='<div style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';
	
	callHtmlNodes("", "/call/call_format.php?func=removeTopic","type="+type+"&tpcId="+tpcId , aFuncs, aErrs);

}
function printTopic(type,tpcId){
	
}

function removeTopicLine(type,mode,name,tpcId){
	var aFuncs =Array();
	var aErrs =Array();
	if(name=="topic"){
		var loadingId ="topic-trash"+tpcId;
		aFuncs =Array("printTopicsListLi('"+type+"','"+mode+"','"+name+"','"+tpcId+"')");
	}else{
		var loadingId ="topic-reply-trash"+tpcId;
		aFuncs =Array("printTopicsRepliesLi('"+type+"','"+mode+"','"+name+"','"+tpcId+"')");
	}
	
	_doc.getElementById(loadingId).innerHTML ='<div class="topic-toolbar-loading" style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';
	
	callHtmlNodes("", "/call/call_format.php?func=removeTopicLine","type="+type+"&mode="+mode+"&name="+name+"&tpcId="+tpcId , aFuncs, aErrs);

}

function activateTopicLine(type,mode,name,tpcId){
	var aFuncs =Array();
	var aErrs =Array();
	if(name=="topic"){
		var loadingId ="topic-trash"+tpcId;
		aFuncs =Array("printTopicsListLi('"+type+"','"+mode+"','"+name+"','"+tpcId+"')");
	}else{
		var loadingId ="topic-reply-trash"+tpcId;
		aFuncs =Array("printTopicsRepliesLi('"+type+"','"+mode+"','"+name+"','"+tpcId+"')");
	}
	_doc.getElementById(loadingId).innerHTML ='<div class="topic-toolbar-loading" style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';
	
	callHtmlNodes("", "/call/call_format.php?func=activateTopicLine","type="+type+"&mode="+mode+"&name="+name+"&tpcId="+tpcId , aFuncs, aErrs);

}

function showTopicReportPanel(type,name,cnrId,tpcId,reId){	
	if(name=="topic"){
		var objId ="topic-report"+tpcId;
	}else{
		var objId ="topic-reply-report"+reId;
	}
	
	var oTopicReportPanel =_doc.getElementById(objId);
	
	sOrigReport =oTopicReportPanel.innerHTML;
	
	var aFuncs =Array('showTopicReportPanelAfter("'+objId+'")');
	var aErrs =Array();
	
	_doc.getElementById(objId).innerHTML ='<div class="topic-toolbar-loading" style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';
	
	//var oReportPanel;
	if(oReportPanel=_doc.getElementById("topic-report-panel")){
	}else{
		oReportPanel =_doc.createElement("div");
		//oFavstarPanel.setAttribute("class","balloon-white");
		oReportPanel.setAttribute("id","topic-report-panel");
		oOuter.appendChild(oReportPanel);
	}
	
	oReportPanel.style.right ="220px";
	oReportPanel.style.top =(offsetY-300)+"px";

	callHtmlNodes("topic-report-panel", "/call/call_format.php?func=showTopicReportPanel","type="+type+"&name="+name+"&cnrId="+cnrId+"&tpcId="+tpcId+"&reId="+reId , aFuncs, aErrs);

	oWrap.onclick	=function(){
		hideTopicReportPanel(false);
	}

}

function showTopicReportPanelAfter(objId){
	_doc.getElementById(objId).innerHTML=sOrigReport;
}

function hideTopicReportPanel(force){
	var bChange =false;
	var aReportTypes =_doc.topicReport.topicReportType;
	try{
		for(i in aReportTypes){
			if(aReportTypes[i].checked){
				bChange =true;
				break;
			}
		}
	}catch(e){}
	
	if(_doc.topicReport.topicReportComment.value!=""){
		bChange =true;
	}
	if(force===true||bChange===false||confirm("報告内容が未送信です。\n入力途中のデータは破棄します。")){
		var oReportPanel =_doc.getElementById("topic-report-panel");
		try{
		oOuter.removeChild(oReportPanel);
		}catch(e){}
		oWrap.onclick ="";
	}
}

function showTopicReportPanelText(reportId){
	var oReportText =_doc.getElementById("topic-report-panel-text-"+reportId);
	oReportText.style.display="block";
	//oReportPanel.style.top =(offsetY-300)+"px";	
	oWrap.onclick =function(){
		oWrap.onclick =function(){
			hideTopicReportPanel(false);
		}
		hideTopicReportPanelText(reportId);
	}
	oReportPanel.onclick =function(){
		hideTopicReportPanelText(reportId);
	}
	
}

function hideTopicReportPanelText(reportId){
	var oReportText =_doc.getElementById("topic-report-panel-text-"+reportId);
	oReportText.style.display="none";
}

function selectReportType(){
	var aReportTypes =_doc.topicReport.topicReportType;
	for(i in aReportTypes){
		if(aReportTypes[i].value=="9"&&aReportTypes[i].checked){
			_doc.getElementById("topic-report-panel-comment").style.display="block";
			break;
		}else{
			_doc.getElementById("topic-report-panel-comment").style.display="none";			
		}
	}
}

function sendTopicReport(type,name,cnrId,tpcId,reId){
	var aFuncs =Array('showPopupSaveDone("ご報告、ありがとうございました")','hideTopicReportPanel(true)');
	var aErrs =Array();

	_doc.getElementById("topic-report-panel-form-submit").innerHTML ='<span" id="topic-report-form-send" style="background-position:-150px -350px;position:relative;text-align:left;text-indent:20px;"><img style="position:absolute;top:1px;left:1px;" src="/images/global/picture.updating.gif" alt="送信中" />送信中</span>';
	var report =String();
	var aReportTypes =_doc.topicReport.topicReportType;
	//try{
		//for(i in aReportTypes){
		for(i=0;i<aReportTypes.length;i++){	
			//alert(aReportTypes[i].checked);
			if(aReportTypes[i].checked){
				report =aReportTypes[i].value;	
			}
		}
	//}catch(e){}
	if(report!=""){
		text =_doc.topicReport.topicReportComment.value;
		callHtmlNodes("", "/call/call_format.php?func=sendTopicReport","type="+type+"&name="+name+"&cnrId="+cnrId+"&tpcId="+tpcId+"&reId="+reId+"&report="+report+"&text="+text , aFuncs, aErrs);	
	}else{
		alert("「報告内容」を選択してください。");	
	}
}

function addTopicFavstar(type,name,cnrId,tpcId,reId){
	var aFuncs =Array();
	var aErrs =Array();
	if(name=="topic"){
		var objId ="topic-favstar"+tpcId;
	}else{
		var objId ="topic-reply-favstar"+reId;
	}
	
	_doc.getElementById(objId).innerHTML ='<div class="topic-toolbar-loading" style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';
	
	if(isPlatform=="mobile"){
		sCall =	"/mobile.call/call_format.php?func=addTopicFavstar";
	}else{
		sCall =	"/call/call_format.php?func=addTopicFavstar";
		
	}
	
	callHtmlNodes(objId,sCall,"type="+type+"&name="+name+"&cnrId="+cnrId+"&tpcId="+tpcId+"&reId="+reId , aFuncs, aErrs);

}
function showTopicFavstarPanel(type,name,cnrId,tpcId,reId){
	
	if(name=="topic"){
		var objId ="topic-favstar"+tpcId;
	}else{
		var objId ="topic-reply-favstar"+reId;
	}
	
	sOrigFavstar =_doc.getElementById(objId).innerHTML;
	
	_doc.getElementById(objId).innerHTML ='<div id="topic-favstar-loading" style="text-align:center;"><img src="/images/global/loading.12.gif" /></div>\n';

	var aFuncs =Array("showTopicFavstarPanelAfter('"+objId+"')");
	var aErrs =Array();
	var oFavstarPanel;
	if(oFavstarPanel=_doc.getElementById("topic-favstar-panel")){
	}else{
		oFavstarPanel =_doc.createElement("div");
		//oFavstarPanel.setAttribute("class","balloon-white");
		oFavstarPanel.setAttribute("id","topic-favstar-panel");
		oOuter.appendChild(oFavstarPanel);
	}
	
	//oFavstarPanel.innerHTML ='<div style="text-align:center;"><img src="/images/global/loading.30.gif" /></div>\n';
	sCall =	"/call/call_format.php?func=showTopicFavstarPanel";
	oFavstarPanel.style.position ="absolute";
	oFavstarPanel.style.zIndex ="1";
	oFavstarPanel.style.right ="230px";
			
	callHtmlNodes("topic-favstar-panel", sCall,"type="+type+"&name="+name+"&cnrId="+cnrId+"&tpcId="+tpcId+"&reId="+reId, aFuncs, aErrs);

	oWrap.onclick	=function(){
		hideTopicFavstarPanel();
	}
}
function showTopicFavstarPanelAfter(objId){
	var iFavsarCount =_doc.getElementById("topic-favstar-count").innerHTML;
	//var oFavstarPanel =iPull =135+38*Math.ceil(iFavsarCount/15);
	var oFavstarPanel;
	var iPull =135+38*Math.ceil(iFavsarCount/15);
	oFavstarPanel=_doc.getElementById("topic-favstar-panel");
	oFavstarPanel.style.top =(offsetY-iPull)+"px";

	
	_doc.getElementById(objId).innerHTML=sOrigFavstar;
}

function hideTopicFavstarPanel(){
	oFavstarPanel =_doc.getElementById("topic-favstar-panel");
	try{
	oOuter.removeChild(oFavstarPanel);
	}catch(e){}
}


function removeTopicFavstar(type,name,cnrId,tpcId,reId){
	if(name=="topic"){
		var objId ="topic-favstar"+tpcId;
	}else{
		var objId ="topic-reply-favstar"+reId;
	}
	hideTopicFavstarPanel();
	//sOrigFavstar =_doc.getElementById(objId).innerHTML;
	_doc.getElementById(objId).innerHTML ='<div id="topic-favstar-loading" style="text-align:center;position:relative;"><img src="/images/global/loading.12.gif" />'+
										'<span style="position:absolute;top:16px;left:-18px;color:#888;width:5em;text-align:center;font-size:80%;background-color:#fff;">解除中…</span></div>\n';
	
	var aErrs =Array();
	if(isPlatform=="mobile"){
		sCall =	"/mobile.call/call_format.php?func=removeTopicFavstar";
		var aFuncs =Array('clearWholeMobScreen()');
		
	}else{
		var aFuncs =Array();
		sCall =	"/call/call_format.php?func=removeTopicFavstar";
	}

	callHtmlNodes(objId, sCall,"type="+type+"&name="+name+"&cnrId="+cnrId+"&tpcId="+tpcId+"&reId="+reId, aFuncs, aErrs);

}

function reportTopicLine(type,name,tpcId){
}







function postTwitterFromTopic(string,title,url,tag){
	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes("", "/call/call_common.php?func=postTwitterFromTopic","string="+string+"&title="+title+"&url="+url+"&tag="+tag, aFuncs, aErrs);
}


function sendTopic(type,mode,name,cnrId,cols,rows,maxsize,reId){
	var topicValue =eval("_doc."+name+"."+name+"_value.value");
	if(topicValue!=""){
		//var cols =eval("_doc."+name+"."+name+"_value.getAttributeNode('cols').nodeValue");
		//var rows =eval("_doc."+name+"."+name+"_value.getAttributeNode('rows').nodeValue");
		
		var sPosts ="type="+type+"&mode="+mode+"&name="+name+"&cnrId="+cnrId+"&cols="+cols+"&rows="+rows+"&maxsize="+maxsize+"&reId="+reId+"&value="+topicValue;
		var aFuncs =Array();
		if(reId!=""){
			var sRepliesCount =_doc.getElementById("topic-replies"+reId+"-count").innerHTML;
			sRepliesCount =sRepliesCount.substr(1,sRepliesCount.length-2);
			//alert(sRepliesCount);
			var iRepliesCount =Number(sRepliesCount);
			iRepliesCount++;
			
			aFuncs[0] ='printTopicsRepliesList("'+type+'", "'+ name+'", "'+mode+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+reId+'")';
			aFuncs[1] ='_doc.getElementById("topic-replies'+reId+'-count").innerHTML ="('+iRepliesCount+')"'
			aFuncs[2] ='sendTopicAfter("'+reId+'")';
			//aFuncs =Array('printTopicsRepliesList("'+type+'", "'+ name+'", "'+mode+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+reId+'")','_doc.getElementById("topic-replies'+reId+'-count").innerHTML ="('+iRepliesCount+')"','sendTopicAfter("'+reId+'")');*/
		}else{	
			aFuncs[0] ='printTopicsList("'+type+'", "'+ name+'", "'+mode+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+reId+'")';
			aFuncs[1] ='sendTopicAfter("'+reId+'")';
			//var aFuncs =Array('printTopicsList("'+type+'", "'+ name+'", "'+mode+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+reId+'")','sendTopicAfter("'+reId+'")');
		}
		//var sOrigSubmit =_doc.getElementById("topic-form"+reId+"-submit").innerHTML;
		
		var oSubmit =_doc.getElementById("topic-form"+reId+"-submit");
		var oSubmitBtn =_doc.getElementById("topic-form"+reId+"-submit-btn");
		
		oSubmitBtn.style.display="none";
		//oSubmit.removeChild(oSubmitBtn);
		
		var bTwitterActive=_doc.getElementById("topic-form"+reId+"-twitter-active").innerHTML;
		if(bTwitterActive=="on"){
			var title =_doc.getElementsByTagName("title")[0].innerHTML;
			//var url ="http://iphoners.net/apps/"+cnrId;
			if(reId!=""){
				iReId =Number(reId);
				//var url ="http://iphoners.net/topic/"+type+iReId;
			}else{
				switch(type){
					case "ap":
					sType ="apps";
					break;
				}
				//var url ="http://iphoners.net/"+sType+"/"+cnrId;
			}
			
			f =aFuncs.length;
			aFuncs[f] ='postTwitterFromTopic("'+topicValue+'","'+title+'",sResponse,"iphoners")';
			
		}
		
		var oLoading =_doc.createElement("div");
		oLoading.setAttribute("id","topic-form"+reId+"-submit-loading");
		oSubmit.appendChild(oLoading);
		
		var oTopicFormSubmitLoading =_doc.getElementById("topic-form"+reId+"-submit-loading");
		if(isPlatform=="mobile"){
			oTopicFormSubmitLoading.innerHTML='<span id="topic-form'+reId+'-submit-btn" class="btn-submit" style="background-position:-210px -250px;position:relative;text-align:left;text-indent:20px;"><img style="position:absolute;top:1px;left:1px;" src="/images/global/picture.updating.gif" alt="送信中" />送信中</span>';
		}else{
			oTopicFormSubmitLoading.innerHTML='<span id="topic-form'+reId+'-submit-btn" class="topic-form-submit-btn" style="background-position:-150px -350px;position:relative;text-align:left;text-indent:20px;"><img style="position:absolute;top:1px;left:1px;" src="/images/global/picture.updating.gif" alt="送信中" />送信中</span>';
		}
		var aErrs =Array('sendTopicErr("'+reId+'")');
		
		//callHtmlNodes("topic-form"+reId, "/call/call_format.php?func=sendTopic",sPosts , aFuncs, aErrs);
		callHtmlNodes("", "/call/call_format.php?func=sendTopic",sPosts , aFuncs, aErrs);
	}
}

function sendTopicAfter(){

}

function sendTopicErr(reId){
	var oSubmit =_doc.getElementById("topic-form"+reId+"-submit");
	var oLoading =_doc.getElementById("topic-form"+reId+"-submit-loading")
	oSubmit.removeChild(oLoading);
	var oSubmitBtn =_doc.getElementById("topic-form"+reId+"-submit-btn");
	oSubmitBtn.style.display="block";
}

function printTopicsRepliesLi(type,mode,name,tpcId){
	var objId ="topic-"+name+"-line"+tpcId;
	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes(objId, "/call/call_format.php?func=printTopicsRepliesLi","type="+type+"&mode="+mode+"&name="+name+"&tpcId="+tpcId , aFuncs, aErrs);
}

//function showTopicRepliesList(type,name,mode,cnrId,cols,rows,maxsize,tpcId){
function showTopicRepliesList(type,mode,cnrId,tpcId){
	var oTopicRepliesShowHide =_doc.getElementById("topic-replies"+tpcId+"-showhide");
	oTopicRepliesShowHide.getAttributeNode("class").nodeValue ="ico-open-shown";
	oTopicRepliesShowHide.getAttributeNode("href").nodeValue ="javascript:hideTopicRepliesList('"+type+"','"+mode+"','"+cnrId+"','"+tpcId+"');";
	//oTopicRepliesShowHide.getAttributeNode("href").nodeValue ="";
	
	var aFuncs =Array("showTopicRepliesListAfter('"+type+"','"+mode+"','"+cnrId+"','"+tpcId+"')");
	var aErrs=Array();
	var objId ="topic-replies"+tpcId+"-body";
	_doc.getElementById(objId).style.borderLeft ="1px solid #ccc";
	_doc.getElementById(objId).style.borderTop ="1px solid #aaa";
	_doc.getElementById(objId).style.marginLeft ="10px";

	_doc.getElementById(objId).innerHTML+='<div style="text-align:center;padding:20px 0;"><img src="/images/global/loading.gif" /></div>';
	
	var sParam =String();
	if(location.search!=""){
		sParam =location.search.replace("?","&");
	}
	if(isPlatform=="mobile"){
		callHtmlNodes(objId, "/mobile.call/call_format.php?func=printTopicsReplies"+sParam,"type="+type+"&mode="+mode+"&cnrId="+cnrId+"&tpcId="+tpcId, aFuncs, aErrs);
	}else{
		callHtmlNodes(objId, "/call/call_format.php?func=printTopicsReplies"+sParam,"type="+type+"&mode="+mode+"&cnrId="+cnrId+"&tpcId="+tpcId, aFuncs, aErrs);
	//callHtmlNodes(objId, "/call/call_format.php"+"?func=printTopicsReplies&"+location.search,"type="+type+"&mode="+mode+"&cnrId="+cnrId+"&tpcId="+tpcId, aFuncs, aErrs);
	}
}

function showTopicRepliesListAfter(type,mode,cnrId,tpcId){
	var oTopicRepliesShowHide =_doc.getElementById("topic-replies"+tpcId+"-showhide");
	var objId ="topic-replies"+tpcId+"-body";
	_doc.getElementById(objId).style.borderLeft ="none";
	_doc.getElementById(objId).style.borderTop ="none";
	_doc.getElementById(objId).style.marginLeft ="0";
}

function hideTopicRepliesList(type,mode,cnrId,tpcId){
	var oTopicRepliesShowHide =_doc.getElementById("topic-replies"+tpcId+"-showhide");
	oTopicRepliesShowHide.getAttributeNode("class").nodeValue ="ico-open-hidden";	
	oTopicRepliesShowHide.getAttributeNode("href").nodeValue ="javascript:showTopicRepliesList('"+type+"','"+mode+"','"+cnrId+"','"+tpcId+"');";
	var objId ="topic-replies"+tpcId+"-body";
	_doc.getElementById(objId).style.borderLeft ="none";
	_doc.getElementById(objId).style.borderTop ="none";
	_doc.getElementById(objId).style.marginLeft ="0";
	_doc.getElementById(objId).innerHTML="";
}
//class="ico-open-hidden" href="javascript:showTopicRepliesList('{$type}','replies{$tpcId}','{$mode}','{$cnrId}',65,3,600,'{$reId}');"
function printTopicsRepliesList(type,name,mode,cnrId,cols,rows,maxsize,tpcId){
	var aFuncs =Array('initTopicsForm("'+type+'", "'+ mode+'", "'+name+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+tpcId+'")');
	var objId ="topic-replies"+tpcId+"-line";
	_doc.getElementById(objId).innerHTML='<div style="text-align:center;padding:20px 0;"><img src="/images/global/loading.gif" /></div>'+_doc.getElementById(objId).innerHTML;
	var aErrs=Array();
	var sParam =String();
	if(location.search!=""){
		sParam =location.search.replace("?","&");
	}
	callHtmlNodes(objId, "/call/call_format.php?func=printTopicsRepliesList"+sParam,"type="+type+"&mode="+mode+"&tpcId="+tpcId, aFuncs, aErrs);
}

function printTopicsListLi(type,mode,name,tpcId){
	var objId ="topic-line"+tpcId;
	var aFuncs =Array();
	var aErrs =Array();
	callHtmlNodes(objId, "/call/call_format.php?func=printTopicsListLi","type="+type+"&mode="+mode+"&name="+name+"&tpcId="+tpcId , aFuncs, aErrs);
}

function printTopicsList(type,name,mode,cnrId,cols,rows,maxsize,reId){
	var aFuncs =Array('initTopicsForm("'+type+'", "'+ mode+'", "'+name+'", "'+cnrId+'", "'+cols+'", "'+ rows+'", "'+maxsize+'", "'+reId+'")');
	var aErrs=Array();
	var objId ="topic-line"+reId;
	//alert(objId);
	_doc.getElementById(objId).innerHTML='<div style="text-align:center;padding:20px 0;"><img src="/images/global/loading.box.gif" /></div>'+_doc.getElementById(objId).innerHTML;
	if(location.search!=""){
		sParam =location.search.replace("?","&");
	}else{
		sParam ="";		
	}
	if(isPlatform=="mobile"){
		callHtmlNodes(objId, "/mobile.call/call_format.php?func=printTopicsList"+sParam,"type="+type+"&mode="+mode+"&cnrId="+cnrId, aFuncs, aErrs);
	}else{
		callHtmlNodes(objId, "/call/call_format.php?func=printTopicsList"+sParam,"type="+type+"&mode="+mode+"&cnrId="+cnrId, aFuncs, aErrs);
	}
}

function initTopicsForm(type, mode, name, cnrId, cols, rows, maxsize, tpcId){
	var sPosts ="type="+type+"&mode="+mode+"&name="+name+"&cnrId="+cnrId+"&cols="+cols+"&rows="+rows+"&maxsize="+maxsize+"&tpcId="+tpcId;
	var aFuncs =Array();
	var aErrs=Array();
	if(isPlatform=="mobile"){
		closeTopicsForm();
	}else{
		callHtmlNodes("topic-form"+tpcId, "/call/call_format.php?func=initTopicsForm", sPosts, aFuncs, aErrs);
	}
}


function signOut(mode){
	hideLogoutPanel(false);	
	setScreenWhole(true);
	oScreen.innerHTML ='<p id="signout-msg">ログアウトしています。</p>';
	oSignOutText =_doc.getElementById("signout-msg");
	oSignOutText.style.width ="200px";
	oSignOutText.style.textAlign ="center";
	oSignOutText.style.margin ="0 auto";
	oSignOutText.style.color ="#fff";
		
	if(window.innerHeight>0){
		oSignOutText.style.marginTop=(((window.innerHeight+10)/2)+50)+"px";
	}else{
		oSignOutText.style.height=((_doc.documentElement.clientHeight/2)+50)+"px";	
	}

	//var aFuncs =Array("resetFreeLayer()",'location.href ="/sign/"');
	var aFuncs =Array('location.href ="/sign/"','document.cookie ="iph=\'\'; expires=Tue,16-Feb-2010 00:00:00; path=/;');
	//aFuncs =Array("resetFreeLayer()");
	var aErrs =Array();
	callHtmlNodes("", "/call/call_frame.php?func=signOut", "mode="+mode, aFuncs, aErrs);
	
}

var bLockHttpRequest =Boolean(false);

function searchItemsWithEnterKey(e){
	if (!e) {
		var e = window.event;
	}
	if(e.keyCode == 13){
		searchItems(_doc.search.searchType.value,_doc.search.searchText.value);
		return false;
	}
}

function searchItems(type,text){
	if(text!=""){
		var oSearchText =_doc.getElementById("global-nav-search-text");
		var oSearchLoading =_doc.createElement("span");
		oSearchLoading.setAttribute("id","global-nav-search-loading");
		oSearchLoading.innerHTML ='<img src="/images/global/loading.searchText.gif" />';
		oSearchLoading.style.position="absolute";		
		oSearchLoading.style.top="9px";
		oSearchLoading.style.right="9px";
		
		oSearchText.appendChild(oSearchLoading);
		var oSearchBtn =_doc.getElementById("global-nav-search-btn");
		oSearchBtn.style.display="none";
			
		if (text.match(/[0-9]{9}/)) {
			searchItemsById(type,text);
		}else{
			searchItemsExe(type,text);
		}
	}
}

function searchItemsById(type,text){
	var aFuncs =Array("searchItemsByIdExe('"+type+"','"+text+"',sResponse)");
	var aErrs =Array("searchItemsExeAfter()");
	callHtmlNodes("", "/call/call_frame.php?func=searchItemsById", "id="+text, aFuncs, aErrs);
}

function searchItemsByIdExe(type,text,res){
	if(res>0){
		location.href="/apps/?item="+text;
	}else{
		searchItemsExe(type,text);
	}
}

function searchItemsExe(type,text){
	var aFuncs =Array("searchItemsExeAfter()");
	var aErrs =Array("searchItemsExeAfter()");
	oSearchResult =_doc.createElement("div");
	oSearchResult.setAttribute("id","search-result");
		
	oSearchResult.style.width =(iInnerWidth-40)+"px";

	oOuter.appendChild(oSearchResult);
	
	//var url =escape(location.protocol+location.host+location.pathname+location.search+location.hash);
	
	oWrap.onclick =function(){
		hideSearchResult();
	}
	
	var url =escape(location.pathname+location.search+location.hash);
	callHtmlNodes("search-result", "/call/call_frame.php?func=searchItems", "type="+type+"&text="+text+"&url="+url, aFuncs, aErrs);
}

function hideSearchResult(){
	oSearchResult =_doc.getElementById("search-result");
	oOuter.removeChild(oSearchResult);
	resetFreeLayer();
}

function searchItemsExeAfter(){
	var oSearchText =_doc.getElementById("global-nav-search-text");
	var oSearchLoading =_doc.getElementById("global-nav-search-loading");
	oSearchText.removeChild(oSearchLoading);	
	var oSearchBtn =_doc.getElementById("global-nav-search-btn");
	oSearchBtn.style.display="block";
}

function setCookie(name,value,expiresDate,path){
	var dExpire =new Date();
	dExpire.setTime(dExpire.getTime() + (expiresDate * 24 * 3600 * 1000));
	aDay =Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
	iDay =dExpire.getDay();
	day =aDay[iDay];
	dd =dExpire.getDate();
	aMonth =Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	iMonth =dExpire.getMonth();
	month =aMonth[iMonth];
	yy =dExpire.getYear()+1900;
	HH =dExpire.getHours();
	if(HH<10){
		HH="0"+HH;
	}
	ii =dExpire.getMinutes();
	if(ii<10){
		ii="0"+ii;
	}
	ss =dExpire.getSeconds();
	if(ss<10){
		ss="0"+ss;
	}
	document.cookie =name+'='+value+'; expires='+day+', '+dd+'-'+month+'-'+yy+' '+HH+':'+ii+':'+ss+'; path='+path;
}

function changeSearchType(){
	var aSearchTypeRadios =_doc.searchType.searchTypeRadio;
	for(i=0;i<aSearchTypeRadios.length;i++){
		if(aSearchTypeRadios[i].checked){
			sSearchType =aSearchTypeRadios[i].value;
			break;
		}
	}
	_doc.search.searchType.value=sSearchType;
	
	var dExpire =new Date();
	dExpire.setTime(dExpire.getTime() + (365 * 24 * 3600 * 1000));
	aDay =Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
	iDay =dExpire.getDay();
	day =aDay[iDay];
	dd =dExpire.getDate();
	aMonth =Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	iMonth =dExpire.getMonth();
	month =aMonth[iMonth];
	yy =dExpire.getYear()+1900;
	HH =dExpire.getHours();
	if(HH<10){
		HH="0"+HH;
	}
	ii =dExpire.getMinutes();
	if(ii<10){
		ii="0"+ii;
	}
	ss =dExpire.getSeconds();
	if(ss<10){
		ss="0"+ss;
	}
	
	//alert('prefs[searchType]='+sSearchType+'; expires='+day+', '+dd+'-'+month+'-'+yy+' '+HH+':'+ii+':'+ss+'; path="/"');
	document.cookie ='prefs[searchType]='+sSearchType+'; expires='+day+', '+dd+'-'+month+'-'+yy+' '+HH+':'+ii+':'+ss+'; path=/';
	
	/*var aFuncs =Array();
	var aErrs =Array();
	
	callHtmlNodes("", "/call/call_frame.php?func=changeSearchType", "type="+sSearchType, aFuncs, aErrs);*/

}

function showSearchTypeSelector(){
	oSearchTypeSelector =_doc.createElement("div");
	oSearchTypeSelector.setAttribute("id","search-type-selector");
	oOuter.appendChild(oSearchTypeSelector);
	oSearchTypeSelector.innerHTML ='<div id="search-type-selector-body">\n'+
							'<div style="text-align:center;"><img src="/images/global/loading.small.gif" /></div>\n'+
							'</div>\n'+
							'<div id="search-type-selector-bt"><span class="btn-close-ss" onclick="javascript:hideSearchTypeSelector();">閉じる</span></div>';

	if(bLockHttpRequest===false){
		bLockHttpRequest =true;
		var aFuncs =Array("bLockHttpRequest =false");
		var aErrs =Array();
		callHtmlNodes("search-type-selector-body", "/call/call_frame.php?func=showSearchTypeSelector", "",aFuncs,aErrs);
	}
	
	oSearchTypeSelector.style.top ="80px";
	oSearchTypeSelector.style.right ="170px";
	oSearchTypeSelector.style.MozOpacity =0;
	oSearchTypeSelector.style.opacity 	=0;
	oSearchTypeSelector.style.filter ="Alpha(opacity=0)";
	oSearchTypeSelector.style.display ="block";
		
	oWrap.onclick =function(){
		hideSearchTypeSelector();
	}
	
	iShow =0;
	interval_showSearchTypeSelector =setInterval("showSearchTypeSelectorExe()",10);
}

function showSearchTypeSelectorExe(){
	if(iShow<10){
		iShow++;
	}else{
		iShow=10;
		clearInterval(interval_showSearchTypeSelector);
		var oGlobalNavSearchTypeBtn =_doc.getElementById("global-nav-search-type-btn");
		oGlobalNavSearchTypeBtn.setAttribute("href","javascript:hideSearchTypeSelector()");
		oGlobalNavSearchTypeBtn.style.zIndex=3;
	}
	oSearchTypeSelector.style.MozOpacity =iShow/10;
	oSearchTypeSelector.style.opacity 	=iShow/10;
	//oLogoutPanel.style.opacity 	=iShow/1;
	oSearchTypeSelector.style.filter ="Alpha(opacity="+(iShow*10)+")";	
}

function hideSearchTypeSelector(){
	oSearchTypeSelectorHide =_doc.getElementById("search-type-selector");
	
	iHide =10;
	interval_hideSearchTypeSelector =setInterval("hideSearchTypeSelectorExe()",10);
	
}

function hideSearchTypeSelectorExe(){
	if(oSearchTypeSelectorHide){
		if(iHide>0){
			iHide--;
			//iScreen--;
			oSearchTypeSelectorHide.style.top =(30/(31-iHide*3)+55)+"px";
			oSearchTypeSelectorHide.style.MozOpacity =iHide/5;
			oSearchTypeSelectorHide.style.opacity 	=iHide/5;
			//oLogoutPanelHide.style.opacity 	=iHide*10/5;
			oSearchTypeSelectorHide.style.filter ="Alpha(opacity="+(iHide*20)+")";
		}else{
			/*if(bScreen===true){
				resetFreeLayer();
			}*/
			clearInterval(interval_hideSearchTypeSelector);
			oSearchTypeSelectorHide.style.display="none";
			var oGlobalNavSearchTypeBtn =_doc.getElementById("global-nav-search-type-btn");
			oGlobalNavSearchTypeBtn.setAttribute("href","javascript:showSearchTypeSelector()");
			oGlobalNavSearchTypeBtn.style.zIndex=0;
			/*
			oSearchTypeSelectorHide.style.top ="0px";
			oSearchTypeSelectorHide.style.MozOpacity =0;
			oSearchTypeSelectorHide.style.opacity 	=0;
			oSearchTypeSelectorHide.style.filter ="Alpha(opacity=0)";
			oSearchTypeSelectorHide.style.display ="none";
			*/
			try{
				oOuter.removeChild(oSearchTypeSelectorHide);
			}catch(e){}
			return true;
	
		}
	}else{
		clearInterval(interval_hideSearchTypeSelector);
	}
}



function showLogoutPanel(){
	/*
	oLogoutPanel =_doc.getElementById("global-nav-account-sign-inner");
	var oLogoutPanelBody =_doc.getElementById("logout-panel-body");
	oLogoutPanelBody.innerHTML ='<div style="text-align:center;"><img src="/images/global/loading.small.gif" /></div>';
	if(bLockHttpRequest===false){
		bLockHttpRequest =true;
		aFuncs =Array("bLockHttpRequest =false");
		callHtmlNodes("logout-panel-body", "/call/call_frame.php?func=showLogoutPanelBody", "",aFuncs);
	}
	*/
	
	oLogoutPanel =_doc.createElement("div");
	oLogoutPanel.setAttribute("id","logout-panel");
	oOuter.appendChild(oLogoutPanel);
	oLogoutPanel.innerHTML ='<div id="logout-panel-body">\n'+
							'<div style="text-align:center;"><img src="/images/global/loading.small.gif" /></div>\n'+
							'</div>\n'+
							'<div id="logout-panel-bt"><span class="btn-close-ss" onclick="javascript:hideLogoutPanel();">閉じる</span></div>';
	if(bLockHttpRequest===false){
		bLockHttpRequest =true;
		var aFuncs =Array("bLockHttpRequest =false");
		var aErrs =Array();
		callHtmlNodes("logout-panel", "/call/call_frame.php?func=showLogoutPanel", "",aFuncs,aErrs);
	}
	
	
	
	oLogoutPanel.style.top ="80px";
	oLogoutPanel.style.right ="10px";
	oLogoutPanel.style.MozOpacity =0;
	oLogoutPanel.style.opacity 	=0;
	oLogoutPanel.style.filter ="Alpha(opacity=0)";
	oLogoutPanel.style.display ="block";
	
	/*setScreenWhole(false);
	
	oScreen.onclick	=function(){
		hideLogoutPanel(true);
	}*/
	
	oWrap.onclick	=function(){
		hideLogoutPanel(true);
	}
	
	iShow =0;
	interval_showLogoutPanel =setInterval("showLogoutPanelExe()",10);


}
function showLogoutPanelExe(){
	if(iShow<10){
		iShow++;
	}else{
		iShow=10;
		clearInterval(interval_showLogoutPanel);
		var oGlobalNavAccountSignLogoutBtn =_doc.getElementById("global-nav-account-sign-logout-btn");
		oGlobalNavAccountSignLogoutBtn.setAttribute("href","javascript:hideLogoutPanel(true)");
		oGlobalNavAccountSignLogoutBtn.style.zIndex=3;
	}
	oLogoutPanel.style.MozOpacity =iShow/10;
	oLogoutPanel.style.opacity 	=iShow/10;
	//oLogoutPanel.style.opacity 	=iShow/1;
	oLogoutPanel.style.filter ="Alpha(opacity="+(iShow*10)+")";	
}

function hideLogoutPanel(bScreen){
	//oLogoutPanelHide =_doc.getElementById("global-nav-account-sign-inner");
	oLogoutPanelHide =_doc.getElementById("logout-panel");
	
	iHide =10;
	//oWrap.onclick=null;
	//iScreen =10;
	interval_hideLogoutPanel =setInterval("hideLogoutPanelExe("+bScreen+")",10);
	
}

function hideLogoutPanelExe(bScreen){
	if(iHide>0){
		iHide--;
		//iScreen--;
		oLogoutPanelHide.style.top =(30/(31-iHide*3)+55)+"px";
		oLogoutPanelHide.style.MozOpacity =iHide/5;
		oLogoutPanelHide.style.opacity 	=iHide/5;
		//oLogoutPanelHide.style.opacity 	=iHide*10/5;
		oLogoutPanelHide.style.filter ="Alpha(opacity="+(iHide*20)+")";
	}else{
		/*if(bScreen===true){
			resetFreeLayer();
		}*/
		clearInterval(interval_hideLogoutPanel);
		oLogoutPanelHide.style.display="none";
		var oGlobalNavAccountSignLogoutBtn =_doc.getElementById("global-nav-account-sign-logout-btn");
		oGlobalNavAccountSignLogoutBtn.setAttribute("href","javascript:showLogoutPanel()");
		oGlobalNavAccountSignLogoutBtn.style.zIndex=0;

		oLogoutPanelHide.style.top ="0px";
		oLogoutPanelHide.style.MozOpacity =0;
		oLogoutPanelHide.style.opacity 	=0;
		oLogoutPanelHide.style.filter ="Alpha(opacity=0)";
		oLogoutPanelHide.style.display ="none";
		try{
		oOuter.removeChild(oLogoutPanelHide);
		}catch(e){}
		return true;

	}
		
}



function showAccountSettings(){
	//oAccountSettingsShow =_doc.getElementById("global-nav-account-settings-inner");
	oAccountSettingsShow =_doc.createElement("div");
	oAccountSettingsShow.setAttribute("id","account-panel");
	oOuter.appendChild(oAccountSettingsShow);
	oAccountSettingsShow.innerHTML ='<div id="account-panel-body">\n'+
							'<div style="text-align:center;"><img src="/images/global/loading.small.gif" /></div>\n'+
							'</div>\n'+
							'<div id="account-panel-bt"><span class="btn-close-ss" onclick="javascript:hideAccountSettings();">閉じる</span></div>';

	if(bLockHttpRequest===false){
		bLockHttpRequest =true;
		var aFuncs =Array("bLockHttpRequest =false");
		var aErrs=Array();
		callHtmlNodes("account-panel", "/call/call_frame.php?func=showAccountPanel", "",aFuncs, aErrs);
	}
	
	//oAccountSettingsShow =_doc.getElementById("account-panel");
	//alert(oAccountSettingsShow.innerHTML);
	oAccountSettingsShow.style.display="block";
	oAccountSettingsShow.style.top ="80px";
	oAccountSettingsShow.style.right ="105px";
	oAccountSettingsShow.style.zIndex =3;
	
	oAccountSettingsShow.style.MozOpacity =0;
	oAccountSettingsShow.style.opacity 	=0;
	oAccountSettingsShow.style.filter ="Alpha(opacity=0)";

	//setScreenWhole(false);
	
	oWrap.onclick	=function(){
		hideAccountSettings();
	}
	
	iShow =0;
	interval_showAccountSettings =setInterval("showAccountSettingsExe()",10);
}


function showAccountSettingsExe(){
	if(iShow<10){
		iShow++;
	}else{
		iShow=10;
		clearInterval(interval_showAccountSettings);
		var oGlobalNavAccountSettingsTitleBtn =_doc.getElementById("global-nav-account-settings-title-btn");
		oGlobalNavAccountSettingsTitleBtn.setAttribute("href","javascript:hideAccountSettings()");
		oGlobalNavAccountSettingsTitleBtn.style.zIndex=3;
		var oAccountBtn =_doc.getElementById("global-nav-account-settings-title-btn");
		var oAccountInner =_doc.getElementById("global-nav-account-settings-inner");
		
		/*
		oWrap.onclick	=function(){
			if(!oAccountInner.onclick){
				hideAccountSettings();	
			}
		}*/
	
	}
	oAccountSettingsShow.style.MozOpacity =iShow/10;
	oAccountSettingsShow.style.opacity 	=iShow/10;
	//oAccountSettingsShow.style.opacity 	=iShow/1;
	oAccountSettingsShow.style.filter ="Alpha(opacity="+(iShow*10)+")";
	
	//oAccountSettingsShow.style.top =(iShow*3)+"px";
}


function hideAccountSettings(){
	//oAccountSettingsHide =_doc.getElementById("global-nav-account-settings-inner");
	oAccountSettingsHide =_doc.getElementById("account-panel");
	iHide =10;
	//oWrap.onclick=null;
	//iScreen =10;
	interval_hideAccountSettings =setInterval("hideAccountSettingsExe()",10);
	
}

function hideAccountSettingsExe(){
	if(iHide>0){
		iHide--;
		//iScreen--;
		oAccountSettingsHide.style.top =(30/(31-iHide*3)+55)+"px";
		oAccountSettingsHide.style.MozOpacity =iHide/5;
		oAccountSettingsHide.style.opacity 	=iHide/5;
		//oAccountSettingsHide.style.opacity 	=iHide*10/5;
		oAccountSettingsHide.style.filter ="Alpha(opacity="+(iHide*20)+")";
	}else{
		//resetFreeLayer();
		clearInterval(interval_hideAccountSettings);
		oAccountSettingsHide.style.display="none";
		var oGlobalNavAccountSettingsTitleBtn =_doc.getElementById("global-nav-account-settings-title-btn");
		oGlobalNavAccountSettingsTitleBtn.setAttribute("href","javascript:showAccountSettings()");
		oGlobalNavAccountSettingsTitleBtn.style.zIndex=0;

		oAccountSettingsHide.style.top ="0px";
		oAccountSettingsHide.style.MozOpacity =0;
		oAccountSettingsHide.style.opacity 	=0;
		oAccountSettingsHide.style.filter ="Alpha(opacity=0)";

		//var oAccount =_doc.getElementById("global-nav-account-settings");
		try{
		oOuter.removeChild(oAccountSettingsHide);
		}catch(e){}
	}
	
	/*oScreen.style.MozOpacity 	=iScreen/20;
	oScreen.style.opacity 		=iScreen/20;
	//oScreen.style.opacity 		=iScreen/2;
	oScreen.style.filter		="Alpha(opacity="+(iScreen*5)+")";
	*/
}


function showAlert(str,stick){
	setScreenWhole(true);
	
	oScreen.onclick	=function(){
		if(!oAlert.onclick){
			hideAlert();	
		}
		
	}

	oAlert =_doc.createElement("div");
	oAlert.setAttribute("class","balloon-black");
	oAlert.setAttribute("id","balloon-alert");
	var oWrap=_doc.getElementById("wrap");
	oWrap.appendChild(oAlert);
	var oBalloonAlert =_doc.getElementById('balloon-alert');
/*	oBalloonAlert.innerHTML=
'<div id="loading"><img style="margin:50px auto;" src="/images/sign/loading.gif" /></div>';
*/
	var aFuncs=Array('oScreen.style.background="#000"');
	var aErrs=Array();
	callHtmlNodes("balloon-alert", "/call/call_frame.php?func=printBalloon", "str="+str+"&stick="+stick+"&closeFunc=hideAlert()", aFuncs, aErrs);

	
	switch(stick){
		case "tl":
		break;
		case "tr":
		break;
		case "bl":
			var iMarginTop =-120;
			var iMarginLeft =-50;
		break;
		case "br":
			var iMarginTop =-120;
			var iMarginLeft =-270;
		break;
	}

	//oAlert.style.top =(iPtTop+iMarginTop)+"px";
	//oAlert.style.left =(iPtLeft+iMarginLeft)+"px";
	oAlert.style.top =(offsetY+iMarginTop)+"px";
	oAlert.style.left =(offsetX+iMarginLeft)+"px";
	
}

function hideAlert(){
	interval_hideAlert=setInterval("hideAlertExe()",10);
	iAlert=10;
	iScreen=10;
}
function hideAlertExe(){
	if(iScreen>0){
		iAlert--;
		iScreen--;
	}else{
		resetFreeLayer();
		resetAlert();
		clearInterval(interval_hideAlert);
	}
	
	oAlert.style.MozOpacity =iAlert/10;
	oAlert.style.opacity 	=iAlert/10;
	//oAlert.style.opacity 	=iAlert/1;
	oAlert.style.filter		="Alpha(opacity="+(iAlert*10)+")";
	oScreen.style.MozOpacity 	=iScreen/20;
	oScreen.style.opacity 		=iScreen/20;
	//oScreen.style.opacity 		=iScreen/2;
	oScreen.style.filter		="Alpha(opacity="+(iScreen*5)+")";
}

function resetAlert(){
	var oParent=oAlert.parentNode;
	oParent.removeChild(oAlert);
}

function escapeSubmitOnInput(){
	var objInputs=_doc.getElementsByTagName("input");
	
	for(iI=0;iI<objInputs.length;iI++){
		if(objInputs[iI].type=="text"||objInputs[iI].type=="password"){
			//if(objInputs[iI].id=="url"){
				//objInputs[iI].onkeypress=function(event){
					//return checkUrlExistsOnEnter(event,document.pick.url.value,'pick-url-check');
				//}
			//}else{
				objInputs[iI].onkeypress=function(event){
					return escapeSubmit(event);
				}
			//}
		}
	}
}

function changePicture(mode){
	var pictureId =_doc.changePicture.pictureId.value;
	switch(mode){
		case "usrIcon":
		parentId ="change-picture-panel";
		break;
		default:
		break;
	}
	switchPictureSubmit(mode,"updating");


/*
	
	var oUpload =_doc.getElementById("picture-preview-upload");
	oUpload.innerHTML ='<span style="background-position:0 -520px;position:relative;"><img style="position:absolute;top:4px;left:5px;" src="/images/global/uploading.gif" alt="アップロード中" />アップロード中</span>';

	//aFuncs =Array("closePreviewPicture('"+parentId+"')","printChangePicturePanelList()",);
	aFuncs =Array("closePreviewPicture('"+parentId+"')","afterUploadPicture('"+mode+"',sResponse)");

*/
	var aFuncs =Array("afterChangePicture('"+mode+"')");
	var aErrs =Array();
	callHtmlNodes("picture-submit", "/call/call_common.php?func=changePicture", "mode="+mode+"&pictureId="+pictureId, aFuncs, aErrs);
	
}

function afterChangePicture(mode){
	switch(mode){
		case "usrIcon":	
		hideChangePicturePanel();
		if(location.search.indexOf("profile")>-1){
			printAccountProfilePictures();
		}else{
			printUsrIconPicture();	
		}
		break;
		default:
		break;
	}
}

function printUsrIconPicture(){
	//_doc.getElementById(pictureId).src=	_doc.getElementById(pictureId).src;
	var aFuncs =Array("_doc.getElementById('usricon-picture').src=sResponse");
	var aErrs =Array();	
	callHtmlNodes("", "/call/call_common.php?func=printUsrIconPicture", "", aFuncs, aErrs);
}


function printPicturePicker(mode,pictureId){
	var aFuncs =Array("printChangePicturePanelList('"+mode+"','"+pictureId+"')");
	var aErrs =Array();
	callHtmlNodes("picture-picker", "/call/call_common.php?func=printPicturePicker", "", aFuncs, aErrs);
}

function removePicture(mode,pictureId){
	if(confirm("アイコン画像のファイルを1つ削除します。\nこの作業は取り消しできません。")===true){
		_doc.getElementById("picture-list").innerHTML ='<div style="text-align:center;padding:20px 0;"><img src="/images/global/loading.gif" /></div>';
		switchPictureSubmit(mode,"invalid");

		if(_doc.getElementById("picture-picker-msg").innerHTML!=""){		
			//aFuncs=Array("resetChangePicturePanel()","showChangePicturePanel('"+mode+"')");
			var aFuncs=Array("printPicturePicker('"+mode+"','"+pictureId+"')");
		}else{			
			var aFuncs=Array("printChangePicturePanelList('"+mode+"'),'"+pictureId+"'");
		}
		var aErrs=Array();
		//showChangePicturePanel
		callHtmlNodes("", "/call/call_common.php?func=removePicture", "mode="+mode+"&pictureId="+pictureId, aFuncs, aErrs);	
		
	}
}

function selectPicture(mode,pictureId){
	/*aFuncs=Array();
	callHtmlNodes("picture-list", "/call/call_common.php?func=selectPicture", "pictureId="+pictureId, aFuncs);
	*/
	var oPictureList =_doc.getElementById("picture-list");
	var oPictureNoImage =_doc.getElementById("picture-li-noimage");
	var oPictureLi =oPictureList.getElementsByTagName("img");
	if(pictureId=="noimage"){
		oPictureNoImage.innerHTML='<span id="picture-selected" class="usricon-110"><img id="picture-list-noimage" src="/images/picture/noimage.png" alt="画像なし"></span>\n';
	}else{
		oPictureNoImage.innerHTML='<a class="usricon-110" href="javascript:selectPicture(\''+mode+'\',\'noimage\');"><img id="picture-list-noimage" src="/images/picture/noimage.png" alt="画像なし"></a>\n';
	}
	var pId =String();
	var	nodeId =String();
	for(i in oPictureLi){
		try{
			sSrc =oPictureLi[i].getAttributeNode("src").nodeValue;
			//alert(oPictureLi[i].getAttributeNode("id").nodeValue);
			nodeId =oPictureLi[i].getAttributeNode("id").nodeValue;
			
			pId =nodeId.substr(nodeId.lastIndexOf("-")+4);

			if(nodeId=="picture-list-img"+pictureId){
				oPictureLi[i].parentNode.parentNode.innerHTML =
				'<a class="ico-delete" href="javascript:removePicture(\''+mode+'\',\''+pId+'\');"><span class="hidden">アイコン画像'+pId+'を削除する</span></a>'+
				'<span id="picture-selected" class="usricon-110"><span></span><img id="'+nodeId+'" src="'+sSrc+'" alt="選択中のアイコン画像"></span>';
			}else if(nodeId!="picture-list-noimage"){
				oPictureLi[i].parentNode.parentNode.innerHTML ='<a class="usricon-110" href="javascript:selectPicture(\''+mode+'\','+pId+');"><span></span><img id="'+nodeId +'" src="'+sSrc+'" alt="アイコン画像'+pId+'"></a>';
			}
			//alert(oPictureLi[i].parentNode.parentNode.innerHTML);
		}catch(e){}	
	}

	_doc.changePicture.pictureId.value =pictureId;
	switchPictureSubmit(mode,"valid");
}

function switchPictureSubmit(mode,status){
	var oPictureSubmit =_doc.getElementById("picture-submit");
	switch(status){
		case "valid":
		default:
		oPictureSubmit.innerHTML='<a id="picture-submit-btn" href="javascript:changePicture(\''+mode+'\');">変更する</a>';
		break;
		case "invalid":
		oPictureSubmit.innerHTML='<span id="picture-submit-btn">変更する</span>';
		break;
		case "updating":
		oPictureSubmit.innerHTML='<div id="picture-submit-btn"><img src="/images/global/picture.updating.gif">変更中</div>';
		break;
	}
}

function setChangePicturePanelPos(){
	if(window.innerWidth>0){
		iWidth =(window.innerWidth);
	}else{
		iWidth =(_doc.documentElement.clientWidth);
	}
	
	if(window.innerHeight>0){
		iHeight =(window.innerHeight+10);
	}else{
		iHeight =(_doc.documentElement.clientHeight);	
	}	
	oPicture.style.left=(iWidth/2-300)+"px";

	if(window.pageYOffset>=0){
		oPicture.style.top=(window.pageYOffset-10+iHeight/2-110)+"px";
	}else{
		oPicture.style.top=(_doc.documentElement.scrollTop+iHeight/2-110)+"px";
	}

}

function showChangePicturePanel(mode){
	setScreenWhole(true);
	oPicture =_doc.createElement("div");
	oPicture.setAttribute("id","change-picture-panel");
	oWrap.appendChild(oPicture);
	var aFuncs=Array("");
	var aErrs=Array();
	callHtmlNodes("change-picture-panel", "/call/call_common.php?func=showChangePicturePanel", "mode="+mode, aFuncs, aErrs);

	setChangePicturePanelPos();
	window.onresize =function(){
		setChangePicturePanelPos();
		setScreenWholeSize();
	}
	
	oScreen.onclick	=function(){
		if(!oPicture.onclick){
			hideChangePicturePanel();	
		}	
	}

}

function hideChangePicturePanel(){
	interval_hidePanel=setInterval("hideChangePicturePanelExe()",10);
	iForm=10;
	iScreen=10;

}

function hideChangePicturePanelExe(){
	if(iScreen>0){
		iForm--;
		iScreen--;
	}else{
		resetFreeLayer();
		resetChangePicturePanel();
		clearInterval(interval_hidePanel);
	}
	oPicture.style.MozOpacity =iForm/10;
	oPicture.style.opacity 	=iForm/10;
	oPicture.style.opacity 	=iForm/1;
	oPicture.style.filter		="Alpha(opacity="+(iForm*10)+")";
	oScreen.style.MozOpacity 	=iScreen/20;
	oScreen.style.opacity 		=iScreen/20;
	//oScreen.style.opacity 		=iScreen/2;
	oScreen.style.filter		="Alpha(opacity="+(iScreen*5)+")";

}

function resetChangePicturePanel(){
	var oParent=oPicture.parentNode;
	oParent.removeChild(oPicture);
}

function previewPicture(mode,htPath,objId){
	//var oPreview =parent._doc.getElementById(objId).createElement("div");
	try{
		oPreviewParent.removeChild(oPreview);
	}catch(e){}
	if(htPath!=""){
		if(!parent._doc.getElementById("picture-preview")){
			oPreview =parent._doc.createElement("div");
			oPreview.setAttribute("id","picture-preview");
			
			oPreviewParent =parent._doc.getElementById(objId);
			oPreviewParent.appendChild(oPreview);
						
			oPreviewParentAs =oPreviewParent.getElementsByTagName('a');
			
			for(i in oPreviewParentAs){
				try{
					if(oPreviewParentAs[i].getAttributeNode("class").nodeValue=="ico-close-a"){
						oPreviewParentAs[i].style.display ="none";
						break;
					}
				}catch(e){}
			}
			
		}
		var aFuncs=Array("oPreview.innerHTML=sResponse",'parent._doc.getElementById("free-layer").onclick=null');
		var aErrs=Array();
		callHtmlNodes("", "/call/call_common.php?func=previewPicture", "mode="+mode+"&htPath="+htPath+"&obj="+objId, aFuncs,aErrs);
	}
}

function closePreviewPicture(parentId){
	oPreview =_doc.getElementById("picture-preview");
	oPreview.innerHTML ="";
	var oPreviewParent =_doc.getElementById(parentId);


	//閉じるアイコンを表示
	oPreviewParentAs =oPreviewParent.getElementsByTagName("a");
	for(i in oPreviewParentAs){
		try{
			if(oPreviewParentAs[i].getAttributeNode("class").nodeValue=="ico-close-a"){
				oPreviewParentAs[i].style.display ="block";
				break;
			}
		}catch(e){}
	}
	
	oPreviewParent.removeChild(oPreview);	
	
	setScreenWhole(true);
	oScreen.onclick	=function(){
		if(!oPicture.onclick){
			hideChangePicturePanel();	
		}	
	}
	
}

function uploadPicture(mode){
	switch(mode){
		case "usrIcon":
		parentId ="change-picture-panel";
		break;
		default:
		break;
	}
	
	switchPictureSubmit(mode,false);
	var oUpload =_doc.getElementById("picture-preview-upload");
	oUpload.innerHTML ='<span style="background-position:0 -520px;position:relative;"><img style="position:absolute;top:4px;left:5px;" src="/images/global/picture.uploading.gif" alt="アップロード中" />アップロード中</span>';

	//aFuncs =Array("closePreviewPicture('"+parentId+"')","printChangePicturePanelList()",);
	var aFuncs =Array("closePreviewPicture('"+parentId+"')","afterUploadPicture('"+mode+"',sResponse)");
	var aErrs=Array();
	htPath =_doc.pictureUpload.htPath.value;
	//htPath =_doc.getElementById("picture-preview-img").getElementsByTagName("img")[0].getAttribute("src");
	//callHtmlNodes("picture-picker-msg", "/call/call_common.php?func=uploadPicture", "mode="+mode+"&htPath="+htPath, aFuncs);
	callHtmlNodes("", "/call/call_common.php?func=uploadPicture", "mode="+mode+"&htPath="+htPath, aFuncs, aErrs);
}


function afterUploadPicture(mode,res){
	switch(mode){
		case "usrIcon":
		_doc.getElementById("picture-list").innerHTML ='<div style="text-align:center;padding:20px 0;"><img src="/images/global/loading.gif" /></div>';
		if(res=="0"){
			//if(alert("アイコン画像を変更しました")){
			alert("アイコン画像を変更しました");
			hideChangePicturePanel();
			printAccountProfilePictures();
			//}
		}else if(res=="3"){
			//showChangePicturePanel(mode);
			//printChangePicturePanelList(mode,res);
			printPicturePicker(mode,res);
		}else if(res=="error"){
			_doc.getElementById("picture-picker-msg").innerHTML ='<p class="">アップロードできるアイコン画像は、4点までです。</p>';
		}else{
			printChangePicturePanelList(mode,res);
		}
		break;
		default:
		break;
	}
}

function printChangePicturePanelList(mode,pictureId){
	var aFuncs =Array();
	if(pictureId!=""){
		aFuncs =Array("selectPicture('"+mode+"','"+pictureId+"')");
	}
	var aErrs=Array();
	callHtmlNodes("picture-list", "/call/call_common.php?func=printChangePicturePanelList", "mode="+mode+"&pictureId="+pictureId, aFuncs, aErrs);
}

function canselUploadPicture(parentId){
	if(confirm("アップロードしていない画像ファイルは、破棄します。")){
		var aFuncs =Array("closePreviewPicture('"+parentId+"')");
		var aErrs=Array();
		htPath =_doc.getElementById("picture-preview-img").getElementsByTagName("img")[0].getAttribute("src");
		callHtmlNodes("", "/call/call_common.php?func=removeTmpPicture", "htPath="+htPath, aFuncs, aErrs);
	}
}

function setFormChangeFlag(ideaType){
	switch(ideaType){
		case 1:
		entryChange=0;
		if(_doc.entry){
			for(i=0;i<_doc.entry.elements.length;i++){
				_doc.entry.elements[i].onchange=function(){
					entryChange=1;
				}
			}
		}
		
		break;
		case 2:
		tsubuChange=0;
		if(_doc.tsubu===true){
			for(i=0;i<_doc.tsubu.elements.length;i++){
				_doc.tsubu.elements[i].onchange=function(){
					tsubuChange=1;
				}
			}
		}
		
		break;
		case 3:
		pickChange=0;
		if(_doc.pick===true){
			for(i=0;i<_doc.pick.elements.length;i++){
				_doc.pick.elements[i].onchange=function(){
					pickChange=1;
				}
			}
		}
		
		break;
	}
}


function showPopupSaveDone(str){	
	resetFreeLayer();
	moveTop();

	iPopup=0;
	oPopup =_doc.getElementById("free-layer");
	oPopup.style.display ="block";
	oPopup.innerHTML ='<p style="font-size:150%;">'+str+'</p>';
	oPopup.style.width ="100%";
	oPopup.style.height ="25px";	
	oPopup.style.position ="absolute";	
	oPopup.style.borderBottom ="solid 1px #000";
	oPopup.style.top ="0";
	oPopup.style.left ="0";	
	oPopup.style.padding ="30px 0";	
	oPopup.style.textAlign ="center";	
	oPopup.style.backgroundColor ="#fff";
	oPopup.style.MozOpacity =1;
	oPopup.style.opacity =1;
	//oPopup.style.opacity =10;
	oPopup.style.filter="Alpha(opacity=100)";
	popupInterval =setInterval('hidePopupSaveDone()',25);
}

function hidePopupSaveDone(){	
	if(iPopup<90){
		iPopup++;
		if(iPopup>45){
			oPopup.style.top =((45-iPopup)*2)+"px";
		}
	}else{
		clearInterval(popupInterval);
		resetFreeLayer();
	}
}


window.onbeforeunload = function(event){
	if(location.pathname.indexOf("/entry")>-1){	
		if(entryChange==1){
			event = event || window.event;
			event.returnValue = "作業中で未保存のデータが残っています。\nこのままページを移動するか、ウィンドウを閉じた場合、\n未保存のデータは消滅します。";
		}
	}else if(location.pathname.indexOf("/tsubu")>-1){
		if(tsubuChange==1){
			event = event || window.event;
			event.returnValue = "作業中で未保存のデータが残っています。\nこのままページを移動するか、ウィンドウを閉じた場合、\n未保存のデータは消滅します。";
		}
	}
}

var offsetX,offsetY;
function doInit() {
    if (_doc.layers) {
        //_doc.getElementById("wrap").captureEvents(Event.MOUSEDOWN);
        _doc.captureEvents(Event.MOUSEDOWN);
    }
    //_doc.getElementById("wrap").onmousedown = onMouseDown;
    _doc.onmousedown = onMouseDown;
}
function onMouseDown(e) {
   oMdown = this;
	if (document.all) {
    	/*offsetX = event.clientX;
        offsetY = event.clientY;*/	
    	offsetX = event.x;
        offsetY = event.y+100;
	} else if (oMdown.getElementsByTagName) {
		offsetX = e.pageX;
		offsetY = e.pageY;
	}
	//return false;
}



function printEditSwitch(mode,ideaType,objId){
		var objTp =_doc.getElementById("editmode-tp");
		var objBt =_doc.getElementById("editmode-bt");
		var httpoj = createHttpRequest();
		httpoj.open( "POST", "../call/call_printeditswitch.php" , true );
		httpoj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		httpoj.onreadystatechange = function(){ 
		
			//readyState値は4で受信完了
			if (httpoj.readyState==4){ 			
				var val=httpoj.responseText;
				objTp.innerHTML=val;
				objBt.innerHTML=val;
			}
		}
    
    	//send メソッド
		httpoj.send("mode="+mode+"&idea_type="+ideaType+"&obj_id="+objId);
	
}



/*function sendSysReport(){
	var intRadio;
	for(i=0;i<_doc.sys_report.sys_report_radio.length;i++){
		if(_doc.sys_report.sys_report_radio[i].checked==true){
			intRadio =_doc.sys_report.sys_report_radio[i].value;
			break;
		}
	}
	var strText		=_doc.sys_report.sys_report_text.value;
	var strEmail 	=_doc.sys_report.sys_report_email.value;
	var strLocation	=location.pathname+location.search;
	var aFuncs=Array();
	var aErrs=Array();
	callHtmlNodes("system-report-form-body","../call/call_sendSysReport.php","radio="+intRadio+"&text="+strText+"&email="+strEmail+"&location="+strLocation, aFuncs, aErrs);
	
}*/

function escapeSubmit(e){
	if (!e) {
		var e = window.event;
	}
	if(e.keyCode == 13){
		return false;
	}
}

function showPagetopBtn(){
	var iScroll;
	var intHeight;
	try{
		iScroll=window.pageYOffset;
	}catch(e){
		iScroll=_doc.body.scrollTop;
	}
	
	try{
		intHeight=window.innerHeight;
	}catch(e){
		intHeight=_doc.body.clientHeight;
	}

	if(iScroll>intHeight){
		oPagetop.style.display="block";
	}

}

function setObjPagetop(){
	try{
		var oPagetop	=_doc.getElementById("pagetop");
		oPagetop.getElementsByTagName("a")[0].getAttributeNode("href").nodeValue="javascript:moveTop();";
	}catch(e){}
}

function mouseDownEvent(ev){
	//setPosMoveTop(ev);
	setPosClick(ev);

}

function setPosClick(ev){//マウスのクリック位置を取得
//function setPosMoveTop(ev){//マウスのクリック位置を取得
	objMouse=this;
	try{
		 iPtTop	=event.clientY + (_doc.body.scrollTop || _doc.documentElement.scrollTop);
		 iPtLeft=event.clientX + (_doc.body.scrollLeft || _doc.documentElement.scrollLeft);
	}catch(e){
		iPtTop	=ev.pageY;
		iPtLeft	=ev.pageX;
	}
	return false;
}

function moveTop(){

	//intTop	=iPtTop-100;
	intTop =offsetY-100;
	//moveTopInt	=setInterval("moveTopExe()",10/iPtTop*1000);
	moveTopInt	=setInterval("moveTopExe()",10/offsetY*1000);
}


function moveTopExe(){
	if(intTop>0){
		//if(intTop<iPtTop/20){
		if(intTop<offsetY/20){
			intTop=0;
		}else{
			//intTop-=iPtTop/20;
			intTop-=offsetY/20;
		}
		window.scrollTo(0,intTop);
	
	}else{
		clearInterval(moveTopInt);
	}
}

function replaceAmp(str){
	var i=0;
	while(str.indexOf("&",i)>-1){
		str	=str.replace("&","[amp]");
	}
	while(str.indexOf("+",i)>-1){
		str	=str.replace("+","[pls]");
	}
return str;
}

function selectForm(selForm){
	selForm.focus();
	selForm.select();
}

function clearForm(clrForm){
	clrForm.value	="";
}

/*var offsetX;
var offsetY;*/
var flgImgClosable=new Boolean();

function closeZoomImg(){
	if(flgImgClosable==true){
		intImg	=20;
		intScrn	=10;
		objZoomImg	=_doc.getElementById("zoom-img");
		//closeZoomImgExe();
		intCloseZoomImg	=setInterval("closeZoomImgExe()",10);
		flgImgClosable=false;
	}
}
function closeZoomImgExe(){
	if(intImg>0){
		intImg	-=5;
		intScrn	-=1;
	}else{
		if(intScrn>0){
			intScrn--;
		}else{
			clearInterval(intCloseZoomImg);
			var objParent	=_doc.getElementById("wrap");
			//alert(objParent.lastChild);
			//objParent	=objZoomImg.parentNode;
			var objParentChilds	=objParent.getElementsByTagName("div");
			for(i in objParentChilds){
				var strId	=String();
				try{
					strId	=objParentChilds[i].getAttributeNode("id").nodeValue;
				}catch(e){}	
				
				if(strId=="zoom-img"){
					objParent.removeChild(objParentChilds[i]);
				}
			}

			resetFreeLayer();	
		}
	}

	objZoomImg.style.MozOpacity =intImg/20;
	objZoomImg.style.opacity 	=intImg/20;
	//objZoomImg.style.opacity 	=intImg/2;
	objZoomImg.style.filter		="Alpha(opacity="+(intImg*5)+")";
	oScreen.style.MozOpacity 	=intScrn/20;
	oScreen.style.opacity 		=intScrn/20;
	//oScreen.style.opacity 		=intScrn/2;
	oScreen.style.filter		="Alpha(opacity="+(intScrn*5)+")";

	

}

function zoomImg(filename,pos){

	//this.onclick=setZiPos();
	setScreenWhole(true);
	objZI	=_doc.createElement("div");
	objZI.innerHTML	=
	'<img src="'+filename+'" alt="拡大画像" />\n'+
	'<div style="width:100%;"><a href="javascript:closeZoomImg();" class="btn-close-ss" style="margin:5px auto;"><span class="hidden">閉じる</span></a>\n</div>\n';
		
	objZI.setAttribute("id","zoom-img");
	objWrap		=_doc.getElementById("wrap");
	
	objWrap.appendChild(objZI);
	
	objZoomImg	=_doc.getElementById("zoom-img");
	
	objZoomImg.style.position	="absolute";
	objZoomImg.style.zIndex		=2;
	if(window.pageYOffset){
		objZoomImg.style.top=(window.pageYOffset+10)+"px";
	}else{
		objZoomImg.style.top=(_doc.documentElement.scrollTop+10)+"px";
	}
	//objZoomImg.style.top		=(_doc.documentElement.scrollTop+10)+"px";
	if(pos=="right"){
		objZoomImg.style.right		=10+"px";		
	}else{
		objZoomImg.style.left		=10+"px";		
	}
	objZoomImg.style.paddingTop			="10px";
	objZoomImg.style.paddingLeft		="10px";
	objZoomImg.style.paddingBottom		="0";
	objZoomImg.style.paddingRight		="10px";
	objZoomImg.style.backgroundColor	="#fff";
	objZoomImg.style.textAlign			="center";
	objZoomImg.style.width				=objZoomImg.getElementsByTagName("img")[0].width+"px";
//objZoomImg.innerHTML	='<div style=""><img src="'+filename+'" alt="拡大画像" /></div>';
	oScreen.onclick	=function(){
		if(!objZoomImg.onclick){
			closeZoomImg();		
		}
		
	}
	flgImgClosable=true;
}

function setZiPos(){
	//alert(window.event.clientY);
}


function setScreenWholeSize(){
	if(window.innerWidth>0){
		oScreen.style.width=(window.innerWidth-15)+"px";
	}else{
		oScreen.style.width=_doc.documentElement.clientWidth+"px";
	}
	
	if(window.innerHeight>0){
		oScreen.style.height=(window.innerHeight+10)+"px";
	}else{
		oScreen.style.height=_doc.documentElement.clientHeight+"px";	
	}	
}

var oScreen;
function setScreenWhole(loading){
	oScreen=_doc.getElementById("free-layer");
	oScreen.style.display ="block";
	oScreen.innerHTML="";
	oScreen.style.zIndex=1;
	
	
	//oScreen.style.display="block";
	//oScreen.style.backgroundColor="#000";
	if(loading===true){
		oScreen.style.background ="url(/images/global/loading.screen.gif) center center no-repeat #000";
	}else{
		/*oScreen.style.backgroundColor ="#fff";*/
	}
	//oScreen.style.height=(screen.height)+"px";
	setScreenWholeSize();

	window.onresize=function(){
		setScreenWholeSize();	
	}
	
	oScreen.style.left=0;
	if(window.pageYOffset>=0){
		oScreen.style.top=(window.pageYOffset-10)+"px";
	}else{
		oScreen.style.top=_doc.documentElement.scrollTop;
	}

	oScreen.style.MozOpacity =0.5;
	oScreen.style.opacity =0.5;
	//oScreen.style.opacity =5;
	oScreen.style.filter="Alpha(opacity=50)";
	
}

function resetFreeLayer(){
	var oScreen	=_doc.getElementById("free-layer");
	oScreen.innerHTML		="";
	oScreen.style.background="none";
	oScreen.style.width		="auto";
	oScreen.style.height	="auto";
	oScreen.style.top		="auto";
	oScreen.style.left		="auto";
	//oScreen.style.MozOpacity =1;
	//oScreen.style.opacity =1;
	//oScreen.style.opacity =10;
	//oScreen.style.filter="Alpha(opacity=100)";
	oScreen.style.MozOpacity =0.5;
	oScreen.style.opacity =0.5;
	//oScreen.style.opacity =10;
	oScreen.style.filter="Alpha(opacity=50)";
	oScreen.style.display ="none";
}


function closeBoxById(id){
	var obj	=_doc.getElementById(id);
	var oScreen=_doc.getElementById("free-layer");
	oScreen.innerHTML="";
	obj.innerHTML="";
}

function fadeIn(){
	if(i<10){
		i++;
	}else{
		i=10;
		clearInterval(intInterval);
	}
	objGlobal.style.MozOpacity =i/10;
	objGlobal.style.opacity =i/10;
	//objGlobal.style.opacity =i/1;
	objGlobal.style.filter="Alpha(opacity="+(10*i)+")";
	try{
		objGlobalTp.style.MozOpacity =i/10;
		objGlobalTp.style.opacity =i/10;
		//objGlobalTp.style.opacity =i/1;
		objGlobalTp.style.filter="Alpha(opacity="+(10*i)+")";		
	}catch(e){}
}


function printAge(objId,yyyy,mm,dd){ //"profile"と"register"で共用するため、このファイルに記述
	var obj =	_doc.getElementById(objId);
	if(yyyy!="0000"&&mm!="00"){	
		var today	=new Date();
		var curYear		=today.getFullYear();
		var curMonth	=today.getMonth()+1;
		var curDay		=today.getDate();
		
		if(curMonth	<10){	curMonth="0"+curMonth;	}
		if(curDay	<10){	curDay	="0"+curDay;	}

		var age	=	'年齢: '+ Math.floor((Number(curYear+curMonth+curDay)-Number(yyyy+mm+dd))/10000) + " 歳";
		obj.innerHTML=age;
		obj.style.display="block";
	}else{
		obj.style.display="none";
	}
}

function countChar(str){
	var intStrLen	=0;
	//var intExLen	=0;
	strEsc			=escape(str);

	for(i=0; i < strEsc.length; i++, intStrLen++	){
		if(strEsc.charAt(i)=="%"){
			if(strEsc.charAt(++i) == "u"){
				i += 3;
				intStrLen++;
			}else if(strEsc.charAt(i) == "0"){
				intStrLen--;
			}
			i++;
		}
	}

	return intStrLen;
}

//フォーム入力文字数のチェック
var origHref =String("");
function checkCharLimit(layerId,objText,limit,exeId,byte){
	var p,r,b,g;
	var objLayer	=_doc.getElementById(layerId);
	
	if(objText.value.length>0){

		var intStrLen	=countChar(objText.value);
		//textareaの行数を設定
		
		//try{
		var cols=String("");
		try{
			cols=objText.getAttributeNode("cols").nodeValue;
		}catch(e){}

		if(cols!=""){
			var n=0;
			var intRows=0;
			if(objText.value.indexOf("\n")>-1){
				var arrText	=objText.value.split("\n");
				//intRows	=arrText.length-1;
				
				for(n in arrText){
					//intRows +=Math.ceil(countChar(arrText[n])/(parseInt(objText.getAttributeNode("cols").nodeValue)+1));
					intCols	=countChar(arrText[n]);
					if(intCols>0){
						intRows +=Math.ceil(intCols/(parseInt(objText.getAttributeNode("cols").nodeValue)+2));
					}else{
						intRows++;
					}
				}
			}else{
				intRows=Math.ceil(intStrLen/(parseInt(objText.getAttributeNode("cols").nodeValue)));
				//intRows=Math.ceil(intStrLen/(parseInt(objText.getAttributeNode("cols").nodeValue)+1));
			}
			intDefRows=2;
			try{
				intDefRows=objText.getAttributeNode("rows").nodeValue;
			}catch(e){}
			
			if(intRows<intDefRows){
				intRows=intDefRows;
			}
			objText.getAttributeNode("rows").nodeValue=intRows;
		
		}
		//}catch(e){}


		var strIndiText;
		if(byte=="half"){
			strIndiText	= '［文字数制限（半角）］' + Math.floor(intStrLen) +"/"+limit;
		}else{
			//strIndiText	= '［文字数制限（全角）］' + Math.floor(intStrLen/2) +"/"+limit/2;
			strIndiText	= '［文字数制限（全角）］' + intStrLen/2 +"/"+limit/2;
		}
		

		if(intStrLen<=limit){
			//if(intStrLen>0){
			p=intStrLen/limit;
			objLayer.innerHTML=strIndiText;
			//objLayer.style.display	="inline";
			try{
				var objExe= _doc.getElementById(exeId);
				if(origHref!=""){
					objExe.getAttributeNode("href").nodeValue=origHref;
					origHref	=String("");
				}
						
			}catch(e){}
			
		}else{
			p=1;
			objLayer.innerHTML=strIndiText+"&nbsp;<span>文字数オーバー</span>";
			//objLayer.style.display	="inline";
			try{
				var objExe= _doc.getElementById(exeId);
	
				if(objExe.getAttributeNode("href").nodeValue.indexOf("overCharLimit")==-1){
					origHref =objExe.getAttributeNode("href").nodeValue;
				}
				//objExe.getAttributeNode("href").nodeValue="javascript:overCharLimit('" + exeId + "',\""+origHref+"\");";
				objExe.getAttributeNode("href").nodeValue="javascript:overCharLimit();";
			}catch(e){}
		}
		
		var arrNum=Array(0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f");
		
		r=Math.floor(Math.abs(p*12))+2;
		b=Math.floor(Math.abs(1-p)*6)+3;
		g=Math.floor(Math.abs(1-p)*6)+3;
		r=arrNum[r];
		b=arrNum[b];
		g=arrNum[g];
		
		objLayer.style.color ="#"+r+b+g;

	}else{
		objLayer.innerHTML ="";	
		
	}
}


function overCharLimit(){
	alert("文字数制限を超えているため、実行できません。");
}

function reloadDaySelector(objId,year,month,day){
	//alert(_doc.forms[0].elements['usr[name]']);
	var oDay =_doc.getElementById(objId);
	if(year!="0000"&&year!=""&&month!="00"&&month!=""){
		oDay.disabled ="";
	}else{
		oDay.disabled ="disabled";	
	}
	
	var aFuncs=Array();
	var aErrs=Array();
	callHtmlNodes(objId, "/call/call_common.php?func=reloadMonthSelector", "year="+year+"&month="+month+"&day="+day, aFuncs, aErrs);
}

function reloadCitySelector(objId,pref,city){
	var oCity =_doc.getElementById(objId);
	if(pref!="00"&&pref!="99"&&pref!=""){
		oCity.disabled ="";
	}else{		
		oCity.disabled ="disabled";	
	}
	oCity.innerHTML ='<div id="loading"><img src="/images/global/loading15.gif" /></div>';
	var aFuncs=Array();
	var aErrs=Array();
	callHtmlNodes(objId, "/call/call_common.php?func=reloadCitySelector", "pref="+pref+"&city="+city, aFuncs, aErrs);
}

function callHtmlNodes(objId, url, data, funcs, errs){
	//alert(objId);
	if(objId!=""){
		var oElmnts =_doc.getElementById(objId);
	}
	
	var httpoj = createHttpRequest();
	//open メソッド
	if(data!=""){	
		sMethod	="POST";
	}else{
		sMethod	="GET";	
	}
	httpoj.open( sMethod, url , true );
	httpoj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	//受信時に起動するイベント
	httpoj.onreadystatechange = function(){ 
	
		//readyState値は4で受信完了
		if (httpoj.readyState==4){ 			
			var sResponse=httpoj.responseText;
			//safari
			var ajax_filter = function(t){return t};
			if(navigator.appVersion.indexOf( "KHTML" ) > -1){
				ajax_filter = function(t){
					var esc = escape(t);
					sResponse	=(esc.indexOf("%u") < 0 && esc.indexOf("%") > -1) ? decodeURIComponent(esc) : t
				}
			}

			if ( navigator.appVersion.indexOf( "KHTML" ) > -1 ) {
				var esc = escape( sResponse );
				if ( esc.indexOf("%u") < 0 && esc.indexOf("%") > -1 ) {
					sResponse = decodeURIComponent( esc );
				}
			}
			
			aResponse =sResponse.split(":");
			if(aResponse[0]!="Error"){
				if(objId!=""){
					oElmnts.charset="UTF-8";
					oElmnts.innerHTML=sResponse;
				}

				if(funcs.length>0){
					for(i in funcs){
						eval(funcs[i]);	
					}
				}
			}else{
				alert(aResponse[1]);
				if(errs.length>0){
					for(i in errs){
						eval(errs[i]);	
					}
				}
			}
		}
	}
    
    httpoj.send( data );
	
}

function createHttpRequest(){
	if(window.ActiveXObject){
		try {
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				return null
			}
		}
	} else if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	} else {
		return null;
	}
}

function fadeOut(interval){
	if(i>0){
		obj.style.MozOpacity=i/20;
		obj.style.opacity 	=i/20;
		//obj.style.opacity 	=i/2;
		obj.style.filter	="Alpha(opacity="+(i*5)+")";
		i--;
	}else{
		clearInterval(int);
		try{
		oParent.removeChild(obj);
		}catch(e){}
	}
}

function preloadScreenshot(sItem){
	var aFuncs =Array("preloadScreenshotExe(sResponse)");
	var aErrs =Array();
	callHtmlNodes("", "/mobile.call/call_common.php?func=preloadScreenshot","item="+sItem, aFuncs, aErrs);
}

function preloadScreenshotExe(response){
	var aUrls =response.split(",");
	var preloadImg =Array();
	for(i in aUrls){
		preloadImg[i] =new Image();
		preloadImg[i].src =aUrls[i];
	}
}

