function get_image_data(level) {
	var adjustPath = get_adjust_path(level);
	var url = adjustPath+"/api/test/get_view_image.php";
	// フォームに入力されたテキストを取得して、パラメータとして使用する
	var to	= "";
	var msg	= "";
	var from= "";
	if (document.form) {
		if (document.form.to) {
			to	= document.form.to.value;
		}
		msg= tinyMCE.get('msg').getContent();
		if (document.form.from) {
			from= document.form.from.value;
		}
		if (document.form.layoutkb) {
			layoutkb= document.form.layoutkb.value;
		}
		if (document.form.font) {
			font= document.form.font.value;
		}
		if (document.form.fontsize) {
			fontsize= document.form.fontsize.value;
		}
	}
	// データ量が多くなるかもしれないので、POSTで送信する
	$.post(
		url,
		{to:to, msg:msg, from:from,layoutkb:layoutkb,font:font,fontsize:fontsize, nocache:new Date().getTime()},
		function(xml) {
			var imgPath = decodeURIComponent($(xml).find("url").text());
			imgPath = imgPath.replace(/\r|\n/, '');
			imgPath = get_adjust_path(level)+imgPath;

			objImage = new Image();
			objImage.src = imgPath;
			var maxWidth = 420;//420;//縮小後のサイズ（「windowsシステム」縮小機能を実行していないので、固定に設定する）
			var maxHeight = 640;//;640;

			// 画像ロードが完了してから、ウィンドウに収まるようにリサイズ
			objImage.onload = function () {
				objImage.onload = null;
				imageWidth = "420";//"420";//縮小後のサイズ
				imageHeight = "640";//"640";//
				var imageWidth = objImage.width;
				var imageHeight = objImage.height;
				if (imageWidth > maxWidth) {
					imageHeight = imageHeight * (maxWidth / imageWidth);
					imageWidth = maxWidth;
					if (imageHeight > maxHeight) {
						imageWidth = imageWidth * (maxHeight / imageHeight);
						imageHeight = maxHeight;
					}
				} else if (imageHeight > maxHeight) {
					imageWidth = imageWidth * (maxHeight / imageHeight);
					imageHeight = maxHeight;
					if (imageWidth > maxWidth) {
						imageHeight = imageHeight * (maxWidth / imageWidth);
						imageWidth = maxWidth;
					}
				}
				imageWidth = parseInt(imageWidth);
				imageHeight = parseInt(imageHeight);
				var imageTag = $("<img>");
				imageTag.attr("src", imgPath);
				imageTag.attr("width", imageWidth);
				imageTag.attr("height", imageHeight);
				imageTag.attr("id", "preId");
				imageTag.css({
					margin:"0px auto",
					display:"block",
					display:"block"
				});
				$("#view_image_body").html(imageTag);

				var buttonTag = $("<input>");
				buttonTag.attr("type","button");
				buttonTag.attr("value","全体を見る");
				buttonTag.css({
					position:"relative",
					top:"-420px",
					left:"270px",
					width:"80px"
				});
				buttonTag.bind("click",function(){
					var src = $("#preId").attr("src");
					var src_temp = src.replace("prev_l.png","print.jpg");
					//window.open('../../assist/print.html?href='+src_temp, 'mywindow', 'width=600, height=768, resizable=no') ;
					window.showModalDialog('../../assist/print.html?href='+src_temp, 'mywindow', 'dialogWidth:600px;dialogHeight:768px;dialogLeft:'+(screen.width/2-300)+'px;dialogTop:0px');
				});
				$(buttonTag).appendTo("#view_image_body");
			};
		},
		"xml"
	);// End of $.post()
}


function get_image_data2(level) {
	var adjustPath = get_adjust_path(level);
	var url = adjustPath+"/api/test/get_view_image.php";
	// フォームに入力されたテキストを取得して、パラメータとして使用する
	var to	= "";
	var msg	= "";
	var from= "";
	if (document.form) {
		if (document.form.to) {
			to	= document.form.to.value;
		}
		msg= tinyMCE.get('msg').getContent();
		if (document.form.from) {
			from= document.form.from.value;
		}
		if (document.form.layoutkb) {
			layoutkb= document.form.layoutkb.value;
		}
		if (document.form.font) {
			font= document.form.font.value;
		}
		if (document.form.fontsize) {
			fontsize= document.form.fontsize.value;
		}
	}
	// データ量が多くなるかもしれないので、POSTで送信する
	$.post(
		url,
		{to:to, msg:msg, from:from,layoutkb:layoutkb,font:font,fontsize:fontsize, nocache:new Date().getTime()},
		function(xml) {
			var imgPath = decodeURIComponent($(xml).find("url").text());
			imgPath = imgPath.replace(/\r|\n/, '');
			imgPath = get_adjust_path(level)+imgPath;

			var src_temp = imgPath.replace("prev_l.png","print.jpg");
			//window.open('../../assist/print.html?href='+src_temp, 'mywindow', 'width=600, height=768, resizable=no') ;
			//window.showModalDialog('../../assist/print.html?href='+src_temp, 'mywindow', 'dialogWidth:600px;dialogHeight:768px;dialogLeft:'+(screen.width/2-300)+'px;dialogTop:0px');
			args = new Array();
			args[0] = src_temp;
			args[1] = "完成イメージを確認してください";
			window.showModalDialog('../../assist/print.html', args, 'dialogWidth:600px;dialogHeight:768px;dialogLeft:'+(screen.width/2-300)+'px;dialogTop:0px');
		},
		"xml"
	);// End of $.post()
}


function get_image_data3(level) {
	var adjustPath = get_adjust_path(level);
	var url = adjustPath+"/api/test/get_view_image.php";
	// フォームに入力されたテキストを取得して、パラメータとして使用する
	var to	= "";
	var msg	= "";
	var from= "";

	var maxLeng = 1400;
	var nowLeng = 0;

	if (document.form) {
		if (document.form.to) {
			// 文字列長対策
			if (document.form.to.value.length  <= maxLeng) {
				to = document.form.to.value;
			}
			else {
				to = document.form.to.value.substring(0, maxLeng);
			}
			nowLeng = document.form.to.value.length;
		}

//		msg= tinyMCE.get('msg').getContent();
		msg= document.form.message.value;
		if (msg != "") {
			// 文字列長対策
			if (nowLeng < maxLeng) {
				msg = msg.substring(0, maxLeng - nowLeng);
			}
			else {
				msg = "";
			}
			nowLeng += msg.length;
		}

		if (document.form.from) {
			// 文字列長対策
			if (nowLeng < maxLeng) {
				from = document.form.from.value.substring(0, maxLeng - nowLeng);
			}
			nowLeng += msg.length;
		}

		if (document.form.layoutkb) {
			layoutkb= document.form.layoutkb.value;
		}
		if (document.form.font) {
			font= document.form.font.value;
		}
		if (document.form.fontsize) {
			fontsize= document.form.fontsize.value;
		}
		if (document.form.fontcolor) {
			fontcolor= document.form.fontcolor.value;
		}

		document.formPrint.level.value		= level;
		document.formPrint.path.value		= url;
		document.formPrint.to.value			= to;
		document.formPrint.msg.value		= msg;
		document.formPrint.from.value		= from;
		document.formPrint.layoutkb.value	= layoutkb;
		document.formPrint.font.value 		= font;
		document.formPrint.fontsize.value 	= fontsize;
		document.formPrint.fontcolor.value 	= fontcolor;

		var winobj = window.open('../../assist/print.html', 'mywindow', 'width=600, height=768, resizable=no, scrollbars=yes') ;

//		winobj.document.forms[0].path.value		= url;
//		winobj.document.forms[0].to.value		= to;
//		winobj.document.forms[0].msg.value		= msg;
//		winobj.document.forms[0].from.value		= from;
//		winobj.document.forms[0].layoutkb.value	= layoutkb;
//		winobj.document.forms[0].font.value 	= font;
//		winobj.document.forms[0].fontsize.value = fontsize;
//
//		winobj.document.forms[0].submit();
	}
//	// データ量が多くなるかもしれないので、POSTで送信する
//	$.post(
//		url,
//		{to:to, msg:msg, from:from,layoutkb:layoutkb,font:font,fontsize:fontsize, nocache:new Date().getTime()},
//		function(xml) {
//			var imgPath = decodeURIComponent($(xml).find("url").text());
//			imgPath = imgPath.replace(/\r|\n/, '');
//			imgPath = get_adjust_path(level)+imgPath;
//
//			var src_temp = imgPath.replace("prev_l.png","print.jpg");
//			window.open('../../assist/print.html', 'mywindow', 'width=600, height=768, resizable=no') ;
//			//window.showModalDialog('../../assist/print.html?href='+src_temp, 'mywindow', 'dialogWidth:600px;dialogHeight:768px;dialogLeft:'+(screen.width/2-300)+'px;dialogTop:0px');
//			args = new Array();
//			args[0] = src_temp;
//			args[1] = "完成イメージを確認してください";
//			window.showModalDialog('../../assist/print.html', args, 'dialogWidth:600px;dialogHeight:768px;dialogLeft:'+(screen.width/2-300)+'px;dialogTop:0px');
//		},
//		"xml"
//	);// End of $.post()
}





