///　　リストのカテゴリ検索　　/////
function CategorySelect(){
	var s_genre= document.searchForm.genre.selectedIndex;
	var genre_no = document.searchForm.genre.options[s_genre].value;
	var genreName = document.searchForm.genre.options[s_genre].text;
	
	var category_no = "";
	var categoryName = "";
	if(document.getElementById("category")){
		var s_category = document.searchForm.category.selectedIndex;
		category_no = document.searchForm.category.options[s_category].value;
		categoryName = document.searchForm.category.options[s_category].text;
	}
	
	HTML_AJAX.call('ajaxcode','categorySelect',
		function(categorySelect){
			document.getElementById("categorySelect").innerHTML = categorySelect
		},
		genre_no , category_no
	);

	var keyword = document.searchForm.keyword.value;
	
	var s_print = document.pcForm.print_pc.selectedIndex;
	var pc = document.pcForm.print_pc.options[s_print].value;

	document.getElementById("list_block").innerHTML = '<p style="text-align:center; padding:50px"><img src="http://www.dounano.net/core/image/loading.gif" width="32" height="32" alt="Now Loading･･･" /><br />Now Loading･･</p>';

	HTML_AJAX.call('ajaxcode','SelectTitle',
		function(title){
			document.getElementById("title").innerHTML = title
		},
		genre_no , genreName , 
		category_no , categoryName , 
		keyword
	);
	
	HTML_AJAX.call('ajaxcode','SelectListUp',
		function(list_block){
			document.getElementById("list_block").innerHTML = list_block
		},
		genre_no , genreName , 
		category_no , categoryName , 
		keyword , pc
	);
	
}

////　　グラフ　　////////////////
function ChangeGraph(url,qNo,State){
	var questionNoId = "Que"+qNo;
	
	$("#"+questionNoId).html("<p style='text-align:center; padding:50px'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' /><br />Now Loading･･･</p>");
	$("#"+questionNoId).fadeOut("fast");
	HTML_AJAX.call('ajaxcode','changegraph',
		function(questionNoId){
			document.getElementById("Que"+qNo).innerHTML = questionNoId;
		},
		url, qNo, State
	);
	$("#"+questionNoId).load($("#"+questionNoId).fadeIn("slow"));
	
$.scrollTo("#Qtag"+qNo, 'slow');
}



////　　投票者データ　　//////////////
function SelectOpen(url,Vdata){
	var selectV1= document.vote_form.V1.selectedIndex;
	var V1 = document.vote_form.V1.options[selectV1].value;
	
	if(document.vote_form.V2){
		var selectV2= document.vote_form.V2.selectedIndex;
		var V2 = document.vote_form.V2.options[selectV2].value;
	}else{
		var V2 = "";
	}
	if(document.vote_form.V3){
		var selectV3= document.vote_form.V3.selectedIndex;
		var V3 = document.vote_form.V3.options[selectV3].value;
	}else{
		var V3 = "";
	}

	document.getElementById("voteCdata").innerHTML = "<p style='text-align:center'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	HTML_AJAX.call('ajaxcode','selectopen',
		function(voteCdata){
			document.getElementById("voteCdata").innerHTML = voteCdata;
		},
		url, Vdata,V1,V2,V3
  );
	$.scrollTo("#vote", 'slow');
}


////　　コメント表示　　//////////////
function CommentOrder(position,url,order,del){
	document.getElementById("com_list_block").innerHTML = "<p style='text-align:center'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	
	HTML_AJAX.call('ajaxcode','commentOrder',
		function(com_list_block){
			document.getElementById("com_list_block").innerHTML = com_list_block
		},
		position,url,order,del
  );
	$.scrollTo("#com_list_block", 'slow');
	return false;

}

////　　作成アンケート検索　　//////////////
function DounanoMakedSearch(memberNo){
	var s_genre= document.makedForm.s_genre.selectedIndex;
	var genre = document.makedForm.s_genre.options[s_genre].value;
	
	var s_OpenClose= document.makedForm.OpenClose.selectedIndex;
	var OpenClose = document.makedForm.OpenClose.options[s_OpenClose].value;
	
	var keyword = document.makedForm.keyword.value;

	document.getElementById("make_list").innerHTML = "<p style='text-align:center'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' /><br />Now Loading･･･</p>";

	HTML_AJAX.call('ajaxcode','dounanomakedsearch',
		function(makied_bolck){
		document.getElementById("maked_bolck").innerHTML = makied_bolck;
		},
		memberNo, genre, OpenClose, keyword
	);
}

////　　通知変更　　//////////////
function Notice(qNo,AorC,notice){
	var Ntype ="";
	if(AorC === 'Antc'){
		Ntype = '投票者';
	}else if(AorC === 'Antc'){
		Ntype = 'コメント';
	}
	
	if(notice == 1){
		var noticome = Ntype+"通知を開始しますか？";
	}else{
		var noticome = Ntype+"通知を停止しますか？";
	}
	
	if(confirm(noticome)){
		var idName = AorC+qNo;
		HTML_AJAX.call('ajaxcode','notice',
			function(idName){
				document.getElementById(AorC+qNo).innerHTML = idName;
			},
			qNo,AorC ,notice
		);
	}
}

////　　結果閲覧変更　　//////////////
function SLcc(qNo){
	var srl = document.getElementById("Rlim"+qNo).selectedIndex;
	var Rlimit = document.getElementById("Rlim"+qNo).options[srl].value;
	if((Rlimit === "RP")||(Rlimit=== "WP")){
		$("#QpassInp"+qNo).slideDown("slow"); 
	}else{
		$("#QpassInp"+qNo).slideUp("slow");
	}
	
	
}

////　　結果閲覧変更　　//////////////
function SLimChan(qNo){
	var srl = document.getElementById("Rlim"+qNo).selectedIndex;
	var Rlimit = document.getElementById("Rlim"+qNo).options[srl].value;
	var error ="";
	var Qpass ="";
	if((Rlimit === "RP")||(Rlimit=== "WP")){
		Qpass = $("#Qpass"+qNo).val();
		if(!Qpass){
			error += "パスワードを設定して下さい\n";
		}else if(Qpass.length<4){
			error += "パスワードは英数半角4～10文字で設定して下さい\n";
		}
	}else{
		$("#QpassInp"+qNo).slideUp("slow");
		$("#SetRlim"+qNo).slideUp("slow");
	}
	
	if(error){
		alert(error);
	}else{
		var idName = "CheckLimit"+qNo;
		HTML_AJAX.call('ajaxcode','RlimChange',
			function(idName){
				document.getElementById("CheckLimit"+qNo).innerHTML = idName;
			},
			qNo,Rlimit,Qpass
		);
		SaveLimitChange(qNo);
		$("#CheckLimit"+qNo).slideDown("slow");
		if(Qpass){
			$("#SetQpass"+qNo).text(Qpass);
			$("#SetRlim"+qNo).slideDown("slow");
		}else{
			$("#SetRlim"+qNo).slideUp("slow");
		}
	}
}

////　　掲載サイト変更　　//////////////
function SetUpSite(qNo){
	var site = $("#site"+qNo).val();
	var siteUrl = $("#siteUrl"+qNo).val();
	
	document.getElementById("setUpSite"+qNo).innerHTML = "<p style='text-align:center'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' />Now Loading･･･</p>";
	var idName = "setUpSite"+qNo;
	HTML_AJAX.call('ajaxcode','SetUpSite',
		function(idName){
			document.getElementById("setUpSite"+qNo).innerHTML = idName;
		},
		qNo,site,siteUrl
	);
}


/////　カテゴリ変更　///////
function OpenChangeCategory(qNo,category_no){
	var CcId = 'Cc'+qNo;
	if($("#Nc"+qNo).css("display") === 'inline'){
		var NcVal = $("#Ncv"+qNo).text();
		$("#Nc"+qNo).after('<span id="'+CcId +'">'+NcVal+'</span>');
		$("#Nc"+qNo).css("display","none");
		HTML_AJAX.call('ajaxcode','CcSelect',
			function(CcId){
				document.getElementById("Cc"+qNo).innerHTML = CcId;
			},
			qNo,category_no
		);
	}else if($("#Nc"+qNo).css("display") === 'none'){
		$("#"+CcId).remove();
		$("#Nc"+qNo).css("display","inline");
	}
}

/////　カテゴリ変更UP　///////
function CCateChange(qNo,BeforeCate){
	var srl = document.getElementById("Scategory"+qNo).selectedIndex;
	var SetChangeCate = document.getElementById("Scategory"+qNo).options[srl].value;
	
	var CcId = 'Cc'+qNo;
	if(SetChangeCate == BeforeCate){
		$("#"+CcId).remove();
		$("#Nc"+qNo).css("display","inline");
	
	}else if(SetChangeCate != BeforeCate){
		document.getElementById("Nc"+qNo).innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='15' height='15' alt='Now Loading･･･' />";
		var NcId = 'Nc'+qNo;
		HTML_AJAX.call('ajaxcode','CCateChange',
			function(NcId){
				document.getElementById("Nc"+qNo).innerHTML = NcId;
			},
			qNo,SetChangeCate
		);
		$("#"+CcId).remove();
		$("#Nc"+qNo).css("display","inline");
	}
	
	
}


////　　締切変更　　//////////////
function CorrectDL(qNo){
	var sSelDL = document.getElementById("SelDL"+qNo).selectedIndex;
	var SelDL = document.getElementById("SelDL"+qNo).options[sSelDL].value;
	
	var DLN = $("#DeadLineNumber"+qNo).val();
	
	//締切日時用
	var YMDHM = new Array("Year"+qNo,"Month"+qNo,"Day"+qNo,"Hour"+qNo,"Min"+qNo);
	var CHK = "";
	var ArrayDLT = new Array();
	var CheckTime ='';
	for(var i=0; i<YMDHM.length; i++){
		var ss = document.getElementById(YMDHM[i]).selectedIndex;
		var SValue = document.getElementById(YMDHM[i]).options[ss].value;
		ArrayDLT[i] = SValue;
		
		if(YMDHM[i] === "Year"+qNo){
			CheckTime += SValue+'年';
		}else if(YMDHM[i] === "Month"+qNo){
			CheckTime += SValue+'月';
		}else if(YMDHM[i] === "Day"+qNo){
			CheckTime += SValue+'日';
		}else if(YMDHM[i] === "Hour"+qNo){
			CheckTime += SValue+'時';
		}else if(YMDHM[i] === "Min"+qNo){
			CheckTime += SValue+'分';
		}
	}
	
	var checkCom = "";
	if(SelDL === 'T'){
		checkCom = '締め切りを'+CheckTime+'に変更しますか？';
	}else if(SelDL === 'N'){
		var CheckNumber = DLN+'票';
		checkCom = '締め切りを'+CheckNumber+'に変更しますか？';
	}
	
	
	if(confirm(checkCom)){
		$("#CDLBlock"+qNo).slideUp("slow");
		document.getElementById("dead"+qNo).innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='15' height='15' alt='Now Loading･･･' />";
		var idName = "dead"+qNo;
		HTML_AJAX.call('ajaxcode','CorrectDL',
			function(idName){
				document.getElementById("dead"+qNo).innerHTML = idName;
			},
			qNo,SelDL,ArrayDLT,DLN
		);
	}
}



//////
//タイトルの変更
function AmendPurport(){
	var url = $("#url").val();
	var BeforeTitle = $("#purport").text();
	var ChangeTitle = $("#AmendPurportText").val();
	if(BeforeTitle !== ChangeTitle){
		if(confirm("タイトルを修正しますか？")){
			document.getElementById("purport").innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='15' height='15' alt='Now Loading･･･' />";
			HTML_AJAX.call('ajaxcode','ChangePurport',
				function(purport){
					document.getElementById('purport').innerHTML = purport;
				},
				url , ChangeTitle
			);
			$("#AmendPurport").slideUp("slow");
			$("#purport").slideDown("slow");
		}else{  }
		
	}else{
		$("#AmendPurport").slideUp("slow");
		$("#purport").slideDown("slow");
	}
}


//////
//質問文の変更
function AmendQitem(qNo){
	var url = $("#url").val();
	var BeforeQT = $("#QitemTxt"+qNo).text();
	var QT = $("#QT"+qNo).val();
	if(BeforeQT !== QT){
		if(confirm("質問"+qNo+"の質問文を修正しますか？")){
			var SetId = 'QitemTxt' + qNo;
			document.getElementById("QitemTxt"+qNo).innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='15' height='15' alt='Now Loading･･･' />";
			HTML_AJAX.call('ajaxcode','ChangeQitem',
				function(SetId){
					document.getElementById('QitemTxt' + qNo).innerHTML = SetId;
				},
				qNo , url , QT
			);
			$("#AmendQitem"+qNo).slideUp("slow");
			$("#QI"+qNo).slideDown("slow");
		}else{  }
		
	}else{
		$("#AmendQitem"+qNo).slideUp("slow");
		$("#QI"+qNo).slideDown("slow");
	}
}

/////////
//選択項目変更
function SelectAmendUpdate(qNo , sNo){
	var Sid = "s"+qNo+"s"+sNo;
	var NowText = $("#"+Sid).text();
	var AmendInpId = "amd"+qNo+"s"+sNo;
	var AmendVal = $("#"+AmendInpId).val();
	
	$("#"+Sid).css("display","inline");
	$("#SP"+AmendInpId).remove();
	
	//修正されていればデータを更新
	if(NowText !== AmendVal){
		if(confirm("質問"+qNo+"選択項目"+sNo+"の内容を\n-----------\n\n"+AmendVal+"\n\n-----------\nに修正しますか？")){
			$("#"+Sid).html= "<img src='http://www.dounano.net/core/image/loading.gif' width='15' height='15' alt='Now Loading･･･' />";
			$("#"+Sid).css("display","inline");
			$("#SP"+AmendInpId).remove();
			var url = $("#url").val();
			HTML_AJAX.call('ajaxcode','SelectAmend',
				function(Sid){
					document.getElementById("s"+qNo+"s"+sNo).innerHTML = Sid;
				},
				qNo , sNo , AmendVal , url
			);
		}else{ return false }
	}
}


/////////////////
//任意回答へ変更
function ChangeSure(qNo){
	var url = $("#url").val();
	
	if(confirm("質問"+qNo+"を任意回答にしますか？\n一度任意回答にすると必須回答へ戻す事は出来ません")){
		var SetId = 'sureAns' + qNo;
		HTML_AJAX.call('ajaxcode','ChangeSure',
			function(SetId){
				document.getElementById('sureAns' + qNo).innerHTML = SetId;
			},
			url , qNo 
		);
	
	}else{  }
	
}

/////////////////
//複数回答へ変更
function ChengeNumAmend(qNo){
	var CNid = 'ChoiceNumSelct'+qNo;
	var ss = document.getElementById(CNid).selectedIndex;
	var Cmax = document.getElementById(CNid).options[ss].value;
	
	var url = $("#url").val();
	
	if(confirm("質問"+qNo+"を複数回答にしますか？")){
		var SetId = 'SingleInfo' + qNo;
		HTML_AJAX.call('ajaxcode','ChengeAnsChoice',
			function(SetId){
				document.getElementById('SingleInfo' + qNo).innerHTML = SetId;
			},
			url , qNo  ,Cmax
		);
		
		$("#ChengeAnsChoice"+qNo).css("display","none");
	
	}else{ return false }

}	



/***************
アンケート作成
****************/
//作成アドヴァイス
function Madv(Update,No){
	var QUESTION_MAX = 20;
	var State = "";
	var LoadID = '';
	var OpenID = '';
	var ScrollId = "";

	var SetNo = No;
	if(($("#CCreator").text()) || (Update === 'upCreator')){
		State ="ToFinalCheck";
		No = "";
		ScrollId = "CreatorPack";
	}else if(Update === 'InputCreator'){
		State ="InputCreator";
		No = "";
		ScrollId = "DeadLine";
		
	}else if(Update === 'TermsCancell'){
		State ="SettingTerms";
		No = "";

	}else if(Update === 'upVote'){
		State ="SettingTerms";
		No = "";
		ScrollId = "SvBLOCK";  

	}else if(Update === 'VoteSet'){
		State ="ProgressVote";
		No = "";
		ScrollId = "SvBLOCK";  

	}else if(Update === 'upLimit'){
		State ="SettingTerms";
		No = "";
		ScrollId = "LimitPack";
		
	}else if(Update === 'LimitSet'){
		State ="SelectLimit";
		No = "";
		ScrollId = "LimitPack";  

	}else if(Update === 'upDeadLine'){
		State ="SettingTerms";
		No = "";
		ScrollId = "DeadLine";

	}else if(Update === 'DeadLineSet'){
		State ="SelectDeadLine";
		No = "";
		ScrollId = "DeadLine";

	//カテゴリ有 OR カテゴリUP 補助項目
	}else if(($("#Ccate").text()) || (Update === 'upCategory')){
		LoadID = 'Ccate';
		OpenID = 'TermsBlock';
		State ="SettingTerms";
		No = "";
		ScrollId = "CatePack";  
		
	}else{
		//質問を確認
		var Qino = (No)? No:1;
		for(mi=Qino; mi<=QUESTION_MAX; mi++){
			var nextNo = mi +1;
			var beforNo = mi -1;
			//チェック部分がなければ入力部分を開く
			if($("#ChkQ"+mi).css("display") !== "block"){
				if(mi== 1){
					State = "inputQuestion";
					LoadID = 'purport';
					OpenID = 'QBlock1';
					No = mi;
				}else if(Update === 'upQuestion'){
					LoadID = 'ChkQ'+beforNo;
					OpenID = 'MorF'+beforNo;;
					State = "MorF";
					ScrollId = "QBlock"+beforNo;
					No = beforNo;
				}else{
					State = "MorF";
					ScrollId = "QBlock"+beforNo;
					No = beforNo;
				}
				break;
			}else if(mi == 20){
				LoadID = 'ChkQ'+mi;
				OpenID = 'MorF'+mi;
				State = "MorF";
				ScrollId = "QBlock"+mi;
				No = mi;
			}
		}
	}	
		
	if(LoadID){
		TimeOut = setTimeout('TimeOutError()',10000);
		Set = setInterval("LoadedOpen('"+LoadID+"','"+OpenID+"','"+Update+"','"+State+"','"+No+"','"+SetNo+"','"+TimeOut+"')",500);
	}else{
		document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
		HTML_AJAX.call('ajaxcode','MadvBlock',
			function(ProBlock){
				document.getElementById("ProBlock").innerHTML = ProBlock
		},
		Update,State,No,SetNo
		);
		$("#ProBlock").slideDown("slow");
		$("#CorBlock").slideUp("slow");
	}
	
	if(ScrollId){
		$.scrollTo("#"+ScrollId, 'slow');
	}
}

////////////////
function LoadedOpen(LoadID,OpenID,Update,State,No,SetNo,TimeOut){
	
	if(($("#"+LoadID).text()) && ($("#"+LoadID).text() !== "データ保存中")){
		$("#"+OpenID).slideDown("slow");
		clearInterval(Set);
		//作成案内部分
		document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
		HTML_AJAX.call('ajaxcode','MadvBlock',
			function(ProBlock){
				document.getElementById("ProBlock").innerHTML = ProBlock
		},
		Update,State,No,SetNo
		);
		
		$("#ProBlock").slideDown("slow");
		$("#CorBlock").slideUp("slow");  
		
		clearTimeout(TimeOut);
		
	}
}

function TimeOutError(){
	clearInterval(Set);
	alert('データを保存できませんでした\n訂正をクリックして保存しなおしてください\nそれでも出来ない場合はブラウザの更新ボタンか\nアンケート作成を再度クリックして下さい');
}

///////訂正
function CorrectAdv(Correct,State,No,ScrollId){
	document.getElementById("CorBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	//作成案内部分
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(CorBlock){
			document.getElementById("CorBlock").innerHTML = CorBlock
		},
		Correct,State,No,""
	);
	$("#ProBlock").slideUp("slow");
	$("#CorBlock").slideDown("slow");
	$.scrollTo("#"+ScrollId, 'slow');
}


///投票者・締め切り・制限のセッティング
function TermsOpen(AnchorID,InpID,ScrollID){
	$("#"+AnchorID).slideUp("slow");
	$("#"+InpID).slideDown("slow");
	$("#"+AnchorID).slideUp("slow");
	$("#SetCreator").slideUp("slow");

	Madv(AnchorID,'');
}

///投票者・締め切り・制限のセッティングキャンセル
function TermsCancell(AnchorID,ID,CheckID){
	$("#Inp"+ID).slideUp("slow");
	if($("#"+CheckID).text()){
		if(ID === 'Vote'){
			if($("#"+CheckID).text() == 'なし'){
				$("#"+AnchorID).slideDown("slow");
		}else{
				$("#Chk"+ID).slideDown("slow");
			}
		}else{	
			$("#Chk"+ID).slideDown("slow");
		}
	}else{
		$("#"+AnchorID).slideDown("slow");
	}
	$("#SetCreator").slideDown("slow");
	Madv('TermsCancell','');
}

///////　題名の確認＆UPDATE　////////
function Porpurt(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var purport = $("#purportText").val();
	var error = '';
	if(!purport){
		error += 'アンケートのタイトルが入力されていません\n';
	}
	if(!error){
		document.getElementById("purport").innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中";
		//データをインサートしてその値を出力
		HTML_AJAX.call('ajaxcode','purportinsert',
			function(purport){
				document.getElementById("purport").innerHTML = purport;
			},
			purport
		);
		
		if(!$("#QBlock1").text()){
			QueBlock('1');//一問目のＨＴＭＬ追加
		}
		
		Madv('upPurport','');
		
		$("#InpPurport").slideUp("slow");
		$("#ChkPurport").slideDown("slow");
	}else{
		alert(error);
	}
}

/////////題名の訂正
function CorrectPurport(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	
	$("#InpPurport").slideDown("slow");
	$("#ChkPurport").slideUp("slow");
	
	document.getElementById("CorBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";

	//作成案内部分
	CorrectAdv('CorrectPurport','inputPurport','','InputPurport');
	
	if(!document.getElementById("CorrectPurportCancel")){
		$("#InMakePurport").append('<p class="correct" id="CorrectPurportCancel"><a href="javascript:CorrectPurportCancel()">タイトル訂正中止</a></p>');
	}
	
	$("#CorBlock").slideDown("slow");
	$("#ProBlock").slideUp("slow");
}

/////////題名の訂正キャンセル
function CorrectPurportCancel(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	$("#ChkPurport").slideDown("slow");
	$("#InpPurport").slideUp("slow");

	$("#ProBlock").slideDown("slow");
	$("#CorBlock").slideUp("slow");
}


////質問部分ＨＴＭ挿入
function QueBlock(qNo){

	var SetId = "QBlock"+qNo;
	HTML_AJAX.call('ajaxcode','qbHTML',
		function(SetId){
			document.getElementById("QBlock"+qNo).innerHTML = SetId;
		},
		qNo
	);
}


////　　アンケート作成時　回答の種類変更　　//////////////
function SelectAnswer(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	var ans = document.getElementById("IansType"+qNo).selectedIndex;
	var ansType = document.getElementById("IansType"+qNo).options[ans].value;
	$("#IansType"+qNo).css("background-color","rgb(255,255,255)")

	if((ansType == 'S') || (ansType == 'P') ){
		 $("#QDB"+qNo).slideDown("slow");
		 $("#ST"+qNo).slideDown("slow");
		 $("#MQS"+qNo).slideDown("slow");
		 
		 if($("#QSelH"+qNo).css("display") !== "none"){
		 	$("#QSelH"+qNo).slideUp("slow");
		 }
	}else{
		 $("#QDB"+qNo).slideUp("slow");
		 $("#ST"+qNo).slideUp("slow");
		 $("#MQS"+qNo).slideUp("slow");
	}
	
	//作成案内部分
	$("#ProBlock").slideDown("slow");
	$("#CorBlock").slideUp("slow");

	document.getElementById("ST"+qNo).innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' />Now Loading･･･";
	var ST = "ST"+qNo;
	HTML_AJAX.call('ajaxcode','selectanswer',
		function(ST){
			document.getElementById("ST"+qNo).innerHTML = ST;
		},
		qNo,ansType
	);
	
	document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	if(ansType == 0){
		var AnsT = "selectAnsType";
	}else{
		var AnsT = "ansType";
	}
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(ProBlock){
			document.getElementById("ProBlock").innerHTML = ProBlock
		},
		"",AnsT,qNo,ansType
	);
		
	$.scrollTo("#QT"+qNo, 'slow');
}



////　　複数回答の最大値変更　　//////////////
function ChangeMax(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	var sMi = document.getElementById("min"+qNo).selectedIndex;
	var min = document.getElementById("min"+qNo).options[sMi].value;

	var sMa = document.getElementById("max"+qNo).selectedIndex;
	var max = document.getElementById("max"+qNo).options[sMa].value;
	
	var MaxID = "maxSel"+qNo;
	HTML_AJAX.call('ajaxcode','changemax',
		function(MaxID){
			document.getElementById("maxSel"+qNo).innerHTML = MaxID;
		},
		qNo,min,max
	);
}

///各質問の更新
function QueUp(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});


	var question = document.getElementById("QT"+qNo).value;
	
	var ans = document.getElementById("IansType"+qNo).selectedIndex;
	var ansType = document.getElementById("IansType"+qNo).options[ans].value;
	
	var ns = document.getElementById("InewAns"+qNo).selectedIndex;
	var newAns = document.getElementById("InewAns"+qNo).options[ns].value;

	var ss = document.getElementById("Isure"+qNo).selectedIndex;
	var sure = document.getElementById("Isure"+qNo).options[ss].value;
	
	var error = "";
	
	if(!question){
		error += "質問内容が未入力です\n";
	}

	
	if(!ansType){
		error += "回答の種類を選択して下さい\n";
	}
	
	var SelData = new Array();
	var setI = 0;
	for(var i = 1; i<=20; i++){
		var GetData = document.getElementById("qNo"+qNo+"sel"+i).value;
		var SetUpData = "";
		if(document.getElementById("UpqNo"+qNo+"sel"+i)){
			var GetFile = document.getElementById("UpqNo"+qNo+"sel"+i).value;
		}else{
			var GetFile ="";
		}
		if(GetData){
			if(GetData.length > 30){
				error += "選択項目"+i+"が"+GetData.length+"文字あります\n30文字以内にして下さい\n";
			}

			setI++;
			SetUpData = GetData;
		}
			
		if(GetFile){
			if(!GetData){
				setI++;
			}
			SetUpData += '/&/' +GetFile;
		}
		
		for(var ci = 1; ci<SelData.length; ci++){
			if(ci !== setI){
				if(SelData[ci] == SetUpData){
					error += "選択項目"+ci+"と"+setI+"は重複してます\n";
					break;
				}
			}
		}
		if(!SelData[setI]){
			SelData[setI] = SetUpData;
		}
	}
	
	if(newAns === "N"){
		if(SelData.length < 3){
		error += "新しい回答を許可しない場合は選択項目を2つ以上設定して下さい\n";
		}
	}
	

	if(ansType == 'P'){
		var smi = document.getElementById("min"+qNo).selectedIndex;
		var min = document.getElementById("min"+qNo).options[smi].value;
		var sma = document.getElementById("max"+qNo).selectedIndex;
		var max = document.getElementById("max"+qNo).options[sma].value;
		var num = min+"-"+max;
		
		var selCK = SelData.length-1;
		if(min > max){
			error += "指定回答数の最小値と最大値が正しくありません\n";
		}else if(selCK < max){
			error += selCK+"選択項目数が指定回答数に足りません\n";
		}else if(min == selCK){
			error += selCK+"選択項目数と指定回答数の最小値が同じです\n";
		}
		
	}else{
		var num ="";
	}
	
	question += '/&/' + ansType + '&&'+ newAns + '&&' + sure + '&&' + num;
	
	if(document.getElementById("UpqNo"+qNo)){
		question += '/&/'+document.getElementById("UpqNo"+qNo).value;
	}
	
	if(error){
		alert(error);
	}else{
		$("#ChkQ"+qNo).slideDown("slow");
		$("#qItem"+qNo).slideDown("slow");
		$("#QCOR"+qNo).slideDown("slow");
		$("#InpQ"+qNo).slideUp("slow");
		var nNo = "";
		
		var ChkQid = "ChkQ"+qNo;
		document.getElementById("ChkQ"+qNo).innerHTML = "<p class='center' style='margin:20px auto 0'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中</p>";
		HTML_AJAX.call('ajaxcode','questionup',
			function(ChkQid){
				document.getElementById("ChkQ"+qNo).innerHTML = ChkQid;
			},
			qNo,ansType,newAns,sure,num,question,SelData
		);
		
		Madv('upQuestion',qNo);
		var Tb = qNo*100+62;
		document.getElementById("QcL"+qNo).innerHTML = '<a href="javascript:CorrectQuestion('+qNo+')" title="この質問を訂正する" tabindex="'+Tb+'">訂正</a>';
		
	}
}


/////////質問訂正
function CorrectQuestion(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	$("#ChkQ"+qNo).slideUp("slow");
	$("#qItem"+qNo).slideUp("slow");
	$("#InpQ"+qNo).slideDown("slow");
	
	var ans = document.getElementById("IansType"+qNo).selectedIndex;
	var ansType = document.getElementById("IansType"+qNo).options[ans].value;

	if((ansType === "S")||(ansType === "P")){
		$("#QDB"+qNo).slideDown("slow");
		$("#MQS"+qNo).slideDown("slow");
	}
	
	var Tb = qNo*100+62;
	document.getElementById("QcL"+qNo).innerHTML = '<a href="javascript:CorrectQuestionCancel('+qNo+')" title="訂正を辞める" tabindex="'+Tb+'">訂正中止</a>';

	CorrectAdv('CorrectQuestion','CorrectQuestion',qNo,"#Qtag"+qNo);
	
}

/////////質問訂正キャンセル
function CorrectQuestionCancel(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	$("#ChkQ"+qNo).slideDown("slow");
	$("#qItem"+qNo).slideDown("slow");
	$("#InpQ"+qNo).slideUp("slow");

	$("#ProBlock").slideDown("slow");
	$("#CorBlock").slideUp("slow");
	
	var Tb = qNo*100+62;
	document.getElementById("QcL"+qNo).innerHTML = '<a href="javascript:CorrectQuestion('+qNo+')" title="この質問を訂正する" tabindex="'+Tb+'">訂正</a>';
	$.scrollTo("#QBlock"+qNo, 'slow');
}


//次の質問の入力エリア表示
function NextQuestion(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var nextNo = new Number(qNo);
	nextNo++;
	QueBlock(nextNo);//次の質問のＨＴＭＬ追加
	$("#CorBlock").slideUp("slow");
	$("#ProBlock").slideDown("slow");	
	document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(ProBlock){
			document.getElementById("ProBlock").innerHTML = ProBlock
		},
		"","inputQuestion",nextNo,""
	);
	TimeOut = setTimeout('TimeOutError()',10000);
	Set = setInterval("MorFopen('MorF"+qNo+"','QBlock"+nextNo+"')",500);
	AddColor('QT'+nextNo);
}

//次の質問へ
function MorFopen(MoFid,NextBlock){
	if($("#"+NextBlock).text()){
		$("#"+MoFid).slideUp("slow");
		$.scrollTo("#"+MoFid, 'slow');
		clearInterval(Set);
		clearTimeout(TimeOut);
	}

}

function AddQuestion(qNo){
	if(document.getElementById("MorF"+qNo).style.display === "block"){
		$("#MorF"+qNo).slideUp("slow");       
		$("#CorBlock").slideUp("slow");
		$("#ProBlock").slideDown("slow");
	}else{
		var nextNo = new Number(qNo);
		nextNo++;
		
		if(document.getElementById("QBlock"+nextNo).style.display !== "block"){
			$("#MorF"+qNo).slideDown("slow");       
			document.getElementById("CorBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
			HTML_AJAX.call('ajaxcode','MadvBlock',
				function(CorBlock){
					document.getElementById("CorBlock").innerHTML = CorBlock
				},
				"","MorF",qNo,""
			);
			$.scrollTo("#QBlock"+qNo, 'slow');
			$("#CorBlock").slideDown("slow");
			$("#ProBlock").slideUp("slow");
		}else{
			alert("エラー\n質問"+nextNo+"を作成中です");
		}
	}
	
}

/***********************************************/
////カテゴリ　
function OpenCate(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#CatePack").slideDown("slow");
	$("#MorF"+qNo).slideUp("slow");
	if(qNo<20){
		document.getElementById("addQB").innerHTML = '<a href="javascript:AddQuestion('+qNo+')" title="質問の追加をする事ができます">質問を追加する</a>'
	}else{
		document.getElementById("addQB").innerHTML = '';
	}
	$.scrollTo("#MorF"+qNo, 'slow');

	TimeOut = setTimeout('TimeOutError()',10000);
	Set = setInterval("ToBlock('CatePack','SelectCategory')",500);
}

//カテ選択へ
function ToBlock(BlockId,State){
	if($("#"+BlockId).css("display") === 'block'){
		$.scrollTo("#"+BlockId, 'slow');
		clearInterval(Set);
		clearTimeout(TimeOut);
		document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
		HTML_AJAX.call('ajaxcode','MadvBlock',
			function(ProBlock){
				document.getElementById("ProBlock").innerHTML = ProBlock
		},
		'',State,'',''
		);
		$("#ProBlock").slideDown("slow");
		$("#CorBlock").slideUp("slow");
	}
}

function SelCate(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var sc = document.getElementById("Scategory").selectedIndex;
	var category = document.getElementById("Scategory").options[sc].value;
	if(category){
		$("#DecCate").slideDown("slow");
	}else{
		$("#DecCate").slideUp("slow");
	}
}


	//カテゴリ登録
function DecCate(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var sc = document.getElementById("Scategory").selectedIndex;
	var category = document.getElementById("Scategory").options[sc].value;
	
	var so = document.getElementById("SelOpen").selectedIndex;
	var open = document.getElementById("SelOpen").options[so].value;
	if(category){
		HTML_AJAX.call('ajaxcode','TermsBlockHTML',
			function(TermsBlock){
				document.getElementById("TermsBlock").innerHTML = TermsBlock;
			}
		);
	
		document.getElementById("Ccate").innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中";
		HTML_AJAX.call('ajaxcode','DecCate',
			function(Ccate){
				document.getElementById("Ccate").innerHTML = Ccate;
			},
			category,open
		);
		$("#ChkCate").slideDown("slow");
		$("#InpCate").slideUp("slow");
		
		
		Madv('upCategory','');
	
	}else{
		alert("カテゴリを選択して下さい");
	}
}	

//カテゴリ訂正
function CorrectCate(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkCate").slideUp("slow");
	$("#InpCate").slideDown("slow");
	$("#DecCate").slideDown("slow");
	
	CorrectAdv('CorrectCategory','SelectCategory','','CatePack');
	
	if(!document.getElementById("CorrectCateCancel")){
		$("#InpCate").append('<p class="correct" id="CorrectCateCancel"><a href="javascript:CorrectCateCancel()">カテゴリ訂正中止</a></p>');
	}
}

//////カテゴリ訂正キャンセル
function CorrectCateCancel(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkCate").slideDown("slow");
	$("#InpCate").slideUp("slow");
	
	$("#ProBlock").slideDown("slow");
	$("#CorBlock").slideUp("slow");
}

/***********************************************/
////投票者データへ
function ProgressVote(qNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#SvBLOCK").slideDown("slow");
	$("#QMaked").slideUp("slow");
	$("#MorF"+qNo).slideUp("slow");
	
	$("#CorBlock").slideUp("slow");
	$("#ProBlock").slideDown("slow");

	document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(ProBlock){
			document.getElementById("ProBlock").innerHTML = ProBlock
		},
		"","ProgressVote",qNo,""
	);
	
	if(qNo<5){
		document.getElementById("addQB").innerHTML = '<a href="javascript:AddQuestion('+qNo+')" title="質問の追加をする事ができます">質問を追加する</a>'
	}else{
		document.getElementById("addQB").innerHTML = '';
	}
	
	$.scrollTo("#MorF"+qNo, 'slow');
}

////投票者データＯＰＥＮ
function vdOpen(vNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var error = "";
	var MadvType = "";
	if(document.getElementById("vd"+vNo).checked === true){
		$("#VDB"+vNo).slideDown("slow");
		if(vNo > 1){
			var bNo = new Number(vNo);
			bNo--;
			$.scrollTo("#vdK"+bNo, 'slow',  'offset:20' );
		}else{
			$.scrollTo("#SvBLOCK", 'slow');
		}
		MadvType = "SelectVote";
		
	}else{
		$("#VDB"+vNo).slideUp("slow");
		$.scrollTo("#SvBLOCK", 'slow');
		MadvType = "ProgressVote";
	}
	
	$("#CorBlock").slideUp("slow");
	$("#ProBlock").slideDown("slow");

	document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(ProBlock){
			document.getElementById("ProBlock").innerHTML = ProBlock
		},
		"",MadvType,vNo,""
	);
}


//オリジナルＵＰ
function UpOriginal(vNo){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	var ForHtml = "";
	var error = "";

	var orginalTitle = document.getElementById("ovk"+vNo).value;
	if(!orginalTitle){
		error += "項目名をご入力下さい\n";
	}
	
	var orginal = document.getElementById("ovt"+vNo).value;
	var orginalArray = orginal.split("\n");
	SetOrginalArray = new Array();
	if(orginal){
		if(orginalArray.length < 2){
			error += "項目は最低２つ以上ご入力下さい\n";
		}else if(orginalArray.length > 50){
			error += "現在"+orginalArray.length+"項目　50項目以下でお願いします\n";
		}
		ForHtml += '<select class="select_vote">'
		ForHtml += '<option>▼'+orginalTitle+'</option>';
		
		for(i=0; i<orginalArray.length; i++){
		
			if((orginalArray[i]) && (!orginalArray[i].search(/\S/i))){
				if(orginalArray[i].length > 15){
					error += "["+orginalArray[i]+"]は"+orginalArray[i].length+"文字あります\n";
				}
			
				for(ci=0; ci<=i; ci++) {
					if(i !== ci){
						if(orginalArray[i] === orginalArray[ci]){
							var Bn = i+1;
							var An = ci+1;
							error += An+"番目と"+Bn+"番目の\n["+orginalArray[i]+"]は重複してます\n";
						}
					}
				}
				ForHtml += '<option>'+orginalArray[i]+'</option>';
				SetOrginalArray[i] = orginalArray[i];
			}
		}
		ForHtml += '</select>'
	}else{
		error += "入力内容が確認出来ません";
	}

	var HovDate = '▼'+orginalTitle+'&gt;'+SetOrginalArray.join('&gt;');
	if(!error){
		ForHtml += '<a href="javascript:ToggleBlock(\'OVB'+vNo+'\')" style="margin:0 0 0 10px">訂正</a>'
		ForHtml += '<input type="hidden" id="SaveVD'+vNo+'" value="'+HovDate+'" />';
		document.getElementById("OVDselect"+vNo).innerHTML = ForHtml;
		$("#OVB"+vNo).slideUp("slow");
		$.scrollTo("#VDB"+vNo,"slow");
	}else{
		alert(error);
	}
}


/////投票者データUPdate
function vdUpdate(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var error = "";
	//1～３までを順に処理
	VD = new Array('');
	for(var i = 1; i <= 3; i ++){
		//投票者データがチェックされていたら処理
		if(document.getElementById('vd'+i).checked === true){
			var originalData = "";
			//全Elementsから該当投票者データでチェック入りを探す
			for(var ei = 0; ei < document.voteSelForm.elements.length; ei ++){
				if((document.voteSelForm.elements[ei].name === 'vdSel'+i) && 
				(document.voteSelForm.elements[ei].checked)){
					var CheckValue = document.voteSelForm.elements[ei].value;
					
					if(CheckValue === "original"){
						originalData = document.getElementById('SaveVD'+i).value;
					}else{
						for(var ci=1; ci< VD.length; ci++){
							if(VD[ci] === CheckValue+'&&'){
								error = "選んだ投票者データが重複しています";
							}
						}
					
					}
					VD[i] = CheckValue+'&&'+originalData;
					break;
				}
			}
		}
	}
	
	if((VD) && (!error)){
		document.getElementById("ChkVote").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' /><br />データ保存中</p>";
		HTML_AJAX.call('ajaxcode','UpVoteData',
			function(CcVote){
				document.getElementById("ChkVote").innerHTML = CcVote;
			},
			VD
		);
		$("#ChkVote").slideDown("slow");
		$("#InpVote").slideUp("slow");
		
		TimeOut = setTimeout('TimeOutError()',10000);
		Set = setInterval("LoadCheckVote('"+TimeOut+"')",500);
	}
	
	if(error){  alert(error);  }
}

////
function LoadCheckVote(TimeOut){
	if($("#ChkVote").text() !== "データ保存中"){
		clearInterval(Set);
		clearTimeout(TimeOut);
		$("#SetCreator").slideDown("slow");
		Madv('upVote','');
	}

}

//////投票者データ訂正
function CorrectVote(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkVote").slideUp("slow");
	$("#InpVote").slideDown("slow");
	
	$("#SetCreator").slideUp("slow");
	CorrectAdv('CorrectVote','ProgressVote','','SvBLOCK');
}



//閲覧
function ChangeLimit(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var srl = document.getElementById("SelReadLimit").selectedIndex;
	var Rlimit = document.getElementById("SelReadLimit").options[srl].value;

	if((Rlimit === "RP")||(Rlimit=== "WP")){
		$("#LPP").slideDown("slow");
		AddColor('Qpass');
		$("#SelReadLimit").css("background-color","rgb(255,255,255)")
	}else{
		$("#LPP").slideUp("slow");
	}
	
	$.scrollTo("#LimitPack", 'slow');
}

//閲覧制限決定
function DecLimit(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var sal = document.getElementById("SelAnsLimit").selectedIndex;
	var Alimit = document.getElementById("SelAnsLimit").options[sal].value;

	var srl = document.getElementById("SelReadLimit").selectedIndex;
	var Rlimit = document.getElementById("SelReadLimit").options[srl].value;
	
	var error = "";
	var Qpass = "";
	if((Rlimit === "RP")||(Rlimit=== "WP")){
		Qpass = document.getElementById("Qpass").value;
		if(!Qpass){
			error += "パスワードを設定して下さい\n";
		}else if(Qpass.length<4){
			error += "パスワードは英数半角4～10文字で設定して下さい\n";
		}
	}
	
	if(!error){
		document.getElementById("ChkLimit").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中</p>";
		HTML_AJAX.call('ajaxcode','DecLimit',
			function(ChkLimit){
				document.getElementById("ChkLimit").innerHTML = ChkLimit;
			},
			Alimit,Rlimit,Qpass
		);
		
		
		$("#ChkLimit").slideDown("slow");
		$("#InpLimit").slideUp("slow");
		
		TimeOut = setTimeout('TimeOutError()',10000);
		Set = setInterval("LoadCheckLimit('"+TimeOut+"')",500);
	
	}else{
		alert(error);
	}
}

////
function LoadCheckLimit(TimeOut){
	if($("#ChkLimit").text() !== "データ保存中"){
		clearInterval(Set);
		clearTimeout(TimeOut);
		$("#SetCreator").slideDown("slow");
		Madv('upLimit','');
	}
}

//制限訂正
function CorrectLimit(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkLimit").slideUp("slow");
	$("#InpLimit").slideDown("slow");
	$("#SetCreator").slideUp("slow");
	
	CorrectAdv('CorrectLimit','SelectLimit','','LimitPack');
}


//締め切り方法
function ChangeDeadLine(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var sd = document.getElementById("SelDL").selectedIndex;
	var DeadWay = document.getElementById("SelDL").options[sd].value;
	
	var Htype = "";
	if(DeadWay === "T"){
		$("#dlT").slideDown("slow");
		$("#dlN").slideUp("slow");
		Htype = 'DeadTime';
		SelDLT();
		$("#SelDL").css("background-color","rgb(255,255,255)")
		
	}else if(DeadWay === "N"){
		$("#dlT").slideUp("slow");
		$("#dlN").slideDown("slow");
		Htype = 'DeadNumber';
		AddColor("DeadLineNumber");
		$("#SelDL").css("background-color","rgb(255,255,255)")
	}else{
		$("#dlT").slideUp("slow");
		$("#dlN").slideUp("slow");
		Htype = 'SelectDeadLine';
	}
	
	$("#CorBlock").slideUp("slow");
	$("#ProBlock").slideDown("slow");

	document.getElementById("ProBlock").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	HTML_AJAX.call('ajaxcode','MadvBlock',
		function(ProBlock){
			document.getElementById("ProBlock").innerHTML = ProBlock
		},
		"",Htype,"",""
	);
	
	$.scrollTo("#DeadLine", 'slow');
	
}

function SelDLT(){
	var YMDHM = new Array("Year","Month","Day","Hour","Min");
	var CHK = "";
	var ArrayDL = new Array();
	for(var i=0; i<YMDHM.length; i++){
		var ss = document.getElementById(YMDHM[i]).selectedIndex;
		var SValue = document.getElementById(YMDHM[i]).options[ss].value;
		if(!SValue){
			AddColor(YMDHM[i]);
			CHK =YMDHM[i];
			break;
		}else{
			$("#"+YMDHM[i]).css("background-color","rgb(255,255,255)");
			YMDHM[i] = SValue;
			ArrayDL[i] = SValue;
		}
	}
	if(!CHK){
		if(!document.getElementById("DLTunix")){
			$("#dlT").append('<span id="DLTunix"></span>');
		}

		HTML_AJAX.call('ajaxcode','DLTunix',
			function(DLTunix){
				document.getElementById("DLTunix").innerHTML = DLTunix
			},
			ArrayDL
	);
	}
}
//締め切り確定
function DecDeadLine(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	var sd = document.getElementById("SelDL").selectedIndex;
	var DeadWay = document.getElementById("SelDL").options[sd].value;

	var error = "";
	
	var Year = "";	var Month = "";	var Day = "";	var Hour = "";	var Min = "";
	var DeadLineTime = "";
	var DeadLineNumber = "";

	if(DeadWay === "T"){
		var sy = document.getElementById("Year").selectedIndex;
		Year = document.getElementById("Year").options[sy].value;
		error += (!Year)? '年　を設定して下さい\n' :'' ;

		var smo = document.getElementById("Month").selectedIndex;
		Month = document.getElementById("Month").options[smo].value;
		error += (!Month)? '月　を設定して下さい\n' :'' ;

		var sd = document.getElementById("Day").selectedIndex;
		Day = document.getElementById("Day").options[sd].value;
		error += (!Day)? '日　を設定して下さい\n' :'' ;

		var sh = document.getElementById("Hour").selectedIndex;
		Hour = document.getElementById("Hour").options[sh].value;
		error += (!Hour)? '時　を設定して下さい\n' :'' ;

		var smi = document.getElementById("Min").selectedIndex;
		Min = document.getElementById("Min").options[smi].value;
		error += (!Min)? '分　を設定して下さい\n' :'' ;
		
		var unix = new Date/1000;
		DeadLineTime = $('#unixDLTime').val();
		
		if(unix > DeadLineTime){
			error += "締め切り日時が過去になってます\n";
		}
		
	}else if(DeadWay === "N"){
		DeadLineNumber = document.getElementById("DeadLineNumber").value;
		
		if(DeadLineNumber){
			if(!DeadLineNumber.match(/[0-9]/)){
				error += '締め切り投票数は半角数字のみで入力してください\n';
			}
		}else{
			error += "締め切り投票数を入力して下さい";
		}
	}
	
	
	if(!error){
		document.getElementById("cDead").innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中";
		HTML_AJAX.call('ajaxcode','DecDeadLine',
			function(cDead){
				document.getElementById("cDead").innerHTML = cDead
			},
			DeadWay,DeadLineTime,DeadLineNumber
		);
	
		$("#InpDeadLine").slideUp("slow");
		$("#ChkDeadLine").slideDown("slow");
		
		TimeOut = setTimeout('TimeOutError()',10000);
		Set = setInterval("LoadCheckDeadLine('"+TimeOut+"')",500);
	
	}else{
		alert(error);
	}
}

////
function LoadCheckDeadLine(TimeOut){
	if($("#cDead").text() !== "データ保存中"){
		clearInterval(Set);
		clearTimeout(TimeOut);
		$("#SetCreator").slideDown("slow");
		Madv('upDeadLine','');
	}
}

//締め切り訂正
function CorrectDeadLine(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkDeadLine").slideUp("slow");
	$("#InpDeadLine").slideDown("slow");
	$("#SetCreator").slideUp("slow");
	
	CorrectAdv('CorrectDeadLine','SelectDeadLine','','DeadLine');
	
}


//作成者名入力へ
function SetCreator(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	HTML_AJAX.call('ajaxcode','CheckTrems',function(){});
	$("#SetCreator").slideUp("slow");
	$("#CreatorPack").slideDown("slow");
	Madv('InputCreator','');

}

//作成者名決定
function DecCreator(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});

	var error = "";
	var Creator = document.getElementById("CreatorText").value;
	if(!Creator){
		error += "作成者名をご入力下さい";
		alert(error);
	}else{
		document.getElementById("CCreator").innerHTML = "<img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='データ保存中' />データ保存中";
		HTML_AJAX.call('ajaxcode','DecCreator',
			function(CCreator){
				document.getElementById("CCreator").innerHTML = CCreator;
			},
			Creator
		);
		
		$("#ChkCreator").slideDown("slow");
		$("#InpCreator").slideUp("slow");
		
		TimeOut = setTimeout('TimeOutError()',10000);
		Set = setInterval("ToCREATOR('CCreator')",500);
	}
}

//カテ選択へ
function ToCREATOR(BlockId){
	if(($("#"+BlockId).text())&& ($("#"+BlockId).text() !== "データ保存中")){
		clearInterval(Set);
		clearTimeout(TimeOut);
		Madv('upCreator','');
	
		$("#ToFinalCheck").slideDown("slow");
		$("#allDecision").slideDown("slow");
		$("#SetCreator").slideUp("slow");
	}

}
//作成者名訂正
function CorrectCreator(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	
	$("#ChkCreator").slideUp("slow");
	$("#InpCreator").slideDown("slow");
	$("#allDecision").slideUp("slow");
	
	CorrectAdv('CorrectCreator','InputCreator','','CreatorPack');
	if(!document.getElementById("CorrectCreatorCancel")){
		$("#InpCreator").append('<p class="correct" id="CorrectCreatorCancel"><a href="javascript:CorrectCreatorCancel()">作成者名訂正中止</a></p>');
	}
}

//////作成者名訂正キャンセル
function CorrectCreatorCancel(){
	HTML_AJAX.call('ajaxcode','sessionupdate',function(){});
	$("#ChkCreator").slideDown("slow");
	$("#InpCreator").slideUp("slow");
	
	$("#ProBlock").slideDown("slow");
	$("#CorBlock").slideUp("slow");
	
	$("#allDecision").slideDown("slow");
}





//コード確認
function CheckCode(){
	if($("#Checked").css("display") === "none"){
		$("#Checked").css("display","block");
	}
	document.getElementById("Checked").innerHTML = "<p class='center'><img src='http://www.dounano.net/core/image/loading.gif' width='20' height='20' alt='Now Loading' />Now Loading</p>";
	var CheckUrl = $("#CheckUrl").val();
	HTML_AJAX.call('ajaxcode','CheckCode',
		function(Checked){
			document.getElementById("Checked").innerHTML = Checked;
		},
		CheckUrl
	);
	
}



///フォームプレビュー変更
function FormPreView(){
	
	GET = new Array();
	var error = "";
	
	var url = document.FormSet.url.value;
	GET.push("url="+url);
	
/***大枠処理***/
	//質問線形	
	var s_c= document.FormSet.c.selectedIndex;
	var c = document.FormSet.c.options[s_c].value;
	GET.push("c="+c);

	//大枠サイズ
	var w = document.FormSet.w.value;
	if(w.match(/[\D]/g)){
		error += "横幅は半角数字でご入力下さい\n";
	}else if((w < 100) || (w > 500)){
		error += "横幅は100～500の間で設定して下さい\n";
	}else{
		GET.push("w="+w);
	}
	
	//大枠背景
	var ch = document.FormSet.ch.value;
	if((ch.match(/[^A-Fa-f0-9]/g)) || (ch.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("ch="+ch);
	}
	
	
	//大枠余白
	var csUD = $("#csUD").val();
	var csLR = $("#csLR").val();
	if(csUD.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else if(csLR.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else{
		cs = csUD+"-"+csLR;
		GET.push("cs="+cs);
	}
	
	//大枠線
	var cb = document.FormSet.cb.value;
	if(cb.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("cb="+cb);
	}
	
	//大枠線形
	var s_cbt= document.FormSet.cbt.selectedIndex;
	var cbt = document.FormSet.cbt.options[s_cbt].value;
	GET.push("cbt="+cbt);


	//大枠線色
	var cbc = document.FormSet.cbc.value;
	if((cbc.match(/[^A-Fa-f0-9]/g)) || (cbc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("cbc="+cbc);
	}

/***主旨***/	
	//主旨背景
	var ph = document.FormSet.ph.value;
	if((ph.match(/[^A-Fa-f0-9]/g)) || (ph.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("ph="+ph);
	}
	
	//主旨余白
	var psUD = $("#psUD").val();
	var psLR = $("#psLR").val();
	if(psUD.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else if(psLR.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else{
		ps = psUD+"-"+psLR;
		GET.push("ps="+ps);
	}
	
	//主旨線
	var pb = document.FormSet.pb.value;
	if(pb.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("pb="+pb);
	}
		
	var s_pbt= document.FormSet.pbt.selectedIndex;
	var pbt = document.FormSet.pbt.options[s_pbt].value;
	GET.push("pbt="+pbt);//主旨線形
	
	//主旨線色	
	var pbc = document.FormSet.pbc.value;
	if((pbc.match(/[^A-Fa-f0-9]/g)) || (pbc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("pbc="+pbc);
	}
	
	
	//主旨フォント
	var pf = document.FormSet.pf.value;
	if(pf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("pf="+pf);
	}
	
	//主旨フォント太さ
	var s_pfw= document.FormSet.pfw.selectedIndex;
	var pfw = document.FormSet.pfw.options[s_pfw].value;
	GET.push("pfw="+pfw);
	
	//主旨フォント色.
	var pfc = document.FormSet.pfc.value;
	if((pfc.match(/[^A-Fa-f0-9]/g)) || (pfc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("pfc="+pfc);
	}


/***質問***/	
	//質問背景
	var qh = document.FormSet.qh.value;
	if((qh.match(/[^A-Fa-f0-9]/g)) || (qh.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("qh="+qh);
	}
	
	//質問余白
	var qsUD = $("#qsUD").val();
	var qsLR = $("#qsLR").val();
	if(qsUD.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else if(qsLR.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else{
		qs = qsUD+"-"+qsLR;
		GET.push("qs="+qs);
	}

	//質問線
	var qb = document.FormSet.qb.value;
	if(qb.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("qb="+qb);
	}
	
	//質問線形	
	var s_qbt= document.FormSet.qbt.selectedIndex;
	var qbt = document.FormSet.qbt.options[s_qbt].value;
	GET.push("qbt="+qbt);
	
	//質問線色	
	var qbc = document.FormSet.qbc.value;
	if((qbc.match(/[^A-Fa-f0-9]/g)) || (qbc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("qbc="+qbc);
	}
	
	
	//質問フォント
	var qf = document.FormSet.qf.value;
	if(qf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("qf="+qf);
	}
	
	//質問フォント太さ
	var s_qfw= document.FormSet.qfw.selectedIndex;
	var qfw = document.FormSet.qfw.options[s_qfw].value;
	GET.push("qfw="+qfw);
	
	//質問フォント色.
	var qfc = document.FormSet.qfc.value;
	if((qfc.match(/[^A-Fa-f0-9]/g)) || (qfc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("qfc="+qfc);
	}


/***答え***/	
	//答え背景
	var ah = document.FormSet.ah.value;
	if((ah.match(/[^A-Fa-f0-9]/g)) || (ah.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("ah="+ah);
	}
	
	//答え線
	var ab = document.FormSet.ab.value;
	if(ab.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("ab="+ab);
	}
	
	//答え線形	
	var s_abt= document.FormSet.abt.selectedIndex;
	var abt = document.FormSet.abt.options[s_abt].value;
	GET.push("abt="+abt);
	
	//答え線色	
	var abc = document.FormSet.abc.value;
	if((abc.match(/[^A-Fa-f0-9]/g)) || (abc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("abc="+abc);
	}
	
	
	//答え列	
	var s_asn= document.FormSet.asn.selectedIndex;
	var asn = document.FormSet.asn.options[s_asn].value;
	GET.push("asn="+asn);

	//答えフォント
	var af = document.FormSet.af.value;
	if(af.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("af="+af);
	}
	
	//答えフォント太さ
	var s_afw= document.FormSet.afw.selectedIndex;
	var afw = document.FormSet.afw.options[s_afw].value;
	GET.push("afw="+afw);
	
	//答えフォント色.
	var afc = document.FormSet.afc.value;
	if((afc.match(/[^A-Fa-f0-9]/g)) || (afc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("afc="+afc);
	}

/***投票者***/	
	//投票者背景
	var vh = document.FormSet.vh.value;
	if((vh.match(/[^A-Fa-f0-9]/g)) || (vh.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("vh="+vh);
	}
	
	//投票者余白
	var vsUD = $("#vsUD").val();
	var vsLR = $("#vsLR").val();
	if(vsUD.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else if(vsLR.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else{
		vs = vsUD+"-"+vsLR;
		GET.push("vs="+vs);
	}

	//投票線
	var vb = document.FormSet.vb.value;
	if(vb.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("vb="+vb);
	}
	
	//投票線形	
	var s_vbt= document.FormSet.vbt.selectedIndex;
	var vbt = document.FormSet.vbt.options[s_vbt].value;
	GET.push("vbt="+vbt);
	
	//投票線色	
	var vbc = document.FormSet.vbc.value;
	if((vbc.match(/[^A-Fa-f0-9]/g)) || (vbc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("vbc="+vbc);
	}
	
	
	//投票フォント
	var vf = document.FormSet.vf.value;
	if(vf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("vf="+vf);
	}
	
	//投票フォント色.
	var vfc = document.FormSet.vfc.value;
	if((vfc.match(/[^A-Fa-f0-9]/g)) || (vfc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("vfc="+vfc);
	}

	//投票表示幅
	var vsw = document.FormSet.vsw.value;
	if(vsw.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		var Cvsw = w - csLR*2 - vsLR*2;
		if(Cvsw < vsw){
			error += "全体に対して投票者データの表示幅が大きすぎます\n投票者データを"+Cvsw+"pxまでで設定して下さい\n";
		}else{
			GET.push("vsw="+vsw);
		}
	}

	//投票表示位置
	var s_vp= document.FormSet.vp.selectedIndex;
	var vp = document.FormSet.vp.options[s_vp].value;
	GET.push("vp="+vp);
	
	//投票表示タイプ
	var s_vt= document.FormSet.vt.selectedIndex;
	var vt = document.FormSet.vt.options[s_vt].value;
	GET.push("vt="+vt);


/***コメント***/
	//コメント
	var s_cm= document.FormSet.cm.selectedIndex;
	var cm = document.FormSet.cm.options[s_cm].value;
	GET.push("cm="+cm);

	var cmh = document.FormSet.cmh.value;
	if((cmh.match(/[^A-Fa-f0-9]/g)) || (cmh.length != 6)){
		error += "背景色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("cmh="+cmh);
	}

	//コメント余白
	var cmsUD = $("#cmsUD").val();
	var cmsLR = $("#cmsLR").val();
	if(cmsUD.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else if(cmsLR.match(/[\D]/g)){
		error += "余白は半角数字でご入力下さい\n";
	}else{
		cms = cmsUD+"-"+cmsLR;
		GET.push("cms="+cms);
	}

	//コメント線
	var cmb = document.FormSet.cmb.value;
	if(cmb.match(/[\D]/g)){
		error += "線の太さは半角数字でご入力下さい\n";
	}else{
		GET.push("cmb="+cmb);
	}
	
	//コメント線形	
	var s_cmbt= document.FormSet.cmbt.selectedIndex;
	var cmbt = document.FormSet.cmbt.options[s_cmbt].value;
	GET.push("cmbt="+cmbt);
	
	//コメント線色	
	var cmbc = document.FormSet.cmbc.value;
	if((cmbc.match(/[^A-Fa-f0-9]/g)) || (cmbc.length != 6)){
		error += "線の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("cmbc="+cmbc);
	}
	
	
	//コメントフォント
	var cmf = document.FormSet.cmf.value;
	if(cmf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("cmf="+cmf);
	}
	
	//コメントフォント色.
	var cmfc = document.FormSet.cmfc.value;
	if((cmfc.match(/[^A-Fa-f0-9]/g)) || (cmfc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("cmfc="+cmfc);
	}


/***ボタン***/
	//ボタン幅
	var bs = document.FormSet.bs.value;
	if(bs.match(/[\D]/g)){
		error += "ボタン幅は半角数字でご入力下さい\n";
	}else{
		var cw = w - csLR*2;
		if(cw < bs){
			error += "全体に対してボタン幅が大きすぎます\nボタン幅を"+cw+"pxまでで設定して下さい\n";
		}else{
			GET.push("bs="+bs);
		}
	}
	
	//ボタン文字
	var bf = document.FormSet.bf.value;
	if(bf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("bf="+bf);
	}

	//ボタン表示位置
	var s_bp= document.FormSet.bp.selectedIndex;
	var bp = document.FormSet.bp.options[s_bp].value;
	GET.push("bp="+bp);

	//結果ボタン文字
	var rf = document.FormSet.rf.value;
	if(rf.match(/[\D]/g)){
		error += "文字サイズは半角数字でご入力下さい\n";
	}else{
		GET.push("rf="+rf);
	}

	//結果フォント色.
	var rfc = document.FormSet.rfc.value;
	if((rfc.match(/[^A-Fa-f0-9]/g)) || (rfc.length != 6)){
		error += "文字の色は半角A～Fと0～9の6文字で設定して下さい\n";
	}else{
		GET.push("rfc="+rfc);
	}

	//結果リンク
	var s_r= document.FormSet.r.selectedIndex;
	var r = document.FormSet.r.options[s_r].value;
	GET.push("r="+r);

	if(error){
		alert(error);
	}else{
		//ソース変更
		HTML_AJAX.call('ajaxcode','formpreview',
			function(FormView){
				document.getElementById("FormView").innerHTML = FormView;
			},
			document.FormSet.url.value,//アンケートナンバー
			GET//値
		);
		
		var Src = document.FormSet.Hurl.value+GET.join("&amp;");
		var DounanoP = ' style="width:'+w+'px;margin:5px auto 0;text-align:right;"';
		
		if(w <= 200){
			document.getElementById("code").value = '<script language="javascript" type="text/javascript" src="'+Src+'"></script><p '+DounanoP+'>by<a href="http://www.dounano.net" target="_blank" style="font-size:11px;">どうなの.ねっと</a></p>';
		}else{
			document.getElementById("code").value = '<script language="javascript" type="text/javascript" src="'+Src+'"></script><p '+DounanoP+'><a href="http://www.dounano.net" target="_blank" style="font-size:11px;">無料アンケートサイトどうなの.ねっと</a></p>';
		}
	}
	
}

////　　貼り付けのソース変更　　//////////////
function selectSource(No){
	var s_questionNo= document.linkForm.questionNo.selectedIndex;
	var questionNo = document.linkForm.questionNo.options[s_questionNo].value;

	var s_questionType= document.linkForm.questionType.selectedIndex;
	var questionType = document.linkForm.questionType.options[s_questionType].value;


	var s_sourceWidth= document.linkForm.sourceWidth.selectedIndex;
	var sourceWidth = document.linkForm.sourceWidth.options[s_sourceWidth].value;
	
	document.getElementById("linkSource").innerHTML = "<p style='text-align:center'><img src='http://www.dounano.net/core/image/loading.gif' width='32' height='32' alt='Now Loading･･･' /><br />Now Loading･･･</p>";
	//ソース変更
	HTML_AJAX.call('ajaxcode','linksource',
		function(linkSource){
			document.getElementById("linkSource").innerHTML = linkSource;
		},
		No,questionNo,questionType,sourceWidth
	);

}




