/**<?php
 * cms 1.0
 *
 * PHP versions 5.0.0 upper
 *
 * Copyright 2007-2010, MAGREX 
 *
 * @copyright		Copyright 2007-2010, MAGREX
 * @link			http://www.magrex.co.jp/
 * @version			1.0.0.3
 * @lastmodified	2010-03-22
 * 
*/

function openImageWindow(path,width,height){
	var windowstatus = 'width=' + width +', height=' + height +', menubar=no, toolbar=no, scrollbars=no';
	var newWindow = window.open("",'imagewindow',windowstatus);
	newWindow.document.open();
	newWindow.document.writeln("<html><head>");
	newWindow.document.writeln("<title>image</title>");
	newWindow.document.writeln("</head>");
	newWindow.document.writeln("<body style='margin:0;padding:0;'>");
	newWindow.document.writeln("<img src='" + path  + "'>");
	newWindow.document.writeln("</body></html>");
	newWindow.document.close();
}



function SendCheck_6001(form, id, lang){
	document.getElementById(id + "_obj_category_id").value = "6001";
	if(lang == "0"){
		return confirm("以上の内容で送信してよろしいですか？");
	}else{
		return confirm("Is it OK to submit?");
	}
}

function SendCheck_6002(form, id, lang){
	var count = document.getElementById(id + "_count").value
	var mess = "";
	var value = "";
	var temp,flg,obj;
	for(i=0; i<count; i++){
		value = document.getElementById(id + "_hidden_value" + i).value;
		temp = value.split(",");
		if(temp[1] == "true"){
			if(temp[0] == 3){
				obj = form.elements["text" + i].options.selectedIndex;
				if (form.elements["text" + i].options[obj].value == "") {
					if(lang == "0"){
						mess = "「" + document.getElementById(id + "_hidden_name" + i).value + "」を選択して下さい"; 
					}else{
						mess = "Please select " + document.getElementById(id + "_hidden_name" + i).value;
					}
					break;
				}
			}else if(temp[0] == 2){
				obj = null;
				obj = form.elements["text" + i];
				for(var j=0; j<obj.length; j++){
					if(obj[j].checked){
						mess = "true"; 
						break;
					}
				}
				if(mess != "true"){
					if(lang == "0"){
						mess = "「" + document.getElementById(id + "_hidden_name" + i).value + "」を選択して下さい"; 
					}else{
						mess = "Please select " + document.getElementById(id + "_hidden_name" + i).value;
					}
					break;
				}else{
					mess = ""; 
				}
			}else if(temp[0] == 4){
				obj = null;
				obj = form.elements["text" + i + "[]"];
				for(var j=0; j<obj.length; j++){
					if(obj[j].checked){
						mess = "true"; 
						break;
					}
				}
				if(mess != "true"){
					if(lang == "0"){
						mess = "「" + document.getElementById(id + "_hidden_name" + i).value + "」を１つ以上選択して下さい"; 
					}else{
						mess = "Please select one or more " + document.getElementById(id + "_hidden_name" + i).value;
					}
					break;
				}else{
                   mess = ""; 
				}
			}else{
				if(document.getElementById(id + "_text" + i).value == ""){
					if(lang == "0"){
						mess = "「" + document.getElementById(id + "_hidden_name" + i).value + "」を入力して下さい";
					}else{
						mess = "Please enter " + document.getElementById(id + "_hidden_name" + i).value;
					}
					break;
				}
			}
		}
	}

	if(mess == ""){
		document.getElementById(id + "_obj_category_id").value = "6002";
		if(lang == "0"){
			return confirm("以上の内容で送信してよろしいですか？");
		}else{
			return confirm("Is it OK to submit?");
		}
	}else{
		alert(mess);
		return false;
	}
}
//----------------------------------- end of file ------------------------------------------?>
